diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-02-01 17:24:14 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-02-01 17:24:14 +0000 |
commit | 5a078c7e377e7d5e6edac44eeef8393d537d3886 (patch) | |
tree | 71c6af32b34a4b157aa768d75c8d53838c3f660d /cpp/src | |
parent | Fixed Win32 failures (diff) | |
download | ice-5a078c7e377e7d5e6edac44eeef8393d537d3886.tar.bz2 ice-5a078c7e377e7d5e6edac44eeef8393d537d3886.tar.xz ice-5a078c7e377e7d5e6edac44eeef8393d537d3886.zip |
Fixed alternate sequence generation for more types.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 141 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 2 |
2 files changed, 137 insertions, 6 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 30d9f2883bc..587e184804d 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -605,12 +605,82 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& } if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) { - out << nl << "::IceInternal::writeConstructedSequence<" << typeStr << ">(" << stream << ", " - << fixedParam << ");"; + SequencePtr innerSeq = SequencePtr::dynamicCast(seq->type()); + if(innerSeq) + { + string innerScope = fixKwd(innerSeq->scope()); + StringList l = innerSeq->getMetaData(); + seqType = findMetaData(l); + if(seqType == "array") + { + seqType = ""; + } + builtin = BuiltinPtr::dynamicCast(innerSeq->type()); + if(!seqType.empty()) + { + out << nl << "::IceInternal::writeSequence5<" << typeStr << ", " << innerScope + << fixKwd(innerSeq->name()) << ", " << innerScope << "__U__" + << fixKwd(innerSeq->name()) << ">(" << stream << ", " << fixedParam << ", " + << innerScope << "__write);"; + } + else if(!builtin || builtin->kind() == Builtin::KindObject || + builtin->kind() == Builtin::KindObjectProxy) + { + out << nl << "::IceInternal::writeSequence4<" << typeStr << ", " + << typeToString(innerSeq->type()) << ", " << innerScope << "__U__" + << fixKwd(innerSeq->name()) << ">(" << stream << ", " << fixedParam << ", " + << innerScope << "__write);"; + } + else if(builtin->kind() == Builtin::KindBool) + { + out << nl << "::IceInternal::writeSequence1<" << typeStr << ">(" << stream << ", " + << fixedParam << ");"; + } + else + { + out << nl << "::IceInternal::writeSequence3<" << typeStr << ">(" << stream << ", " + << fixedParam << ");"; + } + return; + } + + DictionaryPtr innerDict = DictionaryPtr::dynamicCast(seq->type()); + if(innerDict) + { + string innerScope = fixKwd(innerDict->scope()); + out << nl << "::IceInternal::writeSequence5<" << typeStr << ", " << innerScope + << fixKwd(innerDict->name()) << ", " << innerScope << "__U__" << fixKwd(innerDict->name()) + << ">(" << stream << ", " << fixedParam << ", " << innerScope << "__write);"; + return; + } + + EnumPtr innerEnum = EnumPtr::dynamicCast(seq->type()); + if(innerEnum) + { + string innerScope = fixKwd(innerEnum->scope()); + out << nl << "::IceInternal::writeSequence6<" << typeStr << ", " << innerScope + << fixKwd(innerEnum->name()) << ">(" << stream << ", " << fixedParam << ", " + << innerScope << "__write);"; + return; + } + + ProxyPtr innerProxy = ProxyPtr::dynamicCast(seq->type()); + if(innerProxy) + { + string innerScope = fixKwd(innerProxy->_class()->scope()); + out << nl << "::IceInternal::writeSequence7<" << typeStr << ", " + << typeToString(innerProxy) << ">(" << stream << ", " << fixedParam << ", " + << innerScope << "__write);"; + return; + + } + + out << nl << "::IceInternal::writeSequence2<" << typeStr << ">(" << stream + << ", " << fixedParam << ");"; } else { - out << nl << "::IceInternal::writeBuiltinSequence<" << typeStr << ">(" << stream << ", " + out << nl << "::IceInternal::writeSequence1<" << typeStr << ">(" << stream << ", " << fixedParam << ");"; } } @@ -701,14 +771,75 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& } if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) { + SequencePtr innerSeq = SequencePtr::dynamicCast(seq->type()); + if(innerSeq) + { + string innerScope = fixKwd(innerSeq->scope()); + StringList l = innerSeq->getMetaData(); + seqType = findMetaData(l); + if(seqType == "array") + { + seqType = ""; + } + builtin = BuiltinPtr::dynamicCast(innerSeq->type()); + if(!seqType.empty() || !builtin || builtin->kind() == Builtin::KindObject || + builtin->kind() == Builtin::KindObjectProxy) + { + out << nl << "::IceInternal::readSequence4<" << typeStr << ", " << innerScope + << fixKwd(innerSeq->name()) << ", " << innerScope << "__U__" << fixKwd(innerSeq->name()) + << ">(" << stream << ", " << fixedParam << ", " << innerScope << "__read);"; + } + else if(builtin->kind() == Builtin::KindByte) + { + out << nl << "::IceInternal::readSequence3<" << typeStr << ">(" << stream << ", " + << fixedParam << ");"; + } + else + { + out << nl << "::IceInternal::readSequence1<" << typeStr << ">(" << stream << ", " + << fixedParam << ", true);"; + } + return; + } + + DictionaryPtr innerDict = DictionaryPtr::dynamicCast(seq->type()); + if(innerDict) + { + string innerScope = fixKwd(innerDict->scope()); + out << nl << "::IceInternal::readSequence4<" << typeStr << ", " << innerScope + << fixKwd(innerDict->name()) << ", " << innerScope << "__U__" << fixKwd(innerDict->name()) + << ">(" << stream << ", " << fixedParam << ", " << innerScope << "__read);"; + return; + } + + EnumPtr innerEnum = EnumPtr::dynamicCast(seq->type()); + if(innerEnum) + { + string innerScope = fixKwd(innerEnum->scope()); + out << nl << "::IceInternal::readSequence5<" << typeStr << ", " << innerScope + << fixKwd(innerEnum->name()) << ">(" << stream << ", " << fixedParam << ", " << innerScope + << "__read);"; + return; + } + + ProxyPtr innerProxy = ProxyPtr::dynamicCast(seq->type()); + if(innerProxy) + { + string innerScope = fixKwd(innerProxy->_class()->scope()); + out << nl << "::IceInternal::readSequence5<" << typeStr << ", " + << typeToString(innerProxy) << ">(" << stream << ", " << fixedParam << ", " << innerScope + << "__read);"; + return; + } + TypePtr elemType = seq->type(); - out << nl << "::IceInternal::readConstructedSequence<" << typeStr << ">(" << stream << ", " + out << nl << "::IceInternal::readSequence2<" << typeStr << ">(" << stream << ", " << fixedParam << ", " << elemType->minWireSize() << ", " << (elemType->isVariableLength() ? "true" : "false") << ");"; } else { - out << nl << "::IceInternal::readBuiltinSequence<" << typeStr << ">(" << stream << ", " + out << nl << "::IceInternal::readSequence1<" << typeStr << ">(" << stream << ", " << fixedParam << ", " << (builtin->kind() == Builtin::KindString ? "true" : "false") << ");"; } } diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp index fac452ac22c..2f367ed5f15 100644 --- a/cpp/src/slice2cppe/Gen.cpp +++ b/cpp/src/slice2cppe/Gen.cpp @@ -958,7 +958,7 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) H << sp << nl << _dllExport << "void __write(::IceInternal::BasicStream*, " << name << ");"; H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&);"; - C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped + C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, " << scoped << " v)"; C << sb; if(sz <= 0x7f) |