Date: Monday, December 4, 2006 @ 23:14:10
Author: marc
Path: /cvsroot/carob/carob
Modified: include/StringCodecs.hpp (1.15 -> 1.16) src/Common.cpp (1.48 ->
1.49)
Added std::wstring fromASCII(std::string) method
--------------------------+
include/StringCodecs.hpp | 4 ++++
src/Common.cpp | 2 ++
2 files changed, 6 insertions(+)
Index: carob/include/StringCodecs.hpp
diff -u carob/include/StringCodecs.hpp:1.15 carob/include/StringCodecs.hpp:1.16
--- carob/include/StringCodecs.hpp:1.15 Tue Nov 21 18:38:44 2006
+++ carob/include/StringCodecs.hpp Mon Dec 4 23:14:10 2006
@@ -181,6 +181,9 @@
class StaticCodecs
{
public:
+ /** Converts ASCII "encoded" string to a wide string */
+ static std::wstring fromASCII(const std::string& in) throw (CodecException)
+ { return ascii_codec.decode(in); }
/** Converts UTF-8 encoded string to a wide string */
static std::wstring fromUTF8(const std::string& in) throw (CodecException)
{ return utf8_codec.decode(in); }
@@ -194,6 +197,7 @@
static std::string toString(const std::wstring& in) throw (CodecException)
{ return user_codec.encode(in); }
private:
+ static const CarobNS::MBSCodec ascii_codec;
/** Codec for UTF-8 strings */
#ifdef CAROB_USE_ICONV
static const CarobNS::IconvCodec utf8_codec;
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.48 carob/src/Common.cpp:1.49
--- carob/src/Common.cpp:1.48 Tue Nov 28 17:01:35 2006
+++ carob/src/Common.cpp Mon Dec 4 23:14:10 2006
@@ -305,6 +305,8 @@
}
}
+const CarobNS::MBSCodec
CarobNS::StaticCodecs::ascii_codec(std::locale::classic());
+
// init order matters here, since a failure to init utf8_codec will
// call user_codec
const CarobNS::MBSCodec CarobNS::StaticCodecs::user_codec(tryuserlocale());
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits