diff options
Diffstat (limited to 'cpp/include/Ice/BasicStream.h')
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 25a37510c43..e87d85b0082 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -17,6 +17,7 @@ #include <Ice/Buffer.h> #include <Ice/Protocol.h> #include <IceUtil/AutoArray.h> +#include <IceUtil/Unicode.h> namespace Ice { @@ -437,6 +438,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&); |