Date: Tuesday, November 15, 2005 @ 17:19:52
Author: marc
Path: /cvsroot/carob/carob
Modified: include/DriverSocket.hpp (1.5 -> 1.6) src/DriverSocket.cpp (1.5
-> 1.6)
Added convenience method to send c_style strings directly:
(the method takes care of creating the wstring object)
--------------------------+
include/DriverSocket.hpp | 10 +++++++++-
src/DriverSocket.cpp | 9 ++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
Index: carob/include/DriverSocket.hpp
diff -u carob/include/DriverSocket.hpp:1.5 carob/include/DriverSocket.hpp:1.6
--- carob/include/DriverSocket.hpp:1.5 Wed Sep 21 12:08:15 2005
+++ carob/include/DriverSocket.hpp Tue Nov 15 17:19:52 2005
@@ -44,8 +44,16 @@
* Writes a string to the socket according to the controller protocol
* @throws SocketIOException
*/
- const DriverSocket & operator<<(const wstring &) const
+ const DriverSocket & operator<<(const wstring &) const
throw (SocketIOException, UnexpectedException);
+
+ /**
+ * Convenience method to send C-style strings. Creates a wstring and sends
it.
+ * Reminder: every C-style string can be a wstring; the opposite is not true.
+ */
+ const DriverSocket& DriverSocket::operator <<(const wchar_t *s) const
+ throw (SocketIOException, UnexpectedException);
+
/**
* Reads a string from the socket according to the controller protocol
* @throws SocketIOException
Index: carob/src/DriverSocket.cpp
diff -u carob/src/DriverSocket.cpp:1.5 carob/src/DriverSocket.cpp:1.6
--- carob/src/DriverSocket.cpp:1.5 Thu Nov 3 15:29:02 2005
+++ carob/src/DriverSocket.cpp Tue Nov 15 17:19:52 2005
@@ -40,7 +40,7 @@
wstring fctName(L"DriverSocket::operator<<(wstring)");
if (isVerboseEnabled())
logVerbose(fctName, L"");
- //First write "true", then the size of the upcomming string, then the string
itself
+ //First write "true", then the size of the upcoming string, then the string
itself
*this<<true;
//TODO: check what size to send !!!
int32_t strLen = s.size();
@@ -53,6 +53,13 @@
return *this;
}
+const DriverSocket& DriverSocket::operator <<(const wchar_t *s) const
+ throw (SocketIOException, UnexpectedException)
+{
+ wstring wobject(s);
+ return *this<<wobject;
+}
+
const DriverSocket & DriverSocket::operator >>(wstring & s) const
throw (SocketIOException, UnexpectedException)
{
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits