textwolf  0.2
Public Types | Public Member Functions | Static Public Member Functions | List of all members
textwolf::charset::Interface Class Reference

This interface has to be implemented for a character set encoding. More...

#include <charset_interface.hpp>

Public Types

enum  { MaxChar =0xFF }
 Maximum character this characer set encoding can represent. More...
 

Public Member Functions

template<class Iterator >
UChar value (char *buf, unsigned int &bufpos, Iterator &itr) const
 Fetches the unicode character representation of the current character. More...
 
template<class Buffer_ >
void print (UChar chr, Buffer_ &buf) const
 Prints a unicode character to a buffer. More...
 

Static Public Member Functions

template<class Iterator >
static void skip (char *buf, unsigned int &bufpos, Iterator &itr)
 Skip to start of the next character. More...
 
template<class Iterator >
static signed char asciichar (char *buf, unsigned int &bufpos, Iterator &itr)
 Fetches the ascii char representation of the current character. More...
 
template<class Iterator >
static void fetchbytes (char *buf, unsigned int &bufpos, Iterator &itr)
 Fetches the bytes of the current character into a buffer. More...
 
static bool is_equal (const Interface &, const Interface &)
 Evaluate if two character set encodings of the same type are equal in all properties (code page, etc.) More...
 

Detailed Description

This interface has to be implemented for a character set encoding.

Member Enumeration Documentation

anonymous enum

Maximum character this characer set encoding can represent.

Enumerator
MaxChar 

Member Function Documentation

template<class Iterator >
static signed char textwolf::charset::Interface::asciichar ( char *  buf,
unsigned int &  bufpos,
Iterator &  itr 
)
static

Fetches the ascii char representation of the current character.

Template Parameters
Iteratorsource iterator used
Remarks
'bufpos' is used as state of the iterator 'itr' passed. Therefore it is strictly forbidden to use the class by two clients simultaneously wihtout sharing the buffer 'buf' and the state 'bufpos'.
Parameters
[in]bufbuffer for the parses character data
[in,out]bufposposition in 'buf'
[in,out]itriterator on the source
Returns
the value of the ascii character or -1
template<class Iterator >
static void textwolf::charset::Interface::fetchbytes ( char *  buf,
unsigned int &  bufpos,
Iterator &  itr 
)
static

Fetches the bytes of the current character into a buffer.

Template Parameters
Iteratorsource iterator used
Remarks
'bufpos' is used as state of the iterator 'itr' passed. Therefore it is strictly forbidden to use the class by two clients simultaneously wihtout sharing the buffer 'buf' and the state 'bufpos'.
Parameters
[in]bufbuffer for the parses character data
[in,out]bufposposition in 'buf'
[in,out]itriterator on the source
static bool textwolf::charset::Interface::is_equal ( const Interface ,
const Interface  
)
inlinestatic

Evaluate if two character set encodings of the same type are equal in all properties (code page, etc.)

Returns
true if yes
template<class Buffer_ >
void textwolf::charset::Interface::print ( UChar  chr,
Buffer_ &  buf 
) const

Prints a unicode character to a buffer.

Template Parameters
Buffer_STL back insertion sequence
Parameters
[in]chrcharacter to print
[out]bufbuffer to print to
template<class Iterator >
static void textwolf::charset::Interface::skip ( char *  buf,
unsigned int &  bufpos,
Iterator &  itr 
)
static

Skip to start of the next character.

Template Parameters
Iteratorsource iterator used
Remarks
'bufpos' is used as state of the iterator 'itr' passed. Therefore it is strictly forbidden to use the class by two clients simultaneously wihtout sharing the buffer 'buf' and the state 'bufpos'.
Parameters
[in]bufbuffer for the character data
[in,out]bufposposition in 'buf'
[in,out]itriterator to skip
template<class Iterator >
UChar textwolf::charset::Interface::value ( char *  buf,
unsigned int &  bufpos,
Iterator &  itr 
) const

Fetches the unicode character representation of the current character.

Template Parameters
Iteratorsource iterator used
Remarks
'bufpos' is used as state of the iterator 'itr' passed. Therefore it is strictly forbidden to use the class by two clients simultaneously wihtout sharing the buffer 'buf' and the state 'bufpos'.
Parameters
[in]bufbuffer for the parses character data
[in,out]bufposposition in 'buf'
[in,out]itriterator on the source
Returns
the value of the unicode character

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