summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2012-09-24 17:01:05 -0400
committerBernard Normier <bernard@zeroc.com>2012-09-24 17:01:05 -0400
commitcc15ebed97ad43d9f2b04e73c8555ac4b2a3a0a3 (patch)
treeccf84d02fe6defae4995259028d4bacd4a403ee4 /cpp/src
parentPartial fix for ICE-3393: (diff)
downloadice-cc15ebed97ad43d9f2b04e73c8555ac4b2a3a0a3.tar.bz2
ice-cc15ebed97ad43d9f2b04e73c8555ac4b2a3a0a3.tar.xz
ice-cc15ebed97ad43d9f2b04e73c8555ac4b2a3a0a3.zip
Replaced optionalType in StreamTrait<> by a bool fixedLength member
and updated slice2cpp accordingly No longer rely on assert / static_assert to detect incorrect use of base StreamOptionalHelper: now, the code no longer compiles vector<bool> is now handled like a built-in type: InputStream and OutputStream have now read / write vector<bool>& functions. The default implementation (StreamI) simply delegates to the same functions on BasicStream.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/StreamI.cpp12
-rw-r--r--cpp/src/Ice/StreamI.h29
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp7
-rw-r--r--cpp/src/slice2cpp/Gen.cpp12
4 files changed, 33 insertions, 27 deletions
diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp
index 431926d64b0..0cb438049c7 100644
--- a/cpp/src/Ice/StreamI.cpp
+++ b/cpp/src/Ice/StreamI.cpp
@@ -235,6 +235,12 @@ InputStreamI::read(wstring& v)
}
void
+InputStreamI::read(vector<bool>& v)
+{
+ _is->read(v);
+}
+
+void
InputStreamI::read(pair<const bool*, const bool*>& p, ::IceUtil::ScopedArray<bool>& result)
{
result.reset(_is->read(p));
@@ -528,6 +534,12 @@ OutputStreamI::write(const wstring& v)
_os->write(v);
}
+void
+OutputStreamI::write(const vector<bool>& v)
+{
+ _os->write(v);
+}
+
void
OutputStreamI::write(const bool* begin, const bool* end)
{
diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h
index ba0d103a640..496b01aeb19 100644
--- a/cpp/src/Ice/StreamI.h
+++ b/cpp/src/Ice/StreamI.h
@@ -30,8 +30,8 @@ class InputStreamI : public InputStream
{
public:
- InputStreamI(const CommunicatorPtr&, const std::vector< Byte >&);
- InputStreamI(const CommunicatorPtr&, const std::pair< const Byte*, const Byte* >&);
+ InputStreamI(const CommunicatorPtr&, const std::vector<Byte>&);
+ InputStreamI(const CommunicatorPtr&, const std::pair<const Byte*, const Byte*>&);
virtual ~InputStreamI();
virtual CommunicatorPtr communicator() const;
@@ -70,16 +70,17 @@ public:
virtual void skip(Ice::Int);
virtual void skipSize();
- virtual void read(bool& v);
- virtual void read(Byte& v);
- virtual void read(Short& v);
- virtual void read(Int& v);
- virtual void read(Long& v);
- virtual void read(Float& v);
- virtual void read(Double& v);
- virtual void read(std::string& v, bool convert = true);
+ virtual void read(bool&);
+ virtual void read(Byte&);
+ virtual void read(Short&);
+ virtual void read(Int&);
+ virtual void read(Long&);
+ virtual void read(Float&);
+ virtual void read(Double&);
+ virtual void read(std::string&, bool = true);
virtual void read(std::vector<std::string>&, bool);
- virtual void read(std::wstring& v);
+ virtual void read(std::wstring&);
+ virtual void read(std::vector<bool>&);
virtual void read(std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&);
virtual void read(std::pair<const Byte*, const Byte*>&);
virtual void read(std::pair<const Short*, const Short*>&, ::IceUtil::ScopedArray<Short>&);
@@ -132,9 +133,9 @@ public:
virtual void write(Double);
virtual void write(const std::string&, bool = true);
virtual void write(const std::vector<std::string>&, bool);
- virtual void write(const char* v, bool = true);
- virtual void write(const std::wstring& v);
-
+ virtual void write(const char*, bool = true);
+ virtual void write(const std::wstring&);
+ virtual void write(const std::vector<bool>&);
virtual void write(const bool*, const bool*);
virtual void write(const Byte*, const Byte*);
virtual void write(const Short*, const Short*);
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 83fb812cd20..086e839b195 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -105,13 +105,6 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ
}
else
{
- // Get the metadata associated at the point of definition.
- seqType = findMetaData(seq->getMetaData(), typeCtx);
- if(!seqType.empty())
- {
- return seqType;
- }
-
return fixKwd(seq->scoped());
}
}
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index d67d8aa3256..e46b5aeae43 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -6096,20 +6096,20 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p)
H << sb;
if(classMetaData)
{
- H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeStructClass;";
+ H << nl << "static const StreamTraitType type = StreamTraitTypeStructClass;";
}
else
{
- H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeStruct;";
+ H << nl << "static const StreamTraitType type = StreamTraitTypeStruct;";
}
H << nl << "static const int minWireSize = " << p->minWireSize() << ";";
if(p->isVariableLength())
{
- H << nl << "static const ::Ice::OptionalType optionalType = ::Ice::OptionalTypeFSize;";
+ H << nl << "static const bool fixedLength = false;";
}
else
{
- H << nl << "static const ::Ice::OptionalType optionalType = ::Ice::OptionalTypeVSize;";
+ H << nl << "static const bool fixedLength = true;";
}
H << eb << ";" << nl;
}
@@ -6123,10 +6123,10 @@ Slice::Gen::StreamVisitor::visitEnum(const EnumPtr& p)
H << nl << "template<>";
H << nl << "struct StreamTrait< " << scoped << ">";
H << sb;
- H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeEnum;";
+ H << nl << "static const StreamTraitType type = StreamTraitTypeEnum;";
H << nl << "static const int enumLimit = " << p->getEnumerators().size() << ";";
H << nl << "static const int minWireSize = " << p->minWireSize() << ";";
- H << nl << "static const ::Ice::OptionalType optionalType = ::Ice::OptionalTypeSize;";
+ H << nl << "static const bool fixedLength = false;";
H << eb << ";" << nl;
}