• 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_BOOLEAN_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_BOOLEAN_H_
9 
10 #include <memory>
11 
12 #include "core/fpdfapi/parser/cpdf_object.h"
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/fx_system.h"
15 
16 class CPDF_Boolean : public CPDF_Object {
17  public:
18   CPDF_Boolean();
19   explicit CPDF_Boolean(bool value);
20   ~CPDF_Boolean() override;
21 
22   // CPDF_Object:
23   Type GetType() const override;
24   std::unique_ptr<CPDF_Object> Clone() const override;
25   ByteString GetString() const override;
26   int GetInteger() const override;
27   void SetString(const ByteString& str) override;
28   bool IsBoolean() const override;
29   CPDF_Boolean* AsBoolean() override;
30   const CPDF_Boolean* AsBoolean() const override;
31   bool WriteTo(IFX_ArchiveStream* archive) const override;
32 
33  protected:
34   bool m_bValue;
35 };
36 
ToBoolean(CPDF_Object * obj)37 inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) {
38   return obj ? obj->AsBoolean() : nullptr;
39 }
40 
ToBoolean(const CPDF_Object * obj)41 inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) {
42   return obj ? obj->AsBoolean() : nullptr;
43 }
44 
45 #endif  // CORE_FPDFAPI_PARSER_CPDF_BOOLEAN_H_
46