summaryrefslogtreecommitdiff
path: root/cppe/include/IceE/BasicStream.h
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-03-30 15:34:00 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-03-30 15:34:00 +0000
commit7be9675ec7f3c74f721bede6c94d3d214ee31d2c (patch)
treeeea38601215022b09a2833165b4d8581e253c2a8 /cppe/include/IceE/BasicStream.h
parentFixed ice_timeout/ice_compress for indirect proxies (diff)
downloadice-7be9675ec7f3c74f721bede6c94d3d214ee31d2c.tar.bz2
ice-7be9675ec7f3c74f721bede6c94d3d214ee31d2c.tar.xz
ice-7be9675ec7f3c74f721bede6c94d3d214ee31d2c.zip
Added wstring support
Diffstat (limited to 'cppe/include/IceE/BasicStream.h')
-rw-r--r--cppe/include/IceE/BasicStream.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/cppe/include/IceE/BasicStream.h b/cppe/include/IceE/BasicStream.h
index 7e6dca17ddd..fc968be6833 100644
--- a/cppe/include/IceE/BasicStream.h
+++ b/cppe/include/IceE/BasicStream.h
@@ -15,6 +15,7 @@
#include <IceE/Buffer.h>
#include <IceE/AutoArray.h>
#include <IceE/Protocol.h>
+#include <IceE/Unicode.h>
namespace Ice
{
@@ -450,6 +451,40 @@ public:
}
void read(std::vector<std::string>&);
+ void write(const std::wstring& v)
+ {
+ std::string s = IceUtil::wstringToString(v);
+ Ice::Int sz = static_cast<Ice::Int>(s.size());
+ writeSize(sz);
+ if(sz > 0)
+ {
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ memcpy(&b[pos], s.c_str(), sz);
+ }
+ }
+ void write(const std::wstring*, const std::wstring*);
+ void read(std::wstring& v)
+ {
+ Ice::Int sz;
+ readSize(sz);
+ if(sz > 0)
+ {
+ if(b.end() - i < sz)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ std::string s(reinterpret_cast<const char*>(&*i), reinterpret_cast<const char*>(&*i) + sz);
+ IceUtil::stringToWstring(s).swap(v);
+ i += sz;
+ }
+ else
+ {
+ v.clear();
+ }
+ }
+ void read(std::vector<std::wstring>&);
+
void write(const Ice::ObjectPrx&);
void read(Ice::ObjectPrx&);