PDFArray Class Documentation
class PDFArray : PDFObjectNamespace:datalogics_interface
- Inherits from:
PDFObject
Detailed Description
Represents an array of data elements within a PDF document.
All objects in a PDF document are built from a collection of simpler objects that represent fundamental datatypes like numbers, strings and arrays. PDFObject and its subclasses allow direct access and manipulation of these simple objects. Some subclasses represent single data elements. For example, PDFInteger represents a single integer value. Others represent a collection of PDFObjects, like PDFArray, an indexed array of data elements.
A PDFArray is a heterogenous collection object that gathers other PDFObjects (including other PDFArrays) into an indexed list.
Referenced by
Uses types
Constructor & Destructor Documentation
PDFArray
PDFArray(Document & doc, bool indirect)Parameters
doc: Document &Document object containing this PDFArray
indirect: boolflag marking this as an indirect PDFObject
General constructor
Member Function Documentation
add
void add(PDFObject & value)Parameters
value: PDFObject &the object to append.
Returns:
voidAdds an object to the end of the array
get
std::unique_ptr< PDFObject > get(int index)Parameters
index: intthe position of the object to retrieve.
Returns:
std::unique_ptr< PDFObject >Returns the object at the given index.
get_generation
int get_generation()Returns:
intThe generation number of this indirect object.
The generation number for this object.
Only indirect objects have a generation number.
get_id
int get_id()Returns:
intThe ID number of this indirect object.
The ID number for this object.
Only indirect objects have an ID number.
get_indirect
bool get_indirect()Returns:
booltrue if this object is indirect, false if it is direct.
Indicates if this object is indirect or direct.
get_length
int get_length()Returns:
intThe number of elements in this array.
get_type
PDFObjectType get_type()Returns:
PDFObjectTypeThe underlying Cos type of this object. Prefer this over dynamic_cast/try_as chains in hot paths.
insert
void insert(int index, PDFObject & value)Parameters
index: intthe position at which to insert.
value: PDFObject &the object to insert.
Returns:
voidInserts an object at the given index, displacing existing objects. All objects following this will have their index increased by one.
operator!=
bool operator!=(const PDFObject & other)Parameters
other: const PDFObject &
Returns:
booltrue if other is not equal to this.
Inequality.
operator==
bool operator==(const PDFObject & other)Parameters
other: const PDFObject &The other PDFObject to compare against.
Returns:
booltrue if the two objects are equal, false otherwise.
Compare if two objects are equal.
put
void put(int index, PDFObject & value)Parameters
index: intthe position at which to place the object.
value: PDFObject &the object to place at the given index.
Returns:
voidPuts an object at the given index, replacing the existing item. The index can be greater than the current length of the array; the array will be extended and the empty slots filled with null objects.
remove_at
void remove_at(int index)Parameters
index: intthe position of the object to remove.
Returns:
voidRemoves the object at the given index. The length of the array is reduced by 1.
to_string
std::string to_string()Returns:
std::stringA string describing this PDFObject.
Returns a string representation of this PDFObject.
The string includes the object's indirect status, and if indirect, its ID and generation number.
try_as
T * try_as(typename T )Parameters
: typename T
Returns:
T *Attempt to downcast this object to a derived Cos type such as PDFString, PDFDict, PDFArray, PDFStream, PDFName, PDFInteger, PDFReal, or PDFBoolean. Returns nullptr if the object's actual type doesn't match T.
try_as
const T * try_as(typename T )Parameters
: typename T
Returns:
const T *Const overload of try_as(). Returns a const pointer, or nullptr.