Represents a PDF object.
More...
#include <pdfsdk/cxx/object.h>
|
| | Object () noexcept |
| | Object (PDObject obj, bool adopt=false) noexcept |
| | Object (const Object &that) noexcept |
| | Object (Object &&that) noexcept |
| Object & | operator= (const Object &rhs) noexcept |
| Object & | operator= (Object &&rhs) noexcept |
| void | reset (PDObject obj, bool adopt=false) noexcept |
| PDObject * | operator& () noexcept |
| PDObject | get () const noexcept |
| PDObject | detach () noexcept |
|
| operator bool () const noexcept |
|
bool | operator== (const Object &rhs) const noexcept |
| bool | Equals (const Object &rhs) const noexcept |
| | Compares two objects for identity.
|
| PDObjectType | GetObjectType () const |
| bool | IsNull () const |
| bool | IsBool () const |
| bool | IsInteger () const |
| bool | IsReal () const |
| bool | IsNumber () const |
| bool | IsString () const |
| bool | IsName () const |
| bool | IsDict () const |
| bool | IsArray () const |
| bool | IsStream () const |
| bool | IsDictOrStream () const |
| bool | IsIndirect () const |
| uint32_t | GetObjNumber () const |
| uint16_t | GetGenNumber () const |
| uint64_t | GetFileOffset () const |
| bool | GetBoolValue () const |
| int64_t | GetIntValue () const |
| float | GetRealValue () const |
| std::wstring | GetUnicodeString () const |
| std::string | GetStringValue () const |
| PDAtom | GetNameValue () const |
| void | ArrayAdd (const Object &object) |
| void | ArrayAddInteger (int64_t value) |
| void | ArrayAddReal (float value) |
| void | ArrayAddBoolean (bool value) |
| void | ArrayAddName (PDAtom value) |
| void | ArrayAddString (std::string_view bytes, bool hex=false) |
| void | ArrayAddStringUnicode (std::wstring_view unicode) |
| Object | ArrayAddDict () |
| Object | ArrayAddArray () |
| void | ArrayInsert (size_t index, const Object &object) |
| void | ArrayPut (size_t index, const Object &object) |
| Object | ArrayGet (size_t index) const |
| void | ArrayRemove (size_t index) |
| size_t | GetArrayLength () const |
| void | DictPut (PDAtom name, const Object &object) |
| void | DictPutName (PDAtom name, PDAtom value) |
| void | DictPutInteger (PDAtom name, int64_t value) |
| void | DictPutReal (PDAtom name, float value) |
| void | DictPutBoolean (PDAtom name, bool value) |
| void | DictPutString (PDAtom name, std::string_view bytes, bool hex=false) |
| void | DictPutStringUnicode (PDAtom name, std::wstring_view unicode) |
| Object | DictPutDict (PDAtom name) |
| Object | DictPutArray (PDAtom name) |
| Object | DictFind (PDAtom name) const |
| PDAtom | DictFindName (PDAtom name) const |
| void | DictRemove (PDAtom name) |
| template<class Func> |
| void | DictEnum (Func &&func) const |
| DictEnumerator | DictGetEnumerator () const |
| size_t | GetDictNumEntries () const |
| Object | GetStreamDict () const |
| ReadStream | StreamOpen (PDObjectStreamOpenMode openMode=kPDObjectStreamOpenFiltered) const |
| bool | DeepEquals (const Object &that) |
Represents a PDF object.
ISO 32000-2:2020 - 7.3 Objects
◆ Object() [1/4]
Default constructor for the Object class.
The Object will be initialized with a null PDObject.
◆ Object() [2/4]
| PDF::Object::Object |
( |
PDObject | obj, |
|
|
bool | adopt = false ) |
|
noexcept |
Constructor for the Object class.
- Parameters
-
| obj | The PDObject to initialize the Object with. |
| adopt | Flag indicating whether the Object should adopt ownership of the PDObject. |
◆ Object() [3/4]
| PDF::Object::Object |
( |
const Object & | that | ) |
|
|
noexcept |
Copy constructor for the Object class.
- Parameters
-
| that | The Object to copy from. |
◆ Object() [4/4]
| PDF::Object::Object |
( |
Object && | that | ) |
|
|
noexcept |
Move constructor for the Object class.
- Parameters
-
| that | The Object to move from. |
◆ ArrayAdd()
| void PDF::Object::ArrayAdd |
( |
const Object & | object | ) |
|
Add an Object to the array Object.
- Parameters
-
◆ ArrayAddArray()
| Object PDF::Object::ArrayAddArray |
( |
| ) |
|
Append a new empty array to the array Object.
- Returns
- The newly created array Object.
◆ ArrayAddBoolean()
| void PDF::Object::ArrayAddBoolean |
( |
bool | value | ) |
|
Add a boolean value to the array Object.
- Parameters
-
| value | The boolean value to add. |
◆ ArrayAddDict()
| Object PDF::Object::ArrayAddDict |
( |
| ) |
|
Append a new empty dictionary to the array Object.
- Returns
- The newly created dictionary Object.
◆ ArrayAddInteger()
| void PDF::Object::ArrayAddInteger |
( |
int64_t | value | ) |
|
Add an integer value to the array Object.
- Parameters
-
| value | The integer value to add. |
◆ ArrayAddName()
| void PDF::Object::ArrayAddName |
( |
PDAtom | value | ) |
|
Add a name value to the array Object.
- Parameters
-
| value | The name atom to add. |
◆ ArrayAddReal()
| void PDF::Object::ArrayAddReal |
( |
float | value | ) |
|
Add a real value to the array Object.
- Parameters
-
| value | The real value to add. |
◆ ArrayAddString()
| void PDF::Object::ArrayAddString |
( |
std::string_view | bytes, |
|
|
bool | hex = false ) |
Add a byte string value to the array Object.
- Parameters
-
| bytes | The string bytes to add. |
| hex | Whether to write the string as a hexadecimal literal. |
◆ ArrayAddStringUnicode()
| void PDF::Object::ArrayAddStringUnicode |
( |
std::wstring_view | unicode | ) |
|
Add a Unicode string value to the array Object.
- Parameters
-
| unicode | The Unicode string to add. |
◆ ArrayGet()
| Object PDF::Object::ArrayGet |
( |
size_t | index | ) |
const |
Get the Object at the specified index in the array Object.
- Parameters
-
| index | The index of the Object to get. |
- Returns
- The Object at the specified index.
◆ ArrayInsert()
| void PDF::Object::ArrayInsert |
( |
size_t | index, |
|
|
const Object & | object ) |
Insert an Object at the specified index, shifting existing elements towards the end.
- Parameters
-
| index | The index at which to insert the Object. |
| object | The Object to insert. |
- Note
- If index is greater than the current length, the array is extended with null objects to place the element at that index.
◆ ArrayPut()
| void PDF::Object::ArrayPut |
( |
size_t | index, |
|
|
const Object & | object ) |
Put an Object at the specified index, overwriting the existing element.
- Parameters
-
| index | The index at which to put the Object. |
| object | The Object to put. |
- Note
- If index is greater than the current length, the array is extended with null objects to place the element at that index.
◆ ArrayRemove()
| void PDF::Object::ArrayRemove |
( |
size_t | index | ) |
|
Remove the Object at the specified index from the array Object.
- Parameters
-
| index | The index of the Object to remove. |
◆ DeepEquals()
| bool PDF::Object::DeepEquals |
( |
const Object & | that | ) |
|
Check if the Object is deep equal to another Object.
- Parameters
-
| that | The Object to compare with. |
- Returns
- True if the Objects are deep equal, false otherwise.
◆ detach()
Detach the underlying PDObject from the Object.
- Returns
- The detached PDObject.
◆ DictEnum()
template<class Func>
| void PDF::Object::DictEnum |
( |
Func && | func | ) |
const |
Enumerate through the key-value pairs in the dictionary Object.
- Template Parameters
-
| Func | The type of the function object to invoke for each key-value pair. It should have the signature bool(PDAtom key, const Object& value). Enumerating will stop if the function returns false. |
- Parameters
-
| func | The function object to invoke for each key-value pair. |
- Note
- Modifying the dictionary from within the callback results in undefined behavior.
◆ DictFind()
| Object PDF::Object::DictFind |
( |
PDAtom | name | ) |
const |
Find the value associated with the specified key in the dictionary Object.
- Parameters
-
- Returns
- The value associated with the key, or a null Object if the key is not present.
◆ DictFindName()
| PDAtom PDF::Object::DictFindName |
( |
PDAtom | name | ) |
const |
Find the name value with the specified name in the dictionary Object.
- Parameters
-
| name | The name of the name value to find. |
- Returns
- The name value with the specified name.
◆ DictGetEnumerator()
Get an enumerator over the key/value pairs of the dictionary Object.
- Returns
- A DictEnumerator positioned before the first entry. See DictEnumerator for usage.
- Note
- Modifying the dictionary while the enumerator is in use results in undefined behavior.
◆ DictPut()
| void PDF::Object::DictPut |
( |
PDAtom | name, |
|
|
const Object & | object ) |
Put an Object with the specified name into the dictionary Object.
- Parameters
-
| name | The name of the Object. |
| object | The Object to put. |
◆ DictPutArray()
| Object PDF::Object::DictPutArray |
( |
PDAtom | name | ) |
|
Put a new empty array into the dictionary Object.
- Parameters
-
- Returns
- The newly created array Object.
◆ DictPutBoolean()
| void PDF::Object::DictPutBoolean |
( |
PDAtom | name, |
|
|
bool | value ) |
Put a boolean value into the dictionary Object.
- Parameters
-
| name | The key. |
| value | The boolean value. |
◆ DictPutDict()
| Object PDF::Object::DictPutDict |
( |
PDAtom | name | ) |
|
Put a new empty dictionary into the dictionary Object.
- Parameters
-
- Returns
- The newly created dictionary Object.
◆ DictPutInteger()
| void PDF::Object::DictPutInteger |
( |
PDAtom | name, |
|
|
int64_t | value ) |
Put an integer value into the dictionary Object.
- Parameters
-
| name | The key. |
| value | The integer value. |
◆ DictPutName()
| void PDF::Object::DictPutName |
( |
PDAtom | name, |
|
|
PDAtom | value ) |
Put a name value pair into the dictionary Object.
- Parameters
-
| name | The name of the pair. |
| value | The value of the pair. |
◆ DictPutReal()
| void PDF::Object::DictPutReal |
( |
PDAtom | name, |
|
|
float | value ) |
Put a real value into the dictionary Object.
- Parameters
-
| name | The key. |
| value | The real value. |
◆ DictPutString()
| void PDF::Object::DictPutString |
( |
PDAtom | name, |
|
|
std::string_view | bytes, |
|
|
bool | hex = false ) |
Put a byte string value into the dictionary Object.
- Parameters
-
| name | The key. |
| bytes | The string bytes. |
| hex | Whether to write the string as a hexadecimal literal. |
◆ DictPutStringUnicode()
| void PDF::Object::DictPutStringUnicode |
( |
PDAtom | name, |
|
|
std::wstring_view | unicode ) |
Put a Unicode string value into the dictionary Object.
- Parameters
-
| name | The key. |
| unicode | The Unicode string. |
◆ DictRemove()
| void PDF::Object::DictRemove |
( |
PDAtom | name | ) |
|
Remove the Object with the specified name from the dictionary Object.
- Parameters
-
| name | The name of the Object to remove. |
◆ Equals()
| bool PDF::Object::Equals |
( |
const Object & | rhs | ) |
const |
|
noexcept |
Compares two objects for identity.
- Parameters
-
| [in] | rhs | The object to compare with. |
◆ get()
Get the underlying PDObject.
- Returns
- The PDObject.
◆ GetArrayLength()
| size_t PDF::Object::GetArrayLength |
( |
| ) |
const |
Get the length of the array Object.
- Returns
- The length of the array Object.
◆ GetBoolValue()
| bool PDF::Object::GetBoolValue |
( |
| ) |
const |
Get the boolean value of the Object.
- Returns
- The boolean value.
◆ GetDictNumEntries()
| size_t PDF::Object::GetDictNumEntries |
( |
| ) |
const |
Get the number of entries in the dictionary Object.
- Returns
- The size of the dictionary Object entries.
◆ GetFileOffset()
| uint64_t PDF::Object::GetFileOffset |
( |
| ) |
const |
Get the byte offset of the Object in the PDF file. Returns 0 for objects compressed inside an Object Stream (PDF 1.5+).
- Returns
- The byte offset, or 0 if not applicable.
◆ GetGenNumber()
| uint16_t PDF::Object::GetGenNumber |
( |
| ) |
const |
Get the generation number of the Object.
- Returns
- The generation number.
◆ GetIntValue()
| int64_t PDF::Object::GetIntValue |
( |
| ) |
const |
Get the integer value of the Object.
- Returns
- The integer value.
◆ GetNameValue()
| PDAtom PDF::Object::GetNameValue |
( |
| ) |
const |
Get the name value of the Object.
- Returns
- The name value.
◆ GetObjectType()
Get the type of the Object.
- Returns
- The type of the Object.
◆ GetObjNumber()
| uint32_t PDF::Object::GetObjNumber |
( |
| ) |
const |
Get the object number of the Object.
- Returns
- The object number.
◆ GetRealValue()
| float PDF::Object::GetRealValue |
( |
| ) |
const |
Get the real value of the Object.
- Returns
- The real value.
◆ GetStreamDict()
| Object PDF::Object::GetStreamDict |
( |
| ) |
const |
Get the stream dictionary Object.
- Returns
- The stream dictionary Object.
◆ GetStringValue()
| std::string PDF::Object::GetStringValue |
( |
| ) |
const |
Get the string value of the Object.
- Returns
- The string value.
◆ GetUnicodeString()
| std::wstring PDF::Object::GetUnicodeString |
( |
| ) |
const |
Get the Unicode string value of the Object.
- Returns
- The Unicode string value.
◆ IsArray()
| bool PDF::Object::IsArray |
( |
| ) |
const |
- Returns
- true if the Object is an array, false otherwise.
◆ IsBool()
| bool PDF::Object::IsBool |
( |
| ) |
const |
- Returns
- true if the Object is a boolean, false otherwise.
◆ IsDict()
| bool PDF::Object::IsDict |
( |
| ) |
const |
- Returns
- true if the Object is a dictionary, false otherwise.
◆ IsDictOrStream()
| bool PDF::Object::IsDictOrStream |
( |
| ) |
const |
Check whether the Object is a dictionary or a stream. Both expose dictionary entries, so this is the appropriate guard before calling the Dict* methods.
- Returns
- true if the Object is a dictionary or a stream, false otherwise.
◆ IsIndirect()
| bool PDF::Object::IsIndirect |
( |
| ) |
const |
Check if the Object is an indirect object.
- Returns
- true if the Object is an indirect object, false otherwise.
◆ IsInteger()
| bool PDF::Object::IsInteger |
( |
| ) |
const |
- Returns
- true if the Object is an integer, false otherwise.
◆ IsName()
| bool PDF::Object::IsName |
( |
| ) |
const |
- Returns
- true if the Object is a name, false otherwise.
◆ IsNull()
| bool PDF::Object::IsNull |
( |
| ) |
const |
- Returns
- true if the Object is the null object, false otherwise.
◆ IsNumber()
| bool PDF::Object::IsNumber |
( |
| ) |
const |
- Returns
- true if the Object is a number (integer or real), false otherwise.
◆ IsReal()
| bool PDF::Object::IsReal |
( |
| ) |
const |
- Returns
- true if the Object is a real number, false otherwise.
◆ IsStream()
| bool PDF::Object::IsStream |
( |
| ) |
const |
- Returns
- true if the Object is a stream, false otherwise.
◆ IsString()
| bool PDF::Object::IsString |
( |
| ) |
const |
- Returns
- true if the Object is a string, false otherwise.
◆ operator&()
Get the address of the underlying PDObject.
- Returns
- The address of the PDObject.
◆ operator=() [1/2]
Copy assignment operator for the Object class.
- Parameters
-
| rhs | The Object to copy assign from. |
- Returns
- A reference to the assigned Object.
◆ operator=() [2/2]
Move assignment operator for the Object class.
- Parameters
-
| rhs | The Object to move assign from. |
- Returns
- A reference to the assigned Object.
◆ reset()
| void PDF::Object::reset |
( |
PDObject | obj, |
|
|
bool | adopt = false ) |
|
noexcept |
Reset the Object with a new PDObject.
- Parameters
-
| obj | The new PDObject to reset the Object with. |
| adopt | Flag indicating whether the Object should adopt ownership of the PDObject. |
◆ StreamOpen()
Open a read stream for the Object.
- Parameters
-
| openMode | The open mode for the read stream. |
- Returns
- The read stream.
The documentation for this class was generated from the following file: