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

Side by Side Diff: core/fpdfapi/page/pageint.h

Issue 2520133002: Remove some WrapUnique() calls by returing unique_ptrs (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « core/fpdfapi/page/cpdf_streamparser.cpp ('k') | core/fpdfapi/parser/cpdf_document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CORE_FPDFAPI_PAGE_PAGEINT_H_ 7 #ifndef CORE_FPDFAPI_PAGE_PAGEINT_H_
8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_ 8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <unordered_map> 13 #include <unordered_map>
14 #include <utility>
14 #include <vector> 15 #include <vector>
15 16
16 #include "core/fpdfapi/page/cpdf_contentmark.h" 17 #include "core/fpdfapi/page/cpdf_contentmark.h"
17 #include "core/fpdfapi/page/cpdf_countedobject.h" 18 #include "core/fpdfapi/page/cpdf_countedobject.h"
18 #include "core/fpdfapi/page/cpdf_pageobjectholder.h" 19 #include "core/fpdfapi/page/cpdf_pageobjectholder.h"
19 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" 20 #include "core/fpdfapi/page/cpdf_streamcontentparser.h"
20 #include "core/fpdfapi/parser/cpdf_stream.h" 21 #include "core/fpdfapi/parser/cpdf_stream.h"
21 #include "core/fxcrt/cfx_string_pool_template.h" 22 #include "core/fxcrt/cfx_string_pool_template.h"
22 #include "core/fxcrt/cfx_weak_ptr.h" 23 #include "core/fxcrt/cfx_weak_ptr.h"
23 #include "core/fxge/cfx_pathdata.h" 24 #include "core/fxge/cfx_pathdata.h"
(...skipping 21 matching lines...) Expand all
45 class CPDF_StreamParser { 46 class CPDF_StreamParser {
46 public: 47 public:
47 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; 48 enum SyntaxType { EndOfData, Number, Keyword, Name, Others };
48 49
49 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); 50 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
50 CPDF_StreamParser(const uint8_t* pData, 51 CPDF_StreamParser(const uint8_t* pData,
51 uint32_t dwSize, 52 uint32_t dwSize,
52 const CFX_WeakPtr<CFX_ByteStringPool>& pPool); 53 const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
53 ~CPDF_StreamParser(); 54 ~CPDF_StreamParser();
54 55
55 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc,
56 CPDF_Dictionary* pDict,
57 CPDF_Object* pCSObj);
58 SyntaxType ParseNextElement(); 56 SyntaxType ParseNextElement();
59 uint8_t* GetWordBuf() { return m_WordBuffer; } 57 uint8_t* GetWordBuf() { return m_WordBuffer; }
60 uint32_t GetWordSize() const { return m_WordSize; } 58 uint32_t GetWordSize() const { return m_WordSize; }
61 CPDF_Object* GetObject();
62 uint32_t GetPos() const { return m_Pos; } 59 uint32_t GetPos() const { return m_Pos; }
63 void SetPos(uint32_t pos) { m_Pos = pos; } 60 void SetPos(uint32_t pos) { m_Pos = pos; }
64 CPDF_Object* ReadNextObject(bool bAllowNestedArray, uint32_t dwInArrayLevel); 61 std::unique_ptr<CPDF_Object> GetObject() { return std::move(m_pLastObj); }
62 std::unique_ptr<CPDF_Object> ReadNextObject(bool bAllowNestedArray,
63 uint32_t dwInArrayLevel);
64 std::unique_ptr<CPDF_Stream> ReadInlineStream(CPDF_Document* pDoc,
65 CPDF_Dictionary* pDict,
66 CPDF_Object* pCSObj);
65 67
66 private: 68 private:
67 friend class cpdf_streamparser_ReadHexString_Test; 69 friend class cpdf_streamparser_ReadHexString_Test;
68 70
69 void GetNextWord(bool& bIsNumber); 71 void GetNextWord(bool& bIsNumber);
70 CFX_ByteString ReadString(); 72 CFX_ByteString ReadString();
71 CFX_ByteString ReadHexString(); 73 CFX_ByteString ReadHexString();
72 bool PositionIsInBounds() const; 74 bool PositionIsInBounds() const;
73 75
74 const uint8_t* m_pBuf; 76 const uint8_t* m_pBuf;
75 uint32_t m_Size; // Length in bytes of m_pBuf. 77 uint32_t m_Size; // Length in bytes of m_pBuf.
76 uint32_t m_Pos; // Current byte position within m_pBuf. 78 uint32_t m_Pos; // Current byte position within m_pBuf.
77 uint8_t m_WordBuffer[256]; 79 uint8_t m_WordBuffer[256];
78 uint32_t m_WordSize; 80 uint32_t m_WordSize;
79 CPDF_Object* m_pLastObj; 81 std::unique_ptr<CPDF_Object> m_pLastObj;
80 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; 82 CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
81 }; 83 };
82 84
83 #define _FPDF_MAX_TYPE3_FORM_LEVEL_ 4 85 #define _FPDF_MAX_TYPE3_FORM_LEVEL_ 4
84 86
85 class CPDF_ContentParser { 87 class CPDF_ContentParser {
86 public: 88 public:
87 enum ParseStatus { Ready, ToBeContinued, Done }; 89 enum ParseStatus { Ready, ToBeContinued, Done };
88 90
89 CPDF_ContentParser(); 91 CPDF_ContentParser();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 CPDF_CountedPattern* m_pCountedPattern; 299 CPDF_CountedPattern* m_pCountedPattern;
298 int m_nComps; 300 int m_nComps;
299 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; 301 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS];
300 }; 302 };
301 303
302 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); 304 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr);
303 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( 305 CFX_ByteStringC PDF_FindValueAbbreviationForTesting(
304 const CFX_ByteStringC& abbr); 306 const CFX_ByteStringC& abbr);
305 307
306 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_ 308 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_streamparser.cpp ('k') | core/fpdfapi/parser/cpdf_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698