summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp76
-rw-r--r--cpp/src/slice2cpp/Gen.cpp77
2 files changed, 50 insertions, 103 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 6909df3d44d..1baee9853e6 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -418,39 +418,6 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string&
}
}
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
- {
- out << sb;
- string scope = fixKwd(cl->scope());
- if(marshal)
- {
- out << nl << scope << "__write(" << stream << ", " << fixedParam << ");";
- }
- else
- {
- ClassDefPtr def = cl->definition();
- string factory;
- string type;
- if(def && !def->isAbstract())
- {
- factory = fixKwd(cl->scoped());
- factory += "::ice_factory()";
- type = fixKwd(cl->scoped());
- type += "::ice_staticId()";
- }
- else
- {
- factory = "0";
- type = "\"\"";
- }
- out << nl << scope << "__read(" << stream << ", " << type << ", " << factory << ", " << fixedParam << ");";
- }
- out << eb;
-
- return;
- }
-
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
@@ -628,48 +595,13 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
else
{
- out << nl << fixedParam << " = " << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()]
- << "(" << tagName << ");";
+ out << nl << fixedParam << " = " << stream << deref << streamFunc
+ << outputBuiltinTable[builtin->kind()] << "(" << tagName << ");";
}
return;
}
}
- ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
- if(cl)
- {
- string scope = fixKwd(cl->scope());
- out << sb;
- if(marshal)
- {
- out << nl << scope << "__" << streamFunc << "Object(" << stream << ", " << tagName << ", "
- << fixedParam << ");";
- }
- else
- {
- ClassDefPtr def = cl->definition();
- string factory;
- string type;
- if(def && !def->isAbstract())
- {
- factory = fixKwd(cl->scoped());
- factory += "::ice_factory()";
- type = fixKwd(cl->scoped());
- type += "::ice_staticId()";
- }
- else
- {
- factory = "0";
- type = "\"\"";
- }
- out << nl << scope << "__" << streamFunc << "Object(" << stream << ", " << tagName << ", "
- << type << ", " << factory << ", " << fixedParam << ");";
- }
- out << eb;
-
- return;
- }
-
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
@@ -690,8 +622,8 @@ Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const
}
else
{
- out << nl << fixedParam << " = " << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()]
- << "Seq(" << tagName << ");";
+ out << nl << fixedParam << " = " << stream << deref << streamFunc
+ << outputBuiltinTable[builtin->kind()] << "Seq(" << tagName << ");";
}
}
else
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index ef0ae358582..a4924302bf7 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2252,15 +2252,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
- << "const ::std::string& __st, const ::Ice::ObjectFactoryPtr& __f, " << scoped << "Ptr& v)";
- C << sb;
- C << nl << "::Ice::ObjectPtr __obj;";
- C << nl << "__is->read(__st, __f, __obj);";
- C << nl << "v = " << scoped << "Ptr::dynamicCast(__obj);";
- C << eb;
-
- C << sp;
C << nl << "void" << nl << scoped.substr(2)
<< "::__marshal(const ::Ice::StreamPtr& __os) const";
C << sb;
@@ -2276,16 +2267,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__readObject(const ::Ice::StreamPtr& __is, "
- << "const ::std::string& __n, const ::std::string& __st, const ::Ice::ObjectFactoryPtr& __f, "
- << scoped << "Ptr& v)";
- C << sb;
- C << nl << "::Ice::ObjectPtr __obj;";
- C << nl << "__obj = __is->readObject(__n, __st, __f);";
- C << nl << "v = " << scoped << "Ptr::dynamicCast(__obj);";
- C << eb;
-
- C << sp;
C << nl << "void" << nl << scoped.substr(2) << "::ice_unmarshal(const ::std::string& __name, "
<< "const ::Ice::StreamPtr& __is, " << scoped << "Ptr& value)";
C << sb;
@@ -2820,15 +2801,18 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p)
H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;";
H << sp;
+ H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);";
+ H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Ptr&);";
+
+ H << sp;
H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);";
H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);";
- H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);";
- H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, const ::std::string&, "
- << "const ::Ice::ObjectFactoryPtr&, " << name << "Ptr&);";
- H << nl << _dllExport << "void __writeObject(const ::Ice::StreamPtr&, const ::std::string&, const "
+
+ H << sp;
+ H << nl << _dllExport << "void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const "
+ << name << "Ptr&);";
+ H << nl << _dllExport << "void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&, "
<< name << "Ptr&);";
- H << nl << _dllExport << "void __readObject(const ::Ice::StreamPtr&, const ::std::string&, "
- << "const ::std::string&, const ::Ice::ObjectFactoryPtr&, " << name << "Ptr&);";
H << sp;
H << nl << _dllExport << "void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const "
@@ -2846,6 +2830,35 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
+ string factory;
+ string type;
+ if(!p->isAbstract())
+ {
+ type = scoped + "::ice_staticId()";
+ factory = scoped + "::ice_factory()";
+ }
+ else
+ {
+ type = "\"\"";
+ factory = "0";
+ }
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " << scoped
+ << "Ptr& v)";
+ C << sb;
+ C << nl << "__os->write(::Ice::ObjectPtr(v));";
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, "
+ << scoped << "Ptr& v)";
+ C << sb;
+ C << nl << "::Ice::ObjectPtr __obj;";
+ C << nl << "__is->read(" << type << ", " << factory << ", __obj);";
+ C << nl << "v = " << scoped << "Ptr::dynamicCast(__obj);";
+ C << eb;
+
C << sp;
C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " << scoped
<< "Prx& v)";
@@ -2871,17 +2884,19 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " << scoped
- << "Ptr& v)";
+ C << nl << "void" << nl << scope.substr(2)
+ << "ice_marshal(const ::std::string& __name, const ::Ice::StreamPtr& __os, const " << scoped << "Ptr& v)";
C << sb;
- C << nl << "__os->write(::Ice::ObjectPtr(v));";
+ C << nl << "__os->writeObject(__name, v);";
C << eb;
C << sp;
- C << nl << "void" << nl << scope.substr(2) << "__writeObject(const ::Ice::StreamPtr& __os, "
- << "const ::std::string& __s, const " << scoped << "Ptr& v)";
+ C << nl << "void" << nl << scope.substr(2) << "ice_unmarshal(const ::std::string& __name, "
+ << "const ::Ice::StreamPtr& __is, " << scoped << "Ptr& v)";
C << sb;
- C << nl << "__os->writeObject(__s, ::Ice::ObjectPtr(v));";
+ C << nl << "::Ice::ObjectPtr __obj;";
+ C << nl << "__obj = __is->readObject(__name, " << type << ", " << factory << ");";
+ C << nl << "v = " << scoped << "Ptr::dynamicCast(__obj);";
C << eb;
C << sp;