From 39c3a0f56b6dc3b4e9c43c2a08ec0e8bfb01015d Mon Sep 17 00:00:00 2001 From: Brent Eagles Date: Tue, 5 Apr 2005 11:27:37 +0000 Subject: Removing class support from slice2javae and slice2cppe translators. removed generation of object marshalling code added validation code for parsers added feature set flag to slice parser library (defaults to Ice feature set) --- cpp/src/Slice/JavaUtil.cpp | 179 +++++++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 80 deletions(-) (limited to 'cpp/src/Slice/JavaUtil.cpp') diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 88ca2adf72f..049b62da2f4 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -154,6 +154,13 @@ Slice::JavaGenerator::JavaGenerator(const string& dir) : { } +Slice::JavaGenerator::JavaGenerator(const string& dir, Slice::FeatureProfile profile) : + _featureProfile(profile), + _dir(dir), + _out(0) +{ +} + Slice::JavaGenerator::~JavaGenerator() { assert(_out == 0); @@ -660,28 +667,31 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } case Builtin::KindObject: { - if(marshal) - { - out << nl << stream << ".writeObject(" << v << ");"; - } - else - { - if(holder) + if(_featureProfile != Slice::IceE) + { + if(marshal) { - out << nl << stream << ".readObject(" << param << ".getPatcher());"; + out << nl << stream << ".writeObject(" << v << ");"; } else { - if(patchParams.empty()) - { - out << nl << stream << ".readObject(new Patcher());"; - } - else - { - out << nl << stream << ".readObject(" << patchParams << ");"; - } + if(holder) + { + out << nl << stream << ".readObject(" << param << ".getPatcher());"; + } + else + { + if(patchParams.empty()) + { + out << nl << stream << ".readObject(new Patcher());"; + } + else + { + out << nl << stream << ".readObject(" << patchParams << ");"; + } + } } - } + } break; } case Builtin::KindObjectProxy: @@ -723,29 +733,32 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); if(cl) { - if(marshal) - { - out << nl << stream << ".writeObject(" << v << ");"; - } - else - { - string typeS = typeToString(type, TypeModeIn, package); - if(holder) + if(_featureProfile != Slice::IceE) + { + if(marshal) { - out << nl << stream << ".readObject(" << param << ".getPatcher());"; + out << nl << stream << ".writeObject(" << v << ");"; } else { - if(patchParams.empty()) - { - out << nl << stream << ".readObject(new Patcher());"; - } - else - { - out << nl << stream << ".readObject(" << patchParams << ");"; - } + string typeS = typeToString(type, TypeModeIn, package); + if(holder) + { + out << nl << stream << ".readObject(" << param << ".getPatcher());"; + } + else + { + if(patchParams.empty()) + { + out << nl << stream << ".readObject(new Patcher());"; + } + else + { + out << nl << stream << ".readObject(" << patchParams << ");"; + } + } } - } + } return; } @@ -1551,28 +1564,31 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, } case Builtin::KindObject: { - if(marshal) - { - out << nl << stream << ".writeObject(" << v << ");"; - } - else - { - if(holder) - { - out << nl << stream << ".readObject((Ice.ReadObjectCallback)" << param << ".getPatcher());"; - } - else - { - if(patchParams.empty()) - { - out << nl << stream << ".readObject(new Patcher());"; - } - else - { - out << nl << stream << ".readObject(" << patchParams << ");"; - } - } - } + if(_featureProfile != Slice::IceE) + { + if(marshal) + { + out << nl << stream << ".writeObject(" << v << ");"; + } + else + { + if(holder) + { + out << nl << stream << ".readObject((Ice.ReadObjectCallback)" << param << ".getPatcher());"; + } + else + { + if(patchParams.empty()) + { + out << nl << stream << ".readObject(new Patcher());"; + } + else + { + out << nl << stream << ".readObject(" << patchParams << ");"; + } + } + } + } break; } case Builtin::KindObjectProxy: @@ -1614,29 +1630,32 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); if(cl) { - if(marshal) - { - out << nl << stream << ".writeObject(" << v << ");"; - } - else - { - string typeS = typeToString(type, TypeModeIn, package); - if(holder) - { - out << nl << stream << ".readObject(" << param << ".getPatcher());"; - } - else - { - if(patchParams.empty()) - { - out << nl << stream << ".readObject(new Patcher());"; - } - else - { - out << nl << stream << ".readObject(" << patchParams << ");"; - } - } - } + if(_featureProfile != Slice::IceE) + { + if(marshal) + { + out << nl << stream << ".writeObject(" << v << ");"; + } + else + { + string typeS = typeToString(type, TypeModeIn, package); + if(holder) + { + out << nl << stream << ".readObject(" << param << ".getPatcher());"; + } + else + { + if(patchParams.empty()) + { + out << nl << stream << ".readObject(new Patcher());"; + } + else + { + out << nl << stream << ".readObject(" << patchParams << ");"; + } + } + } + } return; } -- cgit v1.2.3