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/fxcrt/retain_ptr.h" 14 #include "third_party/base/span.h" 15 16 class CPDF_Dictionary; 17 class IFX_SeekableReadStream; 18 19 class CFDF_Document final : public CPDF_IndirectObjectHolder { 20 public: 21 static std::unique_ptr<CFDF_Document> CreateNewDoc(); 22 static std::unique_ptr<CFDF_Document> ParseMemory( 23 pdfium::span<const uint8_t> span); 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 private: 32 void ParseStream(RetainPtr<IFX_SeekableReadStream> pFile); 33 34 RetainPtr<CPDF_Dictionary> m_pRootDict; 35 RetainPtr<IFX_SeekableReadStream> m_pFile; 36 }; 37 38 #endif // CORE_FPDFAPI_PARSER_CFDF_DOCUMENT_H_ 39