#include <QoreEncoding.h>
Public Member Functions | |
DLLLOCAL qore_size_t | getLength (const char *p, const char *end, bool &invalid) const |
gives the length of the string in characters | |
DLLLOCAL qore_size_t | getLength (const char *p, const char *end, ExceptionSink *xsink) const |
gives the length of the string in characters | |
DLLLOCAL qore_size_t | getByteLen (const char *p, const char *end, qore_size_t c, bool &invalid) const |
gives the number of bytes for the number of chars in the string or up to the end of the string | |
DLLLOCAL qore_size_t | getByteLen (const char *p, const char *end, qore_size_t c, ExceptionSink *xsink) const |
gives the number of bytes for the number of chars in the string or up to the end of the string | |
DLLLOCAL qore_size_t | getCharPos (const char *p, const char *end, bool &invalid) const |
gives the character position (number of characters) starting from the first pointer to the second | |
DLLLOCAL qore_size_t | getCharPos (const char *p, const char *end, ExceptionSink *xsink) const |
gives the character position (number of characters) starting from the first pointer to the second | |
DLLLOCAL qore_size_t | getCharLen (const char *p, qore_size_t valid_len) const |
gives the number of total bytes for the character given one or more characters | |
DLLEXPORT bool | isMultiByte () const |
returns true if the encoding is a multi-byte encoding | |
DLLEXPORT const char * | getCode () const |
returns the string code (ex: "UTF-8") for the encoding | |
DLLEXPORT const char * | getDesc () const |
returns the description for the encoding | |
DLLEXPORT int | getMaxCharWidth () const |
returns the maximum character width in bytes for the encoding |
for performance reasons this is not a class hierarchy with virtual methods; this ugly implementation with function pointers is much faster. Only encodings where a single character can be more than 1 byte needs to have functions implemented.
the default encoding is represented by QCS_DEFAULT; unless another encoding is explicitly given, all strings will be tagged with QCS_DEFAULT
DLLLOCAL qore_size_t QoreEncoding::getByteLen | ( | const char * | p, | |
const char * | end, | |||
qore_size_t | c, | |||
ExceptionSink * | xsink | |||
) | const |
gives the number of bytes for the number of chars in the string or up to the end of the string
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
c | the number of characters to check | |
xsink | Qore-language exceptions will be raised using this argument |
DLLLOCAL qore_size_t QoreEncoding::getByteLen | ( | const char * | p, | |
const char * | end, | |||
qore_size_t | c, | |||
bool & | invalid | |||
) | const [inline] |
gives the number of bytes for the number of chars in the string or up to the end of the string
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
c | the number of characters to check | |
invalid | if true after executing the function, invalid input was given and the return value should be ignored |
DLLLOCAL qore_size_t QoreEncoding::getCharLen | ( | const char * | p, | |
qore_size_t | valid_len | |||
) | const [inline] |
gives the number of total bytes for the character given one or more characters
always returns 1 for single-byte encodings
p | a pointer to the character data to check | |
valid_len | the number of valid bytes at the start of the character pointer |
DLLLOCAL qore_size_t QoreEncoding::getCharPos | ( | const char * | p, | |
const char * | end, | |||
ExceptionSink * | xsink | |||
) | const |
gives the character position (number of characters) starting from the first pointer to the second
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
xsink | Qore-language exceptions will be raised using this argument |
DLLLOCAL qore_size_t QoreEncoding::getCharPos | ( | const char * | p, | |
const char * | end, | |||
bool & | invalid | |||
) | const [inline] |
gives the character position (number of characters) starting from the first pointer to the second
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
invalid | if true after executing the function, invalid input was given and the return value should be ignored |
DLLLOCAL qore_size_t QoreEncoding::getLength | ( | const char * | p, | |
const char * | end, | |||
ExceptionSink * | xsink | |||
) | const |
gives the length of the string in characters
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
xsink | Qore-language exceptions will be raised using this argument |
DLLLOCAL qore_size_t QoreEncoding::getLength | ( | const char * | p, | |
const char * | end, | |||
bool & | invalid | |||
) | const [inline] |
gives the length of the string in characters
p | a pointer to the character data | |
end | a pointer to the next byte after the end of the character data | |
invalid | if true after executing the function, invalid input was given and the return value should be ignored |