PoDoFo  0.9.1
Public Member Functions | Protected Member Functions
PoDoFo::PdfEncoding Class Reference

#include <PdfEncoding.h>

Inheritance diagram for PoDoFo::PdfEncoding:
PoDoFo::PdfDifferenceEncoding PoDoFo::PdfIdentityEncoding PoDoFo::PdfSimpleEncoding PoDoFo::PdfDocEncoding PoDoFo::PdfMacRomanEncoding PoDoFo::PdfStandardEncoding PoDoFo::PdfSymbolEncoding PoDoFo::PdfWinAnsiEncoding PoDoFo::PdfZapfDingbatsEncoding

List of all members.

Public Member Functions

bool operator== (const PdfEncoding &rhs) const
bool operator< (const PdfEncoding &rhs) const
virtual void AddToDictionary (PdfDictionary &rDictionary) const =0
virtual PdfString ConvertToUnicode (const PdfString &rEncodedString, const PdfFont *pFont) const =0
virtual PdfRefCountedBuffer ConvertToEncoding (const PdfString &rString, const PdfFont *pFont) const =0
virtual bool IsAutoDelete () const =0
virtual bool IsSingleByteEncoding () const =0
int GetFirstChar () const
int GetLastChar () const
const_iterator begin () const
const_iterator end () const
virtual pdf_utf16be GetCharCode (int nIndex) const =0

Protected Member Functions

 PdfEncoding (int nFirstChar, int nLastChar)
virtual const PdfNameGetID () const =0

Detailed Description

A PdfEncoding is in PdfFont to transform a text string into a representation so that it can be displayed in a PDF file.

PdfEncoding can also be used to convert strings from a PDF file back into a PdfString.


Constructor & Destructor Documentation

PoDoFo::PdfEncoding::PdfEncoding ( int  nFirstChar,
int  nLastChar 
) [protected]

Create a new PdfEncoding.

Parameters:
nFirstCharthe first supported character code (either a byte value in the current encoding or a unicode value)
nLastCharthe last supported character code, must be larger than nFirstChar
  • * (either a byte value in the current encoding or a unicode value)

Member Function Documentation

virtual void PoDoFo::PdfEncoding::AddToDictionary ( PdfDictionary &  rDictionary) const [pure virtual]

Add this encoding object to a dictionary usually be adding an /Encoding key in font dictionaries.

Parameters:
rDictionaryadd the encoding to this dictionary

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

PdfEncoding::const_iterator PoDoFo::PdfEncoding::begin ( ) const [inline]

Iterate over all unicode character points in this encoding, beginning with the first.

Returns:
iterator pointing to the first defined unicode character
virtual PdfRefCountedBuffer PoDoFo::PdfEncoding::ConvertToEncoding ( const PdfString rString,
const PdfFont pFont 
) const [pure virtual]

Convert a unicode PdfString to a string encoded with this encoding.

Parameters:
rStringan unicode PdfString.
pFontthe font for which this string is converted
Returns:
an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is treated as a series of bytes and is allowed to have 0 bytes. The returned buffer must not be a unicode string.

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

virtual PdfString PoDoFo::PdfEncoding::ConvertToUnicode ( const PdfString rEncodedString,
const PdfFont pFont 
) const [pure virtual]

Convert a string that is encoded with this encoding to an unicode PdfString.

Parameters:
rEncodedStringa string encoded by this encoding. Usually this string was read from a content stream.
pFontthe font for which this string is converted
Returns:
an unicode PdfString.

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

PdfEncoding::const_iterator PoDoFo::PdfEncoding::end ( ) const [inline]

Iterate over all unicode character points in this encoding, beginning with the first.

Returns:
iterator pointing at the end
virtual pdf_utf16be PoDoFo::PdfEncoding::GetCharCode ( int  nIndex) const [pure virtual]

Get the unicode character code for this encoding at the position nIndex. nIndex is a position between GetFirstChar() and GetLastChar()

Parameters:
nIndexcharacter code at position index
Returns:
unicode character code
See also:
GetFirstChar
GetLastChar

Will throw an exception if nIndex is out of range.

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

int PoDoFo::PdfEncoding::GetFirstChar ( ) const [inline]
Returns:
the first character code that is defined for this encoding
virtual const PdfName& PoDoFo::PdfEncoding::GetID ( ) const [protected, pure virtual]

Get a unique ID for this encoding which can used for comparisons!

Returns:
a unique id for this encoding!

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

int PoDoFo::PdfEncoding::GetLastChar ( ) const [inline]
Returns:
the last character code that is defined for this encoding
virtual bool PoDoFo::PdfEncoding::IsAutoDelete ( ) const [pure virtual]
Returns:
true if this encoding should be deleted automatically with the font.

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

virtual bool PoDoFo::PdfEncoding::IsSingleByteEncoding ( ) const [pure virtual]
Returns:
true if this is a single byte encoding with a maximum of 256 values.

Implemented in PoDoFo::PdfSimpleEncoding, PoDoFo::PdfDifferenceEncoding, and PoDoFo::PdfIdentityEncoding.

bool PoDoFo::PdfEncoding::operator< ( const PdfEncoding rhs) const [inline]

Comparison operator.

Parameters:
rhsthe PdfEncoding to which this encoding should be compared
Returns:
true if this encoding is less than the specified.
bool PoDoFo::PdfEncoding::operator== ( const PdfEncoding rhs) const [inline]

Comparison operator.

Parameters:
rhsthe PdfEncoding to which this encoding should be compared
Returns:
true if both encodings are the same.