summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-11-04 05:49:04 +0000
committerMichi Henning <michi@zeroc.com>2004-11-04 05:49:04 +0000
commit4ae749c385272ecf3800f9603c34d7a0d5792fdd (patch)
tree85928057b256875554e22cfb54baeb4403b12969 /cpp/src/Slice/CsUtil.cpp
parentMore streaming API changes. (diff)
downloadice-4ae749c385272ecf3800f9603c34d7a0d5792fdd.tar.bz2
ice-4ae749c385272ecf3800f9603c34d7a0d5792fdd.tar.xz
ice-4ae749c385272ecf3800f9603c34d7a0d5792fdd.zip
More code generation for streaming API.
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp56
1 files changed, 51 insertions, 5 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 26f2e896b6e..f49af7c03ae 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -394,11 +394,21 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
string typeS = typeToString(type);
if(marshal)
{
- out << nl << typeS << "Helper.__write(" << stream << ", " << param << ");";
+ out << nl << typeS << "Helper.";
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << "write(" << stream << ", " << param << ");";
}
else
{
- out << nl << param << " = " << typeS << "Helper.__read(" << stream << ')' << ';';
+ out << nl << param << " = " << typeS << "Helper.";
+ if(!streamingAPI)
+ {
+ out << "__";
+ }
+ out << "read(" << stream << ')' << ';';
}
return;
}
@@ -640,11 +650,18 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(marshal)
{
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
out << sb;
out << nl << stream << ".writeObject(" << param << "[__ix]);";
out << eb;
+ out << eb;
}
else
{
@@ -694,11 +711,18 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(marshal)
{
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
out << sb;
out << nl << param << "[__ix].__write(" << stream << ");";
out << eb;
+ out << eb;
}
else
{
@@ -742,11 +766,18 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(marshal)
{
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
out << nl << stream << ".writeSize(" << param << '.'<< limitID << ");";
out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
out << sb;
out << nl << stream << ".writeByte((byte)" << param << "[__ix]);";
out << eb;
+ out << eb;
}
else
{
@@ -796,18 +827,30 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
helperName = fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper");
}
+ string func;
+ if(!streamingAPI && ProxyPtr::dynamicCast(type))
+ {
+ func = "__";
+ }
if(marshal)
{
- string func = ProxyPtr::dynamicCast(type) ? "__write" : "write";
+ func += "write";
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << stream << ".writeSize(0);";
+ out << eb;
+ out << nl << "else";
+ out << sb;
out << nl << stream << ".writeSize(" << param << '.' << limitID << ");";
out << nl << "for(int __ix = 0; __ix < " << param << '.' << limitID << "; ++__ix)";
out << sb;
out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[__ix]);";
out << eb;
+ out << eb;
}
else
{
- string func = ProxyPtr::dynamicCast(type) ? "__read" : "read";
+ func += "read";
out << sb;
out << nl << "int szx = " << stream << ".readSize();";
if(!streamingAPI)
@@ -840,7 +883,10 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".checkSeq();";
}
- out << nl << stream << ".endElement();";
+ if(!streamingAPI)
+ {
+ out << nl << stream << ".endElement();";
+ }
}
out << eb;
if(!streamingAPI)