11 #ifndef __TEXTWOLF_CHARSET_UCS_HPP__
12 #define __TEXTWOLF_CHARSET_UCS_HPP__
27 template <
int byteorder=ByteOrder::BE>
40 template <
class Iterator>
41 static inline void skip(
char*,
unsigned int& bufpos, Iterator& itr)
43 for (;bufpos < 2; ++bufpos)
50 template <
class Iterator>
51 static inline void fetchbytes(
char* buf,
unsigned int& bufpos, Iterator& itr)
67 template <
class Iterator>
72 return (res << 8) + (
unsigned char)buf[
LSB];
76 template <
class Iterator>
77 inline UChar value(
char* buf,
unsigned int& bufpos, Iterator& itr)
const
83 template <
class Iterator>
84 static inline signed char asciichar(
char* buf,
unsigned int& bufpos, Iterator& itr)
87 return (ch > 127)?-1:(char)ch;
91 template <
class Buffer_>
108 buf.push_back( (
unsigned char)(chr >>
Print1shift));
109 buf.push_back( (
unsigned char)(chr >>
Print2shift));
123 template <
int byteorder>
140 template <
class Iterator>
141 static inline void fetchbytes(
char* buf,
unsigned int& bufpos, Iterator& itr)
143 for (;bufpos < 4; ++bufpos)
151 template <
class Iterator>
152 static inline UChar value(
char* buf,
unsigned int& bufpos, Iterator& itr)
155 UChar res = (
unsigned char)buf[
B3];
156 res = (res << 8) + (
unsigned char)buf[
B2];
157 res = (res << 8) + (
unsigned char)buf[
B1];
158 return (res << 8) + (
unsigned char)buf[
B0];
162 template <
class Iterator>
163 static inline void skip(
char*,
unsigned int& bufpos, Iterator& itr)
165 for (;bufpos < 4; ++bufpos)
172 template <
class Iterator>
173 static inline signed char asciichar(
char* buf,
unsigned int& bufpos, Iterator& itr)
176 return (ch > 127)?-1:(char)ch;
180 template <
class Buffer_>
183 buf.push_back( (
unsigned char)((chr >>
Print1shift) & 0xFF));
184 buf.push_back( (
unsigned char)((chr >>
Print2shift) & 0xFF));
185 buf.push_back( (
unsigned char)((chr >>
Print3shift) & 0xFF));
186 buf.push_back( (
unsigned char)((chr >>
Print4shift) & 0xFF));
Definition: charset_ucs.hpp:32
static void skip(char *, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::skip(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:163
Definition: charset_ucs.hpp:136
Character set UCS-2 (little/big endian)
Definition: charset_ucs.hpp:28
UCS-4 big endian character set encoding.
Definition: charset_ucs.hpp:207
Definition: charset_ucs.hpp:34
UCS-2 big endian character set encoding.
Definition: charset_ucs.hpp:201
static bool is_equal(const UCS2 &, const UCS2 &)
See template<class Buffer>Interface::is_equal( const Interface&, const Interface&) ...
Definition: charset_ucs.hpp:114
static bool is_equal(const UCS4 &, const UCS4 &)
See template<class Buffer>Interface::is_equal( const Interface&, const Interface&) ...
Definition: charset_ucs.hpp:190
Definition: charset_ucs.hpp:130
static bool encode(UChar chr, char *bufptr, std::size_t bufsize)
Write the character 'chr' in encoded form as nul-terminated string to a buffer.
Definition: charset_interface.hpp:29
Definition: charset_interface.hpp:119
Definition: charset_ucs.hpp:135
Definition: charset_ucs.hpp:128
UCS-4 little endian character set encoding.
Definition: charset_ucs.hpp:204
static void fetchbytes(char *buf, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::fetchbytes(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:51
UCS-2 little endian character set encoding.
Definition: charset_ucs.hpp:198
static UChar value(char *buf, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::value(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:152
Character set UCS-4 (little/big endian)
Definition: charset_ucs.hpp:124
Definition: charset_ucs.hpp:132
Definition: charset_ucs.hpp:131
Definition: charset_interface.hpp:120
static signed char asciichar(char *buf, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::asciichar(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:173
void print(UChar chr, Buffer_ &buf) const
See template<class Buffer>Interface::print(UChar,Buffer&)
Definition: charset_ucs.hpp:92
uint32_t UChar
Unicode character type.
Definition: char.hpp:37
Definition of unicode characters.
Definition: charset_ucs.hpp:36
Definition: charset_ucs.hpp:133
UChar value(char *buf, unsigned int &bufpos, Iterator &itr) const
See template<class Iterator>Interface::value(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:77
Interface that describes what a character set encoding implementation has to define to be used as cha...
Definition: charset_ucs.hpp:129
static void fetchbytes(char *buf, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::fetchbytes(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:141
Definition: charset_ucs.hpp:35
Definition: charset_ucs.hpp:33
Definition of exceptions with containing error codes thrown by textwolf.
static UChar value_impl(char *buf, unsigned int &bufpos, Iterator &itr)
Definition: charset_ucs.hpp:68
Definition: charset_ucs.hpp:134
static void print(UChar chr, Buffer_ &buf)
See template<class Buffer>Interface::print(UChar,Buffer&)
Definition: charset_ucs.hpp:181
static void skip(char *, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::skip(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:41
static signed char asciichar(char *buf, unsigned int &bufpos, Iterator &itr)
See template<class Iterator>Interface::value(char*,unsigned int&,Iterator&)
Definition: charset_ucs.hpp:84