PoDoFo  1.0.0-dev
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
PoDoFo::PdfName Class Referencefinal

This class represents a PdfName. More...

#include <PdfName.h>

Inheritance diagram for PoDoFo::PdfName:
PoDoFo::PdfDataMember PoDoFo::PdfDataProvider< PdfName >

Public Member Functions

 PdfName ()
 Constructor to create null name (corresponds to "/") use PdfName::Null instead of this constructor.
 
template<std::size_t N>
 PdfName (const char(&str)[N])
 
template<typename T , typename = std::enable_if_t<std::is_same_v<T, const char*>>>
 PdfName (T str)
 
 PdfName (const std::string_view &str)
 Create a new PdfName object. More...
 
 PdfName (const std::string &str)
 
 PdfName (charbuff &&buff)
 
 PdfName (const PdfName &rhs)
 Create a copy of an existing PdfName object. More...
 
 PdfName (PdfName &&rhs) noexcept
 
std::string GetEscapedName () const
 
void Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const
 
std::string_view GetString () const
 
bool IsNull () const
 
std::string_view GetRawData () const
 
PdfNameoperator= (const PdfName &rhs)
 Assign another name to this object. More...
 
PdfNameoperator= (PdfName &&rhs) noexcept
 
bool operator== (const PdfName &rhs) const
 compare to PdfName objects. More...
 
bool operator== (const char *str) const
 
bool operator== (const std::string &str) const
 
bool operator== (const std::string_view &view) const
 
bool operator!= (const PdfName &rhs) const
 compare two PdfName objects. More...
 
bool operator!= (const char *str) const
 
bool operator!= (const std::string &str) const
 
bool operator!= (const std::string_view &view) const
 
 operator std::string_view () const
 Default cast to raw data string view. More...
 
- Public Member Functions inherited from PoDoFo::PdfDataProvider< PdfName >
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
 

Static Public Member Functions

static PdfName FromRaw (const bufferview &rawcontent)
 
static PdfName FromEscaped (const std::string_view &name)
 Create a new PdfName object from a string containing an escaped name string without the leading / . More...
 

Static Public Attributes

static const PdfName Null = PdfName()
 Null name, corresponds to "/".
 

Friends

PdfName PODOFO_API operator""_n (const char *, size_t)
 Create a PdfName from a string literal without checking for PdfDocEncoding characters. More...
 

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/2]

PoDoFo::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.
Remarks
the input string will be checked for all characters to be inside PdfDocEncoding character set

◆ PdfName() [2/2]

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()

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

◆ GetString()

string_view 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 std::string_view()

PoDoFo::PdfName::operator std::string_view ( ) const

Default cast to raw data string view.

It's used in PdfDictionary lookup

◆ operator!=()

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

compare two PdfName objects.

Returns
true if both PdfNames have different values.

◆ operator=()

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.

Friends And Related Function Documentation

◆ operator""_n

PdfName PODOFO_API operator""_n ( const char *  name,
size_t  length 
)
friend

Create a PdfName from a string literal without checking for PdfDocEncoding characters.

Remarks
Use with caution: only string literals should be used, not fixed size char arrays. Only ASCII charset is supported

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