summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/optional/StringView.h
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-07-18 20:55:31 +0000
committerBernard Normier <bernard@zeroc.com>2016-07-18 20:56:23 +0000
commita05470bdfc2c43e49eae41bbf045cd8856d9433d (patch)
tree4dc1d42cd865dfa3663a7083d08e1ad5df9b5e60 /cpp/test/Ice/optional/StringView.h
parentCustomizable PHP config (diff)
downloadice-a05470bdfc2c43e49eae41bbf045cd8856d9433d.tar.bz2
ice-a05470bdfc2c43e49eae41bbf045cd8856d9433d.tar.xz
ice-a05470bdfc2c43e49eae41bbf045cd8856d9433d.zip
New C++11 optional mapping
Diffstat (limited to 'cpp/test/Ice/optional/StringView.h')
-rw-r--r--cpp/test/Ice/optional/StringView.h25
1 files changed, 9 insertions, 16 deletions
diff --git a/cpp/test/Ice/optional/StringView.h b/cpp/test/Ice/optional/StringView.h
index 8dd1d7d6f73..43e5bf74bb7 100644
--- a/cpp/test/Ice/optional/StringView.h
+++ b/cpp/test/Ice/optional/StringView.h
@@ -153,11 +153,13 @@ struct StreamHelper<Util::string_view, StreamHelperCategoryBuiltin>
template<class S> static inline void
write(S* stream, const Util::string_view& v)
{
-
-#ifdef STRING_VIEW_IGNORE_STRING_CONVERTER
- stream->write(v.data(), v.size(), false);
+#ifdef ICE_CPP11_MAPPING
+ stream->write(v.data(), v.size());
#else
- stream->write(v.data(), v.size(), true);
+ //
+ // In C++98, for consistency with the read, we don't string-convert
+ //
+ stream->write(v.data(), v.size(), false);
#endif
}
@@ -167,19 +169,10 @@ struct StreamHelper<Util::string_view, StreamHelperCategoryBuiltin>
const char* vdata = 0;
size_t vsize = 0;
-#ifdef STRING_VIEW_IGNORE_STRING_CONVERTER
+ //
+ // In C++98, we ignore the string converter
+ //
stream->read(vdata, vsize);
-#else
- std::string holder;
- stream->read(vdata, vsize, holder);
-
- // If holder is not empty, a string conversion occured, and we can't return a
- // string_view since it does not hold the memory
- if(!holder.empty())
- {
- throw Ice::MarshalException(__FILE__, __LINE__, "string conversion not supported");
- }
-#endif
if(vsize > 0)
{