PDFDict Class Documentation
class PDFDict : PDFObjectNamespace:datalogics_interface
- Inherits from:
PDFObject
Detailed Description
Represents an associative collection 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, such as PDFInteger, which represents a single integer value. Other subclasses represent a collection of PDFObjects, like PDFArray, an indexed array of data elements.
A PDFDict is a heterogenous collection object that maps other PDFObjects (including other PDFDicts) to PDFName objects.
Referenced by
Uses types
Constructor & Destructor Documentation
PDFDict
PDFDict(Document & doc, bool indirect)Parameters
doc: Document &Document object containing this PDFDict
indirect: boolflag marking this as an indirect PDFObject
General constructor
Member Function Documentation
contains
bool contains(const std::string & key)Parameters
key: const std::string &A PDFName for the key
Returns:
booltrue if the given key exists
Tests whether the given key exists in the dictionary
get
std::unique_ptr< PDFObject > get(const std::string & key)Parameters
key: const std::string &A PDFName for the key
Returns:
std::unique_ptr< PDFObject >A PDFObject matching the key
Returns the object matching the given key.
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_keys
std::vector< std::string > get_keys()Returns:
std::vector< std::string >a list of all the keys
Enumerate all keys in this dictionary. Order is undefined; successive calls on the same dictionary are not guaranteed to return keys in the same order. Get a list of all keys in the dictionary
get_type
PDFObjectType get_type()Returns:
PDFObjectTypeThe underlying Cos type of this object. Prefer this over dynamic_cast/try_as chains in hot paths.
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(const std::string & key, PDFObject & value)Parameters
key: const std::string &A PDFName for the key
value: PDFObject &A PDFObject to add to the dictionary
Returns:
voidPuts an object with the matching key into the dictionary, adding the entry if the key is not already present.
remove
void remove(const std::string & key)Parameters
key: const std::string &A PDFName for the key
Returns:
voidRemoves a key/object pair from the dictionary.
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.