|
PoDoFo 1.1.0
|
A string that can be written to a PDF document. More...
#include <PdfString.h>
Public Member Functions | |
| PdfString () | |
| Create an empty string. | |
| PdfString (charbuff &&buff, bool isHex) | |
| template<std::size_t N> | |
| PdfString (const char(&str)[N]) | |
| template<typename T , typename = std::enable_if_t<std::is_same_v<T, const char*>>> | |
| PdfString (T str) | |
| PdfString (const std::string_view &view) | |
| Construct a new PdfString from a utf-8 string The input string will be copied. | |
| PdfString (const std::string &str) | |
| PdfString (std::string &&str) | |
| Construct a new PdfString from a utf-8 string. | |
| PdfString (const PdfString &rhs) | |
| Copy an existing PdfString. | |
| PdfString (PdfString &&rhs) noexcept | |
| bool | IsHex () const |
| Check if this is a hex string. | |
| PdfStringCharset | GetCharset () const |
| A PdfString can be an unevaluated raw buffer, or can be a Ascii, PdfDocEncoding or Unicode string. | |
| bool | IsEmpty () const |
| bool | IsStringEvaluated () const |
| True if the raw data buffer has been evaluated to a string. | |
| std::string_view | GetString () const |
| The contents of the string as UTF-8 string. | |
| std::string_view | GetRawData () const |
| void | Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const |
| PdfString & | operator= (const PdfString &rhs) |
| Copy an existing PdfString. | |
| PdfString & | operator= (PdfString &&rhs) noexcept |
| bool | operator== (const PdfString &rhs) const |
| Comparison operator. | |
| bool | operator== (const char *str) const |
| bool | operator== (const std::string &str) const |
| bool | operator== (const std::string_view &view) const |
| bool | operator!= (const PdfString &rhs) const |
| Comparison operator. | |
| 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 utf8 string view. | |
Public Member Functions inherited from PoDoFo::PdfDataProvider< PdfString > | |
| 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. | |
| void | ToString (std::string &str, PdfWriteFlags flags=PdfWriteFlags::None) const |
Static Public Member Functions | |
| static PdfString | FromRaw (const bufferview &view, bool hex=true) |
| Construct a new PdfString from an utf-8 encoded string. | |
| static PdfString | FromHexData (const std::string_view &hexView, const PdfStatefulEncrypt *encrypt={ }) |
| Set hex-encoded data as the strings data. | |
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.
| PoDoFo::PdfString::PdfString | ( | const std::string_view & | view | ) |
Construct a new PdfString from a utf-8 string The input string will be copied.
| str | the string to copy |
| PdfString::PdfString | ( | std::string && | str | ) |
Construct a new PdfString from a utf-8 string.
| str | the string to move from |
|
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 |
| string_view 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.
Comparison operator.
| rhs | compare to this string object |
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 |