Go to the documentation of this file.
32 #ifndef _UCOMMON_UNICODE_H_
33 #define _UCOMMON_UNICODE_H_
35 #ifndef _UCOMMON_STRING_H_
73 static const char *
nil;
80 static unsigned size(
const char *codepoint);
87 static size_t count(
const char *
string);
95 static char *offset(
char *
string, ssize_t position);
102 static ucs4_t codepoint(
const char *encoded);
109 static size_t chars(
const unicode_t string);
116 static size_t chars(
ucs4_t character);
138 static ucs4_t *udup(
const char *
string);
143 static ucs2_t *wdup(
const char *
string);
152 static const char *find(
const char *
string,
ucs4_t character,
size_t start = 0);
161 static const char *rfind(
const char *
string,
ucs4_t character,
size_t end = (
size_t)-1l);
169 static unsigned ccount(
const char *
string,
ucs4_t character);
284 {
return get(unicode,
size);};
309 {
return UString::at(position);};
316 {
return utf8::count(str->text);}
414 inline operator bool()
const
415 {
return text != NULL;};
421 inline bool operator!()
const
422 {
return text == NULL;};
429 ucs4_t operator[](
long codepoint)
const;
453 inline bool operator==(
const char *
string)
const
454 {
return (
const char *)text == string;};
461 inline bool operator!=(
const char *
string)
const
462 {
return (
const char *)text != string;};
469 {
return utf8::codepoint((
const char *)text);};
475 inline char *c_str(
void)
const
476 {
return (
char *)text;};
482 inline operator char*()
const
483 {
return (
char *)text;};
489 inline size_t len(
void)
const
490 {
return utf8::count((
const char *)text);};
493 inline ucs4_t *strudup(
const char *
string)
494 {
return utf8::udup(
string);}
496 inline ucs2_t *strwdup(
const char *
string)
497 {
return utf8::wdup(
string);}
499 __EXPORT
unicode_t unidup(
const char *
string);
502 inline void dupfree<ucs2_t*>(
ucs2_t *string)
506 inline void dupfree<ucs4_t*>(
ucs4_t *string)
510 inline void dupfree<unicode_t>(
unicode_t string)