pdfmm 0.9.20
Public Member Functions | Static Public Member Functions | List of all members
mm::PdfName Class Referencefinal

#include <PdfName.h>

Inheritance diagram for mm::PdfName:
mm::PdfDataProvider

Public Member Functions

 PdfName ()
 
 PdfName (const std::string_view &str)
 
 PdfName (const PdfName &rhs)
 
std::string GetEscapedName () const
 
void Write (PdfOutputDevice &device, PdfWriteMode writeMode, const PdfEncrypt *encrypt) const override
 
const std::string & GetString () const
 
bool IsNull () const
 
const std::string & GetRawData () const
 
const PdfNameoperator= (const PdfName &rhs)
 
bool operator== (const PdfName &rhs) const
 
bool operator!= (const PdfName &rhs) const
 
bool operator< (const PdfName &rhs) const
 
virtual void Write (PdfOutputDevice &device, PdfWriteMode writeMode, const PdfEncrypt *encrypt) const =0
 

Static Public Member Functions

static PdfName FromEscaped (const std::string_view &name)
 

Additional Inherited Members

- Protected Member Functions inherited from mm::PdfDataProvider
 PdfDataProvider ()
 

Detailed Description

This class represents a PdfName. Whenever a key is required you have to use a PdfName object.

PdfName are required as keys in PdfObject and PdfVariant objects.

PdfName may have a maximum length of 127 characters.

See also
PdfObject
PdfVariant

Constructor & Destructor Documentation

◆ PdfName() [1/3]

PdfName::PdfName ( )

Constructor to create nullptr strings. use PdfName::KeyNull instead of this constructor

◆ PdfName() [2/3]

mm::PdfName::PdfName ( const std::string_view &  str)

Create a new PdfName object.

Parameters
strthe unescaped value of this name. Please specify the name without the leading '/'. Has to be a zero terminated string.

◆ PdfName() [3/3]

PdfName::PdfName ( const PdfName rhs)

Create a copy of an existing PdfName object.

Parameters
rhsanother PdfName object

Member Function Documentation

◆ FromEscaped()

PdfName PdfName::FromEscaped ( const std::string_view &  name)
static

Create a new PdfName object from a string containing an escaped name string without the leading / .

Parameters
nameA string containing the escaped name
Returns
A new PdfName

◆ GetEscapedName()

string PdfName::GetEscapedName ( ) const
Returns
an escaped representation of this name without the leading / .

There is no corresponding GetEscapedLength(), since generating the return value is somewhat expensive.

◆ GetRawData()

const string & PdfName::GetRawData ( ) const
Returns
the raw data of this name object

◆ GetString()

const string & PdfName::GetString ( ) const
Returns
the unescaped value of this name object without the leading slash

◆ IsNull()

bool PdfName::IsNull ( ) const
Returns
true if the name is empty

◆ operator!=()

bool PdfName::operator!= ( const PdfName rhs) const

compare two PdfName objects.

Returns
true if both PdfNames have different values.

◆ operator<()

bool PdfName::operator< ( const PdfName rhs) const

compare two PdfName objects. Used for sorting in lists

Returns
true if this object is smaller than rhs

◆ operator=()

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

Assign another name to this object

Parameters
rhsanother PdfName object

◆ operator==()

bool PdfName::operator== ( const PdfName rhs) const

compare to PdfName objects.

Returns
true if both PdfNames have the same value.

◆ Write()

void PdfName::Write ( PdfOutputDevice device,
PdfWriteMode  writeMode,
const PdfEncrypt encrypt 
) 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 mm::PdfDataProvider.