Static Public Member Functions

base::Unicode Class Reference

Unicode conversion functions. More...

#include <libppbase/base/Unicode.h>

List of all members.

Static Public Member Functions

static bool isUtf16 (const char *s)
 Checks if a string contains UTF-16 characters.
static bool isUtf16 (const char *s, size_t len)
 Checks if a string contains UTF-16 characters.
static bool isUtf16 (const String &s)
 Checks if a string contains UTF-16 characters.
static bool isUtf8 (const char *s)
 Checks if a string contains UTF-8 characters.
static bool isUtf8 (const char *s, size_t len)
 Checks if a string contains UTF-8 characters.
static bool isUtf8 (const String &s)
 Checks if a string contains UTF-8 characters.
static bool isValidUtf8 (const char *s)
 Checks if an UTF-8 encoded string contains valid UTF-8.
static bool isValidUtf8 (const char *s, size_t len)
 Checks if an UTF-8 encoded string contains valid UTF-8.
static bool isValidUtf8 (const String &s)
 Checks if an UTF-8 encoded string contains valid UTF-8.
static WString latin1OrUtf8ToUtf16 (const char *s)
 Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.
static WString latin1OrUtf8ToUtf16 (const char *s, size_t len)
 Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.
static WString latin1OrUtf8ToUtf16 (const String &s)
 Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.
static WString latin1ToUtf16 (const char *s)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.
static WString latin1ToUtf16 (const char *s, size_t len)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.
static WString latin1ToUtf16 (const String &s)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.
static String latin1ToUtf8 (const char *s)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.
static String latin1ToUtf8 (const char *s, size_t len)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.
static String latin1ToUtf8 (const String &s)
 Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.
static String utf16ToUtf8 (const wchar_t *s, size_t *rlen=NULL)
 Converts a string from UTF-16 to UTF-8.
static String utf16ToUtf8 (const wchar_t *s, size_t len, size_t *rlen=NULL)
 Converts a string from UTF-16 to UTF-8.
static String utf16ToUtf8 (const WString &s, size_t *rlen=NULL)
 Converts a string from UTF-16 to UTF-8.
static String utf8ToLatin1 (const char *s, char rep= '\0')
 Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).
static String utf8ToLatin1 (const char *s, size_t len, char rep= '\0')
 Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).
static String utf8ToLatin1 (const String &s, char rep= '\0')
 Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).
static WString utf8ToUtf16 (const char *s, size_t *rlen=NULL)
 Converts a string from UTF-8 to UTF-16.
static WString utf8ToUtf16 (const char *s, size_t len, size_t *rlen=NULL)
 Converts a string from UTF-8 to UTF-16.
static WString utf8ToUtf16 (const String &s, size_t *rlen=NULL)
 Converts a string from UTF-8 to UTF-16.

Detailed Description

Unicode conversion functions.

Author:
Christoph Schwarz
Version:
$Id: Unicode.h 21 2010-09-05 04:18:17Z cschwarz1 $

Member Function Documentation

static bool base::Unicode::isUtf16 ( const char *  s  )  [static]

Checks if a string contains UTF-16 characters.

Parameters:
s the string to check
Returns:
true if the string contains UTF-16 characters
false if the string does not contain UTF-16 characters
static bool base::Unicode::isUtf16 ( const char *  s,
size_t  len 
) [static]

Checks if a string contains UTF-16 characters.

Parameters:
s the string to check
len string length
Returns:
true if the string contains UTF-16 characters
false if the string does not contain UTF-16 characters
static bool base::Unicode::isUtf16 ( const String s  )  [static]

Checks if a string contains UTF-16 characters.

Parameters:
s the string to check
Returns:
true if the string contains UTF-16 characters
false if the string does not contain UTF-16 characters
static bool base::Unicode::isUtf8 ( const char *  s  )  [static]

Checks if a string contains UTF-8 characters.

Parameters:
s the string to check
Returns:
true if the string contains non-ASCII characters and is valid UTF-8
false if the string is not UTF-8

Referenced by base::FileT< size_t >::stat().

static bool base::Unicode::isUtf8 ( const char *  s,
size_t  len 
) [static]

Checks if a string contains UTF-8 characters.

Parameters:
s the string to check
len string length
Returns:
true if the string contains non-ASCII characters and is valid UTF-8
false if the string is not UTF-8
static bool base::Unicode::isUtf8 ( const String s  )  [static]

Checks if a string contains UTF-8 characters.

Parameters:
s the string to check
Returns:
true if the string contains non-ASCII characters and is valid UTF-8
false if the string is not UTF-8
static bool base::Unicode::isValidUtf8 ( const char *  s,
size_t  len 
) [static]

Checks if an UTF-8 encoded string contains valid UTF-8.

Parameters:
s the string to check
len string length
Returns:
true if the UTF-8 is valid
false if the UTF-8 is invalid
static bool base::Unicode::isValidUtf8 ( const String s  )  [static]

Checks if an UTF-8 encoded string contains valid UTF-8.

Parameters:
s the string to check
Returns:
true if the UTF-8 is valid
false if the UTF-8 is invalid
static bool base::Unicode::isValidUtf8 ( const char *  s  )  [static]

Checks if an UTF-8 encoded string contains valid UTF-8.

Parameters:
s the string to check
Returns:
true if the UTF-8 is valid
false if the UTF-8 is invalid
static WString base::Unicode::latin1OrUtf8ToUtf16 ( const char *  s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.

Parameters:
s the string in LATIN-1 or UTF-8 encoding
Returns:
the string in UTF-16 encoding
static WString base::Unicode::latin1OrUtf8ToUtf16 ( const char *  s,
size_t  len 
) [static]

Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.

Parameters:
s the string in LATIN-1 or UTF-8 encoding
len string length
Returns:
the string in UTF-16 encoding
static WString base::Unicode::latin1OrUtf8ToUtf16 ( const String s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) or UTF-8 to UTF-16.

Parameters:
s the string in LATIN-1 or UTF-8 encoding return the string in UTF-16 encoding
static WString base::Unicode::latin1ToUtf16 ( const char *  s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.

Parameters:
s the string in LATIN-1 encoding
Returns:
the string in UTF-16 encoding
static WString base::Unicode::latin1ToUtf16 ( const char *  s,
size_t  len 
) [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.

Parameters:
s the string in LATIN-1 encoding
len string length
Returns:
the string in UTF-16 encoding
static WString base::Unicode::latin1ToUtf16 ( const String s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-16.

Parameters:
s the string in LATIN-1 encoding return the string in UTF-16 encoding
static String base::Unicode::latin1ToUtf8 ( const char *  s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.

Parameters:
s the string in LATIN-1 encoding
Returns:
the string in UTF-8 encoding
static String base::Unicode::latin1ToUtf8 ( const char *  s,
size_t  len 
) [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.

Parameters:
s the string in LATIN-1 encoding
len string length
Returns:
the string in UTF-8 encoding
static String base::Unicode::latin1ToUtf8 ( const String s  )  [static]

Converts a string from LATIN-1 (ISO-8859-1) to UTF-8.

Parameters:
s the string in LATIN-1 encoding return the string in UTF-8 encoding
static String base::Unicode::utf16ToUtf8 ( const wchar_t *  s,
size_t  len,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-16 to UTF-8.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-16 encoding
len the length of the string
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-8 encoding
static String base::Unicode::utf16ToUtf8 ( const WString s,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-16 to UTF-8.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-16 encoding
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-8 encoding
static String base::Unicode::utf16ToUtf8 ( const wchar_t *  s,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-16 to UTF-8.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-16 encoding
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-8 encoding
static String base::Unicode::utf8ToLatin1 ( const char *  s,
size_t  len,
char  rep = '\0' 
) [static]

Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).

Parameters:
s the string in UTF-8 encoding
len string length
rep replacement to insert for characters which cannot be representated in LATIN-1
Returns:
the string in LATIN-1 encoding
static String base::Unicode::utf8ToLatin1 ( const char *  s,
char  rep = '\0' 
) [static]

Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).

Parameters:
s the string in UTF-8 encoding
rep replacement to insert for characters which cannot be representated in LATIN-1
Returns:
the string in LATIN-1 encoding
static String base::Unicode::utf8ToLatin1 ( const String s,
char  rep = '\0' 
) [static]

Converts a string from UTF-8 to LATIN-1 (ISO-8859-1).

Parameters:
s the string in UTF-8 encoding
rep replacement to insert for characters which cannot be representated in LATIN-1
Returns:
the string in LATIN-1 encoding
static WString base::Unicode::utf8ToUtf16 ( const char *  s,
size_t  len,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-8 to UTF-16.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-8 encoding
len the length of the string
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-16 encoding
static WString base::Unicode::utf8ToUtf16 ( const char *  s,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-8 to UTF-16.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-8 encoding
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-16 encoding

Referenced by base::FileT< size_t >::stat().

static WString base::Unicode::utf8ToUtf16 ( const String s,
size_t *  rlen = NULL 
) [static]

Converts a string from UTF-8 to UTF-16.

If rlen returns a number lower than len, a conversion error has occurred at postion rlen.

Parameters:
s the string in UTF-8 encoding
rlen if not NULL, returns number of characters converted
Returns:
the string in UTF-16 encoding

The documentation for this class was generated from the following file: