diff options
author | tsepez <tsepez@chromium.org> | 2016-05-18 10:16:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-18 10:16:43 -0700 |
commit | 3b093630d55ad97807bcc710227b03819944605b (patch) | |
tree | db2148d92e0e56b13a6084af203529e0b3238d88 /core/fpdfdoc/tagged_int.h | |
parent | 5c9b65e603ee970b1a5cfbdf09273885a31e877b (diff) | |
download | pdfium-3b093630d55ad97807bcc710227b03819944605b.tar.xz |
Use std::vector in CPDF_StructTreeImpl
Allows use of CFX_RetainPtrs in place of explicit refcounting.
Review-Url: https://codereview.chromium.org/1985253002
Diffstat (limited to 'core/fpdfdoc/tagged_int.h')
-rw-r--r-- | core/fpdfdoc/tagged_int.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h index 7b9a32fa84..d508211441 100644 --- a/core/fpdfdoc/tagged_int.h +++ b/core/fpdfdoc/tagged_int.h @@ -8,8 +8,12 @@ #define CORE_FPDFDOC_TAGGED_INT_H_ #include <map> +#include <memory> +#include <vector> #include "core/fpdfdoc/include/fpdf_tagged.h" +#include "core/fxcrt/include/cfx_retain_ptr.h" +#include "third_party/base/stl_util.h" class CPDF_StructElementImpl; @@ -35,7 +39,8 @@ class CPDF_StructTreeImpl final : public IPDF_StructTree { const CPDF_Dictionary* const m_pTreeRoot; const CPDF_Dictionary* const m_pRoleMap; const CPDF_Dictionary* m_pPage; - CFX_ArrayTemplate<CPDF_StructElementImpl*> m_Kids; + std::vector<CFX_RetainPtr<CPDF_StructElementImpl>> m_Kids; + friend class CPDF_StructElementImpl; }; @@ -50,9 +55,9 @@ class CPDF_StructElementImpl final : public IPDF_StructElement { const CFX_ByteString& GetType() const override { return m_Type; } IPDF_StructElement* GetParent() const override { return m_pParent; } CPDF_Dictionary* GetDict() const override { return m_pDict; } - int CountKids() const override { return m_Kids.GetSize(); } + int CountKids() const override { return pdfium::CollectionSize<int>(m_Kids); } const CPDF_StructKid& GetKid(int index) const override { - return m_Kids.GetData()[index]; + return m_Kids[index]; } CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, @@ -96,7 +101,7 @@ class CPDF_StructElementImpl final : public IPDF_StructElement { CPDF_StructElementImpl* const m_pParent; CPDF_Dictionary* const m_pDict; CFX_ByteString m_Type; - CFX_ArrayTemplate<CPDF_StructKid> m_Kids; + std::vector<CPDF_StructKid> m_Kids; friend class CPDF_StructTreeImpl; }; |