diff options
Diffstat (limited to 'core/fpdfapi/parser/cpdf_indirect_object_holder.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_indirect_object_holder.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h index da4e942b5d..074e428d43 100644 --- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h +++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h @@ -10,9 +10,14 @@ #include <map> #include <memory> +#include "core/fpdfapi/parser/cpdf_object.h" +#include "core/fxcrt/cfx_string_pool_template.h" +#include "core/fxcrt/cfx_weak_ptr.h" #include "core/fxcrt/fx_system.h" -class CPDF_Object; +class CPDF_Array; +class CPDF_Dictionary; +class CPDF_Stream; class CPDF_IndirectObjectHolder { public: @@ -24,12 +29,23 @@ class CPDF_IndirectObjectHolder { CPDF_Object* GetIndirectObject(uint32_t objnum) const; CPDF_Object* GetOrParseIndirectObject(uint32_t objnum); - void ReleaseIndirectObject(uint32_t objnum); + void DeleteIndirectObject(uint32_t objnum); + + // Take ownership of |pObj|, returns unowned pointer to it. + CPDF_Object* AddIndirectObject(UniqueObject pObj); + + // Adds and owns a new object, returns unowned pointer to it. + CPDF_Array* AddIndirectArray(); + CPDF_Dictionary* AddIndirectDictionary(); + CPDF_Dictionary* AddIndirectDictionary( + const CFX_WeakPtr<CFX_ByteStringPool>& pPool); + CPDF_Stream* AddIndirectStream(); + CPDF_Stream* AddIndirectStream(uint8_t* pData, + uint32_t size, + CPDF_Dictionary* pDict); - // Take ownership of |pObj|. - uint32_t AddIndirectObject(CPDF_Object* pObj); bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, - CPDF_Object* pObj); + UniqueObject pObj); uint32_t GetLastObjNum() const { return m_LastObjNum; } void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } @@ -42,6 +58,8 @@ class CPDF_IndirectObjectHolder { private: uint32_t m_LastObjNum; + + // Ordinary deleter, not Release(). std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs; }; |