Add convenient wxMBConv::cMB2WC/WC2MB overloads taking buffers.

These overloads allow not to worry about buffer lengths and just convert
between wxCharBuffer and wxWCharBuffer directly in a convenient way.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-09-12 22:40:25 +00:00
parent c8299fa80c
commit 40ac5040ce
4 changed files with 77 additions and 0 deletions

View File

@@ -177,6 +177,23 @@ public:
size_t inLen,
size_t *outLen) const;
/**
Converts a char buffer to wide char one.
This is the most convenient and safest conversion function as you
don't have to deal with the buffer lengths directly. Use it if the
input buffer is known not to be empty or if you are sure that the
conversion is going to succeed -- otherwise, use the overload above to
be able to distinguish between empty input and conversion failure.
@return
The buffer containing the converted text, empty if the input was
empty or if the conversion failed.
@since 2.9.1
*/
const wxWCharBuffer cMB2WC(const wxCharBuffer& buf) const;
//@{
/**
Converts from multibyte encoding to the current wxChar type (which
@@ -204,6 +221,23 @@ public:
size_t inLen,
size_t *outLen) const;
/**
Converts a wide char buffer to char one.
This is the most convenient and safest conversion function as you
don't have to deal with the buffer lengths directly. Use it if the
input buffer is known not to be empty or if you are sure that the
conversion is going to succeed -- otherwise, use the overload above to
be able to distinguish between empty input and conversion failure.
@return
The buffer containing the converted text, empty if the input was
empty or if the conversion failed.
@since 2.9.1
*/
const wxCharBuffer cWC2MB(const wxWCharBuffer& buf) const;
//@{
/**
Converts from Unicode to the current wxChar type.