summaryrefslogtreecommitdiff
path: root/xfa/fgas
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-01 08:43:38 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-01 08:43:38 +0000
commit3aec5705db19e0a832660329b05b736ead426022 (patch)
tree7ff796772da72cd1133d44063e47a46137e9345b /xfa/fgas
parentd4906e83d3133d1ac8d13fc9cedc74f6a1dfc960 (diff)
downloadpdfium-3aec5705db19e0a832660329b05b736ead426022.tar.xz
Mark CFGAS_FormatString methods as const.
Change-Id: I7809f2648d24b4ae0dd1a5a0d4fd98a0bd4d8939 Reviewed-on: https://pdfium-review.googlesource.com/39113 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fgas')
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.cpp43
-rw-r--r--xfa/fgas/crt/cfgas_formatstring.h36
2 files changed, 42 insertions, 37 deletions
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp
index e9d065d124..e5ac01416d 100644
--- a/xfa/fgas/crt/cfgas_formatstring.cpp
+++ b/xfa/fgas/crt/cfgas_formatstring.cpp
@@ -838,7 +838,7 @@ CFGAS_FormatString::~CFGAS_FormatString() {}
void CFGAS_FormatString::SplitFormatString(
const WideString& wsFormatString,
- std::vector<WideString>* wsPatterns) {
+ std::vector<WideString>* wsPatterns) const {
int32_t iStrLen = wsFormatString.GetLength();
const wchar_t* pStr = wsFormatString.c_str();
const wchar_t* pToken = pStr;
@@ -859,7 +859,8 @@ void CFGAS_FormatString::SplitFormatString(
}
}
-FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(const WideString& wsPattern) {
+FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(
+ const WideString& wsPattern) const {
FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
int32_t ccf = 0;
int32_t iLenf = wsPattern.GetLength();
@@ -913,8 +914,9 @@ FX_LOCALECATEGORY CFGAS_FormatString::GetCategory(const WideString& wsPattern) {
return eCategory;
}
-WideString CFGAS_FormatString::GetTextFormat(const WideString& wsPattern,
- const WideStringView& wsCategory) {
+WideString CFGAS_FormatString::GetTextFormat(
+ const WideString& wsPattern,
+ const WideStringView& wsCategory) const {
int32_t ccf = 0;
int32_t iLenf = wsPattern.GetLength();
const wchar_t* pStr = wsPattern.c_str();
@@ -960,10 +962,11 @@ WideString CFGAS_FormatString::GetTextFormat(const WideString& wsPattern,
return wsPurgePattern;
}
-LocaleIface* CFGAS_FormatString::GetNumericFormat(const WideString& wsPattern,
- int32_t* iDotIndex,
- uint32_t* dwStyle,
- WideString* wsPurgePattern) {
+LocaleIface* CFGAS_FormatString::GetNumericFormat(
+ const WideString& wsPattern,
+ int32_t* iDotIndex,
+ uint32_t* dwStyle,
+ WideString* wsPurgePattern) const {
*dwStyle = 0;
LocaleIface* pLocale = nullptr;
int32_t ccf = 0;
@@ -1065,7 +1068,7 @@ LocaleIface* CFGAS_FormatString::GetNumericFormat(const WideString& wsPattern,
bool CFGAS_FormatString::ParseText(const WideString& wsSrcText,
const WideString& wsPattern,
- WideString* wsValue) {
+ WideString* wsValue) const {
wsValue->clear();
if (wsSrcText.IsEmpty() || wsPattern.IsEmpty())
return false;
@@ -1138,7 +1141,7 @@ bool CFGAS_FormatString::ParseText(const WideString& wsSrcText,
bool CFGAS_FormatString::ParseNum(const WideString& wsSrcNum,
const WideString& wsPattern,
- WideString* wsValue) {
+ WideString* wsValue) const {
wsValue->clear();
if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty())
return false;
@@ -1541,7 +1544,7 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat(
const WideString& wsPattern,
LocaleIface** pLocale,
WideString* wsDatePattern,
- WideString* wsTimePattern) {
+ WideString* wsTimePattern) const {
*pLocale = nullptr;
WideString wsTempPattern;
FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown;
@@ -1678,7 +1681,7 @@ FX_DATETIMETYPE CFGAS_FormatString::GetDateTimeFormat(
bool CFGAS_FormatString::ParseDateTime(const WideString& wsSrcDateTime,
const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- CFX_DateTime* dtValue) {
+ CFX_DateTime* dtValue) const {
dtValue->Reset();
if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty())
return false;
@@ -1721,7 +1724,7 @@ bool CFGAS_FormatString::ParseDateTime(const WideString& wsSrcDateTime,
}
bool CFGAS_FormatString::ParseZero(const WideString& wsSrcText,
- const WideString& wsPattern) {
+ const WideString& wsPattern) const {
WideString wsTextFormat = GetTextFormat(wsPattern, L"zero");
int32_t iText = 0;
@@ -1753,7 +1756,7 @@ bool CFGAS_FormatString::ParseZero(const WideString& wsSrcText,
}
bool CFGAS_FormatString::ParseNull(const WideString& wsSrcText,
- const WideString& wsPattern) {
+ const WideString& wsPattern) const {
WideString wsTextFormat = GetTextFormat(wsPattern, L"null");
int32_t iText = 0;
@@ -1786,7 +1789,7 @@ bool CFGAS_FormatString::ParseNull(const WideString& wsSrcText,
bool CFGAS_FormatString::FormatText(const WideString& wsSrcText,
const WideString& wsPattern,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsPattern.IsEmpty())
return false;
@@ -1848,7 +1851,7 @@ bool CFGAS_FormatString::FormatText(const WideString& wsSrcText,
bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum,
const WideString& wsPattern,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsInputNum.IsEmpty() || wsPattern.IsEmpty())
return false;
@@ -2225,7 +2228,7 @@ bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum,
bool CFGAS_FormatString::FormatNum(const WideString& wsSrcNum,
const WideString& wsPattern,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsSrcNum.IsEmpty() || wsPattern.IsEmpty())
return false;
return FormatStrNum(wsSrcNum.AsStringView(), wsPattern, wsOutput);
@@ -2234,7 +2237,7 @@ bool CFGAS_FormatString::FormatNum(const WideString& wsSrcNum,
bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime,
const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsSrcDateTime.IsEmpty() || wsPattern.IsEmpty())
return false;
@@ -2288,7 +2291,7 @@ bool CFGAS_FormatString::FormatDateTime(const WideString& wsSrcDateTime,
}
bool CFGAS_FormatString::FormatZero(const WideString& wsPattern,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsPattern.IsEmpty())
return false;
@@ -2308,7 +2311,7 @@ bool CFGAS_FormatString::FormatZero(const WideString& wsPattern,
}
bool CFGAS_FormatString::FormatNull(const WideString& wsPattern,
- WideString* wsOutput) {
+ WideString* wsOutput) const {
if (wsPattern.IsEmpty())
return false;
diff --git a/xfa/fgas/crt/cfgas_formatstring.h b/xfa/fgas/crt/cfgas_formatstring.h
index 3cbe6ff65a..4fdc39df0c 100644
--- a/xfa/fgas/crt/cfgas_formatstring.h
+++ b/xfa/fgas/crt/cfgas_formatstring.h
@@ -24,51 +24,53 @@ class CFGAS_FormatString {
~CFGAS_FormatString();
void SplitFormatString(const WideString& wsFormatString,
- std::vector<WideString>* wsPatterns);
- FX_LOCALECATEGORY GetCategory(const WideString& wsPattern);
+ std::vector<WideString>* wsPatterns) const;
+ FX_LOCALECATEGORY GetCategory(const WideString& wsPattern) const;
bool ParseText(const WideString& wsSrcText,
const WideString& wsPattern,
- WideString* wsValue);
+ WideString* wsValue) const;
bool ParseNum(const WideString& wsSrcNum,
const WideString& wsPattern,
- WideString* wsValue);
+ WideString* wsValue) const;
bool ParseDateTime(const WideString& wsSrcDateTime,
const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- CFX_DateTime* dtValue);
- bool ParseZero(const WideString& wsSrcText, const WideString& wsPattern);
- bool ParseNull(const WideString& wsSrcText, const WideString& wsPattern);
+ CFX_DateTime* dtValue) const;
+ bool ParseZero(const WideString& wsSrcText,
+ const WideString& wsPattern) const;
+ bool ParseNull(const WideString& wsSrcText,
+ const WideString& wsPattern) const;
bool FormatText(const WideString& wsSrcText,
const WideString& wsPattern,
- WideString* wsOutput);
+ WideString* wsOutput) const;
bool FormatNum(const WideString& wsSrcNum,
const WideString& wsPattern,
- WideString* wsOutput);
+ WideString* wsOutput) const;
bool FormatDateTime(const WideString& wsSrcDateTime,
const WideString& wsPattern,
FX_DATETIMETYPE eDateTimeType,
- WideString* wsOutput);
- bool FormatZero(const WideString& wsPattern, WideString* wsOutput);
- bool FormatNull(const WideString& wsPattern, WideString* wsOutput);
+ WideString* wsOutput) const;
+ bool FormatZero(const WideString& wsPattern, WideString* wsOutput) const;
+ bool FormatNull(const WideString& wsPattern, WideString* wsOutput) const;
private:
WideString GetTextFormat(const WideString& wsPattern,
- const WideStringView& wsCategory);
+ const WideStringView& wsCategory) const;
LocaleIface* GetNumericFormat(const WideString& wsPattern,
int32_t* iDotIndex,
uint32_t* dwStyle,
- WideString* wsPurgePattern);
+ WideString* wsPurgePattern) const;
bool FormatStrNum(const WideStringView& wsInputNum,
const WideString& wsPattern,
- WideString* wsOutput);
+ WideString* wsOutput) const;
FX_DATETIMETYPE GetDateTimeFormat(const WideString& wsPattern,
LocaleIface** pLocale,
WideString* wsDatePattern,
- WideString* wsTimePattern);
+ WideString* wsTimePattern) const;
- UnownedPtr<CXFA_LocaleMgr> m_pLocaleMgr;
+ UnownedPtr<CXFA_LocaleMgr> const m_pLocaleMgr;
};
#endif // XFA_FGAS_CRT_CFGAS_FORMATSTRING_H_