7#include "core/fpdfapi/parser/cpdf_indirect_object_holder.h"
13#include "core/fpdfapi/parser/cpdf_object.h"
14#include "core/fpdfapi/parser/cpdf_parser.h"
15#include "third_party/base/check.h"
29 m_pByteStringPool.DeleteObject();
33 uint32_t objnum)
const {
34 return pdfium::WrapRetain(GetIndirectObjectInternal(objnum));
39 return pdfium::WrapRetain(
40 const_cast<
CPDF_Object*>(GetIndirectObjectInternal(objnum)));
44 uint32_t objnum)
const {
45 auto it = m_IndirectObjs.find(objnum);
46 if (it == m_IndirectObjs.end())
49 return FilterInvalidObjNum(it->second.Get());
54 return pdfium::WrapRetain(GetOrParseIndirectObjectInternal(objnum));
63 auto insert_result = m_IndirectObjs.insert(std::make_pair(objnum,
nullptr));
64 if (!insert_result.second) {
66 FilterInvalidObjNum(insert_result.first->second.Get()));
70 m_IndirectObjs.erase(insert_result.first);
74 pNewObj->SetObjNum(objnum);
75 m_LastObjNum =
std::max(m_LastObjNum, objnum);
78 insert_result.first->second =
std::move(pNewObj);
89 CHECK(!pObj->GetObjNum());
90 pObj->SetObjNum(++m_LastObjNum);
91 m_IndirectObjs[m_LastObjNum] = std::move(pObj);
102 auto& obj_holder = m_IndirectObjs[objnum];
103 const CPDF_Object* old_object = FilterInvalidObjNum(obj_holder.Get());
104 if (old_object && pObj->GetGenNum() <= old_object
->GetGenNum())
107 pObj->SetObjNum(objnum);
108 obj_holder =
std::move(pObj);
109 m_LastObjNum =
std::max(m_LastObjNum, objnum);
114 auto it = m_IndirectObjs.find(objnum);
115 if (it == m_IndirectObjs.end() || !FilterInvalidObjNum(it->second.Get()))
118 m_IndirectObjs.erase(it);
void DeleteIndirectObject(uint32_t objnum)
RetainPtr< const CPDF_Object > GetIndirectObject(uint32_t objnum) const
RetainPtr< CPDF_Object > GetOrParseIndirectObject(uint32_t objnum)
CPDF_IndirectObjectHolder()
virtual RetainPtr< CPDF_Object > ParseIndirectObject(uint32_t objnum)
RetainPtr< CPDF_Object > GetMutableIndirectObject(uint32_t objnum)
virtual ~CPDF_IndirectObjectHolder()
uint32_t AddIndirectObject(RetainPtr< CPDF_Object > pObj)
bool ReplaceIndirectObjectIfHigherGeneration(uint32_t objnum, RetainPtr< CPDF_Object > pObj)
uint32_t GetGenNum() const
uint32_t GetObjNum() const
static constexpr uint32_t kInvalidObjNum