summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_pagelabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_pagelabel.cpp')
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp
index 7b5e66e585..5efb18ef3d 100644
--- a/core/fpdfdoc/cpdf_pagelabel.cpp
+++ b/core/fpdfdoc/cpdf_pagelabel.cpp
@@ -13,16 +13,15 @@
namespace {
-CFX_WideString MakeRoman(int num) {
+WideString MakeRoman(int num) {
const int kArabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
- const CFX_WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c",
- L"xc", L"l", L"xl", L"x", L"ix",
- L"v", L"iv", L"i"};
+ const WideString kRoman[] = {L"m", L"cm", L"d", L"cd", L"c", L"xc", L"l",
+ L"xl", L"x", L"ix", L"v", L"iv", L"i"};
const int kMaxNum = 1000000;
num %= kMaxNum;
int i = 0;
- CFX_WideString wsRomanNumber;
+ WideString wsRomanNumber;
while (num > 0) {
while (num >= kArabic[i]) {
num = num - kArabic[i];
@@ -33,11 +32,11 @@ CFX_WideString MakeRoman(int num) {
return wsRomanNumber;
}
-CFX_WideString MakeLetters(int num) {
+WideString MakeLetters(int num) {
if (num == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString wsLetters;
+ WideString wsLetters;
const int nMaxCount = 1000;
const int nLetterCount = 26;
--num;
@@ -50,8 +49,8 @@ CFX_WideString MakeLetters(int num) {
return wsLetters;
}
-CFX_WideString GetLabelNumPortion(int num, const CFX_ByteString& bsStyle) {
- CFX_WideString wsNumPortion;
+WideString GetLabelNumPortion(int num, const ByteString& bsStyle) {
+ WideString wsNumPortion;
if (bsStyle.IsEmpty())
return wsNumPortion;
if (bsStyle == "D") {
@@ -77,7 +76,7 @@ CPDF_PageLabel::CPDF_PageLabel(CPDF_Document* pDocument)
CPDF_PageLabel::~CPDF_PageLabel() {}
-bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
+bool CPDF_PageLabel::GetLabel(int nPage, WideString* wsLabel) const {
if (!m_pDocument)
return false;
@@ -108,10 +107,9 @@ bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
if (pLabel->KeyExist("P"))
*wsLabel += pLabel->GetUnicodeTextFor("P");
- CFX_ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
+ ByteString bsNumberingStyle = pLabel->GetStringFor("S", "");
int nLabelNum = nPage - n + pLabel->GetIntegerFor("St", 1);
- CFX_WideString wsNumPortion =
- GetLabelNumPortion(nLabelNum, bsNumberingStyle);
+ WideString wsNumPortion = GetLabelNumPortion(nLabelNum, bsNumberingStyle);
*wsLabel += wsNumPortion;
return true;
}
@@ -120,7 +118,7 @@ bool CPDF_PageLabel::GetLabel(int nPage, CFX_WideString* wsLabel) const {
return true;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const ByteStringView& bsLabel) const {
if (!m_pDocument)
return -1;
@@ -130,19 +128,19 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
int nPages = m_pDocument->GetPageCount();
for (int i = 0; i < nPages; i++) {
- CFX_WideString str;
+ WideString str;
if (!GetLabel(i, &str))
continue;
if (PDF_EncodeText(str).Compare(bsLabel))
return i;
}
- int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate.
+ int nPage = FXSYS_atoi(ByteString(bsLabel).c_str()); // NUL terminate.
return nPage > 0 && nPage <= nPages ? nPage : -1;
}
-int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
+int32_t CPDF_PageLabel::GetPageByLabel(const WideStringView& wsLabel) const {
// TODO(tsepez): check usage of c_str() below.
return GetPageByLabel(
- PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringC());
+ PDF_EncodeText(wsLabel.unterminated_c_str()).AsStringView());
}