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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_stream.h

Issue 2392603004: Move core/fpdfapi/fpdf_parser to core/fpdfapi/parser (Closed)
Patch Set: Rebase to master Created 4 years, 2 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
(Empty)
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_
8 #define CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_
9
10 #include <memory>
11 #include <set>
12
13 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
14 #include "core/fpdfapi/fpdf_parser/cpdf_object.h"
15 #include "core/fxcrt/fx_basic.h"
16
17 class CPDF_Stream : public CPDF_Object {
18 public:
19 CPDF_Stream();
20
21 // Takes ownership of |pData| and |pDict|.
22 CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
23
24 // CPDF_Object.
25 Type GetType() const override;
26 CPDF_Object* Clone() const override;
27 CPDF_Dictionary* GetDict() const override;
28 CFX_WideString GetUnicodeText() const override;
29 bool IsStream() const override;
30 CPDF_Stream* AsStream() override;
31 const CPDF_Stream* AsStream() const override;
32
33 uint32_t GetRawSize() const { return m_dwSize; }
34 uint8_t* GetRawData() const { return m_pDataBuf.get(); }
35
36 // Does not takes onwership of |pData|, copies into internally-owned buffer.
37 void SetData(const uint8_t* pData, uint32_t size);
38
39 void InitStream(const uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
40 void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict);
41
42 FX_BOOL ReadRawData(FX_FILESIZE start_pos,
43 uint8_t* pBuf,
44 uint32_t buf_size) const;
45
46 bool IsMemoryBased() const { return m_bMemoryBased; }
47
48 protected:
49 ~CPDF_Stream() override;
50 CPDF_Object* CloneNonCyclic(
51 bool bDirect,
52 std::set<const CPDF_Object*>* pVisited) const override;
53
54 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pDict;
55 bool m_bMemoryBased = true;
56 uint32_t m_dwSize = 0;
57 std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf;
58 IFX_FileRead* m_pFile = nullptr;
59 };
60
61 #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_STREAM_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698