Character encoding conversion. More...
#include "debugging/debugging.h"
#include <algorithm>
#include <glib/gunicode.h>
#include <glib/gconvert.h>
#include "character.h"
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< CharacterSet > | GlobalCharacterSet |
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. | |
CharacterSet & | globalCharacterSet () |
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) |
ExtendedASCIICharacterSet & | globalExtendedASCIICharacterSet () |
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. |
Character encoding conversion.
Definition in file convert.h.
typedef LazyStatic<CharacterSet> GlobalCharacterSet |
typedef LazyStatic<ExtendedASCIICharacterSet> GlobalExtendedASCIICharacterSet |
char extended_ascii_for_index | ( | std::size_t | i | ) | [inline] |
Definition at line 139 of file convert.h.
Referenced by ExtendedASCIICharacterSet::ExtendedASCIICharacterSet(), and ExtendedASCIICharacterSet::print().
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] |
Returns the global instance of CharacterSet.
Definition at line 109 of file convert.h.
Referenced by ExtendedASCIICharacterSet::decode(), ExtendedASCIICharacterSet::encode(), ExtendedASCIICharacterSet::ExtendedASCIICharacterSet(), ostream_write(), and ExtendedASCIICharacterSet::print().
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.
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.
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.
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().