Loading...
Searching...
No Matches
pdftron::Layout::ElementRef< T > Class Template Reference

#include <ContentTree.h>

Public Member Functions

 ElementRef ()
T & GetElement ()
bool IsValid ()
 operator void * ()
T * operator-> ()
T & operator* ()

Friends

class ContentElement

Detailed Description

template<typename T>
class pdftron::Layout::ElementRef< T >

An ElementRef is a reference to a specific type of Layout::ContentElement, for example, Layout::TextRun. An instance of ElementRef is largely equivalent to an instance of tElement in terms of capability, the only difference being that the ElementRef can be invalid. As such, ElementRefs are used in cases where a method can return a ContentElement, but may also return an empty result, like ContentElement::AsTextRun.

Definition at line 39 of file ContentTree.h.

Constructor & Destructor Documentation

◆ ElementRef()

template<typename T>
pdftron::Layout::ElementRef< T >::ElementRef ( )

Create an invalid ElementRef object.

Member Function Documentation

◆ GetElement()

template<typename T>
T & pdftron::Layout::ElementRef< T >::GetElement ( )

Retrieves the underlying object of type T.

Returns
The underlying object of type T.
Note
Throws an exception if the ElementRef is invalid or if the underlying object is not of type T.

◆ IsValid()

template<typename T>
bool pdftron::Layout::ElementRef< T >::IsValid ( )

Checks if the reference can be dereferenced, i.e., points to an actual object.

Returns
True if the ElementRef points to an actual object, false otherwise.

◆ operator void *()

template<typename T>
pdftron::Layout::ElementRef< T >::operator void * ( )

Implements the Safe Bool Idiom so the reference can be checked for validity.

◆ operator*()

template<typename T>
T & pdftron::Layout::ElementRef< T >::operator* ( )

Dereference operator to get the underlying object of type T.

Returns
Reference to the underlying object of type T.
Note
Throws an exception if the ElementRef is invalid.

◆ operator->()

template<typename T>
T * pdftron::Layout::ElementRef< T >::operator-> ( )

Overloaded arrow operator to access the members of the object of type T.

Returns
Pointer to the underlying object of type T.
Note
Throws an exception if the ElementRef is invalid.

◆ ContentElement

template<typename T>
friend class ContentElement
friend

Definition at line 41 of file ContentTree.h.


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