diff options
author | Matthew Newhook <matthew@zeroc.com> | 2002-01-25 20:26:12 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2002-01-25 20:26:12 +0000 |
commit | 05f49d24e41fc24032a70e0b10ab31ce39011835 (patch) | |
tree | b82e3e4b829449bf3bd84171c6c521484322710e /cpp/src/slice2cpp/Gen.cpp | |
parent | Fix bug with generic marshaling code for sequences & dictionaries.' (diff) | |
download | ice-05f49d24e41fc24032a70e0b10ab31ce39011835.tar.bz2 ice-05f49d24e41fc24032a70e0b10ab31ce39011835.tar.xz ice-05f49d24e41fc24032a70e0b10ab31ce39011835.zip |
Generation of helper types for sequence & dictionary.
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 63 |
1 files changed, 61 insertions, 2 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 941197197df..c383b1e568c 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -590,16 +590,32 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string scoped = p->scoped(); string scope = p->scope(); + // + // TODO: ice_marshal/ice_unmarshal, __write/__read can be + // moved into the helper. + // H << sp << nl << "class __U__" << name << " { };"; H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__" << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");"; - H << sp << nl << _dllExport << "void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const " + + H << nl << _dllExport << "void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const " << name << "&, __U__" << name << ");"; H << nl << _dllExport << "void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&, " << name << "&, __U__" << name << ");"; + H << sp << nl << "class " << _dllExport << name << "Helper"; + H << sb; + H.zeroIndent(); + H << nl << "public:"; + H.restoreIndent(); + H << sp << nl << _dllExport << "static void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const " + << name << "&);"; + H << nl << _dllExport << "static void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&, " + << name << "&);"; + H << eb << ";"; + C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " << scoped << "& v, " << scope << "__U__" << name << ")"; C << sb; @@ -675,6 +691,20 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << eb; C << nl << "__is->endReadSequence();"; C << eb; + + C << sp << nl << "void" << nl << scope.substr(2) << name << "Helper::" + << "ice_marshal(const ::std::string& __name, const ::Ice::StreamPtr& __os, const " + << name << "& v)"; + C << sb; + C << nl << scope << "ice_marshal(__name, __os, v, " << scope << "__U__" << name << "());"; + C << eb; + + C << nl << "void" << nl << scope.substr(2) << name << "Helper::" + << "ice_unmarshal(const ::std::string& __name, const ::Ice::StreamPtr& __is, " + << name << "& v)"; + C << sb; + C << nl << scope << "ice_unmarshal(__name, __is, v, " << scope << "__U__" << name << "());"; + C << eb; } } @@ -696,7 +726,11 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) { string scoped = p->scoped(); string scope = p->scope(); - + + // + // TODO: ice_marshal/ice_unmarshal, __write/__read can be + // moved into the helper. + // H << sp << nl << "class __U__" << name << " { };"; H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__" << name << ");"; @@ -707,6 +741,17 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) H << nl << _dllExport << "void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&, " << name << "&, __U__" << name << ");"; + H << sp << nl << "class " << _dllExport << name << "Helper"; + H << sb; + H.zeroIndent(); + H << nl << "public:"; + H.restoreIndent(); + H << sp << nl << _dllExport << "static void ice_marshal(const ::std::string&, const ::Ice::StreamPtr&, const " + << name << "&);"; + H << nl << _dllExport << "static void ice_unmarshal(const ::std::string&, const ::Ice::StreamPtr&, " + << name << "&);"; + H << eb << ";"; + C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " << scoped << "& v, " << scope << "__U__" << name << ")"; C << sb; @@ -760,6 +805,20 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << eb; C << nl << "__is->endReadDictionary();"; C << eb; + + C << sp << nl << "void" << nl << scope.substr(2) << name << "Helper::" + << "ice_marshal(const ::std::string& __name, const ::Ice::StreamPtr& __os, const " + << name << "& v)"; + C << sb; + C << nl << scope << "ice_marshal(__name, __os, v, " << scope << "__U__" << name << "());"; + C << eb; + + C << nl << "void" << nl << scope.substr(2) << name << "Helper::" + << "ice_unmarshal(const ::std::string& __name, const ::Ice::StreamPtr& __is, " + << name << "& v)"; + C << sb; + C << nl << scope << "ice_unmarshal(__name, __is, v, " << scope << "__U__" << name << "());"; + C << eb; } } |