convert.h File Reference

Character encoding conversion. More...

#include "debugging/debugging.h"
#include <algorithm>
#include <glib/gunicode.h>
#include <glib/gconvert.h>
#include "character.h"
Include dependency graph for convert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  UTF8Character
class  CharacterSet
 The character-set encoding for the current C locale. More...
class  UTF8CharacterToExtendedASCII
class  ExtendedASCIICharacterSet
 The active extended-ascii character set encoding. Performs UTF-8 encoding and decoding of extended-ascii characters. More...
class  ConvertUTF8ToLocale
class  ConvertLocaleToUTF8

Defines

#define INCLUDED_CONVERT_H

Typedefs

typedef LazyStatic< CharacterSetGlobalCharacterSet
typedef LazyStatic
< ExtendedASCIICharacterSet
GlobalExtendedASCIICharacterSet

Functions

std::size_t utf8_character_length (const char *character)
 Returns the number of bytes required to represent character in UTF-8 encoding.
bool operator< (const UTF8Character &self, const UTF8Character &other)
template<typename TextOutputStreamType >
TextOutputStreamType & ostream_write (TextOutputStreamType &ostream, const UTF8Character &c)
 Writes c to ostream in Hex form. Useful for debugging.
CharacterSetglobalCharacterSet ()
 Returns the global instance of CharacterSet.
bool operator< (const UTF8CharacterToExtendedASCII &self, const UTF8CharacterToExtendedASCII &other)
std::size_t extended_ascii_to_index (char c)
char extended_ascii_for_index (std::size_t i)
ExtendedASCIICharacterSetglobalExtendedASCIICharacterSet ()
 Returns the global instance of ExtendedASCIICharacterSet.
template<typename TextOutputStreamType >
TextOutputStreamType & ostream_write (TextOutputStreamType &ostream, const ConvertUTF8ToLocale &convert)
 Writes convert to ostream after encoding each character to extended-ascii from UTF-8.
template<typename TextOutputStreamType >
TextOutputStreamType & ostream_write (TextOutputStreamType &ostream, const ConvertLocaleToUTF8 &convert)
 Writes convert to ostream after decoding each character from extended-ascii to UTF-8.

Detailed Description

Character encoding conversion.

Definition in file convert.h.


Define Documentation

#define INCLUDED_CONVERT_H

Definition at line 23 of file convert.h.


Typedef Documentation

typedef LazyStatic<CharacterSet> GlobalCharacterSet

Definition at line 106 of file convert.h.

Definition at line 208 of file convert.h.


Function Documentation

char extended_ascii_for_index ( std::size_t  i  )  [inline]
std::size_t extended_ascii_to_index ( char  c  )  [inline]

Definition at line 134 of file convert.h.

Referenced by ExtendedASCIICharacterSet::decode().

CharacterSet& globalCharacterSet (  )  [inline]
ExtendedASCIICharacterSet& globalExtendedASCIICharacterSet (  )  [inline]

Returns the global instance of ExtendedASCIICharacterSet.

Definition at line 211 of file convert.h.

Referenced by ostream_write().

bool operator< ( const UTF8CharacterToExtendedASCII self,
const UTF8CharacterToExtendedASCII other 
) [inline]

Definition at line 129 of file convert.h.

References UTF8CharacterToExtendedASCII::m_utf8.

bool operator< ( const UTF8Character self,
const UTF8Character other 
) [inline]

Definition at line 67 of file convert.h.

References UTF8Character::buffer, and UTF8Character::length.

template<typename TextOutputStreamType >
TextOutputStreamType& ostream_write ( TextOutputStreamType &  ostream,
const ConvertLocaleToUTF8 convert 
) [inline]

Writes convert to ostream after decoding each character from extended-ascii to UTF-8.

Definition at line 266 of file convert.h.

References UTF8Character::buffer, char_is_ascii(), ArrayRange< Element >::first, globalCharacterSet(), globalExtendedASCIICharacterSet(), ArrayRange< Element >::last, UTF8Character::length, and ConvertLocaleToUTF8::m_range.

template<typename TextOutputStreamType >
TextOutputStreamType& ostream_write ( TextOutputStreamType &  ostream,
const ConvertUTF8ToLocale convert 
) [inline]

Writes convert to ostream after encoding each character to extended-ascii from UTF-8.

Definition at line 232 of file convert.h.

References char_is_ascii(), ExtendedASCIICharacterSet::encode(), ArrayRange< Element >::first, globalCharacterSet(), globalExtendedASCIICharacterSet(), ArrayRange< Element >::last, UTF8Character::length, and ConvertUTF8ToLocale::m_range.

template<typename TextOutputStreamType >
TextOutputStreamType& ostream_write ( TextOutputStreamType &  ostream,
const UTF8Character c 
) [inline]

Writes c to ostream in Hex form. Useful for debugging.

Definition at line 75 of file convert.h.

References UTF8Character::buffer, and UTF8Character::length.

Referenced by operator<<(), and ostream_write().

std::size_t utf8_character_length ( const char *  character  )  [inline]

Returns the number of bytes required to represent character in UTF-8 encoding.

Definition at line 36 of file convert.h.


Generated by  doxygen 1.6.2