Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_boolean.cpp
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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
9#include "core/fxcrt/fx_stream.h"
10
11CPDF_Boolean::CPDF_Boolean() = default;
12
13CPDF_Boolean::CPDF_Boolean(bool value) : m_bValue(value) {}
14
15CPDF_Boolean::~CPDF_Boolean() = default;
16
17CPDF_Object::Type CPDF_Boolean::GetType() const {
18 return kBoolean;
19}
20
21RetainPtr<CPDF_Object> CPDF_Boolean::Clone() const {
22 return pdfium::MakeRetain<CPDF_Boolean>(m_bValue);
23}
24
25ByteString CPDF_Boolean::GetString() const {
26 return m_bValue ? "true" : "false";
27}
28
29int CPDF_Boolean::GetInteger() const {
30 return m_bValue;
31}
32
33void CPDF_Boolean::SetString(const ByteString& str) {
34 m_bValue = (str == "true");
35}
36
37CPDF_Boolean* CPDF_Boolean::AsMutableBoolean() {
38 return this;
39}
40
41bool CPDF_Boolean::WriteTo(IFX_ArchiveStream* archive,
42 const CPDF_Encryptor* encryptor) const {
43 return archive->WriteString(" ") &&
44 archive->WriteString(GetString().AsStringView());
45}
ByteString GetString() const override
Type GetType() const override
int GetInteger() const override
void SetString(const ByteString &str) override
~CPDF_Boolean() override
bool WriteTo(IFX_ArchiveStream *archive, const CPDF_Encryptor *encryptor) const override
CPDF_Boolean * AsMutableBoolean() override
RetainPtr< CPDF_Object > Clone() const override
bool WriteString(ByteStringView str)
Definition fx_stream.cpp:47
bool operator==(const char *ptr) const