scim  1.4.18
scim_utility.h File Reference

various utility functions. More...

Namespaces

 scim
 

Macros

#define SCIM_PATH_DELIM_STRING   "/"
 
#define SCIM_PATH_DELIM   '/'
 
#define RET_ILSEQ   0
 
#define RET_TOOFEW(n)   (-1-(n))
 
#define RET_TOOSMALL   -1
 
#define BAD_WCHAR   ((ucs4_t) 0xfffd)
 
#define BAD_CHAR   '?'
 

Functions

int scim::utf8_mbtowc (ucs4_t *pwc, const unsigned char *src, int src_len)
 Convert an utf8 char sequence to ucs4. More...
 
int scim::utf8_wctomb (unsigned char *dest, ucs4_t wc, int dest_size)
 Convert an ucs4 code to utf8 char sequence. More...
 
WideString scim::utf8_mbstowcs (const String &str)
 Convert an utf8 string to an ucs4 string. More...
 
WideString scim::utf8_mbstowcs (const char *str, int len=-1)
 Convert an utf8 string to an ucs4 string. More...
 
String scim::utf8_wcstombs (const WideString &wstr)
 Convert an ucs4 string to an utf8 string. More...
 
String scim::utf8_wcstombs (const ucs4_t *wstr, int len=-1)
 Convert an ucs4 string to an utf8 string. More...
 
ucs4_t scim::utf8_read_wchar (std::istream &is)
 Read a wide char from istream. More...
 
std::ostream & scim::utf8_write_wchar (std::ostream &os, ucs4_t wc)
 Write a wide char to ostream. More...
 
WideString scim::utf8_read_wstring (std::istream &is, ucs4_t delim=(ucs4_t) '\n', bool rm_delim=true)
 Read a wide string from istream. More...
 
std::ostream & scim::utf8_write_wstring (std::ostream &os, const WideString &wstr)
 Write a wide string to ostream. More...
 
void scim::scim_uint32tobytes (unsigned char *bytes, uint32 n)
 Convert an uint32 variable into a sequence of bytes. More...
 
uint32 scim::scim_bytestouint32 (const unsigned char *bytes)
 Convert a sequence of bytes into an uint32 value. More...
 
void scim::scim_uint16tobytes (unsigned char *bytes, uint16 n)
 Convert an uint16 variable into a sequence of bytes. More...
 
uint16 scim::scim_bytestouint16 (const unsigned char *bytes)
 Convert a sequence of bytes into an uint16 value. More...
 
String scim::scim_validate_locale (const String &locale)
 Test if the locale is valid, and return the good locale name. More...
 
String scim::scim_get_locale_encoding (const String &locale)
 Get the encoding for a locale. More...
 
String scim::scim_get_current_locale ()
 Get current system locale. More...
 
String scim::scim_get_current_language ()
 Get current system language. More...
 
int scim::scim_get_locale_maxlen (const String &locale)
 Get the max length of the multibyte char of a locale. More...
 
int scim::scim_split_string_list (std::vector< String > &vec, const String &str, char delim=',')
 Split string list into a string vector according to the delim char. More...
 
String scim::scim_combine_string_list (const std::vector< String > &vec, char delim=',')
 Combine a string vector into one string list, separated by char delim. More...
 
bool scim::scim_is_little_endian ()
 Get machine endian type. More...
 
bool scim::scim_if_wchar_ucs4_equal ()
 Test if wchar_t is using UCS4 encoding. More...
 
ucs4_t scim::scim_wchar_to_full_width (ucs4_t code)
 Convert a half width unicode char to its full width counterpart. More...
 
ucs4_t scim::scim_wchar_to_half_width (ucs4_t code)
 Convert a full width unicode char to its half width counterpart. More...
 
String scim::scim_get_home_dir ()
 Get the home dir of current user. More...
 
String scim::scim_get_user_name ()
 Get the name of current user. More...
 
String scim::scim_get_user_data_dir ()
 Get SCIM data dir of current user. More...
 
size_t scim::scim_load_file (const String &filename, char **bufptr)
 Load a file into memory. More...
 
bool scim::scim_make_dir (const String &dir)
 Make a directory. More...
 
String scim::scim_get_language_name (const String &lang)
 Get the localized name of a language id. More...
 
String scim::scim_get_language_name_english (const String &lang)
 Get the English name of a language id. More...
 
String scim::scim_get_language_name_untranslated (const String &lang)
 Get the untranslated name of a language id. More...
 
String scim::scim_get_language_locales (const String &lang)
 Get the supported locales for a language. More...
 
String scim::scim_get_locale_language (const String &locale)
 Get the language id for a locale. More...
 
String scim::scim_validate_language (const String &lang)
 Test if the language is valid, and return the good language code. More...
 
String scim::scim_get_normalized_language (const String &lang)
 Get the normalized language id of a language. More...
 
int scim::scim_launch (bool daemon, const String &config, const String &imengines, const String &frontend, char *const argv []=0)
 Launch a SCIM process with specific options. More...
 
int scim::scim_launch_panel (bool daemon, const String &config, const String &display, char *const argv []=0)
 Launch a SCIM Panel process with specific options. More...
 
void scim::scim_usleep (unsigned int usec)
 Sleep some microseconds. More...
 
void scim::scim_daemon ()
 Switch process into daemon mode. More...
 

Detailed Description

various utility functions.