Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 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 | |
dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame^] | 7 | #include "core/fpdfapi/parser/cpdf_object.h" |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 8 | |
| 9 | #include <algorithm> |
| 10 | |
dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame^] | 11 | #include "core/fpdfapi/parser/cpdf_array.h" |
| 12 | #include "core/fpdfapi/parser/cpdf_dictionary.h" |
| 13 | #include "core/fpdfapi/parser/cpdf_indirect_object_holder.h" |
| 14 | #include "core/fpdfapi/parser/cpdf_parser.h" |
| 15 | #include "core/fpdfapi/parser/fpdf_parser_decode.h" |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 16 | #include "core/fxcrt/fx_string.h" |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 17 | #include "third_party/base/stl_util.h" |
| 18 | |
| 19 | CPDF_Object::~CPDF_Object() {} |
| 20 | |
| 21 | CPDF_Object* CPDF_Object::GetDirect() const { |
| 22 | return const_cast<CPDF_Object*>(this); |
| 23 | } |
| 24 | |
weili | a470b5e | 2016-08-23 22:08:37 -0700 | [diff] [blame] | 25 | CPDF_Object* CPDF_Object::CloneObjectNonCyclic(bool bDirect) const { |
| 26 | std::set<const CPDF_Object*> visited_objs; |
| 27 | return CloneNonCyclic(bDirect, &visited_objs); |
| 28 | } |
| 29 | |
| 30 | CPDF_Object* CPDF_Object::CloneDirectObject() const { |
| 31 | return CloneObjectNonCyclic(true); |
| 32 | } |
| 33 | |
| 34 | CPDF_Object* CPDF_Object::CloneNonCyclic( |
| 35 | bool bDirect, |
| 36 | std::set<const CPDF_Object*>* pVisited) const { |
| 37 | return Clone(); |
| 38 | } |
| 39 | |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 40 | void CPDF_Object::Release() { |
thestig | b73c993 | 2016-10-03 21:28:07 -0700 | [diff] [blame] | 41 | if (m_ObjNum) |
| 42 | return; |
| 43 | |
tsepez | c6c2e36 | 2016-09-19 12:08:38 -0700 | [diff] [blame] | 44 | delete this; |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | CFX_ByteString CPDF_Object::GetString() const { |
| 48 | return CFX_ByteString(); |
| 49 | } |
| 50 | |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 51 | CFX_WideString CPDF_Object::GetUnicodeText() const { |
| 52 | return CFX_WideString(); |
| 53 | } |
| 54 | |
| 55 | FX_FLOAT CPDF_Object::GetNumber() const { |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | int CPDF_Object::GetInteger() const { |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | CPDF_Dictionary* CPDF_Object::GetDict() const { |
| 64 | return nullptr; |
| 65 | } |
| 66 | |
Tom Sepez | 5fc239a | 2016-03-10 14:10:38 -0800 | [diff] [blame] | 67 | void CPDF_Object::SetString(const CFX_ByteString& str) { |
| 68 | ASSERT(FALSE); |
| 69 | } |
| 70 | |
| 71 | bool CPDF_Object::IsArray() const { |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | bool CPDF_Object::IsBoolean() const { |
| 76 | return false; |
| 77 | } |
| 78 | |
| 79 | bool CPDF_Object::IsDictionary() const { |
| 80 | return false; |
| 81 | } |
| 82 | |
| 83 | bool CPDF_Object::IsName() const { |
| 84 | return false; |
| 85 | } |
| 86 | |
| 87 | bool CPDF_Object::IsNumber() const { |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | bool CPDF_Object::IsReference() const { |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | bool CPDF_Object::IsStream() const { |
| 96 | return false; |
| 97 | } |
| 98 | |
| 99 | bool CPDF_Object::IsString() const { |
| 100 | return false; |
| 101 | } |
| 102 | |
| 103 | CPDF_Array* CPDF_Object::AsArray() { |
| 104 | return nullptr; |
| 105 | } |
| 106 | |
| 107 | const CPDF_Array* CPDF_Object::AsArray() const { |
| 108 | return nullptr; |
| 109 | } |
| 110 | |
| 111 | CPDF_Boolean* CPDF_Object::AsBoolean() { |
| 112 | return nullptr; |
| 113 | } |
| 114 | |
| 115 | const CPDF_Boolean* CPDF_Object::AsBoolean() const { |
| 116 | return nullptr; |
| 117 | } |
| 118 | |
| 119 | CPDF_Dictionary* CPDF_Object::AsDictionary() { |
| 120 | return nullptr; |
| 121 | } |
| 122 | |
| 123 | const CPDF_Dictionary* CPDF_Object::AsDictionary() const { |
| 124 | return nullptr; |
| 125 | } |
| 126 | |
| 127 | CPDF_Name* CPDF_Object::AsName() { |
| 128 | return nullptr; |
| 129 | } |
| 130 | |
| 131 | const CPDF_Name* CPDF_Object::AsName() const { |
| 132 | return nullptr; |
| 133 | } |
| 134 | |
| 135 | CPDF_Number* CPDF_Object::AsNumber() { |
| 136 | return nullptr; |
| 137 | } |
| 138 | |
| 139 | const CPDF_Number* CPDF_Object::AsNumber() const { |
| 140 | return nullptr; |
| 141 | } |
| 142 | |
| 143 | CPDF_Reference* CPDF_Object::AsReference() { |
| 144 | return nullptr; |
| 145 | } |
| 146 | |
| 147 | const CPDF_Reference* CPDF_Object::AsReference() const { |
| 148 | return nullptr; |
| 149 | } |
| 150 | |
| 151 | CPDF_Stream* CPDF_Object::AsStream() { |
| 152 | return nullptr; |
| 153 | } |
| 154 | |
| 155 | const CPDF_Stream* CPDF_Object::AsStream() const { |
| 156 | return nullptr; |
| 157 | } |
| 158 | |
| 159 | CPDF_String* CPDF_Object::AsString() { |
| 160 | return nullptr; |
| 161 | } |
| 162 | |
| 163 | const CPDF_String* CPDF_Object::AsString() const { |
| 164 | return nullptr; |
| 165 | } |