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_PARSER_CFDF_DOCUMENT_H_ 8 #define CORE_FPDFAPI_PARSER_CFDF_DOCUMENT_H_ 9 10 #include <memory> 11 12 #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" 13 #include "core/fpdfapi/parser/cpdf_object.h" 14 #include "core/fxcrt/unowned_ptr.h" 15 16 class CPDF_Dictionary; 17 class IFX_SeekableReadStream; 18 19 class CFDF_Document : public CPDF_IndirectObjectHolder { 20 public: 21 static std::unique_ptr<CFDF_Document> CreateNewDoc(); 22 static std::unique_ptr<CFDF_Document> ParseMemory(uint8_t* pData, 23 uint32_t size); 24 25 CFDF_Document(); 26 ~CFDF_Document() override; 27 28 ByteString WriteToString() const; GetRoot()29 CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); } 30 31 protected: 32 void ParseStream(const RetainPtr<IFX_SeekableReadStream>& pFile); 33 34 UnownedPtr<CPDF_Dictionary> m_pRootDict; 35 RetainPtr<IFX_SeekableReadStream> m_pFile; 36 }; 37 38 #endif // CORE_FPDFAPI_PARSER_CFDF_DOCUMENT_H_ 39