PDFReal Class Documentation

class PDFReal : PDFObject

Namespace:datalogics_interface

Inherits from:
PDFObject

Detailed Description

Represents a floating point data element 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, PDFReal represents a single floating point value. Others represent a collection of PDFObjects, such as PDFArray, an indexed array of data elements.

A PDFReal represents a single floating point value, and may be inserted into any collection object.

Uses types

Constructor & Destructor Documentation

PDFReal

PDFReal(double value, Document & doc, bool indirect)

Parameters

value: double

Double value of this PDFReal

doc: Document &

Document object containing this PDFReal

indirect: bool

flag marking this as an indirect PDFObject

General constructor

Member Function Documentation

get_generation

int get_generation()

Returns:

int

The 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:

int

The 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:

bool

true if this object is indirect, false if it is direct.

Indicates if this object is indirect or direct.

get_type

PDFObjectType get_type()

Returns:

PDFObjectType

The underlying Cos type of this object. Prefer this over dynamic_cast/try_as chains in hot paths.

get_value

double get_value()

Returns:

double

Floating-point value of this object.

operator==

bool operator==(const PDFObject & other)

Parameters

other: const PDFObject &

The other PDFObject to compare against.

Returns:

bool

true if the two objects are equal, false otherwise.

Compare if two objects are equal.

to_string

std::string to_string()

Returns:

std::string

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