diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-09-11 21:12:38 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-09-11 21:12:38 +0000 |
commit | cbd7000724b0474b622ce8c7b47819630f2ab818 (patch) | |
tree | 6b6897c8cb85ce9b6f260df4d261d1b0341fa402 /cpp/src/Slice/CPlusPlusUtil.cpp | |
parent | another minor fix (diff) | |
download | ice-cbd7000724b0474b622ce8c7b47819630f2ab818.tar.bz2 ice-cbd7000724b0474b622ce8c7b47819630f2ab818.tar.xz ice-cbd7000724b0474b622ce8c7b47819630f2ab818.zip |
- Removed dependency on Xerces.
- Removed generic stream interface Ice::Stream and ice_marshal functions.
- Removed XML stream implementation and related test.
- Removed XML transformer and related test.
- Removed slice2xsd.
- Added C++ wrapper for the expat XML parser in IceXML::Parser.
- Removed XML encoding from Freeze.
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 205 |
1 files changed, 1 insertions, 204 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 40400966279..7fa579e051b 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -412,7 +412,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& string scope = fixKwd(cl->scope()); if(marshal) { - out << nl << scope << "__write(" << stream << ", " << fixedParam << ");"; + out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; } else { @@ -508,206 +508,3 @@ Slice::writeAllocateCode(Output& out, const list<pair<TypePtr, string> >& params out << nl << typeToString(p->first) << ' ' << fixKwd(p->second) << ';'; } } - -void -Slice::writeGenericMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& param, - bool marshal, const string& tn, const string& str, bool pointer) -{ - string stream; - if(str.empty()) - { - stream = marshal ? "__os" : "__is"; - } - else - { - stream = str; - } - - string deref; - if(pointer) - { - deref = "->"; - } - else - { - deref = '.'; - } - - static const char* outputBuiltinTable[] = - { - "Byte", - "Bool", - "Short", - "Int", - "Long", - "Float", - "Double", - "String", - "Object", - "Proxy", - "???" - }; - string tagName; - if(tn.empty()) - { - tagName = "\""; - tagName += param; - tagName += "\""; - } - else - { - tagName = tn; - } - - string fixedParam = fixKwd(param); - - string streamFunc = marshal ? "write" : "read"; - string genFunc = marshal ? "ice_marshal(" : "ice_unmarshal("; - - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin) - { - if(builtin->kind() == Builtin::KindObject) - { - streamFunc += outputBuiltinTable[builtin->kind()]; - if(marshal) - { - out << nl << stream << deref << streamFunc << "(" << tagName << ", " << fixedParam << ");"; - } - else - { - out << nl << fixedParam << " = " << stream << deref << streamFunc << "(" << tagName - << ", ::Ice::Object::ice_staticId(), 0);"; - } - return; - } - else - { - if(marshal) - { - out << nl << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()] - << "(" << tagName << ", " << fixedParam << ");"; - } - else - { - 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 typeName; - if(def && !def->isAbstract()) - { - factory = fixKwd(cl->scoped()); - factory += "::ice_factory()"; - typeName = fixKwd(cl->scoped()); - typeName += "::ice_staticId()"; - } - else - { - factory = "0"; - typeName = "\"\""; - } - out << nl << scope << "__" << streamFunc << "Object(" << stream << ", " << tagName << ", " - << typeName << ", " << factory << ", " << fixedParam << ");"; - } - out << eb; - - return; - } - - StructPtr st = StructPtr::dynamicCast(type); - if(st) - { - out << nl << fixedParam << "." << genFunc << tagName << ", " << (pointer ? "" : "&") << stream << ");"; - return; - } - - SequencePtr seq = SequencePtr::dynamicCast(type); - if(seq) - { - builtin = BuiltinPtr::dynamicCast(seq->type()); - if(builtin && builtin->kind() != Builtin::KindObject && builtin->kind() != Builtin::KindObjectProxy) - { - if(marshal) - { - out << nl << stream << deref << streamFunc << outputBuiltinTable[builtin->kind()] << "Seq(" - << tagName << ", " << fixedParam << ");"; - } - else - { - out << nl << fixedParam << " = " << stream << deref << streamFunc - << outputBuiltinTable[builtin->kind()] << "Seq(" << tagName << ");"; - } - } - else - { - string scope = fixKwd(seq->scope()); - out << nl << scope << genFunc << tagName << ", " << (pointer ? "" : "&") << stream - << ", " << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; - } - return; - } - - DictionaryPtr dict = DictionaryPtr::dynamicCast(type); - if(dict) - { - string scope = fixKwd(dict->scope()); - out << nl << scope << genFunc << tagName << ", " << (pointer ? "" : "&") << stream - << ", " << fixedParam << ", " << scope << "__U__" << fixKwd(dict->name()) << "());"; - return; - } - - ConstructedPtr constructed = ConstructedPtr::dynamicCast(type); - if(!constructed) - { - ProxyPtr proxy = ProxyPtr::dynamicCast(type); - assert(proxy); - constructed = proxy->_class(); - } - - out << nl << fixKwd(constructed->scope()) << genFunc << tagName << ", " << (pointer ? "" : "&") << stream - << ", " << fixedParam << ");"; -} - -void -Slice::writeGenericMarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret) -{ - for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p) - { - writeGenericMarshalUnmarshalCode(out, p->first, p->second, true); - } - if(ret) - { - writeGenericMarshalUnmarshalCode(out, ret, "__ret", true); - } -} - -void -Slice::writeGenericUnmarshalCode(Output& out, const list<pair<TypePtr, string> >& params, const TypePtr& ret) -{ - for(list<pair<TypePtr, string> >::const_iterator p = params.begin(); p != params.end(); ++p) - { - writeGenericMarshalUnmarshalCode(out, p->first, p->second, false); - } - if(ret) - { - writeGenericMarshalUnmarshalCode(out, ret, "__ret", false); - } -} |