PDFObject Class Documentation
classPDFObjectNamespace:datalogics_interface
- Derived classes:
- PDFArray, PDFBoolean, PDFDict, PDFInteger, PDFName, PDFReal, PDFStream, PDFString
Detailed Description
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, such as PDFArray, an indexed array of data elements.
PDFObject is the superclass of these simple objects. A PDFObject cannot be directly instantiated, but any of its subclasses may.
Any PDFObject may be either direct or indirect. A direct object exists within its collection object (such as a PDFArray) and can be referenced only within that collection object. An indirect object exists outside of any collection object and can be referenced by many collection objects.
Threading: single-thread use. A PDFObject (and every subclass: PDFDict, PDFArray, PDFStream, PDFString, PDFName, PDFInteger, PDFReal, PDFBoolean) is bound to its owning Document's thread. Do not share instances across threads. See datalogics_interface.hpp for the full threading model.
Referenced by
Uses types
Constructor & Destructor Documentation
PDFObject
PDFObject(PDFObject &&)Parameters
~PDFObject
~PDFObject()Member Function Documentation
get_generation
intget_generation()Returns:
The generation number of this indirect object.Only indirect objects have a generation number.
get_id
intget_id()Returns:
The ID number of this indirect object.Only indirect objects have an ID number.
get_indirect
boolget_indirect()Returns:
true if this object is indirect, false if it is direct.Indicates if this object is indirect or direct.
get_type
PDFObjectTypeget_type()Returns:
PDFObjectTypeThe underlying Cos type of this object. Prefer this over dynamic_cast/try_as chains in hot paths.
operator!=
booloperator!=(const PDFObject &other)Parameters
other: const PDFObject &
Returns:
true if <code>other</code> is not equal to this.Inequality.
operator=
PDFObject &operator=(PDFObject &&)Parameters
Returns:
PDFObject &operator==
booloperator==(const PDFObject &other)Parameters
other: const PDFObject &The other PDFObject to compare against.
Returns:
true if the two objects are equal, false otherwise.Compare if two objects are equal.
to_string
std::stringto_string()Returns:
A string describing 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.