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);};
349 {
return UString::at(position);};
356 {
return utf8::count(str->text);}
454 inline operator bool()
const
455 {
return text != NULL;};
461 inline bool operator!()
const
462 {
return text == NULL;};
469 ucs4_t operator[](
long codepoint)
const;
493 inline bool operator==(
const char *
string)
const
494 {
return (
const char *)text == string;};
501 inline bool operator!=(
const char *
string)
const
502 {
return (
const char *)text != string;};
509 {
return utf8::codepoint((
const char *)text);};
515 inline char *c_str(
void)
const
516 {
return (
char *)text;};
522 inline operator char*()
const
523 {
return (
char *)text;};
529 inline size_t len(
void)
const
530 {
return utf8::count((
const char *)text);};
533 inline ucs4_t *strudup(
const char *
string)
534 {
return utf8::udup(
string);}
536 inline ucs2_t *strwdup(
const char *
string)
537 {
return utf8::wdup(
string);}
539 __EXPORT
unicode_t unidup(
const char *
string);
542 inline void dupfree<ucs2_t*>(
ucs2_t *string)
546 inline void dupfree<ucs4_t*>(
ucs4_t *string)
550 inline void dupfree<unicode_t>(
unicode_t string)