• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FPDFDOC_CPDF_NAMETREE_H_
8 #define CORE_FPDFDOC_CPDF_NAMETREE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/retain_ptr.h"
14 
15 class CPDF_Array;
16 class CPDF_Dictionary;
17 class CPDF_Document;
18 class CPDF_Object;
19 
20 class CPDF_NameTree {
21  public:
22   explicit CPDF_NameTree(CPDF_Dictionary* pRoot);
23   CPDF_NameTree(CPDF_Document* pDoc, const ByteString& category);
24   ~CPDF_NameTree();
25 
26   bool AddValueAndName(RetainPtr<CPDF_Object> pObj, const WideString& name);
27   bool DeleteValueAndName(int nIndex);
28 
29   CPDF_Object* LookupValueAndName(int nIndex, WideString* csName) const;
30   CPDF_Object* LookupValue(const WideString& csName) const;
31   CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const WideString& sName);
32 
33   size_t GetCount() const;
GetRootForTest()34   CPDF_Dictionary* GetRootForTest() const { return m_pRoot.Get(); }
35 
36  private:
37   RetainPtr<CPDF_Dictionary> m_pRoot;
38 };
39 
40 #endif  // CORE_FPDFDOC_CPDF_NAMETREE_H_
41