diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-09 20:59:53 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-09 20:59:53 +0000 |
commit | 7b34e5474383bb5870c4af6f29997f7df9482d4c (patch) | |
tree | 617267dd108f2d9a008b77a9ec08382386f67b92 /cpp | |
parent | fixes (diff) | |
download | ice-7b34e5474383bb5870c4af6f29997f7df9482d4c.tar.bz2 ice-7b34e5474383bb5870c4af6f29997f7df9482d4c.tar.xz ice-7b34e5474383bb5870c4af6f29997f7df9482d4c.zip |
completed structs; parser visitor changes
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Ice/Handle.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/ProxyHandle.h | 5 | ||||
-rw-r--r-- | cpp/include/IceUtil/Handle.h | 2 | ||||
-rw-r--r-- | cpp/include/Slice/Parser.h | 8 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 32 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 264 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.h | 42 | ||||
-rw-r--r-- | cpp/src/slice2cpp/GenUtil.cpp | 7 | ||||
-rw-r--r-- | cpp/src/slice2docbook/Gen.cpp | 16 | ||||
-rw-r--r-- | cpp/src/slice2docbook/Gen.h | 8 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Exceptions.cpp | 61 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Test.ice | 16 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.cpp | 65 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.h | 3 | ||||
-rw-r--r-- | cpp/test/Ice/operations/Twoways.cpp | 395 |
15 files changed, 509 insertions, 417 deletions
diff --git a/cpp/include/Ice/Handle.h b/cpp/include/Ice/Handle.h index c64307fac63..557dfdfe88e 100644 --- a/cpp/include/Ice/Handle.h +++ b/cpp/include/Ice/Handle.h @@ -15,7 +15,7 @@ #include <algorithm> // -// "Handle" or "smart pointer" classes for classes derived from +// "Handle" or "smart pointer" class for classes derived from // IceUtil::Shared or IceUtil::SimpleShared. // // In constrast to IceUtil::Handle, IceInternal::Handle requires the diff --git a/cpp/include/Ice/ProxyHandle.h b/cpp/include/Ice/ProxyHandle.h index a70e33f5bef..eb0880a01fb 100644 --- a/cpp/include/Ice/ProxyHandle.h +++ b/cpp/include/Ice/ProxyHandle.h @@ -18,8 +18,9 @@ namespace IceInternal { // -// Like Handle<>, but specifically for proxies, with support for -// checkedCast() and uncheckedCast(). +// Like IceInternal::Handle, but specifically for proxies, with +// support for checkedCast() and uncheckedCast() instead of +// dynamicCast(). // template<typename T> class ProxyHandle diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h index 2c5a40351ef..6d01a99d429 100644 --- a/cpp/include/IceUtil/Handle.h +++ b/cpp/include/IceUtil/Handle.h @@ -15,7 +15,7 @@ #include <algorithm> // -// "Handle" or "smart pointer" classes for classes derived from +// "Handle" or "smart pointer" class for classes derived from // IceUtil::Shared or IceUtil::SimpleShared. // namespace IceUtil diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index 43898fb2156..2ce5b59a561 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -122,14 +122,14 @@ class SLICE_API ParserVisitor public: virtual ~ParserVisitor() { } - virtual void visitUnitStart(const UnitPtr&) { } + virtual bool visitUnitStart(const UnitPtr&) { return true; } virtual void visitUnitEnd(const UnitPtr&) { } - virtual void visitModuleStart(const ModulePtr&) { } + virtual bool visitModuleStart(const ModulePtr&) { return true; } virtual void visitModuleEnd(const ModulePtr&) { } virtual void visitClassDecl(const ClassDeclPtr&) { } - virtual void visitClassDefStart(const ClassDefPtr&) { } + virtual bool visitClassDefStart(const ClassDefPtr&) { return true; } virtual void visitClassDefEnd(const ClassDefPtr&) { } - virtual void visitStructStart(const StructPtr&) { } + virtual bool visitStructStart(const StructPtr&) { return true; } virtual void visitStructEnd(const StructPtr&) { } virtual void visitOperation(const OperationPtr&) { } virtual void visitDataMember(const DataMemberPtr&) { } diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 3730d84c3e9..a14094e513b 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1023,9 +1023,11 @@ Slice::Module::visit(ParserVisitor* visitor) return; } - visitor->visitModuleStart(this); - Container::visit(visitor); - visitor->visitModuleEnd(this); + if (visitor->visitModuleStart(this)) + { + Container::visit(visitor); + visitor->visitModuleEnd(this); + } } Slice::Module::Module(const ContainerPtr& container, const string& name) : @@ -1342,9 +1344,11 @@ Slice::ClassDef::visit(ParserVisitor* visitor) return; } - visitor->visitClassDefStart(this); - Container::visit(visitor); - visitor->visitClassDefEnd(this); + if (visitor->visitClassDefStart(this)) + { + Container::visit(visitor); + visitor->visitClassDefEnd(this); + } } Slice::ClassDef::ClassDef(const ContainerPtr& container, const string& name, bool local, bool intf, @@ -1469,9 +1473,11 @@ Slice::Struct::visit(ParserVisitor* visitor) return; } - visitor->visitStructStart(this); - Container::visit(visitor); - visitor->visitStructEnd(this); + if (visitor->visitStructStart(this)) + { + Container::visit(visitor); + visitor->visitStructEnd(this); + } } Slice::Struct::Struct(const ContainerPtr& container, const string& name) : @@ -1994,9 +2000,11 @@ Slice::Unit::destroy() void Slice::Unit::visit(ParserVisitor* visitor) { - visitor->visitUnitStart(this); - Container::visit(visitor); - visitor->visitUnitEnd(this); + if (visitor->visitUnitStart(this)) + { + Container::visit(visitor); + visitor->visitUnitEnd(this); + } } BuiltinPtr diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 5215bf7f554..37d0491360f 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -253,30 +253,78 @@ Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllEx { } -void +bool Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasOtherConstructedTypes()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasOtherConstructedTypes()) + H << sp; + H << nl << '}'; +} + +bool +Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) +{ + string name = p->name(); + + H << sp; + H << nl << "struct" << _dllExport << ' ' << name; + H << sb; + + return true; +} + +void +Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) +{ + string name = p->name(); + string scoped = p->scoped(); + + H << sp; + H << nl << "void __write(::IceInternal::Stream*) const;"; // NOT virtual! + H << nl << "void __read(::IceInternal::Stream*);"; // NOT virtual! + H << eb << ';'; + + TypeStringList memberList; + DataMemberList dataMembers = p->dataMembers(); + DataMemberList::const_iterator q; + for (q = dataMembers.begin(); q != dataMembers.end(); ++q) { - return; + memberList.push_back(make_pair((*q)->type(), (*q)->name())); } + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::Stream* __os) const"; + C << sb; + writeMarshalCode(C, memberList, 0); + C << eb; + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::Stream* __is)"; + C << sb; + writeUnmarshalCode(C, memberList, 0); + C << eb; +} +void +Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) +{ + string name = p->name(); + string s = typeToString(p->type()); H << sp; - H << nl << '}'; + H << nl << s << ' ' << name << ';'; } void @@ -494,52 +542,46 @@ Slice::Gen::ProxyDeclVisitor::ProxyDeclVisitor(Output& h, Output& c, const strin { } -void +bool Slice::Gen::ProxyDeclVisitor::visitUnitStart(const UnitPtr& p) { if (!p->hasProxies()) { - return; + return false; } H << sp; H << nl << "namespace IceProxy" << nl << '{'; + + return true; } void Slice::Gen::ProxyDeclVisitor::visitUnitEnd(const UnitPtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::ProxyDeclVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasProxies()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::ProxyDeclVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } @@ -563,62 +605,56 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllEx { } -void +bool Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p) { if (!p->hasProxies()) { - return; + return false; } H << sp; H << nl << "namespace IceProxy" << nl << '{'; + + return true; } void Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasProxies()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) { if (p->isLocal()) { - return; + return false; } string name = p->name(); @@ -657,16 +693,13 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) C << sb; C << nl << "throw " << scoped << "PrxE(this);"; C << eb; + + return true; } void Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) { - if (p->isLocal()) - { - return; - } - string scoped = p->scoped(); H.dec(); @@ -687,13 +720,6 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) void Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - if (cl->isLocal()) - { - return; - } - string name = p->name(); string scoped = p->scoped(); string scope = p->scope(); @@ -800,62 +826,56 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& { } -void +bool Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p) { if (!p->hasProxies()) { - return; + return false; } H << sp; H << nl << "namespace IceDelegate" << nl << '{'; + + return true; } void Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasProxies()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::DelegateVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) { if (p->isLocal()) { - return; + return false; } string name = p->name(); @@ -885,29 +905,19 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p) H.dec(); H << nl << "public: "; H.inc(); + + return true; } void Slice::Gen::DelegateVisitor::visitClassDefEnd(const ClassDefPtr& p) { - if (p->isLocal()) - { - return; - } - H << eb << ';'; } void Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p) { - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - if (cl->isLocal()) - { - return; - } - string name = p->name(); TypePtr ret = p->returnType(); @@ -960,62 +970,56 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& h, Output& c, const strin { } -void +bool Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p) { if (!p->hasProxies()) { - return; + return false; } H << sp; H << nl << "namespace IceDelegateM" << nl << '{'; + + return true; } void Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasProxies()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::DelegateMVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasProxies()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { if (p->isLocal()) { - return; + return false; } string name = p->name(); @@ -1047,29 +1051,19 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) H.dec(); H << nl << "public: "; H.inc(); + + return true; } void Slice::Gen::DelegateMVisitor::visitClassDefEnd(const ClassDefPtr& p) { - if (p->isLocal()) - { - return; - } - H << eb << ';'; } void Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) { - ContainerPtr container = p->container(); - ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - if (cl->isLocal()) - { - return; - } - string name = p->name(); string scoped = p->scoped(); string scope = p->scope(); @@ -1188,28 +1182,25 @@ Slice::Gen::ObjectDeclVisitor::ObjectDeclVisitor(Output& h, Output& c, const str { } -void +bool Slice::Gen::ObjectDeclVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasClassDecls()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::ObjectDeclVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasClassDecls()) - { - return; - } - H << sp; H << nl << '}'; } @@ -1228,33 +1219,30 @@ Slice::Gen::ObjectVisitor::ObjectVisitor(Output& h, Output& c, const string& dll { } -void +bool Slice::Gen::ObjectVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasClassDefs()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::ObjectVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasClassDefs()) - { - return; - } - H << sp; H << nl << '}'; } -void +bool Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) { string name = p->name(); @@ -1505,6 +1493,8 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "return __classIds;"; C << eb; } + + return true; } void @@ -1636,6 +1626,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) H << eb << ';'; } +bool +Slice::Gen::ObjectVisitor::visitStructStart(const StructPtr&) +{ + return false; +} + void Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) { @@ -1773,26 +1769,23 @@ Slice::Gen::IceVisitor::IceVisitor(Output& h, Output& c, const string& dllExport { } -void +bool Slice::Gen::IceVisitor::visitUnitStart(const UnitPtr& p) { if (!p->hasClassDecls()) { - return; + return false; } H << sp; H << nl << "namespace IceInternal" << nl << '{'; + + return true; } void Slice::Gen::IceVisitor::visitUnitEnd(const UnitPtr& p) { - if (!p->hasClassDecls()) - { - return; - } - H << sp; H << nl << '}'; } @@ -1816,7 +1809,7 @@ Slice::Gen::IceVisitor::visitClassDecl(const ClassDeclPtr& p) } } -void +bool Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p) { string scoped = p->scoped(); @@ -1851,6 +1844,8 @@ Slice::Gen::IceVisitor::visitClassDefStart(const ClassDefPtr& p) C << eb; C << eb; } + + return true; } Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dllExport) : @@ -1858,28 +1853,25 @@ Slice::Gen::HandleVisitor::HandleVisitor(Output& h, Output& c, const string& dll { } -void +bool Slice::Gen::HandleVisitor::visitModuleStart(const ModulePtr& p) { if (!p->hasClassDecls()) { - return; + return false; } string name = p->name(); H << sp; H << nl << "namespace " << name << nl << '{'; + + return true; } void Slice::Gen::HandleVisitor::visitModuleEnd(const ModulePtr& p) { - if (!p->hasClassDecls()) - { - return; - } - H << sp; H << nl << '}'; } @@ -1901,12 +1893,12 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) } } -void +bool Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) { if (p->isLocal()) { - return; + return false; } string scoped = p->scoped(); @@ -1936,4 +1928,6 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "proxy->__copyTo(v.get());"; C << eb; C << eb; + + return true; } diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index a0b44a45dc7..42ab3f41d30 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -51,12 +51,15 @@ private: TypesVisitor(Output&, Output&, const std::string&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); + virtual bool visitStructStart(const StructPtr&); + virtual void visitStructEnd(const StructPtr&); virtual void visitSequence(const SequencePtr&); virtual void visitDictionary(const DictionaryPtr&); virtual void visitEnum(const EnumPtr&); virtual void visitNative(const NativePtr&); + virtual void visitDataMember(const DataMemberPtr&); private: @@ -72,9 +75,9 @@ private: ProxyDeclVisitor(Output&, Output&, const std::string&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual void visitClassDecl(const ClassDeclPtr&); @@ -92,11 +95,11 @@ private: ProxyVisitor(Output&, Output&, const std::string&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); virtual void visitOperation(const OperationPtr&); @@ -114,11 +117,11 @@ private: DelegateVisitor(Output&, Output&, const std::string&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); virtual void visitOperation(const OperationPtr&); @@ -136,11 +139,11 @@ private: DelegateMVisitor(Output&, Output&, const std::string&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); virtual void visitOperation(const OperationPtr&); @@ -158,7 +161,7 @@ private: ObjectDeclVisitor(Output&, Output&, const std::string&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual void visitClassDecl(const ClassDeclPtr&); @@ -176,10 +179,11 @@ private: ObjectVisitor(Output&, Output&, const std::string&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); virtual void visitClassDefEnd(const ClassDefPtr&); + virtual bool visitStructStart(const StructPtr&); virtual void visitOperation(const OperationPtr&); virtual void visitDataMember(const DataMemberPtr&); @@ -197,10 +201,10 @@ private: IceVisitor(Output&, Output&, const std::string&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); virtual void visitClassDecl(const ClassDeclPtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); private: @@ -216,10 +220,10 @@ private: HandleVisitor(Output&, Output&, const std::string&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual void visitClassDecl(const ClassDeclPtr&); - virtual void visitClassDefStart(const ClassDefPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); private: diff --git a/cpp/src/slice2cpp/GenUtil.cpp b/cpp/src/slice2cpp/GenUtil.cpp index 1a94c7a1a41..9fa50d2553c 100644 --- a/cpp/src/slice2cpp/GenUtil.cpp +++ b/cpp/src/slice2cpp/GenUtil.cpp @@ -287,6 +287,13 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& return; } + StructPtr st = StructPtr::dynamicCast(type); + if (st) + { + out << nl << param << ".__" << func << stream << ");"; + return; + } + SequencePtr seq = SequencePtr::dynamicCast(type); if (seq) { diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp index 93203be4ffe..706950f6080 100644 --- a/cpp/src/slice2docbook/Gen.cpp +++ b/cpp/src/slice2docbook/Gen.cpp @@ -53,7 +53,7 @@ Slice::Gen::generate(const UnitPtr& unit) unit->visit(this); } -void +bool Slice::Gen::visitUnitStart(const UnitPtr& p) { if (_standAlone) @@ -73,6 +73,8 @@ Slice::Gen::visitUnitStart(const UnitPtr& p) start("section", "Overview"); visitContainer(p); } + + return true; } void @@ -84,7 +86,7 @@ Slice::Gen::visitUnitEnd(const UnitPtr& p) } } -void +bool Slice::Gen::visitModuleStart(const ModulePtr& p) { start(_chapter + " id=" + scopedToId(p->scoped()), p->scoped().substr(2)); @@ -94,6 +96,8 @@ Slice::Gen::visitModuleStart(const ModulePtr& p) O.restoreIndent(); printComment(p); visitContainer(p); + + return true; } void @@ -372,7 +376,7 @@ Slice::Gen::visitContainer(const ContainerPtr& p) end(); } -void +bool Slice::Gen::visitClassDefStart(const ClassDefPtr& p) { start(_chapter + " id=" + scopedToId(p->scoped()), p->scoped().substr(2)); @@ -566,9 +570,11 @@ Slice::Gen::visitClassDefStart(const ClassDefPtr& p) } end(); + + return true; } -void +bool Slice::Gen::visitStructStart(const StructPtr& p) { start(_chapter + " id=" + scopedToId(p->scoped()), p->scoped().substr(2)); @@ -626,6 +632,8 @@ Slice::Gen::visitStructStart(const StructPtr& p) } end(); + + return true; } void diff --git a/cpp/src/slice2docbook/Gen.h b/cpp/src/slice2docbook/Gen.h index 4e420dcfaa6..c463c199be5 100644 --- a/cpp/src/slice2docbook/Gen.h +++ b/cpp/src/slice2docbook/Gen.h @@ -29,12 +29,12 @@ public: void generate(const UnitPtr&); - virtual void visitUnitStart(const UnitPtr&); + virtual bool visitUnitStart(const UnitPtr&); virtual void visitUnitEnd(const UnitPtr&); - virtual void visitModuleStart(const ModulePtr&); + virtual bool visitModuleStart(const ModulePtr&); virtual void visitContainer(const ContainerPtr&); - virtual void visitClassDefStart(const ClassDefPtr&); - virtual void visitStructStart(const StructPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); + virtual bool visitStructStart(const StructPtr&); private: diff --git a/cpp/test/Ice/operations/Exceptions.cpp b/cpp/test/Ice/operations/Exceptions.cpp index 729816dcb8f..3a364d6b72e 100644 --- a/cpp/test/Ice/operations/Exceptions.cpp +++ b/cpp/test/Ice/operations/Exceptions.cpp @@ -114,6 +114,19 @@ exceptions(Test::MyClassPrx p) p->opEx(10); test(false); } + catch(const Test::Struct& ex) + { + test(ex.p == p); + test(ex.e == Test::enum2); + test(ex.s.s == "xxx"); + ex.p->opVoid(); + } + + try + { + p->opEx(11); + test(false); + } catch(const Test::ByteS& ex) { test(ex.size() == 2); @@ -123,7 +136,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(11); + p->opEx(12); test(false); } catch(const Test::BoolS& ex) @@ -135,7 +148,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(12); + p->opEx(13); test(false); } catch(const Test::ShortS& ex) @@ -147,7 +160,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(13); + p->opEx(14); test(false); } catch(const Test::IntS& ex) @@ -159,7 +172,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(14); + p->opEx(15); test(false); } catch(const Test::LongS& ex) @@ -171,7 +184,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(15); + p->opEx(16); test(false); } catch(const Test::FloatS& ex) @@ -183,7 +196,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(16); + p->opEx(17); test(false); } catch(const Test::DoubleS& ex) @@ -195,7 +208,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(17); + p->opEx(18); test(false); } catch(const Test::StringS& ex) @@ -207,7 +220,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(18); + p->opEx(19); test(false); } catch(const Test::WStringS& ex) @@ -219,7 +232,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(19); + p->opEx(20); test(false); } catch(const Test::ByteSS& ex) @@ -234,7 +247,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(20); + p->opEx(21); test(false); } catch(const Test::BoolSS& ex) @@ -249,7 +262,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(21); + p->opEx(22); test(false); } catch(const Test::ShortSS& ex) @@ -264,7 +277,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(22); + p->opEx(23); test(false); } catch(const Test::IntSS& ex) @@ -279,7 +292,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(23); + p->opEx(24); test(false); } catch(const Test::LongSS& ex) @@ -294,7 +307,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(24); + p->opEx(25); test(false); } catch(const Test::FloatSS& ex) @@ -309,7 +322,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(25); + p->opEx(26); test(false); } catch(const Test::DoubleSS& ex) @@ -324,7 +337,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(26); + p->opEx(27); test(false); } catch(const Test::StringSS& ex) @@ -339,7 +352,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(27); + p->opEx(28); test(false); } catch(const Test::WStringSS& ex) @@ -354,7 +367,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(28); + p->opEx(29); test(false); } catch(const Test::ByteBoolD& ex) @@ -368,7 +381,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(29); + p->opEx(30); test(false); } catch(const Test::ShortIntD& ex) @@ -384,7 +397,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(30); + p->opEx(31); test(false); } catch(const Test::LongFloatD& ex) @@ -396,7 +409,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(31); + p->opEx(32); test(false); } catch(const Test::DoubleStringD& ex) @@ -412,7 +425,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(32); + p->opEx(33); test(false); } catch(const Test::WStringMyEnumD& ex) @@ -424,7 +437,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(33); + p->opEx(34); test(false); } catch(const Test::MyClassStringD& ex) @@ -454,7 +467,7 @@ exceptions(Test::MyClassPrx p) try { - p->opEx(34); + p->opEx(35); test(false); } catch(const Test::MyClassPrxE& ex) diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index 5df831053ab..788ac1da67f 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -23,6 +23,18 @@ enum MyEnum class MyClass; +struct AnotherStruct +{ + string s; +}; + +struct Struct +{ + MyClass* p; + MyEnum e; + AnotherStruct s; +}; + sequence<byte> ByteS; sequence<bool> BoolS; sequence<short> ShortS; @@ -82,6 +94,9 @@ class MyClass MyClass* opMyClass(MyClass* p1; MyClass* p2); + Struct opStruct(Struct p1, Struct p2; + Struct p3); + ByteS opByteS(ByteS p1, ByteS p2; ByteS p3); @@ -147,6 +162,7 @@ class MyClass double, string, wstring, + Struct, ByteS, BoolS, ShortS, diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index 13e4e1fb9a9..ad5b9ca2044 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -104,6 +104,14 @@ MyDerivedClassI::opMyClass(const Test::MyClassPrx& p1, return Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); } +Test::Struct +MyDerivedClassI::opStruct(const Test::Struct& p1, const ::Test::Struct& p2, ::Test::Struct& p3) +{ + p3 = p1; + p3.s.s = "a new string"; + return p2; +} + Test::ByteS MyDerivedClassI::opByteS(const Test::ByteS& p1, const Test::ByteS& p2, @@ -386,13 +394,22 @@ MyDerivedClassI::opEx(Ice::Int p) case 10: { + Test::Struct ex; + ex.p = Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); + ex.e = Test::enum2; + ex.s.s = "xxx"; + throw ex; + } + + case 11: + { Test::ByteS ex; ex.push_back(Ice::Byte(0x0f)); ex.push_back(Ice::Byte(0xf0)); throw ex; } - case 11: + case 12: { Test::BoolS ex; ex.push_back(true); @@ -400,7 +417,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 12: + case 13: { Test::ShortS ex; ex.push_back(1); @@ -408,7 +425,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 13: + case 14: { Test::IntS ex; ex.push_back(3); @@ -416,7 +433,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 14: + case 15: { Test::LongS ex; ex.push_back(5); @@ -424,7 +441,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 15: + case 16: { Test::FloatS ex; ex.push_back(Ice::Float(7.7)); @@ -432,7 +449,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 16: + case 17: { Test::DoubleS ex; ex.push_back(Ice::Double(9.9)); @@ -440,7 +457,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 17: + case 18: { Test::StringS ex; ex.push_back("abc"); @@ -448,7 +465,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 18: + case 19: { Test::WStringS ex; ex.push_back(L"xxx"); @@ -456,7 +473,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 19: + case 20: { Test::ByteS v1; Test::ByteS v2; @@ -469,7 +486,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 20: + case 21: { Test::BoolS v1; Test::BoolS v2; @@ -482,7 +499,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 21: + case 22: { Test::ShortS v1; Test::ShortS v2; @@ -495,7 +512,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 22: + case 23: { Test::IntS v1; Test::IntS v2; @@ -508,7 +525,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 23: + case 24: { Test::LongS v1; Test::LongS v2; @@ -521,7 +538,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 24: + case 25: { Test::FloatS v1; Test::FloatS v2; @@ -534,7 +551,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 25: + case 26: { Test::DoubleS v1; Test::DoubleS v2; @@ -547,7 +564,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 26: + case 27: { Test::StringS v1; Test::StringS v2; @@ -560,7 +577,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 27: + case 28: { Test::WStringS v1; Test::WStringS v2; @@ -573,7 +590,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 28: + case 29: { Test::ByteBoolD ex; ex[0] = true; @@ -581,7 +598,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 29: + case 30: { Test::ShortIntD ex; ex[-10] = 10; @@ -590,14 +607,14 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 30: + case 31: { Test::LongFloatD ex; ex[0x7fffffffffffffff] = Ice::Float(3.14); throw ex; } - case 31: + case 32: { Test::DoubleStringD ex; ex[-10.1E1] = "abc"; @@ -606,14 +623,14 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 32: + case 33: { Test::WStringMyEnumD ex; ex[L"Hello"] = Test::enum2; throw ex; } - case 33: + case 34: { Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); Test::MyClassStringD ex; @@ -622,7 +639,7 @@ MyDerivedClassI::opEx(Ice::Int p) throw ex; } - case 34: + case 35: { Test::MyClassPrx p = Test::MyClassPrx::uncheckedCast(_adapter->objectToProxy(this)); p->_throw(); diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index 62e8f9e9aa7..2295ddf36a8 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -57,6 +57,9 @@ public: virtual Test::MyClassPrx opMyClass(const Test::MyClassPrx&, Test::MyClassPrx&); + virtual Test::Struct opStruct(const Test::Struct&, const Test::Struct&, + Test::Struct&); + virtual Test::ByteS opByteS(const Test::ByteS&, const Test::ByteS&, Test::ByteS&); diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 8d26b5494cf..eda7ed90c66 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -142,6 +142,27 @@ twoways(Test::MyClassPrx p) } { + Test::Struct si1; + si1.p = p; + si1.e = Test::enum3; + si1.s.s = "abc"; + Test::Struct si2; + si2.p = 0; + si2.e = Test::enum2; + si2.s.s = "def"; + + Test::Struct so; + Test::Struct rso = p->opStruct(si1, si2, so); + test(rso.p == 0); + test(rso.e == Test::enum2); + test(rso.s.s == "def"); + test(so.p == p); + test(so.e == Test::enum3); + test(so.s.s == "a new string"); + so.p->opVoid(); + } + + { Test::ByteS bsi1; Test::ByteS bsi2; @@ -155,24 +176,24 @@ twoways(Test::MyClassPrx p) bsi2.push_back(Ice::Byte(0xf3)); bsi2.push_back(Ice::Byte(0xf4)); - Test::ByteS bvo; - Test::ByteS rvo; - - rvo = p->opByteS(bsi1, bsi2, bvo); - test(bvo.size() == 4); - test(bvo[0] == Ice::Byte(0x22)); - test(bvo[1] == Ice::Byte(0x12)); - test(bvo[2] == Ice::Byte(0x11)); - test(bvo[3] == Ice::Byte(0x01)); - test(rvo.size() == 8); - test(rvo[0] == Ice::Byte(0x01)); - test(rvo[1] == Ice::Byte(0x11)); - test(rvo[2] == Ice::Byte(0x12)); - test(rvo[3] == Ice::Byte(0x22)); - test(rvo[4] == Ice::Byte(0xf1)); - test(rvo[5] == Ice::Byte(0xf2)); - test(rvo[6] == Ice::Byte(0xf3)); - test(rvo[7] == Ice::Byte(0xf4)); + Test::ByteS bso; + Test::ByteS rso; + + rso = p->opByteS(bsi1, bsi2, bso); + test(bso.size() == 4); + test(bso[0] == Ice::Byte(0x22)); + test(bso[1] == Ice::Byte(0x12)); + test(bso[2] == Ice::Byte(0x11)); + test(bso[3] == Ice::Byte(0x01)); + test(rso.size() == 8); + test(rso[0] == Ice::Byte(0x01)); + test(rso[1] == Ice::Byte(0x11)); + test(rso[2] == Ice::Byte(0x12)); + test(rso[3] == Ice::Byte(0x22)); + test(rso[4] == Ice::Byte(0xf1)); + test(rso[5] == Ice::Byte(0xf2)); + test(rso[6] == Ice::Byte(0xf3)); + test(rso[7] == Ice::Byte(0xf4)); } { @@ -185,19 +206,19 @@ twoways(Test::MyClassPrx p) bsi2.push_back(false); - Test::BoolS bvo; - Test::BoolS rvo; - - rvo = p->opBoolS(bsi1, bsi2, bvo); - test(bvo.size() == 4); - test(bvo[0]); - test(bvo[1]); - test(!bvo[2]); - test(!bvo[3]); - test(rvo.size() == 3); - test(!rvo[0]); - test(rvo[1]); - test(rvo[2]); + Test::BoolS bso; + Test::BoolS rso; + + rso = p->opBoolS(bsi1, bsi2, bso); + test(bso.size() == 4); + test(bso[0]); + test(bso[1]); + test(!bso[2]); + test(!bso[3]); + test(rso.size() == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); } { @@ -218,32 +239,32 @@ twoways(Test::MyClassPrx p) lsi.push_back(30); lsi.push_back(20); - Test::ShortS svo; - Test::IntS ivo; - Test::LongS lvo; - Test::LongS rvo; - - rvo = p->opShortIntLongS(ssi, isi, lsi, svo, ivo, lvo); - test(svo.size() == 3); - test(svo[0] == 1); - test(svo[1] == 2); - test(svo[2] == 3); - test(ivo.size() == 4); - test(ivo[0] == 8); - test(ivo[1] == 7); - test(ivo[2] == 6); - test(ivo[3] == 5); - test(lvo.size() == 6); - test(lvo[0] == 10); - test(lvo[1] == 30); - test(lvo[2] == 20); - test(lvo[3] == 10); - test(lvo[4] == 30); - test(lvo[5] == 20); - test(rvo.size() == 3); - test(rvo[0] == 10); - test(rvo[1] == 30); - test(rvo[2] == 20); + Test::ShortS sso; + Test::IntS iso; + Test::LongS lso; + Test::LongS rso; + + rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso); + test(sso.size() == 3); + test(sso[0] == 1); + test(sso[1] == 2); + test(sso[2] == 3); + test(iso.size() == 4); + test(iso[0] == 8); + test(iso[1] == 7); + test(iso[2] == 6); + test(iso[3] == 5); + test(lso.size() == 6); + test(lso[0] == 10); + test(lso[1] == 30); + test(lso[2] == 20); + test(lso[3] == 10); + test(lso[4] == 30); + test(lso[5] == 20); + test(rso.size() == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); } { @@ -257,24 +278,24 @@ twoways(Test::MyClassPrx p) dsi.push_back(Ice::Double(1.2E10)); dsi.push_back(Ice::Double(1.3E10)); - Test::FloatS fvo; - Test::DoubleS dvo; - Test::DoubleS rvo; - - rvo = p->opFloatDoubleS(fsi, dsi, fvo, dvo); - test(fvo.size() == 2); - test(fvo[0] == ::Ice::Float(3.14)); - test(fvo[1] == ::Ice::Float(1.11)); - test(dvo.size() == 3); - test(dvo[0] == ::Ice::Double(1.3E10)); - test(dvo[1] == ::Ice::Double(1.2E10)); - test(dvo[2] == ::Ice::Double(1.1E10)); - test(rvo.size() == 5); - test(rvo[0] == ::Ice::Double(1.1E10)); - test(rvo[1] == ::Ice::Double(1.2E10)); - test(rvo[2] == ::Ice::Double(1.3E10)); - test(::Ice::Float(rvo[3]) == ::Ice::Float(3.14)); - test(::Ice::Float(rvo[4]) == ::Ice::Float(1.11)); + Test::FloatS fso; + Test::DoubleS dso; + Test::DoubleS rso; + + rso = p->opFloatDoubleS(fsi, dsi, fso, dso); + test(fso.size() == 2); + test(fso[0] == ::Ice::Float(3.14)); + test(fso[1] == ::Ice::Float(1.11)); + test(dso.size() == 3); + test(dso[0] == ::Ice::Double(1.3E10)); + test(dso[1] == ::Ice::Double(1.2E10)); + test(dso[2] == ::Ice::Double(1.1E10)); + test(rso.size() == 5); + test(rso[0] == ::Ice::Double(1.1E10)); + test(rso[1] == ::Ice::Double(1.2E10)); + test(rso[2] == ::Ice::Double(1.3E10)); + test(::Ice::Float(rso[3]) == ::Ice::Float(3.14)); + test(::Ice::Float(rso[4]) == ::Ice::Float(1.11)); } { @@ -287,19 +308,19 @@ twoways(Test::MyClassPrx p) ssi2.push_back("xyz"); - Test::StringS svo; - Test::StringS rvo; - - rvo = p->opStringS(ssi1, ssi2, svo); - test(svo.size() == 4); - test(svo[0] == "abc"); - test(svo[1] == "de"); - test(svo[2] == "fghi"); - test(svo[3] == "xyz"); - test(rvo.size() == 3); - test(rvo[0] == "fghi"); - test(rvo[1] == "de"); - test(rvo[2] == "abc"); + Test::StringS sso; + Test::StringS rso; + + rso = p->opStringS(ssi1, ssi2, sso); + test(sso.size() == 4); + test(sso[0] == "abc"); + test(sso[1] == "de"); + test(sso[2] == "fghi"); + test(sso[3] == "xyz"); + test(rso.size() == 3); + test(rso[0] == "fghi"); + test(rso[1] == "de"); + test(rso[2] == "abc"); } { @@ -312,19 +333,19 @@ twoways(Test::MyClassPrx p) ssi2.push_back(L"xyz"); - Test::WStringS svo; - Test::WStringS rvo; - - rvo = p->opWStringS(ssi1, ssi2, svo); - test(svo.size() == 4); - test(svo[0] == L"abc"); - test(svo[1] == L"de"); - test(svo[2] == L"fghi"); - test(svo[3] == L"xyz"); - test(rvo.size() == 3); - test(rvo[0] == L"fghi"); - test(rvo[1] == L"de"); - test(rvo[2] == L"abc"); + Test::WStringS sso; + Test::WStringS rso; + + rso = p->opWStringS(ssi1, ssi2, sso); + test(sso.size() == 4); + test(sso[0] == L"abc"); + test(sso[1] == L"de"); + test(sso[2] == L"fghi"); + test(sso[3] == L"xyz"); + test(rso.size() == 3); + test(rso[0] == L"fghi"); + test(rso[1] == L"de"); + test(rso[2] == L"abc"); } { @@ -342,29 +363,29 @@ twoways(Test::MyClassPrx p) bsi2[1].push_back(Ice::Byte(0xf2)); bsi2[1].push_back(Ice::Byte(0xf1)); - Test::ByteSS bvo; - Test::ByteSS rvo; - - rvo = p->opByteSS(bsi1, bsi2, bvo); - test(bvo.size() == 2); - test(bvo[0].size() == 1); - test(bvo[0][0] == Ice::Byte(0xff)); - test(bvo[1].size() == 3); - test(bvo[1][0] == Ice::Byte(0x01)); - test(bvo[1][1] == Ice::Byte(0x11)); - test(bvo[1][2] == Ice::Byte(0x12)); - test(rvo.size() == 4); - test(rvo[0].size() == 3); - test(rvo[0][0] == Ice::Byte(0x01)); - test(rvo[0][1] == Ice::Byte(0x11)); - test(rvo[0][2] == Ice::Byte(0x12)); - test(rvo[1].size() == 1); - test(rvo[1][0] == Ice::Byte(0xff)); - test(rvo[2].size() == 1); - test(rvo[2][0] == Ice::Byte(0x0e)); - test(rvo[3].size() == 2); - test(rvo[3][0] == Ice::Byte(0xf2)); - test(rvo[3][1] == Ice::Byte(0xf1)); + Test::ByteSS bso; + Test::ByteSS rso; + + rso = p->opByteSS(bsi1, bsi2, bso); + test(bso.size() == 2); + test(bso[0].size() == 1); + test(bso[0][0] == Ice::Byte(0xff)); + test(bso[1].size() == 3); + test(bso[1][0] == Ice::Byte(0x01)); + test(bso[1][1] == Ice::Byte(0x11)); + test(bso[1][2] == Ice::Byte(0x12)); + test(rso.size() == 4); + test(rso[0].size() == 3); + test(rso[0][0] == Ice::Byte(0x01)); + test(rso[0][1] == Ice::Byte(0x11)); + test(rso[0][2] == Ice::Byte(0x12)); + test(rso[1].size() == 1); + test(rso[1][0] == Ice::Byte(0xff)); + test(rso[2].size() == 1); + test(rso[2][0] == Ice::Byte(0x0e)); + test(rso[3].size() == 2); + test(rso[3][0] == Ice::Byte(0xf2)); + test(rso[3][1] == Ice::Byte(0xf1)); } { @@ -380,31 +401,31 @@ twoways(Test::MyClassPrx p) dsi[0].push_back(Ice::Double(1.2E10)); dsi[0].push_back(Ice::Double(1.3E10)); - Test::FloatSS fvo; - Test::DoubleSS dvo; - Test::DoubleSS rvo; - - rvo = p->opFloatDoubleSS(fsi, dsi, fvo, dvo); - test(fvo.size() == 3); - test(fvo[0].size() == 1); - test(fvo[0][0] == ::Ice::Float(3.14)); - test(fvo[1].size() == 1); - test(fvo[1][0] == ::Ice::Float(1.11)); - test(fvo[2].size() == 0); - test(dvo.size() == 1); - test(dvo[0].size() == 3); - test(dvo[0][0] == ::Ice::Double(1.1E10)); - test(dvo[0][1] == ::Ice::Double(1.2E10)); - test(dvo[0][2] == ::Ice::Double(1.3E10)); - test(rvo.size() == 2); - test(rvo[0].size() == 3); - test(rvo[0][0] == ::Ice::Double(1.1E10)); - test(rvo[0][1] == ::Ice::Double(1.2E10)); - test(rvo[0][2] == ::Ice::Double(1.3E10)); - test(rvo[1].size() == 3); - test(rvo[1][0] == ::Ice::Double(1.1E10)); - test(rvo[1][1] == ::Ice::Double(1.2E10)); - test(rvo[1][2] == ::Ice::Double(1.3E10)); + Test::FloatSS fso; + Test::DoubleSS dso; + Test::DoubleSS rso; + + rso = p->opFloatDoubleSS(fsi, dsi, fso, dso); + test(fso.size() == 3); + test(fso[0].size() == 1); + test(fso[0][0] == ::Ice::Float(3.14)); + test(fso[1].size() == 1); + test(fso[1][0] == ::Ice::Float(1.11)); + test(fso[2].size() == 0); + test(dso.size() == 1); + test(dso[0].size() == 3); + test(dso[0][0] == ::Ice::Double(1.1E10)); + test(dso[0][1] == ::Ice::Double(1.2E10)); + test(dso[0][2] == ::Ice::Double(1.3E10)); + test(rso.size() == 2); + test(rso[0].size() == 3); + test(rso[0][0] == ::Ice::Double(1.1E10)); + test(rso[0][1] == ::Ice::Double(1.2E10)); + test(rso[0][2] == ::Ice::Double(1.3E10)); + test(rso[1].size() == 3); + test(rso[1][0] == ::Ice::Double(1.1E10)); + test(rso[1][1] == ::Ice::Double(1.2E10)); + test(rso[1][2] == ::Ice::Double(1.3E10)); } { @@ -419,25 +440,25 @@ twoways(Test::MyClassPrx p) ssi2[2].push_back("xyz"); - Test::StringSS svo; - Test::StringSS rvo; - - rvo = p->opStringSS(ssi1, ssi2, svo); - test(svo.size() == 5); - test(svo[0].size() == 1); - test(svo[0][0] == "abc"); - test(svo[1].size() == 2); - test(svo[1][0] == "de"); - test(svo[1][1] == "fghi"); - test(svo[2].size() == 0); - test(svo[3].size() == 0); - test(svo[4].size() == 1); - test(svo[4][0] == "xyz"); - test(rvo.size() == 3); - test(rvo[0].size() == 1); - test(rvo[0][0] == "xyz"); - test(rvo[1].size() == 0); - test(rvo[2].size() == 0); + Test::StringSS sso; + Test::StringSS rso; + + rso = p->opStringSS(ssi1, ssi2, sso); + test(sso.size() == 5); + test(sso[0].size() == 1); + test(sso[0][0] == "abc"); + test(sso[1].size() == 2); + test(sso[1][0] == "de"); + test(sso[1][1] == "fghi"); + test(sso[2].size() == 0); + test(sso[3].size() == 0); + test(sso[4].size() == 1); + test(sso[4][0] == "xyz"); + test(rso.size() == 3); + test(rso[0].size() == 1); + test(rso[0][0] == "xyz"); + test(rso[1].size() == 0); + test(rso[2].size() == 0); } { @@ -452,25 +473,25 @@ twoways(Test::MyClassPrx p) ssi2[2].push_back(L"xyz"); - Test::WStringSS svo; - Test::WStringSS rvo; - - rvo = p->opWStringSS(ssi1, ssi2, svo); - test(svo.size() == 5); - test(svo[0].size() == 1); - test(svo[0][0] == L"abc"); - test(svo[1].size() == 2); - test(svo[1][0] == L"de"); - test(svo[1][1] == L"fghi"); - test(svo[2].size() == 0); - test(svo[3].size() == 0); - test(svo[4].size() == 1); - test(svo[4][0] == L"xyz"); - test(rvo.size() == 3); - test(rvo[0].size() == 1); - test(rvo[0][0] == L"xyz"); - test(rvo[1].size() == 0); - test(rvo[2].size() == 0); + Test::WStringSS sso; + Test::WStringSS rso; + + rso = p->opWStringSS(ssi1, ssi2, sso); + test(sso.size() == 5); + test(sso[0].size() == 1); + test(sso[0][0] == L"abc"); + test(sso[1].size() == 2); + test(sso[1][0] == L"de"); + test(sso[1][1] == L"fghi"); + test(sso[2].size() == 0); + test(sso[3].size() == 0); + test(sso[4].size() == 1); + test(sso[4][0] == L"xyz"); + test(rso.size() == 3); + test(rso[0].size() == 1); + test(rso[0][0] == L"xyz"); + test(rso[1].size() == 0); + test(rso[2].size() == 0); } { |