summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CPlusPlusUtil.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-02-01 17:24:14 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-02-01 17:24:14 +0000
commit5a078c7e377e7d5e6edac44eeef8393d537d3886 (patch)
tree71c6af32b34a4b157aa768d75c8d53838c3f660d /cpp/src/Slice/CPlusPlusUtil.cpp
parentFixed Win32 failures (diff)
downloadice-5a078c7e377e7d5e6edac44eeef8393d537d3886.tar.bz2
ice-5a078c7e377e7d5e6edac44eeef8393d537d3886.tar.xz
ice-5a078c7e377e7d5e6edac44eeef8393d537d3886.zip
Fixed alternate sequence generation for more types.
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp141
1 files changed, 136 insertions, 5 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") << ");";
}
}