summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp370
-rw-r--r--cpp/src/slice2cppe/Gen.h11
-rw-r--r--cpp/src/slice2cppe/Main.cpp6
-rw-r--r--cpp/src/slice2javae/Gen.cpp622
-rw-r--r--cpp/src/slice2javae/Gen.h18
-rw-r--r--cpp/src/slice2javae/Main.cpp6
6 files changed, 32 insertions, 1001 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index b862b66634b..0ea98bc91ff 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -22,7 +22,7 @@ using namespace IceUtil;
Slice::Gen::Gen(const string& name, const string& base, const string& headerExtension,
const string& sourceExtension, const string& include, const vector<string>& includePaths,
- const string& dllExport, const string& dir, bool imp, bool checksum, bool stream) :
+ const string& dllExport, const string& dir, bool imp, bool checksum) :
_base(base),
_headerExtension(headerExtension),
_sourceExtension(sourceExtension),
@@ -30,8 +30,7 @@ Slice::Gen::Gen(const string& name, const string& base, const string& headerExte
_includePaths(includePaths),
_dllExport(dllExport),
_impl(imp),
- _checksum(checksum),
- _stream(stream)
+ _checksum(checksum)
{
for(vector<string>::iterator p = _includePaths.begin(); p != _includePaths.end(); ++p)
{
@@ -210,19 +209,9 @@ Slice::Gen::generate(const UnitPtr& p)
C << "\n#include <Ice/Object.h>";
}
- if(_stream || p->hasNonLocalClassDefs() || p->hasNonLocalExceptions())
+ if(p->hasNonLocalExceptions())
{
- H << "\n#include <Ice/StreamF.h>";
-
- if(!p->hasNonLocalClassDefs())
- {
- C << "\n#include <Ice/LocalException.h>";
- }
-
- if(_stream)
- {
- C << "\n#include <Ice/Stream.h>";
- }
+ C << "\n#include <Ice/LocalException.h>";
}
if(_checksum)
@@ -255,10 +244,10 @@ Slice::Gen::generate(const UnitPtr& p)
IceInternalVisitor iceInternalVisitor(H, C, _dllExport);
p->visit(&iceInternalVisitor, false);
- HandleVisitor handleVisitor(H, C, _dllExport, _stream);
+ HandleVisitor handleVisitor(H, C, _dllExport);
p->visit(&handleVisitor, false);
- TypesVisitor typesVisitor(H, C, _dllExport, _stream);
+ TypesVisitor typesVisitor(H, C, _dllExport);
p->visit(&typesVisitor, false);
ProxyVisitor proxyVisitor(H, C, _dllExport);
@@ -267,7 +256,7 @@ Slice::Gen::generate(const UnitPtr& p)
DelegateVisitor delegateVisitor(H, C, _dllExport);
p->visit(&delegateVisitor, false);
- ObjectVisitor objectVisitor(H, C, _dllExport, _stream);
+ ObjectVisitor objectVisitor(H, C, _dllExport);
p->visit(&objectVisitor, false);
if(_impl)
@@ -316,8 +305,8 @@ Slice::Gen::generate(const UnitPtr& p)
}
}
-Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport, bool stream) :
- H(h), C(c), _dllExport(dllExport), _stream(stream)
+Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport) :
+ H(h), C(c), _dllExport(dllExport)
{
}
@@ -445,9 +434,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
- H << sp << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
- H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);";
-
TypeStringList memberList;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -501,76 +487,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
C << eb;
- if(_stream)
- {
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __out) const";
- C << sb;
- C << nl << "__out->writeString(::std::string(\"" << p->scoped() << "\"));";
- C << nl << "__out->startSlice();";
- writeStreamMarshalCode(C, memberList, 0);
- C << nl << "__out->endSlice();";
- if(base)
- {
- C.zeroIndent();
- C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG
- C.restoreIndent();
- C << nl << fixKwd(base->name()) << "::__write(__out);";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << fixKwd(base->scoped()) << "::__write(__out);";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2)
- << "::__read(const ::Ice::InputStreamPtr& __in, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "__in->readString();";
- C << eb;
- C << nl << "__in->startSlice();";
- writeStreamUnmarshalCode(C, memberList, 0);
- C << nl << "__in->endSlice();";
- if(base)
- {
- C.zeroIndent();
- C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG
- C.restoreIndent();
- C << nl << fixKwd(base->name()) << "::__read(__in, true);";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << fixKwd(base->scoped()) << "::__read(__in, true);";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
- }
- C << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
- C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)";
- C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"exception " << scoped .substr(2)<< " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
- }
-
if(p->usesClasses())
{
if(!base || (base && !base->usesClasses()))
@@ -707,12 +623,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*) const;";
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*);";
- if(_stream)
- {
- H << sp << nl << _dllExport << "void __write(const ::Ice::OutputStreamPtr&) const;";
- H << nl << _dllExport << "void __read(const ::Ice::InputStreamPtr&);";
- }
-
TypeStringList memberList;
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -727,41 +637,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
C << sb;
writeUnmarshalCode(C, memberList, 0);
C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __out) const";
- C << sb;
- writeStreamMarshalCode(C, memberList, 0);
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __in)";
- C << sb;
- writeStreamUnmarshalCode(C, memberList, 0);
- C << eb;
- }
}
H << eb << ';';
-
- if(!p->isLocal() && _stream)
- {
- H << sp << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
- << name << "&);";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __out, const " << scoped << "& __v)";
- C << sb;
- C << nl << "__v.__write(__out);";
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __in, " << scoped << "& __v)";
- C << sb;
- C << nl << "__v.__read(__in);";
- C << eb;
- }
}
void
@@ -796,13 +674,6 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
<< ");";
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");";
- if(_stream)
- {
- H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const "
- << name << "&);";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
- }
-
C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
<< scoped << "& v, " << scope << "__U__" << name << ")";
C << sb;
@@ -859,31 +730,6 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
C << nl << "__is->endSeq(sz);";
}
C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __out, const " << scoped << "& v)";
- C << sb;
- C << nl << "__out->writeSize(::Ice::Int(v.size()));";
- C << nl << scoped << "::const_iterator p;";
- C << nl << "for(p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeStreamMarshalUnmarshalCode(C, type, "(*p)", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __in, " << scoped << "& v)";
- C << sb;
- C << nl << "::Ice::Int sz = __in->readSize();";
- C << nl << "v.resize(sz);";
- C << nl << "for(int i = 0; i < sz; ++i)";
- C << sb;
- writeStreamMarshalUnmarshalCode(C, type, "v[i]", false);
- C << eb;
- C << eb;
- }
}
}
@@ -912,13 +758,6 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name
<< "&, __U__" << name << ");";
- if(_stream)
- {
- H << nl << _dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name
- << "&);";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
- }
-
C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const "
<< scoped << "& v, " << scope << "__U__" << name << ")";
C << sb;
@@ -945,35 +784,6 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
writeMarshalUnmarshalCode(C, valueType, "__i->second", false);
C << eb;
C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __out, const " << scoped << "& v)";
- C << sb;
- C << nl << "__out->writeSize(::Ice::Int(v.size()));";
- C << nl << scoped << "::const_iterator p;";
- C << nl << "for(p = v.begin(); p != v.end(); ++p)";
- C << sb;
- writeStreamMarshalUnmarshalCode(C, keyType, "p->first", true);
- writeStreamMarshalUnmarshalCode(C, valueType, "p->second", true);
- C << eb;
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __in, " << scoped << "& v)";
- C << sb;
- C << nl << "::Ice::Int sz = __in->readSize();";
- C << nl << "while(sz--)";
- C << sb;
- C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;";
- string pf = string("const_cast<") + ks + "&>(pair.first)";
- writeStreamMarshalUnmarshalCode(C, keyType, pf, false);
- C << nl << scoped << "::iterator __i = v.insert(v.end(), pair);";
- writeStreamMarshalUnmarshalCode(C, valueType, "__i->second", false);
- C << eb;
- C << eb;
- }
}
}
@@ -1006,13 +816,6 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");";
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);";
- if(_stream)
- {
- H << sp << nl << _dllExport << "void ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr&, " << name << ");";
- H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);";
- }
-
C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped
<< " v)";
C << sb;
@@ -1052,46 +855,6 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
C << nl << "v = static_cast< " << scoped << ">(val);";
}
C << eb;
-
- if(_stream)
- {
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name()
- << "(const ::Ice::OutputStreamPtr& __out, " << scoped << " v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "__out->writeByte(static_cast< ::Ice::Byte>(v));";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "__out->writeShort(static_cast< ::Ice::Short>(v));";
- }
- else
- {
- C << nl << "__out->writeInt(static_cast< ::Ice::Int>(v));";
- }
- C << eb;
-
- C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name()
- << "(const ::Ice::InputStreamPtr& __in, " << scoped << "& v)";
- C << sb;
- if(sz <= 0x7f)
- {
- C << nl << "::Ice::Byte val = __in->readByte();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else if(sz <= 0x7fff)
- {
- C << nl << "::Ice::Short val = __in->readShort();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- else
- {
- C << nl << "::Ice::Int val = __in->readInt();";
- C << nl << "v = static_cast< " << scoped << ">(val);";
- }
- C << eb;
- }
}
}
@@ -1709,8 +1472,8 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);";
}
-Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dllExport, bool stream) :
- H(h), C(c), _dllExport(dllExport), _stream(stream)
+Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dllExport) :
+ H(h), C(c), _dllExport(dllExport)
{
}
@@ -2008,8 +1771,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << sp;
H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);";
- H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
- H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);";
TypeStringList memberList;
DataMemberList dataMembers = p->dataMembers();
@@ -2061,71 +1822,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C.restoreIndent();
C << eb;
- if(_stream)
- {
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __out) const";
- C << sb;
- C << nl << "__out->writeTypeId(ice_staticId());";
- C << nl << "__out->startSlice();";
- writeStreamMarshalCode(C, memberList, 0);
- C << nl << "__out->endSlice();";
- C.zeroIndent();
- C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG
- C.restoreIndent();
- C << nl << (base ? fixKwd(base->name()) : "Object") << "::__write(__out);";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << (base ? fixKwd(base->scoped()) : "::Ice::Object") << "::__write(__out);";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
- C << eb;
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __in, bool __rid)";
- C << sb;
- C << nl << "if(__rid)";
- C << sb;
- C << nl << "__in->readTypeId();";
- C << eb;
- C << nl << "__in->startSlice();";
- writeStreamUnmarshalCode(C, memberList, 0);
- C << nl << "__in->endSlice();";
- C.zeroIndent();
- C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG
- C.restoreIndent();
- C << nl << (base ? fixKwd(base->name()) : "Object") << "::__read(__in, true);";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << (base ? fixKwd(base->scoped()) : "::Ice::Object") << "::__read(__in, true);";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
- C << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
- C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)";
- C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
- }
-
if(!p->isAbstract())
{
H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
@@ -2771,8 +2467,8 @@ Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p)
return true;
}
-Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dllExport, bool stream) :
- H(h), C(c), _dllExport(dllExport), _stream(stream)
+Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dllExport) :
+ H(h), C(c), _dllExport(dllExport)
{
}
@@ -2816,18 +2512,6 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);";
H << nl << _dllExport << "void __patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);";
- if(_stream)
- {
- H << sp;
- H << nl << _dllExport << "void ice_write" << name << "Prx(const ::Ice::OutputStreamPtr&, const " << name
- << "Prx&);";
- H << nl << _dllExport << "void ice_read" << name << "Prx(const ::Ice::InputStreamPtr&, " << name
- << "Prx&);";
-
- H << nl << _dllExport << "void ice_write" << name << "(const ::Ice::OutputStreamPtr&, const "
- << name << "Ptr&);";
- H << nl << _dllExport << "void ice_read" << name << "(const ::Ice::InputStreamPtr&, " << name << "Ptr&);";
- }
}
}
@@ -2883,34 +2567,6 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sb;
C << nl << "__os->write(::Ice::ObjectPtr(v));";
C << eb;
-
- if(_stream)
- {
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "ice_write" << name
- << "Prx(const ::Ice::OutputStreamPtr& __out, const " << scope << name << "Prx& v)";
- C << sb;
- C << nl << "__out->writeProxy(v);";
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scope.substr(2) << "ice_read" << name
- << "Prx(const ::Ice::InputStreamPtr& __in, " << scope << name << "Prx& v)";
- C << sb;
- C << nl << "::Ice::ObjectPrx proxy = __in->readProxy();";
- C << nl << "if(!proxy)";
- C << sb;
- C << nl << "v = 0;";
- C << eb;
- C << nl << "else";
- C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
- C << nl << "v->__copyFrom(proxy);";
- C << eb;
- C << eb;
-
- C << sp;
- }
}
return true;
diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h
index 4c5d86ae417..a7b87ee55de 100644
--- a/cpp/src/slice2cppe/Gen.h
+++ b/cpp/src/slice2cppe/Gen.h
@@ -29,7 +29,6 @@ public:
const std::string&,
const std::string&,
bool,
- bool,
bool);
~Gen();
@@ -53,13 +52,12 @@ private:
std::string _dllExport;
bool _impl;
bool _checksum;
- bool _stream;
class TypesVisitor : public ::IceUtil::noncopyable, public ParserVisitor
{
public:
- TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+ TypesVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
virtual bool visitModuleStart(const ModulePtr&);
virtual void visitModuleEnd(const ModulePtr&);
@@ -82,7 +80,6 @@ private:
::IceUtil::Output& C;
std::string _dllExport;
- bool _stream;
};
class ProxyDeclVisitor : public ::IceUtil::noncopyable, public ParserVisitor
@@ -171,7 +168,7 @@ private:
{
public:
- ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+ ObjectVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
virtual bool visitModuleStart(const ModulePtr&);
virtual void visitModuleEnd(const ModulePtr&);
@@ -192,7 +189,6 @@ private:
::IceUtil::Output& C;
std::string _dllExport;
- bool _stream;
};
class IceInternalVisitor : public ::IceUtil::noncopyable, public ParserVisitor
@@ -218,7 +214,7 @@ private:
{
public:
- HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&, bool);
+ HandleVisitor(::IceUtil::Output&, ::IceUtil::Output&, const std::string&);
virtual bool visitModuleStart(const ModulePtr&);
virtual void visitModuleEnd(const ModulePtr&);
@@ -231,7 +227,6 @@ private:
::IceUtil::Output& C;
std::string _dllExport;
- bool _stream;
};
class ImplVisitor : public ::IceUtil::noncopyable, public ParserVisitor
diff --git a/cpp/src/slice2cppe/Main.cpp b/cpp/src/slice2cppe/Main.cpp
index 7bcebe1b172..87a5f82ebfd 100644
--- a/cpp/src/slice2cppe/Main.cpp
+++ b/cpp/src/slice2cppe/Main.cpp
@@ -37,7 +37,6 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--checksum Generate checksums for Slice definitions.\n"
- "--stream Generate marshaling support for public stream API.\n"
;
// Note: --case-sensitive is intentionally not shown here!
}
@@ -56,7 +55,6 @@ main(int argc, char* argv[])
bool debug;
bool ice;
bool checksum;
- bool stream;
bool caseSensitive;
IceUtil::Options opts;
@@ -76,7 +74,6 @@ main(int argc, char* argv[])
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "checksum");
- opts.addOpt("", "stream");
opts.addOpt("", "case-sensitive");
vector<string> args;
@@ -147,7 +144,6 @@ main(int argc, char* argv[])
debug = opts.isSet("d") || opts.isSet("debug");
ice = opts.isSet("ice");
checksum = opts.isSet("checksum");
- stream = opts.isSet("stream");
caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
@@ -208,7 +204,7 @@ main(int argc, char* argv[])
else
{
Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, include,
- includePaths, dllExport, output, impl, checksum, stream);
+ includePaths, dllExport, output, impl, checksum);
if(!gen)
{
u->destroy();
diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp
index e5d33c25a03..2179a969ebc 100644
--- a/cpp/src/slice2javae/Gen.cpp
+++ b/cpp/src/slice2javae/Gen.cpp
@@ -706,7 +706,7 @@ Slice::Gen::operator!() const
}
void
-Slice::Gen::generate(const UnitPtr& p, bool stream)
+Slice::Gen::generate(const UnitPtr& p)
{
JavaGenerator::validateMetaData(p);
@@ -716,13 +716,13 @@ Slice::Gen::generate(const UnitPtr& p, bool stream)
PackageVisitor packageVisitor(_dir);
p->visit(&packageVisitor, false);
- TypesVisitor typesVisitor(_dir, stream);
+ TypesVisitor typesVisitor(_dir);
p->visit(&typesVisitor, false);
- HolderVisitor holderVisitor(_dir, stream);
+ HolderVisitor holderVisitor(_dir);
p->visit(&holderVisitor, false);
- HelperVisitor helperVisitor(_dir, stream);
+ HelperVisitor helperVisitor(_dir);
p->visit(&helperVisitor, false);
ProxyVisitor proxyVisitor(_dir);
@@ -1122,8 +1122,8 @@ Slice::Gen::PackageVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
-Slice::Gen::TypesVisitor::TypesVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::TypesVisitor::TypesVisitor(const string& dir) :
+ JavaVisitor(dir)
{
}
@@ -1305,10 +1305,6 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(allClassMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
- if(_stream)
- {
- out << ", Ice.ReadObjectCallback";
- }
out << sb;
if(allClassMembers.size() > 1)
{
@@ -1365,14 +1361,6 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
- out << sb;
- out << nl << "patch(v);";
- out << eb;
- }
-
if(allClassMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -1409,71 +1397,6 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "__is.endReadSlice();";
out << nl << "super.__read(__is, true);";
out << eb;
-
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- out << nl << "__out.writeTypeId(ice_staticId());";
- out << nl << "__out.startSlice();";
- iter = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- StringList metaData = (*d)->getMetaData();
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
- metaData);
- }
- out << nl << "__out.endSlice();";
- out << nl << "super.__write(__out);";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
- out << sb;
- out << nl << "if(__rid)";
- out << sb;
- out << nl << "String myId = __in.readTypeId();";
- out << eb;
- out << nl << "__in.startSlice();";
- iter = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- StringList metaData = (*d)->getMetaData();
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
- metaData, patchParams.str());
- }
- out << nl << "__in.endSlice();";
- out << nl << "super.__read(__in, true);";
- out << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- string scoped = p->scoped();
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
- }
}
return true;
@@ -1567,10 +1490,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(allClassMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
- if(_stream)
- {
- out << ", Ice.ReadObjectCallback";
- }
out << sb;
if(allClassMembers.size() > 1)
{
@@ -1627,14 +1546,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
- out << sb;
- out << nl << "patch(v);";
- out << eb;
- }
-
if(allClassMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -1674,77 +1585,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- out << nl << "__out.writeString(\"" << scoped << "\");";
- out << nl << "__out.startSlice();";
- iter = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- StringList metaData = (*d)->getMetaData();
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
- metaData);
- }
- out << nl << "__out.endSlice();";
- if(base)
- {
- out << nl << "super.__write(__out);";
- }
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
- out << sb;
- out << nl << "if(__rid)";
- out << sb;
- out << nl << "String myId = __in.readString();";
- out << eb;
- out << nl << "__in.startSlice();";
- iter = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1 || allClassMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
- StringList metaData = (*d)->getMetaData();
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
- metaData, patchParams.str());
- }
- out << nl << "__in.endSlice();";
- if(base)
- {
- out << nl << "super.__read(__in, true);";
- }
- out << eb;
- }
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- string scoped = p->scoped();
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in, boolean __rid)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
- }
-
if(p->usesClasses())
{
if(!base || base && !base->usesClasses())
@@ -1931,10 +1771,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(classMembers.size() != 0)
{
out << sp << nl << "private class Patcher implements IceInternal.Patcher";
- if(_stream)
- {
- out << ", Ice.ReadObjectCallback";
- }
out << sb;
if(classMembers.size() > 1)
{
@@ -1991,14 +1827,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
- out << sb;
- out << nl << "patch(v);";
- out << eb;
- }
-
if(classMembers.size() > 1)
{
out << sp << nl << "private int __member;";
@@ -2027,41 +1855,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
patchParams.str());
}
out << eb;
-
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- iter = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- StringList metaData = (*d)->getMetaData();
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), true, iter, false,
- metaData);
- }
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __in)";
- out << sb;
- iter = 0;
- classMemberCount = 0;
- for(d = members.begin(); d != members.end(); ++d)
- {
- ostringstream patchParams;
- BuiltinPtr builtin = BuiltinPtr::dynamicCast((*d)->type());
- if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast((*d)->type()))
- {
- if(classMembers.size() > 1)
- {
- patchParams << "new Patcher(" << classMemberCount++ << ')';
- }
- }
- StringList metaData = (*d)->getMetaData();
- writeStreamMarshalUnmarshalCode(out, package, (*d)->type(), fixKwd((*d)->name()), false, iter, false,
- metaData, patchParams.str());
- }
- out << eb;
- }
}
out << eb;
@@ -2170,46 +1963,6 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << nl << "return " << name << ".convert(__v);";
out << eb;
-
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __out)";
- out << sb;
- if(sz <= 0x7f)
- {
- out << nl << "__out.writeByte((byte)__value);";
- }
- else if(sz <= 0x7fff)
- {
- out << nl << "__out.writeShort((short)__value);";
- }
- else
- {
- out << nl << "__out.writeInt(__value);";
- }
- out << eb;
-
- out << sp << nl << "public static " << name << nl << "__read(Ice.InputStream __in)";
- out << sb;
- if(sz <= 0x7f)
- {
- out << nl << "int __v = __in.readByte();";
- }
- else if(sz <= 0x7fff)
- {
- out << nl << "int __v = __in.readShort();";
- }
- else
- {
- out << nl << "int __v = __in.readInt();";
- }
- out << nl << "if(__v < 0 || __v >= " << sz << ')';
- out << sb;
- out << nl << "throw new Ice.MarshalException();";
- out << eb;
- out << nl << "return " << name << ".convert(__v);";
- out << eb;
- }
}
out << sp << nl << "final static private String[] __T =";
@@ -2359,8 +2112,8 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
close();
}
-Slice::Gen::HolderVisitor::HolderVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::HolderVisitor::HolderVisitor(const string& dir) :
+ JavaVisitor(dir)
{
}
@@ -2448,10 +2201,6 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(p))
{
out << sp << nl << "public class Patcher implements IceInternal.Patcher";
- if(_stream)
- {
- out << ", Ice.ReadObjectCallback";
- }
out << sb;
out << nl << "public void";
out << nl << "patch(Ice.Object v)";
@@ -2464,13 +2213,6 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
out << nl << "return \"" << p->typeId() << "\";";
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
- out << sb;
- out << nl << "patch(v);";
- out << eb;
- }
out << eb;
out << sp << nl << "public Patcher";
@@ -2486,8 +2228,8 @@ Slice::Gen::HolderVisitor::writeHolder(const TypePtr& p)
}
}
-Slice::Gen::HelperVisitor::HelperVisitor(const string& dir, bool stream) :
- JavaVisitor(dir), _stream(stream)
+Slice::Gen::HelperVisitor::HelperVisitor(const string& dir) :
+ JavaVisitor(dir)
{
}
@@ -2741,95 +2483,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return null;";
out << eb;
- if(_stream)
- {
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << name << "Prx v)";
- out << sb;
- out << nl << "__out.writeProxy(v);";
- out << eb;
-
- out << sp << nl << "public static " << name << "Prx" << nl << "read(Ice.InputStream __in)";
- out << sb;
- out << nl << "Ice.ObjectPrx proxy = __in.readProxy();";
- out << nl << "if(proxy != null)";
- out << sb;
- out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
- out << nl << "result.__copyFrom(proxy);";
- out << nl << "return result;";
- out << eb;
- out << nl << "return null;";
- out << eb;
- }
-
out << eb;
close();
- if(_stream)
- {
- //
- // Class helper.
- //
- if(!open(getAbsolute(p, "", "", "Helper")))
- {
- return false;
- }
-
- Output& out2 = output();
-
- out2 << sp << nl << "public final class " << name << "Helper";
- out2 << sb;
-
- out2 << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixKwd(name) << " __v)";
- out2 << sb;
- out2 << nl << "__out.writeObject(__v);";
- out2 << eb;
-
- out2 << sp << nl << "public static void" << nl << "read(Ice.InputStream __in, " << name << "Holder __h)";
- out2 << sb;
- out2 << nl << "__in.readObject(__h.getPatcher());";
- out2 << eb;
-
- out2 << eb;
- close();
- }
-
return false;
}
bool
Slice::Gen::HelperVisitor::visitStructStart(const StructPtr& p)
{
- if(!p->isLocal() && _stream)
- {
- string name = p->name();
- string fixedName = fixKwd(name);
-
- if(!open(getAbsolute(p, "", "", "Helper")))
- {
- return false;
- }
-
- Output& out = output();
-
- out << sp << nl << "public final class " << name << "Helper";
- out << sb;
-
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixedName << " __v)";
- out << sb;
- out << nl << "__v.__write(__out);";
- out << eb;
-
- out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __in)";
- out << sb;
- out << nl << fixedName << " __v = new " << fixedName << "();";
- out << nl << "__v.__read(__in);";
- out << nl << "return __v;";
- out << eb;
-
- out << eb;
- close();
- }
-
return false;
}
@@ -2872,23 +2534,6 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << nl << "return __v;";
out << eb;
- if(_stream)
- {
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << typeS << " __v)";
- out << sb;
- iter = 0;
- writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
- out << eb;
-
- out << sp << nl << "public static " << typeS << nl << "read(Ice.InputStream __in)";
- out << sb;
- out << nl << typeS << " __v;";
- iter = 0;
- writeStreamSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
- out << nl << "return __v;";
- out << eb;
- }
-
out << eb;
close();
}
@@ -3027,10 +2672,6 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
// The dictionary uses class values.
//
out << sp << nl << "private static class Patcher implements IceInternal.Patcher";
- if(_stream)
- {
- out << ", Ice.ReadObjectCallback";
- }
out << sb;
string keyTypeS = keyS;
BuiltinPtr b = BuiltinPtr::dynamicCast(key);
@@ -3096,14 +2737,6 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << nl << "return \"" << value->typeId() << "\";";
out << eb;
- if(_stream)
- {
- out << sp << nl << "public void" << nl << "invoke(Ice.Object v)";
- out << sb;
- out << nl << "patch(v);";
- out << eb;
- }
-
out << sp << nl << "private java.util.Map __m;";
out << nl << "private " << keyTypeS << " __key;";
out << eb;
@@ -3219,213 +2852,6 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << nl << "return __r;";
out << eb;
- if(_stream)
- {
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << "java.util.Map __v)";
- out << sb;
- out << nl << "if(__v == null)";
- out << sb;
- out << nl << "__out.writeSize(0);";
- out << eb;
- out << nl << "else";
- out << sb;
- out << nl << "__out.writeSize(__v.size());";
- out << nl << "java.util.Iterator __i = __v.entrySet().iterator();";
- out << nl << "while(__i.hasNext())";
- out << sb;
- out << nl << "java.util.Map.Entry __e = (java.util.Map.Entry)" << "__i.next();";
- iter = 0;
- for(i = 0; i < 2; i++)
- {
- string val;
- string arg;
- TypePtr type;
- if(i == 0)
- {
- arg = "__e.getKey()";
- type = key;
- }
- else
- {
- arg = "__e.getValue()";
- type = value;
- }
-
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(b)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- val = "((java.lang.Byte)" + arg + ").byteValue()";
- break;
- }
- case Builtin::KindBool:
- {
- val = "((java.lang.Boolean)" + arg + ").booleanValue()";
- break;
- }
- case Builtin::KindShort:
- {
- val = "((java.lang.Short)" + arg + ").shortValue()";
- break;
- }
- case Builtin::KindInt:
- {
- val = "((java.lang.Integer)" + arg + ").intValue()";
- break;
- }
- case Builtin::KindLong:
- {
- val = "((java.lang.Long)" + arg + ").longValue()";
- break;
- }
- case Builtin::KindFloat:
- {
- val = "((java.lang.Float)" + arg + ").floatValue()";
- break;
- }
- case Builtin::KindDouble:
- {
- val = "((java.lang.Double)" + arg + ").doubleValue()";
- break;
- }
- case Builtin::KindString:
- case Builtin::KindObject:
- case Builtin::KindObjectProxy:
- {
- break;
- }
- case Builtin::KindLocalObject:
- {
- assert(false);
- break;
- }
- }
- }
-
- if(val.empty())
- {
- val = "((" + typeToString(type, TypeModeIn, package) + ')' + arg + ')';
- }
- writeStreamMarshalUnmarshalCode(out, package, type, val, true, iter, false);
- }
- out << eb;
- out << eb;
- out << eb;
-
- out << sp << nl << "public static " << (dictType.empty() ? "java.util.Map" : dictType)
- << nl << "read(Ice.InputStream __in)";
- out << sb;
- out << nl << "int __sz = __in.readSize();";
- out << nl << (dictType.empty() ? "java.util.Map" : dictType) << " __r = new "
- << (dictType.empty() ? "java.util.HashMap(__sz)" : dictType + "()") << ';';
- out << nl << "for(int __i = 0; __i < __sz; __i++)";
- out << sb;
- iter = 0;
- for(i = 0; i < 2; i++)
- {
- string arg;
- TypePtr type;
- if(i == 0)
- {
- arg = "__key";
- type = key;
- }
- else
- {
- arg = "__value";
- type = value;
- }
-
- BuiltinPtr b = BuiltinPtr::dynamicCast(type);
- if(b)
- {
- switch(b->kind())
- {
- case Builtin::KindByte:
- {
- out << nl << "java.lang.Byte " << arg << " = new java.lang.Byte(__in.readByte());";
- break;
- }
- case Builtin::KindBool:
- {
- out << nl << "java.lang.Boolean " << arg << " = new java.lang.Boolean(__in.readBool());";
- break;
- }
- case Builtin::KindShort:
- {
- out << nl << "java.lang.Short " << arg << " = new java.lang.Short(__in.readShort());";
- break;
- }
- case Builtin::KindInt:
- {
- out << nl << "java.lang.Integer " << arg << " = new java.lang.Integer(__in.readInt());";
- break;
- }
- case Builtin::KindLong:
- {
- out << nl << "java.lang.Long " << arg << " = new java.lang.Long(__in.readLong());";
- break;
- }
- case Builtin::KindFloat:
- {
- out << nl << "java.lang.Float " << arg << " = new java.lang.Float(__in.readFloat());";
- break;
- }
- case Builtin::KindDouble:
- {
- out << nl << "java.lang.Double " << arg << " = new java.lang.Double(__in.readDouble());";
- break;
- }
- case Builtin::KindString:
- {
- out << nl << "java.lang.String " << arg << " = __in.readString();";
- break;
- }
- case Builtin::KindObject:
- {
- out << nl << "__in.readObject(new Patcher(__r, __key));";
- break;
- }
- case Builtin::KindObjectProxy:
- {
- out << nl << "Ice.ObjectPrx " << arg << " = __in.readProxy();";
- break;
- }
- case Builtin::KindLocalObject:
- {
- assert(false);
- break;
- }
- }
- }
- else
- {
- string s = typeToString(type, TypeModeIn, package);
- BuiltinPtr builtin2 = BuiltinPtr::dynamicCast(type);
- if((builtin2 && builtin2->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(type))
- {
- writeStreamMarshalUnmarshalCode(out, package, type, arg, false, iter, false, StringList(),
- "new Patcher(__r, __key)");
- }
- else
- {
- out << nl << s << ' ' << arg << ';';
- writeStreamMarshalUnmarshalCode(out, package, type, arg, false, iter, false);
- }
- }
- }
- if(!(builtin && builtin->kind() == Builtin::KindObject) && !ClassDeclPtr::dynamicCast(value))
- {
- out << nl << "__r.put(__key, __value);";
- }
- out << eb;
- out << nl << "return __r;";
- out << eb;
- }
-
out << eb;
close();
}
@@ -3434,34 +2860,6 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
void
Slice::Gen::HelperVisitor::visitEnum(const EnumPtr& p)
{
- if(!p->isLocal() && _stream)
- {
- string name = p->name();
- string fixedName = fixKwd(name);
-
- if(!open(getAbsolute(p, "", "", "Helper")))
- {
- return;
- }
-
- Output& out = output();
-
- out << sp << nl << "public final class " << name << "Helper";
- out << sb;
-
- out << sp << nl << "public static void" << nl << "write(Ice.OutputStream __out, " << fixedName << " __v)";
- out << sb;
- out << nl << "__v.__write(__out);";
- out << eb;
-
- out << sp << nl << "public static " << fixedName << nl << "read(Ice.InputStream __in)";
- out << sb;
- out << nl << "return " << fixedName << ".__read(__in);";
- out << eb;
-
- out << eb;
- close();
- }
}
Slice::Gen::ProxyVisitor::ProxyVisitor(const string& dir) :
diff --git a/cpp/src/slice2javae/Gen.h b/cpp/src/slice2javae/Gen.h
index 907851578f2..c0437cc15ce 100644
--- a/cpp/src/slice2javae/Gen.h
+++ b/cpp/src/slice2javae/Gen.h
@@ -72,7 +72,7 @@ public:
bool operator!() const; // Returns true if there was a constructor error
- void generate(const UnitPtr&, bool);
+ void generate(const UnitPtr&);
void generateTie(const UnitPtr&);
void generateImpl(const UnitPtr&);
void generateImplTie(const UnitPtr&);
@@ -119,7 +119,7 @@ private:
{
public:
- TypesVisitor(const std::string&, bool);
+ TypesVisitor(const std::string&);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual void visitClassDefEnd(const ClassDefPtr&);
@@ -130,17 +130,13 @@ private:
virtual void visitEnum(const EnumPtr&);
virtual void visitConst(const ConstPtr&);
virtual void visitDataMember(const DataMemberPtr&);
-
- private:
-
- bool _stream;
};
class HolderVisitor : public JavaVisitor
{
public:
- HolderVisitor(const std::string&, bool);
+ HolderVisitor(const std::string&);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual bool visitStructStart(const StructPtr&);
@@ -151,25 +147,19 @@ private:
private:
void writeHolder(const TypePtr&);
-
- bool _stream;
};
class HelperVisitor : public JavaVisitor
{
public:
- HelperVisitor(const std::string&, bool);
+ HelperVisitor(const std::string&);
virtual bool visitClassDefStart(const ClassDefPtr&);
virtual bool visitStructStart(const StructPtr&);
virtual void visitSequence(const SequencePtr&);
virtual void visitDictionary(const DictionaryPtr&);
virtual void visitEnum(const EnumPtr&);
-
- private:
-
- bool _stream;
};
class ProxyVisitor : public JavaVisitor
diff --git a/cpp/src/slice2javae/Main.cpp b/cpp/src/slice2javae/Main.cpp
index 36406c3912c..00ac6db90f0 100644
--- a/cpp/src/slice2javae/Main.cpp
+++ b/cpp/src/slice2javae/Main.cpp
@@ -35,7 +35,6 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
"--checksum CLASS Generate checksums for Slice definitions into CLASS.\n"
- "--stream Generate marshaling support for public stream API.\n"
;
// Note: --case-sensitive is intentionally not shown here!
}
@@ -54,7 +53,6 @@ main(int argc, char* argv[])
bool debug;
bool ice;
string checksumClass;
- bool stream;
bool caseSensitive;
IceUtil::Options opts;
@@ -72,7 +70,6 @@ main(int argc, char* argv[])
opts.addOpt("d", "debug");
opts.addOpt("", "ice");
opts.addOpt("", "checksum", IceUtil::Options::NeedArg);
- opts.addOpt("", "stream");
opts.addOpt("", "case-sensitive");
vector<string>args;
@@ -136,7 +133,6 @@ main(int argc, char* argv[])
{
checksumClass = opts.optArg("checksum");
}
- stream = opts.isSet("stream");
caseSensitive = opts.isSet("case-sensitive");
if(args.empty())
@@ -212,7 +208,7 @@ main(int argc, char* argv[])
p->destroy();
return EXIT_FAILURE;
}
- gen.generate(p, stream);
+ gen.generate(p);
if(tie)
{
gen.generateTie(p);