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

Unified Diff: core/fpdfdoc/tagged_int.h

Issue 2640923006: Cleanup CPDF_StructElement. (Closed)
Patch Set: Make CPDF_StructKid private Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/fpdf_tagged.h ('k') | fpdfsdk/fpdf_structtree.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/tagged_int.h
diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h
index 03f1c40ad605c7eab02bc794e9536a518baf93d9..6a24700502e5c96aa1f71cf2e8043e790379c906 100644
--- a/core/fpdfdoc/tagged_int.h
+++ b/core/fpdfdoc/tagged_int.h
@@ -15,39 +15,62 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "third_party/base/stl_util.h"
-class CPDF_StructElementImpl;
+class CPDF_StructElement;
+
+struct CPDF_StructKid {
+ enum { Invalid, Element, PageContent, StreamContent, Object } m_Type;
+
+ union {
+ struct {
+ CPDF_StructElement* m_pElement;
+ CPDF_Dictionary* m_pDict;
+ } m_Element;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_ContentId;
+ } m_PageContent;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_ContentId;
+ uint32_t m_RefObjNum;
+ } m_StreamContent;
+ struct {
+ uint32_t m_PageObjNum;
+ uint32_t m_RefObjNum;
+ } m_Object;
+ };
+};
-class CPDF_StructTreeImpl final : public IPDF_StructTree {
+class CPDF_StructTree final : public IPDF_StructTree {
public:
- explicit CPDF_StructTreeImpl(const CPDF_Document* pDoc);
- ~CPDF_StructTreeImpl() override;
+ explicit CPDF_StructTree(const CPDF_Document* pDoc);
+ ~CPDF_StructTree() override;
// IPDF_StructTree:
int CountTopElements() const override;
IPDF_StructElement* GetTopElement(int i) const override;
void LoadPageTree(const CPDF_Dictionary* pPageDict);
- CPDF_StructElementImpl* AddPageNode(
+ CPDF_StructElement* AddPageNode(
CPDF_Dictionary* pElement,
- std::map<CPDF_Dictionary*, CPDF_StructElementImpl*>& map,
+ std::map<CPDF_Dictionary*, CPDF_StructElement*>& map,
int nLevel = 0);
- bool AddTopLevelNode(CPDF_Dictionary* pDict,
- CPDF_StructElementImpl* pElement);
+ bool AddTopLevelNode(CPDF_Dictionary* pDict, CPDF_StructElement* pElement);
protected:
const CPDF_Dictionary* const m_pTreeRoot;
const CPDF_Dictionary* const m_pRoleMap;
const CPDF_Dictionary* m_pPage;
- std::vector<CFX_RetainPtr<CPDF_StructElementImpl>> m_Kids;
+ std::vector<CFX_RetainPtr<CPDF_StructElement>> m_Kids;
- friend class CPDF_StructElementImpl;
+ friend class CPDF_StructElement;
};
-class CPDF_StructElementImpl final : public IPDF_StructElement {
+class CPDF_StructElement final : public IPDF_StructElement {
public:
- CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
- CPDF_StructElementImpl* pParent,
- CPDF_Dictionary* pDict);
+ CPDF_StructElement(CPDF_StructTree* pTree,
+ CPDF_StructElement* pParent,
+ CPDF_Dictionary* pDict);
// IPDF_StructElement
IPDF_StructTree* GetTree() const override;
@@ -55,7 +78,7 @@ class CPDF_StructElementImpl final : public IPDF_StructElement {
IPDF_StructElement* GetParent() const override;
CPDF_Dictionary* GetDict() const override;
int CountKids() const override;
- const CPDF_StructKid& GetKid(int index) const override;
+ IPDF_StructElement* GetKidIfElement(int index) const override;
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
bool bInheritable = false,
@@ -81,26 +104,26 @@ class CPDF_StructElementImpl final : public IPDF_StructElement {
bool bInheritable = false,
int subindex = -1) override;
+ std::vector<CPDF_StructKid>* GetKids() { return &m_Kids; }
void LoadKids(CPDF_Dictionary* pDict);
void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid);
CPDF_Object* GetAttr(const CFX_ByteStringC& owner,
const CFX_ByteStringC& name,
bool bInheritable,
int subindex);
- CPDF_StructElementImpl* Retain();
+
+ CPDF_StructElement* Retain();
void Release();
protected:
- ~CPDF_StructElementImpl() override;
+ ~CPDF_StructElement() override;
int m_RefCount;
- CPDF_StructTreeImpl* const m_pTree;
- CPDF_StructElementImpl* const m_pParent;
+ CPDF_StructTree* const m_pTree;
+ CPDF_StructElement* const m_pParent;
CPDF_Dictionary* const m_pDict;
CFX_ByteString m_Type;
std::vector<CPDF_StructKid> m_Kids;
-
- friend class CPDF_StructTreeImpl;
};
#endif // CORE_FPDFDOC_TAGGED_INT_H_
« no previous file with comments | « core/fpdfdoc/fpdf_tagged.h ('k') | fpdfsdk/fpdf_structtree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698