24 #ifndef _QORE_CHARSET_H
26 #define _QORE_CHARSET_H
34 #include <qore/QoreThreadLock.h>
80 unsigned char maxwidth;
83 DLLLOCAL
QoreEncoding(
const char *n_code,
const char *n_desc = 0,
unsigned char n_maxwidth = 1,
mbcs_length_t l = 0,
mbcs_end_t e = 0,
mbcs_pos_t p = 0,
mbcs_charlen_t c = 0) : code(n_code), desc(n_desc ? n_desc :
""), flength(l), fend(e), fpos(p), fcharlen(c), maxwidth(n_maxwidth) {
86 DLLLOCAL ~QoreEncoding() {
96 return flength ? flength(p, end, invalid) : strlen(p);
115 return fend ? fend(p, end, c, invalid) : c;
134 return fpos ? fpos(p, end, invalid) : end - p;
152 return fcharlen ? fcharlen(p, valid_len) : 1;
157 return (
bool)flength;
167 return desc.empty() ?
"<no description available>" : desc.c_str();
177 typedef std::map<const char *, QoreEncoding *, class ltcstrcase> encoding_map_t;
178 typedef std::map<const char *, const QoreEncoding *, class ltcstrcase> const_encoding_map_t;
188 DLLLOCAL
static encoding_map_t emap;
189 DLLLOCAL
static const_encoding_map_t amap;
193 DLLLOCAL
static const QoreEncoding *findUnlocked(
const char *name);
214 DLLLOCAL
static void init(
const char *def);
216 DLLLOCAL ~QoreEncodingManager();
245 #endif // _QORE_CHARSET_H