|
pdfmm 0.9.20
|
#include <PdfString.h>
Public Member Functions | |
| PdfString () | |
| PdfString (const std::string_view &view) | |
| PdfString (const PdfString &rhs) | |
| bool | IsHex () const |
| bool | IsUnicode () const |
| const std::string & | GetString () const |
| void | Write (PdfOutputDevice &device, PdfWriteMode writeMode, const PdfEncrypt *encrypt) const |
| const PdfString & | operator= (const PdfString &rhs) |
| bool | operator== (const PdfString &rhs) const |
| bool | operator!= (const PdfString &rhs) const |
| virtual void | Write (PdfOutputDevice &device, PdfWriteMode writeMode, const PdfEncrypt *encrypt) const =0 |
Static Public Member Functions | |
| static PdfString | FromRaw (const std::string_view &view, bool hex=true) |
| static PdfString | FromHexData (const std::string_view &hexView, PdfEncrypt *encrypt=nullptr) |
Additional Inherited Members | |
Protected Member Functions inherited from mm::PdfDataProvider | |
| 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
| mm::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 |
| 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.
| bool PdfString::IsUnicode | ( | ) | const |
PdfStrings are either PdfDocEncoded, or Unicode encoded (UTF-16BE or UTF-8) strings.
This function returns true if this is an Unicode string object.
| 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 |
|
virtual |
Write this PdfString in PDF format to a PdfOutputDevice.
| device | the output 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 mm::PdfDataProvider.