Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

PoDoFo::PdfString Class Reference

#include <PdfString.h>

Inheritance diagram for PoDoFo::PdfString:
Inheritance graph
[legend]
Collaboration diagram for PoDoFo::PdfString:
Collaboration graph
[legend]

List of all members.

Public Member Functions

pdf_long GetCharacterLength () const
bool GetImmutable () const
pdf_long GetLength () const
const char * GetString () const
const std::string & GetStringUtf8 () const
const pdf_utf16be * GetUnicode () const
pdf_long GetUnicodeLength () const
virtual bool IsDirty () const
bool IsHex () const
bool IsUnicode () const
bool IsValid () const
bool operator!= (const PdfString &rhs) const
bool operator< (const PdfString &rhs) const
const PdfStringoperator= (const PdfString &rhs)
bool operator== (const PdfString &rhs) const
bool operator> (const PdfString &rhs) const
 PdfString (const pdf_utf8 *pszStringUtf8, pdf_long lLen)
 PdfString (const std::string &sString, const PdfEncoding *const pEncoding=NULL)
 PdfString ()
 PdfString (const wchar_t *pszString)
 PdfString (const pdf_utf16be *pszStringUtf16)
 PdfString (const char *pszString, const PdfEncoding *const pEncoding=NULL)
 PdfString (const PdfString &rhs)
 PdfString (const pdf_utf16be *pszStringUtf16, pdf_long lLen)
 PdfString (const char *pszString, pdf_long lLen, bool bHex=false, const PdfEncoding *const pEncoding=NULL)
 PdfString (const pdf_utf8 *pszStringUtf8)
virtual void SetDirty (bool bDirty)
void SetHexData (const char *pszHex, pdf_long lLen=-1, PdfEncrypt *pEncrypt=NULL)
void SetImmutable (bool bImmutable)
PdfString ToUnicode () const
void Write (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt *pEncrypt=NULL) const

Static Public Member Functions

static pdf_long ConvertUTF16toUTF8 (const pdf_utf16be *pszUtf16, pdf_utf8 *pszUtf8, pdf_long lLenUtf8)
static pdf_long ConvertUTF16toUTF8 (const pdf_utf16be *pszUtf16, pdf_long lLenUtf16, pdf_utf8 *pszUtf8, pdf_long lLenUtf8, EPdfStringConversion eConversion=ePdfStringConversion_Strict)
static pdf_long ConvertUTF8toUTF16 (const pdf_utf8 *pszUtf8, pdf_utf16be *pszUtf16, pdf_long lLenUtf16)
static pdf_long ConvertUTF8toUTF16 (const pdf_utf8 *pszUtf8, pdf_long lLenUtf8, pdf_utf16be *pszUtf16, pdf_long lLenUtf16, EPdfStringConversion eConversion=ePdfStringConversion_Strict)

Static Public Attributes

static const PdfString StringNull = PdfString()

Protected Member Functions

void AssertMutable () const

Private Member Functions

void Allocate ()
void FreeBuffer ()
void Init (const char *pszString, pdf_long lLen)
void InitFromUtf8 (const pdf_utf8 *pszStringUtf8, pdf_long lLen)
void InitUtf8 ()

Static Private Member Functions

static void SwapBytes (char *pBuf, pdf_long lLen)

Private Attributes

bool m_bHex
 This string is converted to hex during write out.
PdfRefCountedBuffer m_buffer
 String data (always binary), may contain 0 bytes.
bool m_bUnicode
 This string contains unicode data.
const PdfEncodingm_pEncoding
 Encoding for non Unicode strings. NULL for unicode strings.
std::string m_sUtf8
 The UTF8 version of the strings contents.

Static Private Attributes

static const char *const m_escMap = PdfStringNameSpace::genStrEscMap()
 Mapping of escape sequences to there value.
static const pdf_utf16be s_cPdfDocEncoding [256]
 conversion table from PDFDocEncoding to UTF16
static const char s_pszUnicodeMarker [] = { static_cast<char>(0xFE), static_cast<char>(0xFF) }
 The unicode marker used to indicate unicode strings in PDF.
static const char * s_pszUnicodeMarkerHex = "FEFF"
 The unicode marker converted to HEX.

Detailed Description

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.

PdfStrings representing text are either in PDFDocEncoding (ISO Latin1) encoded or UTF-16BE encoded.

PoDoFo contains methods to convert between these encodings. For convinience conversion to UTF-8 is possible to. Please not that strings are always stored as UTF-16BE or ISO Latin1 (PdfDocEncoding) in the PDF file.

UTF-16BE strings have to start with the byts 0xFE 0xFF to be recognized by PoDoFo as unicode strings.

PdfStrings is an implicitly shared class. As a reason it is very fast to copy PdfString objects.

The internal string buffer is guaranteed to be always terminated by 2 zeros.

Definition at line 65 of file PdfString.h.


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

Generated by  Doxygen 1.6.0   Back to index