cwidget
0.5.17
|
Miscellaneous utility functions that are not directly related to the core functionality of cwidget. More...
Classes | |
struct | accumulate_and |
Computes the return-value of the signal via a short-circuiting AND. More... | |
struct | accumulate_or |
Computes the return-value of the signal via a short-circuiting OR. More... | |
class | AssertionFailure |
Represents an assertion failure. More... | |
class | Exception |
class | ref_ptr |
class | slotarg |
Wraps a slot that may not be present. More... | |
Typedefs | |
typedef slotarg< sigc::slot0< void > > | slot0arg |
Convenience typedefs for slot arguments that take no parameters and return nothing. | |
Functions | |
template<typename T > | |
slotarg< T > | arg (const T &slot) |
Convenience routine to construct a slotarg. More... | |
string | ssprintf (const char *format,...) |
string | vssprintf (const char *format, va_list ap) |
wstring | swsprintf (const wchar_t *format,...) |
wstring | vswsprintf (const wchar_t *format, va_list ap) |
string | sstrerror (int errnum) |
Like strerror_r, but handles all memory allocation and returns a C++ string. | |
bool | transcode (const char *s, wstring &out, const char *encoding) |
std::wstring | transcode (const std::string &s, const char *encoding=NULL, std::wstring(*errf)(int error, const std::wstring &partial, const std::string &input)=NULL) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors. More... | |
std::wstring | transcode (const char *s, const char *encoding=NULL, std::wstring(*errf)(int error, const std::wstring &partial, const std::string &input)=NULL) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors. More... | |
bool | transcode (const wchar_t *s, string &out, const char *encoding) |
std::string | transcode (const std::wstring &s, const char *encoding=NULL, std::string(*errf)(int error, const std::string &partial, const std::wstring &input)=NULL) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors. More... | |
std::string | transcode (const wchar_t *s, const char *encoding=NULL, std::string(*errf)(int error, const std::string &partial, const std::wstring &input)=NULL) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors. More... | |
bool | transcode (const char *s, std::wstring &out, const char *encoding=NULL) |
Convenience function to convert a multibyte encoding to wide characters. More... | |
bool | transcode (const std::string &s, std::wstring &out, const char *encoding=NULL) |
bool | transcode (const wchar_t *s, std::string &out, const char *encoding=NULL) |
Convenience function to convert the native wide character encoding to a multibyte encoding. More... | |
bool | transcode (const std::wstring &s, std::string &out, const char *encoding=NULL) |
Variables | |
const int | initbufsize =512 |
std::string(* | transcode_wtomb_err )(int error, const std::string &partial, const std::wstring &input)=default_wtomb_err |
The error handler for converting multibyte strings to wide strings: it is passed a partially-decoded string and the error code, and its return value becomes the return value of the function. More... | |
std::wstring(* | transcode_mbtow_err )(int error, const std::wstring &partial, const std::string &input)=default_mbtow_err |
The error handler for converting multibyte strings to wide strings: it is passed a partially-decoded string and the error code, and its return value becomes the return value of the function. More... | |
Miscellaneous utility functions that are not directly related to the core functionality of cwidget.
slotarg<T> cwidget::util::arg | ( | const T & | slot | ) |
Convenience routine to construct a slotarg.
The purpose of this routine is to allow C++'s local type inference to determine the template parameters to slotarg. It is the recommended way to construct slotarg objects when passing them as parameters to a function.
T | The slot type that is wrapped by the returned slotarg object. |
slot | The slot that is to be wrapped. |
bool cwidget::util::transcode | ( | const char * | s, |
std::wstring & | out, | ||
const char * | encoding = NULL |
||
) |
Convenience function to convert a multibyte encoding to wide characters.
This is a wrapper around iconv.
s | the string to decode |
out | the location to write the transcoded string |
encoding | the encoding of s; if null or unspecified, the value of LC_CTYPE is used. |
bool cwidget::util::transcode | ( | const wchar_t * | s, |
std::string & | out, | ||
const char * | encoding = NULL |
||
) |
Convenience function to convert the native wide character encoding to a multibyte encoding.
This is a wrapper around iconv.
s | the wide string to encode |
out | the location to write the multibyte string |
encoding | the encoding of out; if null or unspecified, the value of LC_CTYPE is used. |
std::wstring cwidget::util::transcode | ( | const std::string & | s, |
const char * | encoding = NULL , |
||
std::wstring(*)(int error, const std::wstring &partial, const std::string &input) | errf = NULL |
||
) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors.
This is a wrapper around iconv.
s | the string to decode |
encoding | the encoding of s; if null or unspecified, the value of LC_CTYPE is used. |
errf | the error handler, or null to use the default handler (transcode_mbtow_err). |
References transcode_mbtow_err.
std::wstring cwidget::util::transcode | ( | const char * | s, |
const char * | encoding = NULL , |
||
std::wstring(*)(int error, const std::wstring &partial, const std::string &input) | errf = NULL |
||
) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors.
This is a wrapper around iconv.
s | the string to decode |
encoding | the encoding of s; if null or unspecified, the value of LC_CTYPE is used. |
errf | the error handler, or null to use the default handler (transcode_mbtow_err). |
References transcode_mbtow_err.
std::string cwidget::util::transcode | ( | const std::wstring & | s, |
const char * | encoding = NULL , |
||
std::string(*)(int error, const std::string &partial, const std::wstring &input) | errf = NULL |
||
) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors.
This is a wrapper around iconv.
s | the string to decode |
encoding | the encoding of s; if null or unspecified, the value of LC_CTYPE is used. |
errf | the error handler, or null to use the default handler (transcode_mbtow_err). |
References transcode_wtomb_err.
std::string cwidget::util::transcode | ( | const wchar_t * | s, |
const char * | encoding = NULL , |
||
std::string(*)(int error, const std::string &partial, const std::wstring &input) | errf = NULL |
||
) |
Convenience function to convert a multibyte encoding to wide characters, where the caller doesn't need to directly handle errors.
This is a wrapper around iconv.
s | the string to decode |
encoding | the encoding of s; if null or unspecified, the value of LC_CTYPE is used. |
errf | the error handler, or null to use the default handler (transcode_mbtow_err). |
References transcode_wtomb_err.
|
default |
The error handler for converting multibyte strings to wide strings: it is passed a partially-decoded string and the error code, and its return value becomes the return value of the function.
The default handler just returns "partial".
Referenced by transcode().
|
default |
The error handler for converting multibyte strings to wide strings: it is passed a partially-decoded string and the error code, and its return value becomes the return value of the function.
The default handler just returns "partial".
Referenced by transcode().