PoDoFo  1.0.0-dev
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
PoDoFo::PdfArray Class Referencefinal

This class represents a PdfArray Use it for all arrays that are written to a PDF file. More...

#include <PdfArray.h>

Inheritance diagram for PoDoFo::PdfArray:
PoDoFo::PdfDataContainer PoDoFo::PdfDataProvider< PdfDataContainer >

Public Types

using size_type = size_t
 
using value_type = PdfObject
 
using reference = value_type &
 
using const_reference = const value_type &
 
using iterator = PdfArrayList::iterator
 
using const_iterator = PdfArrayList::const_iterator
 
using reverse_iterator = PdfArrayList::reverse_iterator
 
using const_reverse_iterator = PdfArrayList::const_reverse_iterator
 

Public Member Functions

 PdfArray ()
 Create an empty array.
 
 PdfArray (const PdfArray &rhs)
 Deep copy an existing PdfArray. More...
 
 PdfArray (PdfArray &&rhs) noexcept
 
PdfArrayoperator= (const PdfArray &rhs)
 assignment operator More...
 
PdfArrayoperator= (PdfArray &&rhs) noexcept
 
unsigned GetSize () const
 
bool IsEmpty () const
 
void Clear ()
 Remove all elements from the array.
 
void Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const override
 Write the complete datatype to a file. More...
 
template<typename T >
GetAtAs (unsigned idx) const
 
template<typename T >
GetAtAsSafe (unsigned idx, const std::common_type_t< T > &defvalue={ }) const
 
template<typename T >
bool TryGetAtAs (unsigned idx, T &value) const
 
const PdfObjectFindAt (unsigned idx) const
 Get the object at the given index out of the array. More...
 
PdfObjectFindAt (unsigned idx)
 
const PdfObjectMustFindAt (unsigned idx) const
 
PdfObjectMustFindAt (unsigned idx)
 
template<typename T >
FindAtAs (unsigned idx, const std::common_type_t< T > &defvalue={ }) const
 
template<typename T >
FindAtAsSafe (unsigned idx, const std::common_type_t< T > &defvalue={ }) const
 
template<typename T >
bool TryFindAtAs (unsigned idx, T &value) const
 
void RemoveAt (unsigned idx)
 
PdfObjectAdd (const PdfObject &obj)
 
PdfObjectAdd (PdfObject &&obj)
 
void AddIndirect (const PdfObject &obj)
 
PdfObjectAddIndirectSafe (const PdfObject &obj)
 
PdfObjectSetAt (unsigned idx, const PdfObject &obj)
 
PdfObjectSetAt (unsigned idx, PdfObject &&obj)
 
void SetAtIndirect (unsigned idx, const PdfObject *obj)
 
PdfObjectSetAtIndirectSafe (unsigned idx, const PdfObject &obj)
 
PdfArrayIndirectIterable GetIndirectIterator ()
 
PdfArrayConstIndirectIterable GetIndirectIterator () const
 
void Resize (unsigned count, const PdfObject &val=PdfObject())
 Resize the internal vector. More...
 
void Reserve (unsigned n)
 
void SwapAt (unsigned atIndex, unsigned toIndex)
 
void MoveTo (unsigned atIndex, unsigned toIndex)
 
size_t size () const
 
PdfObjectoperator[] (size_type idx)
 
const PdfObjectoperator[] (size_type idx) const
 
iterator begin ()
 Returns a read/write iterator that points to the first element in the array. More...
 
const_iterator begin () const
 Returns a read-only (constant) iterator that points to the first element in the array. More...
 
iterator end ()
 Returns a read/write iterator that points one past the last element in the array. More...
 
const_iterator end () const
 Returns a read-only (constant) iterator that points one past the last element in the array. More...
 
reverse_iterator rbegin ()
 Returns a read/write reverse iterator that points to the last element in the array. More...
 
const_reverse_iterator rbegin () const
 Returns a read-only (constant) reverse iterator that points to the last element in the array. More...
 
reverse_iterator rend ()
 Returns a read/write reverse iterator that points to one before the first element in the array. More...
 
const_reverse_iterator rend () const
 Returns a read-only (constant) reverse iterator that points to one before the first element in the array. More...
 
void resize (size_t size)
 
void reserve (size_t size)
 
iterator insert (const iterator &pos, const PdfObject &obj)
 
iterator insert (const iterator &pos, PdfObject &&obj)
 
template<typename InputIterator >
void insert (const iterator &pos, const InputIterator &first, const InputIterator &last)
 
void erase (const iterator &pos)
 
void erase (const iterator &first, const iterator &last)
 
reference front ()
 
const_reference front () const
 
reference back ()
 
const_reference back () const
 
bool operator== (const PdfArray &rhs) const
 
bool operator!= (const PdfArray &rhs) const
 
- Public Member Functions inherited from PoDoFo::PdfDataContainer
const PdfObjectGetOwner () const
 
PdfObjectGetOwner ()
 
- Public Member Functions inherited from PoDoFo::PdfDataProvider< PdfDataContainer >
std::string ToString (PdfWriteFlags flags=PdfWriteFlags::None) const
 Converts the current object into a string representation which can be written directly to a PDF file on disc. More...
 
void ToString (std::string &str, PdfWriteFlags flags=PdfWriteFlags::None) const
 

Protected Member Functions

void resetDirty () override
 
void setChildrenParent () override
 
- Protected Member Functions inherited from PoDoFo::PdfDataContainer
PdfObjectGetIndirectObject (const PdfReference &reference) const
 
PdfDocumentGetObjectDocument ()
 
void SetDirty ()
 
bool IsIndirectReferenceAllowed (const PdfObject &obj)
 
void AssertMutable () const
 

Friends

class PdfObject
 
class PdfTokenizer
 

Detailed Description

This class represents a PdfArray Use it for all arrays that are written to a PDF file.

A PdfArray can hold any PdfVariant.

See also
PdfVariant

Constructor & Destructor Documentation

◆ PdfArray()

PdfArray::PdfArray ( const PdfArray rhs)

Deep copy an existing PdfArray.

Parameters
rhsthe array to copy

Member Function Documentation

◆ back() [1/2]

PdfObject & PdfArray::back ( )
Returns
a read/write reference to the data at the last element of the array.

◆ back() [2/2]

const PdfObject & PdfArray::back ( ) const
Returns
a read-only (constant) reference to the data at the last element of the array.

◆ begin() [1/2]

PdfArray::iterator PdfArray::begin ( )

Returns a read/write iterator that points to the first element in the array.

Iteration is done in ordinary element order.

◆ begin() [2/2]

PdfArray::const_iterator PdfArray::begin ( ) const

Returns a read-only (constant) iterator that points to the first element in the array.

Iteration is done in ordinary element order.

◆ end() [1/2]

PdfArray::iterator PdfArray::end ( )

Returns a read/write iterator that points one past the last element in the array.

Iteration is done in ordinary element order.

◆ end() [2/2]

PdfArray::const_iterator PdfArray::end ( ) const

Returns a read-only (constant) iterator that points one past the last element in the array.

Iteration is done in ordinary element order.

◆ FindAt()

const PdfObject * PdfArray::FindAt ( unsigned  idx) const

Get the object at the given index out of the array.

Lookup in the indirect objects as well, if the shallow object was a reference. The returned value is a pointer to the internal object in the dictionary so it MUST not be deleted.

Parameters
idx
Returns
pointer to the found value. nullptr if the index was out of the boundaries

◆ front() [1/2]

PdfObject & PdfArray::front ( )
Returns
a read/write reference to the data at the first element of the array.

◆ front() [2/2]

const PdfObject & PdfArray::front ( ) const
Returns
a read-only (constant) reference to the data at the first element of the array.

◆ GetSize()

unsigned PdfArray::GetSize ( ) const
Returns
the size of the array

◆ IsEmpty()

bool PdfArray::IsEmpty ( ) const
Returns
true if is empty

◆ operator=()

PdfArray & PdfArray::operator= ( const PdfArray rhs)

assignment operator

Parameters
rhsthe array to assign

◆ rbegin() [1/2]

PdfArray::reverse_iterator PdfArray::rbegin ( )

Returns a read/write reverse iterator that points to the last element in the array.

Iteration is done in reverse element order.

◆ rbegin() [2/2]

PdfArray::const_reverse_iterator PdfArray::rbegin ( ) const

Returns a read-only (constant) reverse iterator that points to the last element in the array.

Iteration is done in reverse element order.

◆ rend() [1/2]

PdfArray::reverse_iterator PdfArray::rend ( )

Returns a read/write reverse iterator that points to one before the first element in the array.

Iteration is done in reverse element order.

◆ rend() [2/2]

PdfArray::const_reverse_iterator PdfArray::rend ( ) const

Returns a read-only (constant) reverse iterator that points to one before the first element in the array.

Iteration is done in reverse element order.

◆ Resize()

void PdfArray::Resize ( unsigned  count,
const PdfObject val = PdfObject() 
)

Resize the internal vector.

Parameters
countnew size
valuereference value

◆ size()

size_t PdfArray::size ( ) const
Returns
the size of the array

◆ Write()

void PdfArray::Write ( OutputStream stream,
PdfWriteFlags  writeMode,
const PdfStatefulEncrypt *  encrypt,
charbuff buffer 
) const
overridevirtual

Write the complete datatype to a file.

Parameters
devicewrite the object to this device
writeModeadditional options for writing this object
encryptan encryption object which is used to encrypt this object or nullptr to not encrypt this object

Implements PoDoFo::PdfDataContainer.


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