• 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_FPDFAPI_PARSER_CPDF_NAME_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_NAME_H_
9 
10 #include <memory>
11 
12 #include "core/fpdfapi/parser/cpdf_object.h"
13 #include "core/fxcrt/cfx_string_pool_template.h"
14 #include "core/fxcrt/cfx_weak_ptr.h"
15 
16 class CPDF_Name : public CPDF_Object {
17  public:
18   CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_ByteString& str);
19   ~CPDF_Name() override;
20 
21   // CPDF_Object:
22   Type GetType() const override;
23   std::unique_ptr<CPDF_Object> Clone() const override;
24   CFX_ByteString GetString() const override;
25   CFX_WideString GetUnicodeText() const override;
26   void SetString(const CFX_ByteString& str) override;
27   bool IsName() const override;
28   CPDF_Name* AsName() override;
29   const CPDF_Name* AsName() const override;
30 
31  protected:
32   CFX_ByteString m_Name;
33 };
34 
ToName(CPDF_Object * obj)35 inline CPDF_Name* ToName(CPDF_Object* obj) {
36   return obj ? obj->AsName() : nullptr;
37 }
38 
ToName(const CPDF_Object * obj)39 inline const CPDF_Name* ToName(const CPDF_Object* obj) {
40   return obj ? obj->AsName() : nullptr;
41 }
42 
43 #endif  // CORE_FPDFAPI_PARSER_CPDF_NAME_H_
44