|
cwidget
0.5.16
|
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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| bool | transcode (const char *s, std::wstring &out, const char *encoding=NULL) |
| Convenience function to convert a multibyte encoding to wide characters. | |
| 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. | |
| 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. | |
| 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. | |
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.
\param s the string to decode
\param out the location to write the transcoded string
\param encoding the encoding of s; if \b null or unspecified,
the value of LC_CTYPE is used.
\return \b true if the entire string was successfully transcoded;
if transcoding failed, returns \b false and sets errno.
| 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.
\param s the wide string to encode
\param out the location to write the multibyte string
\param encoding the encoding of out; if \b null or unspecified,
the value of LC_CTYPE is used.
\return \b true if the entire string was successfully transcoded;
if transcoding failed, returns \b false and sets errno.
| 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.
\param s the string to decode \param encoding the encoding of s; if \b null or unspecified, the value of LC_CTYPE is used. \param errf the error handler, or \b 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.
\param s the string to decode \param encoding the encoding of s; if \b null or unspecified, the value of LC_CTYPE is used. \param errf the error handler, or \b 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.
\param s the string to decode \param encoding the encoding of s; if \b null or unspecified, the value of LC_CTYPE is used. \param errf the error handler, or \b 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.
\param s the string to decode \param encoding the encoding of s; if \b null or unspecified, the value of LC_CTYPE is used. \param errf the error handler, or \b null to use the default handler (transcode_mbtow_err).
References transcode_wtomb_err.
| std::wstring(* cwidget::util::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.
The default handler just returns "partial".
Referenced by transcode().
| std::string(* cwidget::util::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.
The default handler just returns "partial".
Referenced by transcode().
1.8.1.1