• 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/unowned_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(const CPDF_Document* pDoc, const ByteString& category);
24   ~CPDF_NameTree();
25 
26   bool AddValueAndName(std::unique_ptr<CPDF_Object> pObj,
27                        const WideString& name);
28   bool DeleteValueAndName(int nIndex);
29 
30   CPDF_Object* LookupValueAndName(int nIndex, WideString* csName) const;
31   CPDF_Object* LookupValue(const WideString& csName) const;
32   CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const WideString& sName);
33 
34   int GetIndex(const WideString& csName) const;
35   size_t GetCount() const;
GetRoot()36   CPDF_Dictionary* GetRoot() const { return m_pRoot.Get(); }
37 
38  private:
39   UnownedPtr<CPDF_Dictionary> m_pRoot;
40 };
41 
42 #endif  // CORE_FPDFDOC_CPDF_NAMETREE_H_
43