Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: core/fpdfdoc/cpdf_pagelabel.cpp

Issue 2190983002: Splitting fpdfdoc/doc_* part III. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@fpdf_doc_IV
Patch Set: Rebase to master Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfdoc/cpdf_pagelabel.h" 7 #include "core/fpdfdoc/cpdf_pagelabel.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
11 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 11 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
12 #include "core/fpdfdoc/doc_utils.h" 12 #include "core/fpdfdoc/cpdf_numbertree.h"
13 13
14 namespace { 14 namespace {
15 15
16 CFX_WideString MakeRoman(int num) { 16 CFX_WideString MakeRoman(int num) {
17 const int arabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; 17 const int arabic[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
18 const CFX_WideString roman[] = {L"m", L"cm", L"d", L"cd", L"c", 18 const CFX_WideString roman[] = {L"m", L"cm", L"d", L"cd", L"c",
19 L"xc", L"l", L"xl", L"x", L"ix", 19 L"xc", L"l", L"xl", L"x", L"ix",
20 L"v", L"iv", L"i"}; 20 L"v", L"iv", L"i"};
21 const int nMaxNum = 1000000; 21 const int nMaxNum = 1000000;
22 num %= nMaxNum; 22 num %= nMaxNum;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return i; 126 return i;
127 } 127 }
128 128
129 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate. 129 int nPage = FXSYS_atoi(CFX_ByteString(bsLabel).c_str()); // NUL terminate.
130 return nPage > 0 && nPage <= nPages ? nPage : -1; 130 return nPage > 0 && nPage <= nPages ? nPage : -1;
131 } 131 }
132 132
133 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { 133 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
134 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); 134 return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC());
135 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698