PDF SDK Documentation

Comprehensive Guide for Developers: Features, Integration, and API Reference

Loading...
Searching...
No Matches
PDF::Object Class Reference

Represents a PDF object. More...

#include <pdfsdk/cxx/object.h>

Public Member Functions

 Object () noexcept
 
 Object (PDObject obj, bool adopt=false) noexcept
 
 Object (const Object &that) noexcept
 
 Object (Object &&that) noexcept
 
Objectoperator= (const Object &rhs) noexcept
 
Objectoperator= (Object &&rhs) noexcept
 
void reset (PDObject obj, bool adopt=false) noexcept
 
PDObjectoperator& () noexcept
 
PDObject get () const noexcept
 
PDObject detach () noexcept
 
 operator bool () const noexcept
 
bool operator== (const Object &rhs) const noexcept
 
bool operator!= (const Object &rhs) const noexcept
 
PDObjectType GetObjectType () const
 
bool IsIndirect () const
 
uint32_t GetObjNumber () const
 
uint16_t GetGenNumber () 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)
 
Object ArrayGet (size_t index) const
 
void ArrayRemove (size_t index)
 
size_t GetArrayLength ()
 
void DictPut (PDAtom name, const Object &object)
 
void DictPutName (PDAtom name, PDAtom value)
 
Object DictFind (PDAtom name) const
 
PDAtom DictFindName (PDAtom name) const
 
void DictRemove (PDAtom name)
 
template<class Func >
void DictEnum (Func &&func) const
 
Object GetStreamDict () const
 
ReadStream StreamOpen (PDObjectStreamOpenMode openMode=kPDObjectStreamOpenFiltered)
 
bool DeepEquals (const Object &that)
 

Protected Attributes

PDObject m_obj
 

Detailed Description

Represents a PDF object.

ISO 32000-2:2020 - 7.3 Objects

Constructor & Destructor Documentation

◆ Object() [1/4]

PDF::Object::Object ( )
noexcept

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
objThe PDObject to initialize the Object with.
adoptFlag 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
thatThe Object to copy from.

◆ Object() [4/4]

PDF::Object::Object ( Object && that)
noexcept

Move constructor for the Object class.

Parameters
thatThe Object to move from.

Member Function Documentation

◆ ArrayAdd()

void PDF::Object::ArrayAdd ( const Object & object)

Add an Object to the array Object.

Parameters
objectThe Object to add.

◆ ArrayGet()

Object PDF::Object::ArrayGet ( size_t index) const

Get the Object at the specified index in the array Object.

Parameters
indexThe index of the Object to get.
Returns
The Object at the specified index.

◆ ArrayRemove()

void PDF::Object::ArrayRemove ( size_t index)

Remove the Object at the specified index from the array Object.

Parameters
indexThe 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
thatThe Object to compare with.
Returns
True if the Objects are deep equal, false otherwise.

◆ detach()

PDObject PDF::Object::detach ( )
noexcept

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
FuncThe 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
funcThe function object to invoke for each key-value pair.

◆ DictFind()

Object PDF::Object::DictFind ( PDAtom name) const

Find the Object with the specified name in the dictionary Object.

Parameters
nameThe name of the Object to find.
Returns
The Object with the specified name.

◆ DictFindName()

PDAtom PDF::Object::DictFindName ( PDAtom name) const

Find the name value with the specified name in the dictionary Object.

Parameters
nameThe name of the name value to find.
Returns
The name value with the specified name.

◆ DictPut()

void PDF::Object::DictPut ( PDAtom name,
const Object & object )

Put an Object with the specified name into the dictionary Object.

Parameters
nameThe name of the Object.
objectThe Object to put.

◆ DictPutName()

void PDF::Object::DictPutName ( PDAtom name,
PDAtom value )

Put a name value pair into the dictionary Object.

Parameters
nameThe name of the pair.
valueThe value of the pair.

◆ DictRemove()

void PDF::Object::DictRemove ( PDAtom name)

Remove the Object with the specified name from the dictionary Object.

Parameters
nameThe name of the Object to remove.

◆ get()

PDObject PDF::Object::get ( ) const
noexcept

Get the underlying PDObject.

Returns
The PDObject.

◆ GetArrayLength()

size_t PDF::Object::GetArrayLength ( )

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.

◆ 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()

PDObjectType PDF::Object::GetObjectType ( ) const

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.

◆ 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.

◆ operator bool()

PDF::Object::operator bool ( ) const
explicitnoexcept

Conversion operator to check if the Object is valid.

Returns
True if the Object is valid, false otherwise.

◆ operator!=()

bool PDF::Object::operator!= ( const Object & rhs) const
noexcept

Inequality operator for comparing two Objects.

Parameters
rhsThe Object to compare with.
Returns
True if the Objects are not equal, false otherwise.

◆ operator&()

PDObject * PDF::Object::operator& ( )
noexcept

Get the address of the underlying PDObject.

Returns
The address of the PDObject.

◆ operator=() [1/2]

Object & PDF::Object::operator= ( const Object & rhs)
noexcept

Copy assignment operator for the Object class.

Parameters
rhsThe Object to copy assign from.
Returns
A reference to the assigned Object.

◆ operator=() [2/2]

Object & PDF::Object::operator= ( Object && rhs)
noexcept

Move assignment operator for the Object class.

Parameters
rhsThe Object to move assign from.
Returns
A reference to the assigned Object.

◆ operator==()

bool PDF::Object::operator== ( const Object & rhs) const
noexcept

Equality operator for comparing two Objects.

Parameters
rhsThe Object to compare with.
Returns
True if the Objects are equal, false otherwise.

◆ reset()

void PDF::Object::reset ( PDObject obj,
bool adopt = false )
noexcept

Reset the Object with a new PDObject.

Parameters
objThe new PDObject to reset the Object with.
adoptFlag indicating whether the Object should adopt ownership of the PDObject.

◆ StreamOpen()

ReadStream PDF::Object::StreamOpen ( PDObjectStreamOpenMode openMode = kPDObjectStreamOpenFiltered)

Open a read stream for the Object.

Parameters
openModeThe open mode for the read stream.
Returns
The read stream.

The documentation for this class was generated from the following file: