PoDoFo 0.9.20
|
#include <PdfString.h>
Public Member Functions | |
PdfString () | |
PdfString (const std::string_view &view) | |
PdfString (const PdfString &rhs) | |
bool | IsHex () const |
PdfStringState | GetState () const |
const std::string & | GetString () const |
void | Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt &encrypt, charbuff &buffer) const override |
const PdfString & | operator= (const PdfString &rhs) |
bool | operator== (const PdfString &rhs) const |
bool | operator!= (const PdfString &rhs) const |
operator std::string_view () const | |
![]() | |
std::string | ToString () const |
Static Public Member Functions | |
static PdfString | FromRaw (const bufferview &view, bool hex=true) |
static PdfString | FromHexData (const std::string_view &hexView, const PdfStatefulEncrypt &encrypt={ }) |
Additional Inherited Members | |
![]() | |
PdfDataProvider () | |
A string that can be written to a PDF document. If it contains binary data it is automatically converted into a hex string, otherwise a normal PDF string is written to the document.
PdfString is an implicitly shared class. As a reason it is very fast to copy PdfString objects.
PdfString::PdfString | ( | ) |
Create an empty string
PoDoFo::PdfString::PdfString | ( | const std::string_view & | view | ) |
Construct a new PdfString from a utf-8 string The input string will be copied.
view | the string to copy |
PdfString::PdfString | ( | const PdfString & | rhs | ) |
|
static |
Set hex-encoded data as the strings data.
hexView | must be hex-encoded data. |
len | length of the hex-encoded data. |
encrypt | if !nullptr, assume the hex data is encrypted and should be decrypted after hex-decoding. |
|
static |
Construct a new PdfString from an utf-8 encoded string.
view | a buffer |
hex | true if the string should be written as hex string |
PdfStringState PdfString::GetState | ( | ) | const |
A PdfString can be an unevaluated raw buffer, or can be a Ascii, PdfDocEncoding or Unicode string
const string & PdfString::GetString | ( | ) | const |
The contents of the string as UTF-8 string.
The string's contents are always returned as UTF-8 by this function. Works for Unicode strings and for non-Unicode strings.
This is the preferred way to access the string's contents.
|
inline |
Check if this is a hex string.
If true the data will be hex-encoded when the string is written to a PDF file.
PoDoFo::PdfString::operator std::string_view | ( | ) | const |
Default cast to utf8 string view
bool PdfString::operator!= | ( | const PdfString & | rhs | ) | const |
Comparison operator
rhs | compare to this string object |
bool PdfString::operator== | ( | const PdfString & | rhs | ) | const |
Comparison operator
UTF-8 and strings of the same data compare equal. Whether the string will be written out as hex is not considered - only the real "text" is tested for equality.
rhs | compare to this string object |
|
overridevirtual |
Write the complete datatype to a file.
device | write the object to this device |
writeMode | additional options for writing this object |
encrypt | an encryption object which is used to encrypt this object or nullptr to not encrypt this object |
Implements PoDoFo::PdfDataProvider.