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 #include "core/fpdfapi/parser/cpdf_boolean.h" 8 #include "third_party/base/ptr_util.h" 9 CPDF_Boolean()10CPDF_Boolean::CPDF_Boolean() : m_bValue(false) {} 11 CPDF_Boolean(bool value)12CPDF_Boolean::CPDF_Boolean(bool value) : m_bValue(value) {} 13 ~CPDF_Boolean()14CPDF_Boolean::~CPDF_Boolean() {} 15 GetType() const16CPDF_Object::Type CPDF_Boolean::GetType() const { 17 return BOOLEAN; 18 } 19 Clone() const20std::unique_ptr<CPDF_Object> CPDF_Boolean::Clone() const { 21 return pdfium::MakeUnique<CPDF_Boolean>(m_bValue); 22 } 23 GetString() const24CFX_ByteString CPDF_Boolean::GetString() const { 25 return m_bValue ? "true" : "false"; 26 } 27 GetInteger() const28int CPDF_Boolean::GetInteger() const { 29 return m_bValue; 30 } 31 SetString(const CFX_ByteString & str)32void CPDF_Boolean::SetString(const CFX_ByteString& str) { 33 m_bValue = (str == "true"); 34 } 35 IsBoolean() const36bool CPDF_Boolean::IsBoolean() const { 37 return true; 38 } 39 AsBoolean()40CPDF_Boolean* CPDF_Boolean::AsBoolean() { 41 return this; 42 } 43 AsBoolean() const44const CPDF_Boolean* CPDF_Boolean::AsBoolean() const { 45 return this; 46 } 47