Date: Thursday, January 26, 2006 @ 12:12:53
Author: marc
Path: /cvsroot/carob/carob
Modified: include/BigDecimal.hpp (1.12 -> 1.13) include/Common.hpp (1.29
-> 1.30) include/StringCodecs.hpp (1.6 -> 1.7) src/Common.cpp
(1.22 -> 1.23) test/01-Unit/TestStringCodecs.cpp (1.5 -> 1.6)
test/CarobTestLauncher.cpp (1.19 -> 1.20)
Moves toString() and other converter stuff from Common.hpp to StringCodecs.hpp
-----------------------------------+
include/BigDecimal.hpp | 1
include/Common.hpp | 52 ------------------------------------
include/StringCodecs.hpp | 52 +++++++++++++++++++++++++++++++++++-
src/Common.cpp | 2 +
test/01-Unit/TestStringCodecs.cpp | 9 ++++--
test/CarobTestLauncher.cpp | 2 +
6 files changed, 62 insertions(+), 56 deletions(-)
Index: carob/include/BigDecimal.hpp
diff -u carob/include/BigDecimal.hpp:1.12 carob/include/BigDecimal.hpp:1.13
--- carob/include/BigDecimal.hpp:1.12 Wed Jan 25 23:05:25 2006
+++ carob/include/BigDecimal.hpp Thu Jan 26 12:12:53 2006
@@ -22,6 +22,7 @@
#ifndef BIGDECIMAL_H_
#define BIGDECIMAL_H_
+#include "CarobException.hpp"
#include "Common.hpp" //for java_byte and ResultSetDataType
#include <string>
Index: carob/include/Common.hpp
diff -u carob/include/Common.hpp:1.29 carob/include/Common.hpp:1.30
--- carob/include/Common.hpp:1.29 Thu Jan 26 11:50:43 2006
+++ carob/include/Common.hpp Thu Jan 26 12:12:53 2006
@@ -21,8 +21,6 @@
#ifndef _COMMON_H_
#define _COMMON_H_
-#include "StringCodecs.hpp"
-
#include <string>
// Uncomment to get definition of uint8_t (needed with gcc<3.4 for instance)
@@ -119,56 +117,6 @@
std::wstring trim(const std::wstring& source,
const wchar_t* delims = L" \t\r\n");
-/**
- * The only purpose of this class is to prevent direct access to the
- * private codecs fields, while still be able to inline the calls.
- */
-class StaticCodecs
-{
-public:
- static std::wstring fromUTF8(const std::string& in) throw (CodecException)
- { return utf8_codec.decode(in); }
- static std::string toUTF8(const std::wstring& in) throw (CodecException)
- { return utf8_codec.encode(in); }
- static std::wstring fromString(const std::string& in) throw (CodecException)
- { return user_codec.decode(in); }
- static std::string toString(const std::wstring& in) throw (CodecException)
- { return user_codec.encode(in); }
-private:
- static const CarobNS::MBSCodec utf8_codec;
- // user-defined locale (typically set using LANG, LC_etc)
- static const CarobNS::MBSCodec user_codec;
-};
-
-/**
- * Default (locale) String to Wide-String conversion.
- * @param in original string
- * @return converted wstring
- */
-inline std::wstring fromString(const std::string& in) throw (CodecException)
-{
- return StaticCodecs::fromString(in);
-}
-/**
- * Wide-String to default (locale) String conversion.
- * FIXME: throw exception on error
- * @param in original wide string
- * @return converted string
- */
-inline std::string toString(const std::wstring& in) throw (CodecException)
-{
- return StaticCodecs::toString(in);
-}
-
-inline std::wstring fromUTF8(const std::string& in) throw (CodecException)
-{
- return StaticCodecs::fromUTF8(in);
-}
-
-inline std::string toUTF8(const std::wstring& in) throw (CodecException)
-{
- return StaticCodecs::toUTF8(in);
-}
/**
* Converts integers to wstring
Index: carob/include/StringCodecs.hpp
diff -u carob/include/StringCodecs.hpp:1.6 carob/include/StringCodecs.hpp:1.7
--- carob/include/StringCodecs.hpp:1.6 Thu Jan 26 11:50:43 2006
+++ carob/include/StringCodecs.hpp Thu Jan 26 12:12:53 2006
@@ -73,8 +73,58 @@
};
+/**
+ * The only purpose of this class is to prevent direct access to the
+ * private codecs fields, while still be able to inline the calls.
+ */
+class StaticCodecs
+{
+public:
+ static std::wstring fromUTF8(const std::string& in) throw (CodecException)
+ { return utf8_codec.decode(in); }
+ static std::string toUTF8(const std::wstring& in) throw (CodecException)
+ { return utf8_codec.encode(in); }
+ static std::wstring fromString(const std::string& in) throw (CodecException)
+ { return user_codec.decode(in); }
+ static std::string toString(const std::wstring& in) throw (CodecException)
+ { return user_codec.encode(in); }
+private:
+ static const CarobNS::MBSCodec utf8_codec;
+ // user-defined locale (typically set using LANG, LC_etc)
+ static const CarobNS::MBSCodec user_codec;
+};
+
+/**
+ * Default (locale) String to Wide-String conversion.
+ * @param in original string
+ * @return converted wstring
+ */
+inline std::wstring fromString(const std::string& in) throw (CodecException)
+{
+ return StaticCodecs::fromString(in);
+}
+/**
+ * Wide-String to default (locale) String conversion.
+ * FIXME: throw exception on error
+ * @param in original wide string
+ * @return converted string
+ */
+inline std::string toString(const std::wstring& in) throw (CodecException)
+{
+ return StaticCodecs::toString(in);
+}
+
+inline std::wstring fromUTF8(const std::string& in) throw (CodecException)
+{
+ return StaticCodecs::fromUTF8(in);
+}
+
+inline std::string toUTF8(const std::wstring& in) throw (CodecException)
+{
+ return StaticCodecs::toUTF8(in);
+}
-} // namespace
+} // namespace CarobNS
#endif // include only once
Index: carob/src/Common.cpp
diff -u carob/src/Common.cpp:1.22 carob/src/Common.cpp:1.23
--- carob/src/Common.cpp:1.22 Tue Jan 24 19:45:07 2006
+++ carob/src/Common.cpp Thu Jan 26 12:12:53 2006
@@ -21,6 +21,8 @@
#include "Common.hpp"
+#include "StringCodecs.hpp"
+
#include <iostream>
#include <sstream> //for wostringstream
Index: carob/test/01-Unit/TestStringCodecs.cpp
diff -u carob/test/01-Unit/TestStringCodecs.cpp:1.5
carob/test/01-Unit/TestStringCodecs.cpp:1.6
--- carob/test/01-Unit/TestStringCodecs.cpp:1.5 Thu Jan 12 19:43:51 2006
+++ carob/test/01-Unit/TestStringCodecs.cpp Thu Jan 26 12:12:53 2006
@@ -18,13 +18,16 @@
* Contributor(s):
*/
-#include <iostream>
+#include "TestStringCodecs.hpp"
+
+#include "StringCodecs.hpp"
+#include "Common.hpp"
#include <cppunit/TestSuite.h>
#include <cppunit/TestCaller.h>
-#include "Common.hpp"
-#include "TestStringCodecs.hpp"
+#include <iostream>
+
using namespace CarobNS;
Index: carob/test/CarobTestLauncher.cpp
diff -u carob/test/CarobTestLauncher.cpp:1.19
carob/test/CarobTestLauncher.cpp:1.20
--- carob/test/CarobTestLauncher.cpp:1.19 Tue Jan 24 11:15:13 2006
+++ carob/test/CarobTestLauncher.cpp Thu Jan 26 12:12:53 2006
@@ -27,7 +27,9 @@
#include <cppunit/TestResult.h>
#include "CarobException.hpp"
+#include "StringCodecs.hpp"
#include "Common.hpp"
+
#include "CarobProtector.hpp"
#include "TestBeginCommitRollback.hpp"
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits