summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-11-10 14:07:23 -0500
committerBernard Normier <bernard@zeroc.com>2016-11-10 14:07:23 -0500
commit4e06be13bf710ec95f5d207c59b90a0584b857b4 (patch)
tree5bff3948e1c2db2809ac03ef8f4aa8ba14d03c3f /cpp/src/slice2cs
parentVisual Studio settings for C++/C# languages (diff)
downloadice-4e06be13bf710ec95f5d207c59b90a0584b857b4.tar.bz2
ice-4e06be13bf710ec95f5d207c59b90a0584b857b4.tar.xz
ice-4e06be13bf710ec95f5d207c59b90a0584b857b4.zip
Replaced all double-underscores in C#
Diffstat (limited to 'cpp/src/slice2cs')
-rw-r--r--cpp/src/slice2cs/CsUtil.cpp358
-rw-r--r--cpp/src/slice2cs/CsUtil.h10
-rw-r--r--cpp/src/slice2cs/Gen.cpp702
-rw-r--r--cpp/src/slice2cs/Gen.h11
4 files changed, 561 insertions, 520 deletions
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp
index 3487cde3fce..a9ac2f94042 100644
--- a/cpp/src/slice2cs/CsUtil.cpp
+++ b/cpp/src/slice2cs/CsUtil.cpp
@@ -145,7 +145,7 @@ Slice::CsGenerator::fixId(const ContainedPtr& cont, int baseTypes, bool mangleCa
if(contained && contained->hasMetaData("clr:property") &&
(contained->containedType() == Contained::ContainedTypeClass || contained->containedType() == Contained::ContainedTypeStruct))
{
- return cont->name() + "__prop";
+ return "_" + cont->name();
}
else
{
@@ -507,9 +507,14 @@ void
Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
const TypePtr& type,
const string& param,
- bool marshal)
+ bool marshal,
+ const string& customStream)
{
- string stream = marshal ? "os__" : "is__";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
@@ -687,7 +692,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << param << ".write__(" << stream << ");";
+ out << nl << param << ".iceWrite(" << stream << ");";
}
}
else
@@ -698,7 +703,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << param << ".read__(" << stream << ");";
+ out << nl << param << ".iceRead(" << stream << ");";
}
}
return;
@@ -722,7 +727,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- writeSequenceMarshalUnmarshalCode(out, seq, param, marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, param, marshal, true, stream);
return;
}
@@ -752,9 +757,14 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
const TypePtr& type,
const string& param,
int tag,
- bool marshal)
+ bool marshal,
+ const string& customStream)
{
- string stream = marshal ? "os__" : "is__";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
@@ -901,9 +911,9 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag
<< ", Ice.OptionalFormat.FSize))";
out << sb;
- out << nl << "int pos__ = " << stream << ".startSize();";
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal);
- out << nl << stream << ".endSize(pos__);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
else
@@ -911,10 +921,10 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << nl << "if(" << stream << ".readOptional(" << tag << ", Ice.OptionalFormat.FSize))";
out << sb;
out << nl << stream << ".skip(4);";
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
string typeS = typeToString(type);
out << nl << typeS << ' ' << tmp << ';';
- writeMarshalUnmarshalCode(out, type, tmp, marshal);
+ writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -949,16 +959,16 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << sb;
if(st->isVariableLength())
{
- out << nl << "int pos__ = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
}
else
{
out << nl << stream << ".writeSize(" << st->minWireSize() << ");";
}
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal);
+ writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
if(st->isVariableLength())
{
- out << nl << stream << ".endSize(pos__);";
+ out << nl << stream << ".endSize(pos);";
}
out << eb;
}
@@ -975,7 +985,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << nl << stream << ".skipSize();";
}
string typeS = typeToString(type);
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
if(isValueType(st))
{
out << nl << typeS << ' ' << tmp << " = new " << typeS << "();";
@@ -984,7 +994,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
{
out << nl << typeS << ' ' << tmp << " = null;";
}
- writeMarshalUnmarshalCode(out, type, tmp, marshal);
+ writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1011,9 +1021,9 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << nl << "if(" << stream << ".readOptional(" << tag << ", Ice.OptionalFormat.Size))";
out << sb;
string typeS = typeToString(type);
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << typeS << ' ' << tmp << ';';
- writeMarshalUnmarshalCode(out, type, tmp, marshal);
+ writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1027,7 +1037,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- writeOptionalSequenceMarshalUnmarshalCode(out, seq, param, tag, marshal);
+ writeOptionalSequenceMarshalUnmarshalCode(out, seq, param, tag, marshal, stream);
return;
}
@@ -1042,7 +1052,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << sb;
if(keyType->isVariableLength() || valueType->isVariableLength())
{
- out << nl << "int pos__ = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
}
else
{
@@ -1050,10 +1060,10 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
<< (keyType->minWireSize() + valueType->minWireSize()) << " + (" << param
<< ".Value.Count > 254 ? 5 : 1));";
}
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal);
+ writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
if(keyType->isVariableLength() || valueType->isVariableLength())
{
- out << nl << stream << ".endSize(pos__);";
+ out << nl << stream << ".endSize(pos);";
}
out << eb;
}
@@ -1070,9 +1080,9 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
out << nl << stream << ".skipSize();";
}
string typeS = typeToString(type);
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << typeS << ' ' << tmp << " = new " << typeS << "();";
- writeMarshalUnmarshalCode(out, type, tmp, marshal);
+ writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1087,9 +1097,14 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
const string& param,
bool marshal,
- bool useHelper)
+ bool useHelper,
+ const string& customStream)
{
- string stream = marshal ? "os__" : "is__";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
if(useHelper)
{
@@ -1175,30 +1190,30 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
// cannot contain Ice.Object.
//
out << nl << "Ice.ObjectPrx[] " << param << "_tmp = " << param << ".ToArray();";
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_tmp.Length; ++ix)";
out << sb;
- out << nl << stream << ".writeProxy(" << param << "_tmp[ix__]);";
+ out << nl << stream << ".writeProxy(" << param << "_tmp[ix]);";
out << eb;
}
else
{
out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
- << "> e__ = " << param << ".GetEnumerator();";
- out << nl << "while(e__.MoveNext())";
+ << "> e = " << param << ".GetEnumerator();";
+ out << nl << "while(e.MoveNext())";
out << sb;
string func = (builtin->kind() == Builtin::KindObject ||
builtin->kind() == Builtin::KindValue) ? "writeValue" : "writeProxy";
- out << nl << stream << '.' << func << "(e__.Current);";
+ out << nl << stream << '.' << func << "(e.Current);";
out << eb;
}
}
else
{
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << '.' << limitID << "; ++ix)";
out << sb;
string func = (builtin->kind() == Builtin::KindObject ||
builtin->kind() == Builtin::KindValue) ? "writeValue" : "writeProxy";
- out << nl << stream << '.' << func << '(' << param << "[ix__]);";
+ out << nl << stream << '.' << func << '(' << param << "[ix]);";
out << eb;
}
out << eb;
@@ -1231,7 +1246,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << typeToString(seq) << "(" << param << "_lenx);";
}
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_lenx; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_lenx; ++ix)";
out << sb;
string patcherName;
if(isCustom)
@@ -1250,9 +1265,9 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
patcherName = "Sequence";
}
- out << nl << "IceInternal." << patcherName << "Patcher<Ice.Value> p__ = new IceInternal."
- << patcherName << "Patcher<Ice.Value>(\"::Ice::Object\", " << param << ", ix__);";
- out << nl << stream << ".readValue(p__.patch);";
+ out << nl << "IceInternal." << patcherName << "Patcher<Ice.Value> p = new IceInternal."
+ << patcherName << "Patcher<Ice.Value>(\"::Ice::Object\", " << param << ", ix);";
+ out << nl << stream << ".readValue(p.patch);";
}
else
{
@@ -1273,17 +1288,17 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << typeToString(seq) << "(" << param << "_lenx);";
}
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_lenx; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_lenx; ++ix)";
out << sb;
if(isArray)
{
- out << nl << param << "[ix__] = " << stream << ".readProxy();";
+ out << nl << param << "[ix] = " << stream << ".readProxy();";
}
else
{
- out << nl << "Ice.ObjectPrx val__ = new Ice.ObjectPrxHelperBase();";
- out << nl << "val__ = " << stream << ".readProxy();";
- out << nl << param << "." << addMethod << "(val__);";
+ out << nl << "Ice.ObjectPrx val = new Ice.ObjectPrxHelperBase();";
+ out << nl << "val = " << stream << ".readProxy();";
+ out << nl << param << "." << addMethod << "(val);";
}
}
out << eb;
@@ -1338,8 +1353,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
out << nl << param << " = new " << "global::" << genericType << "<"
<< typeToString(type) << ">();";
- out << nl << "int szx__ = " << stream << ".readSize();";
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << nl << "int szx = " << stream << ".readSize();";
+ out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
out << nl << param << ".Add(" << stream << ".read" << func << "());";
out << eb;
@@ -1376,17 +1391,17 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
// stack bottom-up here.
//
out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
- << "> e__ = " << param << ".GetEnumerator();";
- out << nl << "while(e__.MoveNext())";
+ << "> e = " << param << ".GetEnumerator();";
+ out << nl << "while(e.MoveNext())";
out << sb;
- out << nl << stream << ".writeValue(e__.Current);";
+ out << nl << stream << ".writeValue(e.Current);";
out << eb;
}
else
{
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << '.' << limitID << "; ++ix)";
out << sb;
- out << nl << stream << ".writeValue(" << param << "[ix__]);";
+ out << nl << stream << ".writeValue(" << param << "[ix]);";
out << eb;
}
out << eb;
@@ -1394,12 +1409,12 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
+ out << nl << "int szx = " << stream << ".readAndCheckSeqSize("
<< static_cast<unsigned>(type->minWireSize()) << ");";
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "szx__");
+ out << toArrayAlloc(typeS + "[]", "szx");
}
else if(isCustom)
{
@@ -1410,16 +1425,16 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << "_System.Collections.Generic." << genericType << "<" << typeS << ">(";
if(!isLinkedList)
{
- out << "szx__";
+ out << "szx";
}
out << ")";
}
else
{
- out << fixId(seq->scoped()) << "(szx__)";
+ out << fixId(seq->scoped()) << "(szx)";
}
out << ';';
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
string patcherName;
@@ -1441,7 +1456,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
string scoped = ContainedPtr::dynamicCast(type)->scoped();
out << nl << "IceInternal." << patcherName << "Patcher<" << typeS << "> spx = new IceInternal."
- << patcherName << "Patcher<" << typeS << ">(\"" << scoped << "\", " << param << ", ix__);";
+ << patcherName << "Patcher<" << typeS << ">(\"" << scoped << "\", " << param << ", ix);";
out << nl << stream << ".readValue(spx.patch);";
out << eb;
out << eb;
@@ -1469,18 +1484,18 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(isStack)
{
out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_tmp.Length; ++ix)";
}
else
{
out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
- << "> e__ = " << param << ".GetEnumerator();";
- out << nl << "while(e__.MoveNext())";
+ << "> e = " << param << ".GetEnumerator();";
+ out << nl << "while(e.MoveNext())";
}
}
else
{
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << '.' << limitID << "; ++ix)";
}
out << sb;
string call;
@@ -1488,12 +1503,12 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
if(isValueType(type))
{
- call = "e__.Current";
+ call = "e.Current";
}
else
{
- call = "(e__.Current == null ? new ";
- call += typeS + "() : e__.Current)";
+ call = "(e.Current == null ? new ";
+ call += typeS + "() : e.Current)";
}
}
else
@@ -1514,20 +1529,20 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
call += "_tmp";
}
- call += "[ix__] == null ? new " + typeS + "() : " + param;
+ call += "[ix] == null ? new " + typeS + "() : " + param;
if(isStack)
{
call += "_tmp";
}
}
- call += "[ix__]";
+ call += "[ix]";
if(!isValueType(type))
{
call += ")";
}
}
call += ".";
- call += "write__";
+ call += "iceWrite";
call += "(" + stream + ");";
out << nl << call;
out << eb;
@@ -1536,11 +1551,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
+ out << nl << "int szx = " << stream << ".readAndCheckSeqSize("
<< static_cast<unsigned>(type->minWireSize()) << ");";
if(isArray)
{
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isCustom)
{
@@ -1548,44 +1563,44 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else if(isStack)
{
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << typeS << "[] " << param << "_tmp = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isGeneric)
{
out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(";
if(!isLinkedList)
{
- out << "szx__";
+ out << "szx";
}
out << ");";
}
else
{
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
+ out << nl << param << " = new " << fixId(seq->scoped()) << "(szx);";
}
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
if(isArray || isStack)
{
- string v = isArray ? param : param + "__tmp";
+ string v = isArray ? param : param + "_tmp";
if(!isValueType(st))
{
- out << nl << v << "[ix__] = new " << typeS << "();";
+ out << nl << v << "[ix] = new " << typeS << "();";
}
- out << nl << v << "[ix__].read__(" << stream << ");";
+ out << nl << v << "[ix].iceRead(" << stream << ");";
}
else
{
- out << nl << typeS << " val__ = new " << typeS << "();";
- out << nl << "val__.read__(" << stream << ");";
- out << nl << param << "." << addMethod << "(val__);";
+ out << nl << typeS << " val = new " << typeS << "();";
+ out << nl << "val.iceRead(" << stream << ");";
+ out << nl << param << "." << addMethod << "(val);";
}
out << eb;
if(isStack)
{
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
+ out << nl << "_System.Array.Reverse(" << param << "_tmp);";
out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
- << param << "__tmp);";
+ << param << "_tmp);";
}
out << eb;
}
@@ -1612,26 +1627,26 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(isStack)
{
out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_tmp.Length; ++ix)";
out << sb;
- out << nl << stream << ".writeEnum((int)" << param << "_tmp[ix__], " << en->maxValue() << ");";
+ out << nl << stream << ".writeEnum((int)" << param << "_tmp[ix], " << en->maxValue() << ");";
out << eb;
}
else
{
out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
- << "> e__ = " << param << ".GetEnumerator();";
- out << nl << "while(e__.MoveNext())";
+ << "> e = " << param << ".GetEnumerator();";
+ out << nl << "while(e.MoveNext())";
out << sb;
- out << nl << stream << ".writeEnum((int)e__.Current, " << en->maxValue() << ");";
+ out << nl << stream << ".writeEnum((int)e.Current, " << en->maxValue() << ");";
out << eb;
}
}
else
{
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << '.' << limitID << "; ++ix)";
out << sb;
- out << nl << stream << ".writeEnum((int)" << param << "[ix__], " << en->maxValue() << ");";
+ out << nl << stream << ".writeEnum((int)" << param << "[ix], " << en->maxValue() << ");";
out << eb;
}
out << eb;
@@ -1639,11 +1654,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize(" <<
+ out << nl << "int szx = " << stream << ".readAndCheckSeqSize(" <<
static_cast<unsigned>(type->minWireSize()) << ");";
if(isArray)
{
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isCustom)
{
@@ -1651,27 +1666,27 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else if(isStack)
{
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << typeS << "[] " << param << "_tmp = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isGeneric)
{
out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(";
if(!isLinkedList)
{
- out << "szx__";
+ out << "szx";
}
out << ");";
}
else
{
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
+ out << nl << param << " = new " << fixId(seq->scoped()) << "(szx);";
}
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
if(isArray || isStack)
{
- string v = isArray ? param : param + "__tmp";
- out << nl << v << "[ix__] = (" << typeS << ')' << stream << ".readEnum(" << en->maxValue() << ");";
+ string v = isArray ? param : param + "_tmp";
+ out << nl << v << "[ix] = (" << typeS << ')' << stream << ".readEnum(" << en->maxValue() << ");";
}
else
{
@@ -1681,9 +1696,9 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(isStack)
{
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
+ out << nl << "_System.Array.Reverse(" << param << "_tmp);";
out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
- << param << "__tmp);";
+ << param << "_tmp);";
}
out << eb;
}
@@ -1719,26 +1734,26 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
if(isStack)
{
out << nl << typeS << "[] " << param << "_tmp = " << param << ".ToArray();";
- out << nl << "for(int ix__ = 0; ix__ < " << param << "_tmp.Length; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << "_tmp.Length; ++ix)";
out << sb;
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "_tmp[ix__]);";
+ out << nl << helperName << '.' << func << '(' << stream << ", " << param << "_tmp[ix]);";
out << eb;
}
else
{
out << nl << "_System.Collections.Generic.IEnumerator<" << typeS
- << "> e__ = " << param << ".GetEnumerator();";
- out << nl << "while(e__.MoveNext())";
+ << "> e = " << param << ".GetEnumerator();";
+ out << nl << "while(e.MoveNext())";
out << sb;
- out << nl << helperName << '.' << func << '(' << stream << ", e__.Current);";
+ out << nl << helperName << '.' << func << '(' << stream << ", e.Current);";
out << eb;
}
}
else
{
- out << nl << "for(int ix__ = 0; ix__ < " << param << '.' << limitID << "; ++ix__)";
+ out << nl << "for(int ix = 0; ix < " << param << '.' << limitID << "; ++ix)";
out << sb;
- out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix__]);";
+ out << nl << helperName << '.' << func << '(' << stream << ", " << param << "[ix]);";
out << eb;
}
out << eb;
@@ -1747,11 +1762,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
func = "read";
out << sb;
- out << nl << "int szx__ = " << stream << ".readAndCheckSeqSize("
+ out << nl << "int szx = " << stream << ".readAndCheckSeqSize("
<< static_cast<unsigned>(type->minWireSize()) << ");";
if(isArray)
{
- out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << param << " = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isCustom)
{
@@ -1759,7 +1774,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else if(isStack)
{
- out << nl << typeS << "[] " << param << "__tmp = new " << toArrayAlloc(typeS + "[]", "szx__") << ";";
+ out << nl << typeS << "[] " << param << "_tmp = new " << toArrayAlloc(typeS + "[]", "szx") << ";";
}
else if(isGeneric)
{
@@ -1767,14 +1782,14 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << param << " = new " << fixId(seq->scoped()) << "(szx__);";
+ out << nl << param << " = new " << fixId(seq->scoped()) << "(szx);";
}
- out << nl << "for(int ix__ = 0; ix__ < szx__; ++ix__)";
+ out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
if(isArray || isStack)
{
- string v = isArray ? param : param + "__tmp";
- out << nl << v << "[ix__] = " << helperName << '.' << func << '(' << stream << ");";
+ string v = isArray ? param : param + "_tmp";
+ out << nl << v << "[ix] = " << helperName << '.' << func << '(' << stream << ");";
}
else
{
@@ -1783,9 +1798,9 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(isStack)
{
- out << nl << "_System.Array.Reverse(" << param << "__tmp);";
+ out << nl << "_System.Array.Reverse(" << param << "_tmp);";
out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("
- << param << "__tmp);";
+ << param << "_tmp);";
}
out << eb;
}
@@ -1798,9 +1813,14 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
const string& param,
int tag,
- bool marshal)
+ bool marshal,
+ const string& customStream)
{
- string stream = marshal ? "os__" : "is__";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
const TypePtr type = seq->type();
const string typeS = typeToString(type);
@@ -1863,9 +1883,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".skipSize();";
}
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1885,9 +1905,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
<< getOptionalFormat(seq) << "))";
out << sb;
- out << nl << "int pos__ = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true);
- out << nl << stream << ".endSize(pos__);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
else
@@ -1895,9 +1915,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
out << sb;
out << nl << stream << ".skip(4);";
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1925,17 +1945,17 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << sb;
if(st->isVariableLength())
{
- out << nl << "int pos__ = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
}
else if(st->minWireSize() > 1)
{
out << nl << stream << ".writeSize(" << param << ".Value == null ? 1 : " << length << " * "
<< st->minWireSize() << " + (" << length << " > 254 ? 5 : 1));";
}
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
if(st->isVariableLength())
{
- out << nl << stream << ".endSize(pos__);";
+ out << nl << stream << ".endSize(pos);";
}
out << eb;
}
@@ -1951,9 +1971,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
{
out << nl << stream << ".skipSize();";
}
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -1972,9 +1992,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
<< getOptionalFormat(seq) << "))";
out << sb;
- out << nl << "int pos__ = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true);
- out << nl << stream << ".endSize(pos__);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
else
@@ -1982,9 +2002,9 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
out << sb;
out << nl << stream << ".skip(4);";
- string tmp = "tmpVal__";
+ string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true);
+ writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
@@ -2002,16 +2022,20 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
int tag,
bool serialize)
{
+ //
+ // Could do it only when param == "info", but not as good for testing
+ //
+ string dataMember = "this." + param;
if(optional)
{
const string typeName = typeToString(type, true);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
return;
@@ -2026,11 +2050,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetByte(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetByte(\"" << param << "\");";
}
break;
}
@@ -2038,11 +2062,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetBoolean(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetBoolean(\"" << param << "\");";
}
break;
}
@@ -2050,11 +2074,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetInt16(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetInt16(\"" << param << "\");";
}
break;
}
@@ -2062,11 +2086,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetInt32(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetInt32(\"" << param << "\");";
}
break;
}
@@ -2074,11 +2098,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetInt64(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetInt64(\"" << param << "\");";
}
break;
}
@@ -2086,11 +2110,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetSingle(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetSingle(\"" << param << "\");";
}
break;
}
@@ -2098,11 +2122,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ");";
}
else
{
- out << nl << param << " = " << "info__.GetDouble(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetDouble(\"" << param << "\");";
}
break;
}
@@ -2110,12 +2134,12 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << " == null ? \"\" : " << param
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << " == null ? \"\" : " << dataMember
<< ");";
}
else
{
- out << nl << param << " = " << "info__.GetString(\"" << param << "\");";
+ out << nl << dataMember << " = " << "info.GetString(\"" << param << "\");";
}
break;
}
@@ -2126,11 +2150,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof("
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof("
<< typeName << "));";
}
break;
@@ -2139,12 +2163,12 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember
<< ", typeof(Ice.ObjectPrxHelperBase));";
}
else
{
- out << nl << param << " = (Ice.ObjectPrx)info__.GetValue(\"" << param
+ out << nl << dataMember << " = (Ice.ObjectPrx)info.GetValue(\"" << param
<< "\", typeof(Ice.ObjectPrxHelperBase));";
}
break;
@@ -2159,11 +2183,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "Helper));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "Helper));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "Helper));";
}
return;
@@ -2175,11 +2199,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
return;
@@ -2191,11 +2215,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
return;
@@ -2207,11 +2231,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
return;
@@ -2223,11 +2247,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
return;
@@ -2238,11 +2262,11 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const string typeName = typeToString(type, false);
if(serialize)
{
- out << nl << "info__.AddValue(\"" << param << "\", " << param << ", typeof(" << typeName << "));";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
}
else
{
- out << nl << param << " = (" << typeName << ")info__.GetValue(\"" << param << "\", typeof(" << typeName
+ out << nl << dataMember << " = (" << typeName << ")info.GetValue(\"" << param << "\", typeof(" << typeName
<< "));";
}
}
diff --git a/cpp/src/slice2cs/CsUtil.h b/cpp/src/slice2cs/CsUtil.h
index c6368eb78ff..b25c6a3dd2f 100644
--- a/cpp/src/slice2cs/CsUtil.h
+++ b/cpp/src/slice2cs/CsUtil.h
@@ -48,12 +48,14 @@ protected:
//
// Generate code to marshal or unmarshal a type
//
- void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool);
- void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool);
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool,
+ const std::string& = "");
+ void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool,
+ const std::string& = "");
void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- bool, bool);
+ bool, bool, const std::string& = "");
void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- int, bool);
+ int, bool, const std::string& = "");
void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, int, bool);
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 9122c83a68b..ac2a5eb988b 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -111,14 +111,14 @@ emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, const
}
}
-string
-getEscapedParamName(const ParamDeclList& params, const string& name)
+template<class List>
+string getEscapedParamName(const List& params, const string& name)
{
- for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
+ for(typename List::const_iterator i = params.begin(); i != params.end(); ++i)
{
if((*i)->name() == name)
{
- return name + "__";
+ return name + "_";
}
}
return name;
@@ -150,31 +150,31 @@ Slice::CsVisitor::~CsVisitor()
void
Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const OperationPtr& op, bool marshal,
- bool resultStruct)
+ bool resultStruct, bool publicNames, const string& customStream)
{
ParamDeclList optionals;
string paramPrefix = "";
- string returnValueS = "ret__";
+ string returnValueS = "ret";
if(op && resultStruct)
{
if((op->returnType() && !params.empty()) || params.size() > 1)
{
- paramPrefix = "ret__.";
+ paramPrefix = "ret.";
returnValueS = resultStructReturnValueName(params);
}
}
for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
{
- string param = fixId((*pli)->name());
+ string param = paramPrefix.empty() && !publicNames ? "iceP_" + (*pli)->name() : fixId((*pli)->name());
TypePtr type = (*pli)->type();
bool patch = false;
if(!marshal && isClassType(type))
{
patch = true;
- param = (*pli)->name() + "__PP";
+ param = "icePP_" + (*pli)->name();
string typeS = typeToString(type);
if((*pli)->optional())
{
@@ -195,7 +195,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
}
else
{
- writeMarshalUnmarshalCode(_out, type, patch ? param : (paramPrefix + param), marshal);
+ writeMarshalUnmarshalCode(_out, type, patch ? param : (paramPrefix + param), marshal, customStream);
}
}
@@ -205,7 +205,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
{
ret = op->returnType();
bool patch = false;
- string param = "ret__";
+ string param = "ret";
if(!marshal && isClassType(ret))
{
patch = true;
@@ -226,7 +226,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!op->returnIsOptional())
{
- writeMarshalUnmarshalCode(_out, ret, patch ? param : (paramPrefix + returnValueS), marshal);
+ writeMarshalUnmarshalCode(_out, ret, patch ? param : (paramPrefix + returnValueS), marshal, customStream);
}
}
@@ -252,28 +252,29 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
{
if(checkReturnType && op->returnTag() < (*pli)->tag())
{
- const string param = !marshal && isClassType(ret) ? "ret__PP.patch" : (paramPrefix + returnValueS);
- writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal);
+ const string param = !marshal && isClassType(ret) ? "retPP.patch" : (paramPrefix + returnValueS);
+ writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal, customStream);
checkReturnType = false;
}
- string param = fixId((*pli)->name());
+ string param = paramPrefix.empty() && !publicNames ? "iceP_" + (*pli)->name() : fixId((*pli)->name());
TypePtr type = (*pli)->type();
bool patch = false;
if(!marshal && isClassType(type))
{
- param = (*pli)->name() + "__PP.patch";
+ param = "icePP_" + (*pli)->name() + ".patch";
patch = true;
}
- writeOptionalMarshalUnmarshalCode(_out, type, patch ? param : (paramPrefix + param), (*pli)->tag(), marshal);
+ writeOptionalMarshalUnmarshalCode(_out, type, patch ? param : (paramPrefix + param), (*pli)->tag(),
+ marshal, customStream);
}
if(checkReturnType)
{
- const string param = !marshal && isClassType(ret) ? "ret__PP.patch" : (paramPrefix + returnValueS);
- writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal);
+ const string param = !marshal && isClassType(ret) ? "retPP.patch" : (paramPrefix + returnValueS);
+ writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal, customStream);
}
}
@@ -282,55 +283,57 @@ Slice::CsVisitor::writePostUnmarshalParams(const ParamDeclList& params, const Op
{
string paramPrefix = "";
- string returnValueS = "ret__";
+ string returnValueS = "ret";
if(op)
{
if((op->returnType() && !params.empty()) || params.size() > 1)
{
- paramPrefix = "ret__.";
+ paramPrefix = "ret.";
returnValueS = resultStructReturnValueName(op->outParameters());
}
}
for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
{
+ string param = paramPrefix.empty() ? "iceP_" + (*pli)->name() : fixId((*pli)->name());
+
if(isClassType((*pli)->type()))
{
- const string tmp = (*pli)->name() + "__PP";
- _out << nl << paramPrefix << fixId((*pli)->name()) << " = " << tmp << ".value;";
+ const string tmp = "icePP_" + (*pli)->name();
+ _out << nl << paramPrefix << param << " = " << tmp << ".value;";
}
}
if(op && op->returnType() && isClassType(op->returnType()))
{
- _out << nl << paramPrefix << returnValueS << " = ret__PP.value;";
+ _out << nl << paramPrefix << returnValueS << " = retPP.value;";
}
}
void
-Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name)
+Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& customStream)
{
if(member->optional())
{
- writeOptionalMarshalUnmarshalCode(_out, member->type(), name, member->tag(), true);
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), name, member->tag(), true, customStream);
}
else
{
- writeMarshalUnmarshalCode(_out, member->type(), name, true);
+ writeMarshalUnmarshalCode(_out, member->type(), name, true, customStream);
}
}
void
Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, bool needPatcher,
- int& patchIter)
+ int& patchIter, const string& customStream)
{
const bool classType = isClassType(member->type());
string patcher;
if(classType)
{
- patcher = "new Patcher__(" + getStaticId(member->type()) + ", this";
+ patcher = "new Patcher_(" + getStaticId(member->type()) + ", this";
if(needPatcher)
{
ostringstream ostr;
@@ -342,11 +345,12 @@ Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const st
if(member->optional())
{
- writeOptionalMarshalUnmarshalCode(_out, member->type(), classType ? patcher : name, member->tag(), false);
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), classType ? patcher : name, member->tag(), false,
+ customStream);
}
else
{
- writeMarshalUnmarshalCode(_out, member->type(), classType ? patcher : name, false);
+ writeMarshalUnmarshalCode(_out, member->type(), classType ? patcher : name, false, customStream);
}
}
@@ -412,7 +416,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
}
- _out << nl << "public static new readonly string[] ids__ = ";
+ _out << nl << "private static readonly string[] _ids = ";
_out << sb;
{
StringList::const_iterator q = ids.begin();
@@ -432,9 +436,9 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override bool ice_isA(string s, Ice.Current current__ = null)";
+ _out << nl << "public override bool ice_isA(string s, Ice.Current current = null)";
_out << sb;
- _out << nl << "return _System.Array.BinarySearch(ids__, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;";
+ _out << nl << "return _System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;";
_out << eb;
_out << sp;
@@ -442,9 +446,9 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string[] ice_ids(Ice.Current current__ = null)";
+ _out << nl << "public override string[] ice_ids(Ice.Current current = null)";
_out << sb;
- _out << nl << "return ids__;";
+ _out << nl << "return _ids;";
_out << eb;
_out << sp;
@@ -452,9 +456,9 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string ice_id(Ice.Current current__ = null)";
+ _out << nl << "public override string ice_id(Ice.Current current = null)";
_out << sb;
- _out << nl << "return ids__[" << scopedPos << "];";
+ _out << nl << "return _ids[" << scopedPos << "];";
_out << eb;
_out << sp;
@@ -465,7 +469,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << nl << "public static new string ice_staticId()";
_out << sb;
- _out << nl << "return ids__[" << scopedPos << "];";
+ _out << nl << "return _ids[" << scopedPos << "];";
_out << eb;
_out << sp << nl << "#endregion"; // Slice type-related members
@@ -491,24 +495,24 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
}
_out << nl << "public static _System.Threading.Tasks.Task<Ice.OutputStream>";
- _out << nl << opName << "___(" << name << (p->isInterface() ? "" : "Disp_") << " obj__, "
- << "IceInternal.Incoming inS__, Ice.Current current__)";
+ _out << nl << "iceD_" << opName << "(" << name << (p->isInterface() ? "" : "Disp_") << " obj, "
+ << "IceInternal.Incoming inS, Ice.Current current)";
_out << sb;
TypePtr ret = op->returnType();
ParamDeclList inParams = op->inParameters();
ParamDeclList outParams = op->outParameters();
- _out << nl << "Ice.ObjectImpl.checkMode__(" << sliceModeToIceMode(op->mode()) << ", current__.mode);";
+ _out << nl << "Ice.ObjectImpl.iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
if(!inParams.empty())
{
//
// Unmarshal 'in' parameters.
//
- _out << nl << "var is__ = inS__.startReadParams();";
+ _out << nl << "var istr = inS.startReadParams();";
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
- string param = fixId((*pli)->name());
+ string param = "iceP_" + (*pli)->name();
string typeS = typeToString((*pli)->type(), (*pli)->optional());
const bool isClass = isClassType((*pli)->type());
@@ -539,55 +543,55 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
writeMarshalUnmarshalParams(inParams, 0, false);
if(op->sendsClasses(false))
{
- _out << nl << "is__.readPendingValues();";
+ _out << nl << "istr.readPendingValues();";
}
- _out << nl << "inS__.endReadParams();";
+ _out << nl << "inS.endReadParams();";
}
else
{
- _out << nl << "inS__.readEmptyParams();";
+ _out << nl << "inS.readEmptyParams();";
}
if(op->format() != DefaultFormat)
{
- _out << nl << "inS__.setFormat(" << opFormatTypeToString(op) << ");";
+ _out << nl << "inS.setFormat(" << opFormatTypeToString(op) << ");";
}
vector<string> inArgs;
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
- inArgs.push_back(isClassType((*pli)->type()) ? ((*pli)->name() + "__PP.value") : fixId((*pli)->name()));
+ inArgs.push_back(isClassType((*pli)->type()) ? "icePP_" + (*pli)->name() + ".value" : "iceP_" + (*pli)->name());
}
const bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
if(op->hasMarshaledResult())
{
- _out << nl << "return inS__." << (amd ? "setMarshaledResultTask" : "setMarshaledResult");
- _out << "(obj__." << opName << (amd ? "Async" : "") << spar << inArgs << "current__" << epar << ");";
+ _out << nl << "return inS." << (amd ? "setMarshaledResultTask" : "setMarshaledResult");
+ _out << "(obj." << opName << (amd ? "Async" : "") << spar << inArgs << "current" << epar << ");";
_out << eb;
}
else if(amd)
{
string retS = resultType(op);
- _out << nl << "return inS__.setResultTask" << (retS.empty() ? "" : ('<' + retS + '>'));
- _out << "(obj__." << opName << "Async" << spar << inArgs << "current__" << epar;
+ _out << nl << "return inS.setResultTask" << (retS.empty() ? "" : ('<' + retS + '>'));
+ _out << "(obj." << opName << "Async" << spar << inArgs << "current" << epar;
if(!retS.empty())
{
_out << ",";
_out.inc();
if(!ret && outParams.size() == 1)
{
- _out << nl << "(os__, " << fixId(outParams.front()->name()) << ") =>";
+ _out << nl << "(ostr, " << "iceP_" << outParams.front()->name() << ") =>";
}
else
{
- _out << nl << "(os__, ret__) =>";
+ _out << nl << "(ostr, ret) =>";
}
_out << sb;
writeMarshalUnmarshalParams(outParams, op, true, true);
if(op->returnsClasses(false))
{
- _out << nl << "os__.writePendingValues();";
+ _out << nl << "ostr.writePendingValues();";
}
_out << eb;
_out.dec();
@@ -600,7 +604,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
string typeS = typeToString((*pli)->type(), (*pli)->optional());
- _out << nl << typeS << ' ' << fixId((*pli)->name()) << ";";
+ _out << nl << typeS << ' ' << "iceP_" + (*pli)->name() << ";";
}
//
@@ -609,32 +613,32 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << nl;
if(ret)
{
- _out << "var ret__ = ";
+ _out << "var ret = ";
}
- _out << "obj__." << fixId(opName, DotNet::ICloneable, true) << spar << inArgs;
+ _out << "obj." << fixId(opName, DotNet::ICloneable, true) << spar << inArgs;
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- _out << "out " + fixId((*pli)->name());
+ _out << "out iceP_" + (*pli)->name();
}
- _out << "current__" << epar << ';';
+ _out << "current" << epar << ';';
//
// Marshal 'out' parameters and return value.
//
if(!outParams.empty() || ret)
{
- _out << nl << "var os__ = inS__.startWriteParams();";
+ _out << nl << "var ostr = inS.startWriteParams();";
writeMarshalUnmarshalParams(outParams, op, true);
if(op->returnsClasses(false))
{
- _out << nl << "os__.writePendingValues();";
+ _out << nl << "ostr.writePendingValues();";
}
- _out << nl << "inS__.endWriteParams(os__);";
- _out << nl << "return inS__.setResult(os__);";
+ _out << nl << "inS.endWriteParams(ostr);";
+ _out << nl << "return inS.setResult(ostr);";
}
else
{
- _out << nl << "return inS__.setResult(inS__.writeEmptyParams());";
+ _out << nl << "return inS.setResult(inS.writeEmptyParams());";
}
_out << eb;
}
@@ -652,7 +656,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
allOpNames.sort();
allOpNames.unique();
- _out << sp << nl << "private static string[] all__ =";
+ _out << sp << nl << "private static readonly string[] _all =";
_out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -670,13 +674,13 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
}
_out << nl << "public override _System.Threading.Tasks.Task<Ice.OutputStream>";
- _out << nl << "dispatch__(IceInternal.Incoming inS__, Ice.Current current__)";
+ _out << nl << "iceDispatch(IceInternal.Incoming inS, Ice.Current current)";
_out << sb;
- _out << nl << "int pos = _System.Array.BinarySearch(all__, current__.operation, "
+ _out << nl << "int pos = _System.Array.BinarySearch(_all, current.operation, "
<< "IceUtilInternal.StringUtil.OrdinalStringComparer);";
_out << nl << "if(pos < 0)";
_out << sb;
- _out << nl << "throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);";
+ _out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
_out << eb;
_out << sp << nl << "switch(pos)";
_out << sb;
@@ -689,19 +693,19 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sb;
if(opName == "ice_id")
{
- _out << nl << "return Ice.ObjectImpl.ice_id___(this, inS__, current__);";
+ _out << nl << "return Ice.ObjectImpl.iceD_ice_id(this, inS, current);";
}
else if(opName == "ice_ids")
{
- _out << nl << "return Ice.ObjectImpl.ice_ids___(this, inS__, current__);";
+ _out << nl << "return Ice.ObjectImpl.iceD_ice_ids(this, inS, current);";
}
else if(opName == "ice_isA")
{
- _out << nl << "return Ice.ObjectImpl.ice_isA___(this, inS__, current__);";
+ _out << nl << "return Ice.ObjectImpl.iceD_ice_isA(this, inS, current);";
}
else if(opName == "ice_ping")
{
- _out << nl << "return Ice.ObjectImpl.ice_ping___(this, inS__, current__);";
+ _out << nl << "return Ice.ObjectImpl.iceD_ice_ping(this, inS, current);";
}
else
{
@@ -717,11 +721,11 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
assert(cl);
if(cl->scoped() == p->scoped())
{
- _out << nl << "return " << opName << "___(this, inS__, current__);";
+ _out << nl << "return iceD_" << opName << "(this, inS, current);";
}
else
{
- _out << nl << "return " << fixId(cl->scoped() + "Disp_") << "." << opName << "___(this, inS__, current__);";
+ _out << nl << "return " << fixId(cl->scoped() + "Disp_") << ".iceD_" << opName << "(this, inS, current);";
}
break;
}
@@ -731,7 +735,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
_out << eb;
_out << sp << nl << "_System.Diagnostics.Debug.Assert(false);";
- _out << nl << "throw new Ice.OperationNotExistException(current__.id, current__.facet, current__.operation);";
+ _out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
_out << eb;
}
@@ -761,7 +765,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
assert(find(ids.begin(), ids.end(), scoped) != ids.end());
//
- // Marshalling support
+ // Marshaling support
//
DataMemberList allClassMembers = p->allClassDataMembers();
DataMemberList members = p->dataMembers();
@@ -786,11 +790,11 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void write__(Ice.OutputStream os__)";
+ _out << nl << "public override void iceWrite(Ice.OutputStream ostr_)";
_out << sb;
- _out << nl << "os__.startValue(slicedData__);";
- _out << nl << "writeImpl__(os__);";
- _out << nl << "os__.endValue();";
+ _out << nl << "ostr_.startValue(iceSlicedData);";
+ _out << nl << "iceWriteImpl(ostr_);";
+ _out << nl << "ostr_.endValue();";
_out << eb;
_out << sp;
@@ -798,11 +802,11 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void read__(Ice.InputStream is__)";
+ _out << nl << "public override void iceRead(Ice.InputStream istr_)";
_out << sb;
- _out << nl << "is__.startValue();";
- _out << nl << "readImpl__(is__);";
- _out << nl << "slicedData__ = is__.endValue(true);";
+ _out << nl << "istr_.startValue();";
+ _out << nl << "iceReadImpl(istr_);";
+ _out << nl << "iceSlicedData = istr_.endValue(true);";
_out << eb;
}
@@ -811,24 +815,24 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void writeImpl__(Ice.OutputStream os__)";
+ _out << nl << "protected override void iceWriteImpl(Ice.OutputStream ostr_)";
_out << sb;
- _out << nl << "os__.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
+ _out << nl << "ostr_.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
if(!(*d)->optional())
{
- writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true));
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), "ostr_");
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true));
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), "ostr_");
}
- _out << nl << "os__.endSlice();";
+ _out << nl << "ostr_.endSlice();";
if(base)
{
- _out << nl << "base.writeImpl__(os__);";
+ _out << nl << "base.iceWriteImpl(ostr_);";
}
_out << eb;
@@ -844,9 +848,9 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
_out << "new ";
}
- _out << "class Patcher__";
+ _out << "class Patcher_";
_out << sb;
- _out << sp << nl << "internal Patcher__(string type, Ice.Value instance";
+ _out << sp << nl << "internal Patcher_(string type, Ice.Value instance";
if(classMembers.size() > 1)
{
@@ -973,32 +977,32 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void readImpl__(Ice.InputStream is__)";
+ _out << nl << "protected override void iceReadImpl(Ice.InputStream istr_)";
_out << sb;
- _out << nl << "is__.startSlice();";
+ _out << nl << "istr_.startSlice();";
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
if(!(*d)->optional())
{
- writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), needCustomPatcher, patchIter, "istr_");
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), needCustomPatcher, patchIter, "istr_");
}
- _out << nl << "is__.endSlice();";
+ _out << nl << "istr_.endSlice();";
if(base)
{
- _out << nl << "base.readImpl__(is__);";
+ _out << nl << "base.iceReadImpl(istr_);";
}
_out << eb;
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected Ice.SlicedData slicedData__;";
+ _out << sp << nl << "protected Ice.SlicedData iceSlicedData;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -1040,7 +1044,7 @@ Slice::CsVisitor::getParams(const OperationPtr& op)
}
vector<string>
-Slice::CsVisitor::getInParams(const OperationPtr& op)
+Slice::CsVisitor::getInParams(const OperationPtr& op, bool internal)
{
vector<string> params;
@@ -1051,7 +1055,7 @@ Slice::CsVisitor::getInParams(const OperationPtr& op)
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), (*q)->optional(), cl->isLocal())
- + " " + fixId((*q)->name()));
+ + " " + (internal ? "iceP_" + (*q)->name() : fixId((*q)->name())));
}
return params;
}
@@ -1066,7 +1070,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, bool returnParam, bool ou
TypePtr ret = op->returnType();
if(ret)
{
- params.push_back(typeToString(ret, op->returnIsOptional()) + " ret__");
+ params.push_back(typeToString(ret, op->returnIsOptional()) + " ret");
}
}
@@ -1103,7 +1107,7 @@ Slice::CsVisitor::getArgs(const OperationPtr& op)
}
vector<string>
-Slice::CsVisitor::getInArgs(const OperationPtr& op)
+Slice::CsVisitor::getInArgs(const OperationPtr& op, bool internal)
{
vector<string> args;
ParamDeclList paramList = op->parameters();
@@ -1111,7 +1115,7 @@ Slice::CsVisitor::getInArgs(const OperationPtr& op)
{
if(!(*q)->isOutParam())
{
- args.push_back(fixId((*q)->name()));
+ args.push_back(internal ? "iceP_" + (*q)->name() : fixId((*q)->name()));
}
}
return args;
@@ -1335,7 +1339,7 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, int
_out << nl << "this.";
if(propertyMapping)
{
- _out << (*p)->name() << "__prop";
+ _out << "_" + (*p)->name();
}
else
{
@@ -2236,7 +2240,7 @@ Slice::Gen::CompactIdVisitor::visitClassDefStart(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "public sealed class TypeId_" << p->compactId();
_out << sb;
- _out << nl << "public readonly static string typeId = \"" << p->scoped() << "\";";
+ _out << nl << "public const string typeId = \"" << p->scoped() << "\";";
_out << eb;
}
return false;
@@ -2475,7 +2479,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
const string paramName = fixId((*d)->name());
if(propertyMapping)
{
- _out << (*d)->name() << "__prop";
+ _out << "_" + (*d)->name();
}
else
{
@@ -2504,18 +2508,18 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isInterface() && !p->isLocal())
{
_out << sp << nl;
- _out << nl << "public static new readonly string static_id__ = \""
+ _out << nl << "private const string _id = \""
<< p->scoped() << "\";";
_out << sp;
_out << nl << "public static new string ice_staticId()";
_out << sb;
- _out << nl << "return static_id__;";
+ _out << nl << "return _id;";
_out << eb;
_out << nl << "public override string ice_id()";
_out << sb;
- _out << nl << "return static_id__;";
+ _out << nl << "return _id;";
_out << eb;
writeMarshaling(p);
@@ -2605,7 +2609,7 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
_out << "public abstract ";
}
_out << retS << " end_" << name << spar << getOutParams(p, false, true)
- << "Ice.AsyncResult " + getEscapedParamName(inParamDecls, "result") << epar << ';';
+ << "Ice.AsyncResult " + getEscapedParamName(p->outParameters(), "asyncResult") << epar << ';';
}
}
}
@@ -2710,7 +2714,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
const bool hasDataMemberInitializers = requiresDataMemberInitializers(dataMembers);
if(hasDataMemberInitializers)
{
- _out << sp << nl << "private void initDM__()";
+ _out << sp << nl << "private void _initDM()";
_out << sb;
writeDataMemberInitializers(dataMembers, DotNet::Exception);
_out << eb;
@@ -2722,23 +2726,23 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sb;
if(hasDataMemberInitializers)
{
- _out << nl << "initDM__();";
+ _out << nl << "_initDM();";
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public " << name << "(_System.Exception ex__) : base(ex__)";
+ _out << nl << "public " << name << "(_System.Exception ex) : base(ex)";
_out << sb;
if(hasDataMemberInitializers)
{
- _out << nl << "initDM__();";
+ _out << nl << "_initDM();";
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public " << name << "(_System.Runtime.Serialization.SerializationInfo info__, "
- << "_System.Runtime.Serialization.StreamingContext context__) : base(info__, context__)";
+ _out << nl << "public " << name << "(_System.Runtime.Serialization.SerializationInfo info, "
+ << "_System.Runtime.Serialization.StreamingContext context) : base(info, context)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -2751,7 +2755,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
if(!dataMembers.empty())
{
- _out << sp << nl << "private void initDM__" << spar << paramDecl << epar;
+ _out << sp << nl << "private void _initDM" << spar << paramDecl << epar;
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
@@ -2771,14 +2775,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sb;
if(!dataMembers.empty())
{
- _out << nl << "initDM__" << spar << paramNames << epar << ';';
+ _out << nl << "_initDM" << spar << paramNames << epar << ';';
}
_out << eb;
+ string exParam = getEscapedParamName(allDataMembers, "ex");
vector<string> exceptionParam;
- exceptionParam.push_back("ex__");
+ exceptionParam.push_back(exParam);
vector<string> exceptionDecl;
- exceptionDecl.push_back("_System.Exception ex__");
+ exceptionDecl.push_back("_System.Exception " + exParam);
_out << sp;
emitGeneratedCodeAttribute();
_out << nl << "public " << name << spar << allParamDecl << exceptionDecl << epar << " : base" << spar;
@@ -2790,7 +2795,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sb;
if(!dataMembers.empty())
{
- _out << nl << "initDM__" << spar << paramNames << epar << ';';
+ _out << nl << "_initDM" << spar << paramNames << epar << ';';
}
_out << eb;
}
@@ -2812,37 +2817,37 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sb;
if(p->base())
{
- _out << nl << "int h__ = base.GetHashCode();";
+ _out << nl << "int h_ = base.GetHashCode();";
}
else
{
- _out << nl << "int h__ = 5381;";
+ _out << nl << "int h_ = 5381;";
}
- _out << nl << "IceInternal.HashUtil.hashAdd(ref h__, \"" << p->scoped() << "\");";
+ _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
writeMemberHashCode(dataMembers, DotNet::Exception);
- _out << nl << "return h__;";
+ _out << nl << "return h_;";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override bool Equals(object other__)";
+ _out << nl << "public override bool Equals(object other)";
_out << sb;
- _out << nl << "if(other__ == null)";
+ _out << nl << "if(other == null)";
_out << sb;
_out << nl << "return false;";
_out << eb;
- _out << nl << "if(object.ReferenceEquals(this, other__))";
+ _out << nl << "if(object.ReferenceEquals(this, other))";
_out << sb;
_out << nl << "return true;";
_out << eb;
- _out << nl << name << " o__ = other__ as " << name << ";";
- _out << nl << "if(o__ == null)";
+ _out << nl << name << " o = other as " << name << ";";
+ _out << nl << "if(o == null)";
_out << sb;
_out << nl << "return false;";
_out << eb;
if(p->base())
{
- _out << nl << "if(!base.Equals(other__))";
+ _out << nl << "if(!base.Equals(other))";
_out << sb;
_out << nl << "return false;";
_out << eb;
@@ -2855,15 +2860,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void GetObjectData(_System.Runtime.Serialization.SerializationInfo info__, "
- << "_System.Runtime.Serialization.StreamingContext context__)";
+ _out << nl << "public override void GetObjectData(_System.Runtime.Serialization.SerializationInfo info, "
+ << "_System.Runtime.Serialization.StreamingContext context)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string name = fixId((*q)->name(), DotNet::Exception, false);
writeSerializeDeserializeCode(_out, (*q)->type(), name, (*q)->optional(), (*q)->tag(), true);
}
- _out << sp << nl << "base.GetObjectData(info__, context__);";
+ _out << sp << nl << "base.GetObjectData(info, context);";
_out << eb;
}
@@ -2873,16 +2878,16 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static bool operator==(" << name << " lhs__, " << name << " rhs__)";
+ _out << nl << "public static bool operator==(" << name << " lhs, " << name << " rhs)";
_out << sb;
- _out << nl << "return Equals(lhs__, rhs__);";
+ _out << nl << "return Equals(lhs, rhs);";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static bool operator!=(" << name << " lhs__, " << name << " rhs__)";
+ _out << nl << "public static bool operator!=(" << name << " lhs, " << name << " rhs)";
_out << sb;
- _out << nl << "return !Equals(lhs__, rhs__);";
+ _out << nl << "return !Equals(lhs, rhs);";
_out << eb;
_out << sp << nl << "#endregion"; // Comparison members
@@ -2901,36 +2906,36 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void write__(Ice.OutputStream os__)";
+ _out << nl << "public override void iceWrite(Ice.OutputStream ostr_)";
_out << sb;
- _out << nl << "os__.startException(slicedData__);";
- _out << nl << "writeImpl__(os__);";
- _out << nl << "os__.endException();";
+ _out << nl << "ostr_.startException(iceSlicedData);";
+ _out << nl << "iceWriteImpl(ostr_);";
+ _out << nl << "ostr_.endException();";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void read__(Ice.InputStream is__)";
+ _out << nl << "public override void iceRead(Ice.InputStream istr_)";
_out << sb;
- _out << nl << "is__.startException();";
- _out << nl << "readImpl__(is__);";
- _out << nl << "slicedData__ = is__.endException(true);";
+ _out << nl << "istr_.startException();";
+ _out << nl << "iceReadImpl(istr_);";
+ _out << nl << "iceSlicedData = istr_.endException(true);";
_out << eb;
}
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void writeImpl__(Ice.OutputStream os__)";
+ _out << nl << "protected override void iceWriteImpl(Ice.OutputStream ostr_)";
_out << sb;
- _out << nl << "os__.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
+ _out << nl << "ostr_.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception));
+ writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), "ostr_");
}
- _out << nl << "os__.endSlice();";
+ _out << nl << "ostr_.endSlice();";
if(base)
{
- _out << nl << "base.writeImpl__(os__);";
+ _out << nl << "base.iceWriteImpl(ostr_);";
}
_out << eb;
@@ -2944,9 +2949,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << "new ";
}
- _out << "class Patcher__";
+ _out << "class Patcher_";
_out << sb;
- _out << sp << nl << "internal Patcher__(string type, Ice.Exception instance";
+ _out << sp << nl << "internal Patcher_(string type, Ice.Exception instance";
if(classMembers.size() > 1)
{
_out << ", int member";
@@ -3082,20 +3087,20 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void readImpl__(Ice.InputStream is__)";
+ _out << nl << "protected override void iceReadImpl(Ice.InputStream istr_)";
_out << sb;
- _out << nl << "is__.startSlice();";
+ _out << nl << "istr_.startSlice();";
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), needCustomPatcher, patchIter, "istr_");
}
- _out << nl << "is__.endSlice();";
+ _out << nl << "istr_.endSlice();";
if(base)
{
- _out << nl << "base.readImpl__(is__);";
+ _out << nl << "base.iceReadImpl(istr_);";
}
_out << eb;
@@ -3103,7 +3108,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override bool usesClasses__()";
+ _out << nl << "public override bool iceUsesClasses()";
_out << sb;
_out << nl << "return true;";
_out << eb;
@@ -3111,7 +3116,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected Ice.SlicedData slicedData__;";
+ _out << sp << nl << "protected Ice.SlicedData iceSlicedData;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -3223,7 +3228,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << nl << "this.";
if(propertyMapping)
{
- _out << (*q)->name() << "__prop";
+ _out << "_" + (*q)->name();
}
else
{
@@ -3255,41 +3260,41 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "public override int GetHashCode()";
_out << sb;
- _out << nl << "int h__ = 5381;";
- _out << nl << "IceInternal.HashUtil.hashAdd(ref h__, \"" << p->scoped() << "\");";
+ _out << nl << "int h_ = 5381;";
+ _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
writeMemberHashCode(dataMembers, isClass ? DotNet::ICloneable : 0);
- _out << nl << "return h__;";
+ _out << nl << "return h_;";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override bool Equals(object other__)";
+ _out << nl << "public override bool Equals(object other)";
_out << sb;
if(isClass)
{
- _out << nl << "if(object.ReferenceEquals(this, other__))";
+ _out << nl << "if(object.ReferenceEquals(this, other))";
_out << sb;
_out << nl << "return true;";
_out << eb;
}
if(isClass)
{
- _out << nl << "if(other__ == null)";
+ _out << nl << "if(other == null)";
_out << sb;
_out << nl << "return false;";
_out << eb;
- _out << nl << "if(GetType() != other__.GetType())";
+ _out << nl << "if(GetType() != other.GetType())";
}
else
{
- _out << nl << "if(!(other__ is " << name << "))";
+ _out << nl << "if(!(other is " << name << "))";
}
_out << sb;
_out << nl << "return false;";
_out << eb;
if(!dataMembers.empty())
{
- _out << nl << name << " o__ = (" << name << ")other__;";
+ _out << nl << name << " o = (" << name << ")other;";
}
writeMemberEquals(dataMembers, isClass ? DotNet::ICloneable : 0);
_out << nl << "return true;";
@@ -3301,31 +3306,31 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static bool operator==(" << name << " lhs__, " << name << " rhs__)";
+ _out << nl << "public static bool operator==(" << name << " lhs, " << name << " rhs)";
_out << sb;
- _out << nl << "return Equals(lhs__, rhs__);";
+ _out << nl << "return Equals(lhs, rhs);";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static bool operator!=(" << name << " lhs__, " << name << " rhs__)";
+ _out << nl << "public static bool operator!=(" << name << " lhs, " << name << " rhs)";
_out << sb;
- _out << nl << "return !Equals(lhs__, rhs__);";
+ _out << nl << "return !Equals(lhs, rhs);";
_out << eb;
_out << sp << nl << "#endregion"; // Comparison members
if(!p->isLocal())
{
- _out << sp << nl << "#region Marshalling support";
+ _out << sp << nl << "#region Marshaling support";
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void write__(Ice.OutputStream os__)";
+ _out << nl << "public void iceWrite(Ice.OutputStream ostr_)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0));
+ writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), "ostr_");
}
_out << eb;
@@ -3333,9 +3338,9 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public sealed class Patcher__";
+ _out << nl << "public sealed class Patcher_";
_out << sb;
- _out << sp << nl << "internal Patcher__(string type, " << name << " instance";
+ _out << sp << nl << "internal Patcher_(string type, " << name << " instance";
if(classMembers.size() > 1)
{
_out << ", int member";
@@ -3406,50 +3411,50 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void read__(Ice.InputStream is__)";
+ _out << nl << "public void iceRead(Ice.InputStream istr_)";
_out << sb;
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), needCustomPatcher,
- patchIter);
+ patchIter, "istr_");
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static void write(Ice.OutputStream os__, " << name << " v__)";
+ _out << nl << "public static void write(Ice.OutputStream ostr, " << name << " v)";
_out << sb;
if(isClass)
{
- _out << nl << "if(v__ == null)";
+ _out << nl << "if(v == null)";
_out << sb;
- _out << nl << "nullMarshalValue__.write__(os__);";
+ _out << nl << "_nullMarshalValue.iceWrite(ostr);";
_out << eb;
_out << nl << "else";
_out << sb;
- _out << nl << "v__.write__(os__);";
+ _out << nl << "v.iceWrite(ostr);";
_out << eb;
}
else
{
- _out << nl << "v__.write__(os__);";
+ _out << nl << "v.iceWrite(ostr);";
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " read(Ice.InputStream is__)";
+ _out << nl << "public static " << name << " read(Ice.InputStream istr)";
_out << sb;
- _out << nl << name << " v__ = new " << name << "();";
- _out << nl << "v__.read__(is__);";
- _out << nl << "return v__;";
+ _out << nl << name << " v = new " << name << "();";
+ _out << nl << "v.iceRead(istr);";
+ _out << nl << "return v;";
_out << eb;
if(isClass)
{
- _out << nl << nl << "private static readonly " << name << " nullMarshalValue__ = new " << name << "();";
+ _out << nl << nl << "private static readonly " << name << " _nullMarshalValue = new " << name << "();";
}
_out << sp << nl << "#endregion"; // Marshalling support
}
@@ -3497,18 +3502,18 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
_out << nl << "public sealed class " << p->name() << "Helper";
_out << sb;
_out << sp;
- _out << nl << "public static void write(Ice.OutputStream os__, " << name << " v__)";
+ _out << nl << "public static void write(Ice.OutputStream ostr, " << name << " v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, p, "v__", true);
+ writeMarshalUnmarshalCode(_out, p, "v", true);
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " read(Ice.InputStream is__)";
+ _out << nl << "public static " << name << " read(Ice.InputStream istr)";
_out << sb;
- _out << nl << name << " v__;";
- writeMarshalUnmarshalCode(_out, p, "v__", false);
- _out << nl << "return v__;";
+ _out << nl << name << " v;";
+ writeMarshalUnmarshalCode(_out, p, "v", false);
+ _out << nl << "return v;";
_out << eb;
_out << eb;
@@ -3586,7 +3591,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
string dataMemberName;
if(isProperty)
{
- dataMemberName = p->name() + "__prop";
+ dataMemberName = "_" + p->name();
}
else
{
@@ -3647,7 +3652,7 @@ Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers,
{
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- _out << nl << "IceInternal.HashUtil.hashAdd(ref h__, " << fixId((*q)->name(), baseTypes);
+ _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, " << fixId((*q)->name(), baseTypes);
if((*q)->optional())
{
_out << ".Value";
@@ -3665,9 +3670,9 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
TypePtr memberType = (*q)->type();
if(!(*q)->optional() && !isValueType(memberType))
{
- _out << nl << "if(" << memberName << " == null)";
+ _out << nl << "if(this." << memberName << " == null)";
_out << sb;
- _out << nl << "if(o__." << memberName << " != null)";
+ _out << nl << "if(o." << memberName << " != null)";
_out << sb;
_out << nl << "return false;";
_out << eb;
@@ -3686,14 +3691,14 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
//
// Equals() for native arrays does not have value semantics.
//
- _out << nl << "if(!IceUtilInternal.Arrays.Equals(" << memberName << ", o__." << memberName << "))";
+ _out << nl << "if(!IceUtilInternal.Arrays.Equals(this." << memberName << ", o." << memberName << "))";
}
else if(isGeneric)
{
//
// Equals() for generic types does not have value semantics.
//
- _out << nl << "if(!IceUtilInternal.Collections.SequenceEquals(" << memberName << ", o__."
+ _out << nl << "if(!IceUtilInternal.Collections.SequenceEquals(this." << memberName << ", o."
<< memberName << "))";
}
}
@@ -3705,12 +3710,12 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
//
// Equals() for generic types does not have value semantics.
//
- _out << nl << "if(!IceUtilInternal.Collections.DictionaryEquals(" << memberName << ", o__."
+ _out << nl << "if(!IceUtilInternal.Collections.DictionaryEquals(this." << memberName << ", o."
<< memberName << "))";
}
else
{
- _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
+ _out << nl << "if(!this." << memberName << ".Equals(o." << memberName << "))";
}
}
_out << sb;
@@ -3720,7 +3725,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
}
else
{
- _out << nl << "if(!" << memberName << ".Equals(o__." << memberName << "))";
+ _out << nl << "if(!this." << memberName << ".Equals(o." << memberName << "))";
_out << sb;
_out << nl << "return false;";
_out << eb;
@@ -3852,21 +3857,21 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
//
// One shot constructor
//
- _out << nl << "public " << name << spar << getOutParams(p, true, false) << "Ice.Current current__" << epar;
+ _out << nl << "public " << name << spar << getOutParams(p, true, false) << "Ice.Current current" << epar;
_out << sb;
- _out << nl << "os__ = IceInternal.Incoming.createResponseOutputStream(current__);";
- _out << nl << "os__.startEncapsulation(current__.encoding, " << opFormatTypeToString(p) << ");";
- writeMarshalUnmarshalParams(outParams, p, true);
+ _out << nl << "_ostr = IceInternal.Incoming.createResponseOutputStream(current);";
+ _out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p) << ");";
+ writeMarshalUnmarshalParams(outParams, p, true, false, true, "_ostr");
if(p->returnsClasses(false))
{
- _out << nl << "os__.writePendingValues();";
+ _out << nl << "_ostr.writePendingValues();";
}
- _out << nl << "os__.endEncapsulation();";
+ _out << nl << "_ostr.endEncapsulation();";
_out << eb;
_out << sp;
_out << nl << "public Ice.OutputStream getOutputStream(Ice.Current current)";
_out << sb;
- _out << nl << "if(os__ == null)";
+ _out << nl << "if(_ostr == null)";
_out << sb;
_out << nl << "return new " << name << spar;
if(ret)
@@ -3879,10 +3884,10 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
}
_out << "current" << epar << ".getOutputStream(current);";
_out << eb;
- _out << nl << "return os__;";
+ _out << nl << "return _ostr;";
_out << eb;
_out << sp;
- _out << nl << "private Ice.OutputStream os__;";
+ _out << nl << "private Ice.OutputStream _ostr;";
_out << eb;
}
}
@@ -4014,7 +4019,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string context = getEscapedParamName(inParamDecls, "context");
string callback = getEscapedParamName(inParamDecls, "callback");
string cookie = getEscapedParamName(inParamDecls, "cookie");
- string result = getEscapedParamName(inParamDecls, "result");
+ string asyncResult = getEscapedParamName(p->outParameters(), "asyncResult");
_out << sp;
writeDocCommentAMI(p, InParam, deprecateReason,
@@ -4057,13 +4062,13 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
//
_out << sp;
writeDocCommentAMI(p, OutParam, deprecateReason,
- "<param name=\"" + result + "\">The asynchronous result object for the invocation.</param>");
+ "<param name=\"" + asyncResult + "\">The asynchronous result object for the invocation.</param>");
if(!deprecateReason.empty())
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
_out << nl << retS << " end_" << p->name() << spar << getOutParams(p, false, true)
- << "Ice.AsyncResult " + result << epar << ';';
+ << "Ice.AsyncResult " + asyncResult << epar << ';';
}
}
@@ -4119,7 +4124,7 @@ Slice::Gen::AsyncDelegateVisitor::visitOperation(const OperationPtr& p)
_out << nl << "public delegate void " << delName << spar;
if(p->returnType())
{
- _out << retS + " ret__";
+ _out << retS + " ret";
}
_out << paramDeclAMI << epar << ';';
}
@@ -4270,8 +4275,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
_out << sp;
- _out << nl << "public " << name << "PrxHelper(_System.Runtime.Serialization.SerializationInfo info__, "
- << "_System.Runtime.Serialization.StreamingContext context__) : base(info__, context__)";
+ _out << nl << "public " << name << "PrxHelper(_System.Runtime.Serialization.SerializationInfo info, "
+ << "_System.Runtime.Serialization.StreamingContext context) : base(info, context)";
_out << sb;
_out << eb;
@@ -4334,14 +4339,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(ret || outParams.size() > 1)
{
- _out << "var result__ = ";
+ _out << "var result_ = ";
}
else
{
_out << fixId(outParams.front()->name()) << " = ";
}
}
- _out << op->name() << "Async" << spar << argsAMI << context
+ _out << "_iceI_" << op->name() << "Async" << spar << argsAMI << context
<< "null" << "_System.Threading.CancellationToken.None" << "true" << epar;
if(ret || outParams.size() > 0)
@@ -4358,18 +4363,18 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
ParamDeclPtr param = *i;
- _out << nl << fixId(param->name()) << " = result__." << fixId(param->name()) << ";";
+ _out << nl << fixId(param->name()) << " = result_." << fixId(param->name()) << ";";
}
if(ret)
{
- _out << nl << "return result__." << resultStructReturnValueName(outParams) << ";";
+ _out << nl << "return result_." << resultStructReturnValueName(outParams) << ";";
}
}
_out << eb;
- _out << nl << "catch(_System.AggregateException ex__)";
+ _out << nl << "catch(_System.AggregateException ex_)";
_out << sb;
- _out << nl << "throw ex__.InnerException;";
+ _out << nl << "throw ex_.InnerException;";
_out << eb;
_out << eb;
}
@@ -4439,7 +4444,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
<< epar;
_out << sb;
- _out << nl << "return " << opName << "Async" << spar << argsAMI
+ _out << nl << "return _iceI_" << opName << "Async" << spar << argsAMI
<< context << progress << cancel << "false" << epar << ";";
_out << eb;
@@ -4452,73 +4457,73 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << "<" << returnTypeS << ">";
}
- _out << " " << opName << "Async" << spar << paramsAMI
- << "Ice.OptionalContext context__"
- << "_System.IProgress<bool> progress__"
- << "_System.Threading.CancellationToken cancel__"
- << "bool synchronous__" << epar;
+ _out << " _iceI_" << opName << "Async" << spar << getInParams(op, true)
+ << "Ice.OptionalContext context"
+ << "_System.IProgress<bool> progress"
+ << "_System.Threading.CancellationToken cancel"
+ << "bool synchronous" << epar;
_out << sb;
if(returnTypeS.empty())
{
- _out << nl << "var completed__ = "
- << "new IceInternal.OperationTaskCompletionCallback<object>(progress__, cancel__);";
+ _out << nl << "var completed = "
+ << "new IceInternal.OperationTaskCompletionCallback<object>(progress, cancel);";
}
else
{
- _out << nl << "var completed__ = "
- << "new IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress__, cancel__);";
+ _out << nl << "var completed = "
+ << "new IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);";
}
- _out << nl << opName << "___" << spar << argsAMI << "context__" << "synchronous__" << "completed__"
+ _out << nl << "_iceI_" << opName << spar << getInArgs(op, true) << "context" << "synchronous" << "completed"
<< epar << ";";
- _out << nl << "return completed__.Task;";
+ _out << nl << "return completed.Task;";
_out << eb;
- string flatName = "__" + opName + "_name";
+ string flatName = "_" + opName + "_name";
_out << sp << nl << "private const string " << flatName << " = \"" << op->name() << "\";";
//
// Write the common invoke method
//
_out << sp << nl;
- _out << "private void " << op->name() << "___" << spar << paramsAMI
- << "_System.Collections.Generic.Dictionary<string, string> ctx__"
- << "bool synchronous__"
- << "IceInternal.OutgoingAsyncCompletionCallback completed__" << epar;
+ _out << "private void _iceI_" << op->name() << spar << getInParams(op, true)
+ << "_System.Collections.Generic.Dictionary<string, string> context"
+ << "bool synchronous"
+ << "IceInternal.OutgoingAsyncCompletionCallback completed" << epar;
_out << sb;
if(op->returnsData())
{
- _out << nl << "checkAsyncTwowayOnly__(" << flatName << ");";
+ _out << nl << "iceCheckAsyncTwowayOnly(" << flatName << ");";
}
if(returnTypeS.empty())
{
- _out << nl << "var outAsync__ = getOutgoingAsync<object>(completed__);";
+ _out << nl << "var outAsync = getOutgoingAsync<object>(completed);";
}
else
{
- _out << nl << "var outAsync__ = getOutgoingAsync<" << returnTypeS << ">(completed__);";
+ _out << nl << "var outAsync = getOutgoingAsync<" << returnTypeS << ">(completed);";
}
- _out << nl << "outAsync__.invoke(";
+ _out << nl << "outAsync.invoke(";
_out.inc();
_out << nl << flatName << ",";
_out << nl << sliceModeToIceMode(op->sendMode()) << ",";
_out << nl << opFormatTypeToString(op) << ",";
- _out << nl << "ctx__,";
- _out << nl << "synchronous__";
+ _out << nl << "context,";
+ _out << nl << "synchronous";
if(!inParams.empty())
{
_out << ",";
- _out << nl << "write: (Ice.OutputStream os__) =>";
+ _out << nl << "write: (Ice.OutputStream ostr) =>";
_out << sb;
writeMarshalUnmarshalParams(inParams, 0, true);
if(op->sendsClasses(false))
{
- _out << nl << "os__.writePendingValues();";
+ _out << nl << "ostr.writePendingValues();";
}
_out << eb;
}
@@ -4554,11 +4559,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(ret || !outParams.empty())
{
_out << ",";
- _out << nl << "read: (Ice.InputStream is__) =>";
+ _out << nl << "read: (Ice.InputStream istr) =>";
_out << sb;
if(outParams.empty())
{
- _out << nl << returnTypeS << " ret__";
+ _out << nl << returnTypeS << " ret";
if(!op->returnIsOptional() && !isClassType(ret) && StructPtr::dynamicCast(ret))
{
_out << " = " << (isValueType(StructPtr::dynamicCast(ret)) ? ("new " + returnTypeS + "()") : "null");
@@ -4567,12 +4572,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(ret || outParams.size() > 1)
{
- _out << nl << returnTypeS << " ret__ = new " << returnTypeS << "();";
+ _out << nl << returnTypeS << " ret = new " << returnTypeS << "();";
}
else
{
TypePtr t = outParams.front()->type();
- _out << nl << typeToString(t, (outParams.front()->optional())) << " " << fixId(outParams.front()->name());
+ _out << nl << typeToString(t, (outParams.front()->optional())) << " iceP_" << outParams.front()->name();
if(!outParams.front()->optional() && !isClassType(t) && StructPtr::dynamicCast(t))
{
_out << " = " << (isValueType(StructPtr::dynamicCast(t)) ? ("new " + returnTypeS + "()") : "null");
@@ -4583,18 +4588,18 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
writeMarshalUnmarshalParams(outParams, op, false, true);
if(op->returnsClasses(false))
{
- _out << nl << "is__.readPendingValues();";
+ _out << nl << "istr.readPendingValues();";
}
writePostUnmarshalParams(outParams, op);
if(!ret && outParams.size() == 1)
{
- _out << nl << "return " << fixId(outParams.front()->name()) << ";";
+ _out << nl << "return iceP_" << outParams.front()->name() << ";";
}
else
{
- _out << nl << "return ret__;";
+ _out << nl << "return ret;";
}
_out << eb;
}
@@ -4631,67 +4636,73 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
//
string delType = clScope + "Callback_" + cl->name() + "_" + op->name();
+ string context = getEscapedParamName(inParams, "context");
+ string callback = getEscapedParamName(inParams, "callback");
+ string cookie = getEscapedParamName(inParams, "cookie");
+
_out << sp;
_out << nl << "public Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI
- << ("Ice.OptionalContext ctx__ = new Ice.OptionalContext()") << epar;
+ << "Ice.OptionalContext " + context + " = new Ice.OptionalContext()" << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "null" << "null" << "false"
+ _out << nl << "return begin_" << opName << spar << argsAMI << context << "null" << "null" << "false"
<< epar << ';';
_out << eb;
_out << sp;
_out << nl << "public Ice.AsyncResult begin_" << opName << spar << paramsAMI
- << "Ice.AsyncCallback cb__" << "object cookie__" << epar;
+ << "Ice.AsyncCallback " + callback << "object " + cookie << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "new Ice.OptionalContext()" << "cb__"
- << "cookie__" << "false" << epar << ';';
+ _out << nl << "return begin_" << opName << spar << argsAMI << "new Ice.OptionalContext()" << callback
+ << cookie << "false" << epar << ';';
_out << eb;
_out << sp;
_out << nl << "public Ice.AsyncResult begin_" << opName << spar << paramsAMI
- << "Ice.OptionalContext ctx__" << "Ice.AsyncCallback cb__"
- << "object cookie__" << epar;
+ << "Ice.OptionalContext " + context << "Ice.AsyncCallback " + callback
+ << "object " + cookie << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "ctx__" << "cb__"
- << "cookie__" << "false" << epar << ';';
+ _out << nl << "return begin_" << opName << spar << argsAMI << context << callback
+ << cookie << "false" << epar << ';';
_out << eb;
//
// Write the end_ method.
//
- string flatName = "__" + opName + "_name";
+ string flatName = "_" + opName + "_name";
+ string asyncResult = getEscapedParamName(outParams, "asyncResult");
+
_out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, false, true)
- << "Ice.AsyncResult r__" << epar;
+ << "Ice.AsyncResult " + asyncResult << epar;
_out << sb;
- _out << nl << "var resultI__ = IceInternal.AsyncResultI.check(r__, this, " << flatName << ");";
+ _out << nl << "var resultI_ = IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");";
if(returnTypeS.empty())
{
- _out << nl << "((IceInternal.OutgoingAsyncT<object>)resultI__.OutgoingAsync).result__(resultI__.wait());";
+ _out << nl << "((IceInternal.OutgoingAsyncT<object>)resultI_.OutgoingAsync).getResult(resultI_.wait());";
}
else
{
- _out << nl << "var outgoing__ = (IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI__.OutgoingAsync;";
+ _out << nl << "var outgoing_ = (IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI_.OutgoingAsync;";
if(outParams.empty())
{
- _out << nl << "return outgoing__.result__(resultI__.wait());";
+ _out << nl << "return outgoing_.getResult(resultI_.wait());";
}
else if(!ret && outParams.size() == 1)
{
- _out << nl << fixId(outParams.front()->name()) << " = outgoing__.result__(resultI__.wait());";
+ _out << nl << fixId(outParams.front()->name()) << " = outgoing_.getResult(resultI_.wait());";
}
else
{
- _out << nl << "var result__ = outgoing__.result__(resultI__.wait());";
+ _out << nl << "var result_ = outgoing_.getResult(resultI_.wait());";
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << nl << fixId((*i)->name()) << " = result__." << fixId((*i)->name()) << ";";
+ _out << nl << fixId((*i)->name()) << " = result_." << fixId((*i)->name()) << ";";
}
if(ret)
{
- _out << nl << "return result__." << resultStructReturnValueName(outParams) << ";";
+ _out << nl << "return result_." << resultStructReturnValueName(outParams) << ";";
}
}
}
@@ -4701,13 +4712,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the common begin_ implementation.
//
_out << sp;
- _out << nl << "private Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI
- << "_System.Collections.Generic.Dictionary<string, string> ctx__"
- << "Ice.AsyncCallback completedCallback__" << "object cookie__" << "bool synchronous__"
+ _out << nl << "private Ice.AsyncResult<" << delType << "> begin_" << opName << spar << getInParams(op, true)
+ << "_System.Collections.Generic.Dictionary<string, string> context"
+ << "Ice.AsyncCallback completedCallback" << "object cookie" << "bool synchronous"
<< epar;
_out << sb;
- _out << nl << "var completed__ = new IceInternal.OperationAsyncResultCompletionCallback<" << delType;
+ _out << nl << "var completed = new IceInternal.OperationAsyncResultCompletionCallback<" << delType;
_out << ", " << (returnTypeS.empty() ? "object" : returnTypeS);
_out << ">(";
@@ -4715,38 +4726,38 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the completed callback
//
_out.inc();
- _out << nl << "(" << delType << " cb__, " << (returnTypeS.empty() ? "object" : returnTypeS) << " ret__) =>";
+ _out << nl << "(" << delType << " cb, " << (returnTypeS.empty() ? "object" : returnTypeS) << " ret) =>";
_out << sb;
- _out << nl << "if(cb__ != null)";
+ _out << nl << "if(cb != null)";
_out << sb;
- _out << nl << "cb__.Invoke" << spar;
+ _out << nl << "cb.Invoke" << spar;
if(ret && outParams.empty())
{
- _out << "ret__";
+ _out << "ret";
}
else if(ret || outParams.size() > 1)
{
if(ret)
{
- _out << "ret__." + resultStructReturnValueName(outParams);
+ _out << "ret." + resultStructReturnValueName(outParams);
}
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- _out << "ret__." + fixId((*pli)->name());
+ _out << "ret." + fixId((*pli)->name());
}
}
else if(!outParams.empty())
{
- _out << "ret__";
+ _out << "ret";
}
_out << epar << ';';
_out << eb;
_out << eb << ",";
- _out << nl << "this, " << flatName << ", cookie__, completedCallback__);";
+ _out << nl << "this, " << flatName << ", cookie, completedCallback);";
_out.dec();
- _out << nl << op->name() << "___" << spar << argsAMI << "ctx__" << "synchronous__" << "completed__" << epar << ";";
- _out << nl << "return completed__;";
+ _out << nl << "_iceI_" << op->name() << spar << getInArgs(op, true) << "context" << "synchronous" << "completed" << epar << ";";
+ _out << nl << "return completed;";
_out << eb;
}
_out << sp << nl << "#endregion"; // Asynchronous operations
@@ -4762,7 +4773,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "if((r == null) && b.ice_isA(ice_staticId()))";
_out << sb;
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(b);";
+ _out << nl << "h.iceCopyFrom(b);";
_out << nl << "r = h;";
_out << eb;
_out << nl << "return r;";
@@ -4779,7 +4790,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "if((r == null) && b.ice_isA(ice_staticId(), ctx))";
_out << sb;
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(b);";
+ _out << nl << "h.iceCopyFrom(b);";
_out << nl << "r = h;";
_out << eb;
_out << nl << "return r;";
@@ -4797,7 +4808,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "if(bb.ice_isA(ice_staticId()))";
_out << sb;
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(bb);";
+ _out << nl << "h.iceCopyFrom(bb);";
_out << nl << "return h;";
_out << eb;
_out << eb;
@@ -4821,7 +4832,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "if(bb.ice_isA(ice_staticId(), ctx))";
_out << sb;
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(bb);";
+ _out << nl << "h.iceCopyFrom(bb);";
_out << nl << "return h;";
_out << eb;
_out << eb;
@@ -4841,7 +4852,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "if(r == null)";
_out << sb;
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(b);";
+ _out << nl << "h.iceCopyFrom(b);";
_out << nl << "r = h;";
_out << eb;
_out << nl << "return r;";
@@ -4855,7 +4866,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
_out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);";
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
- _out << nl << "h.copyFrom__(bb);";
+ _out << nl << "h.iceCopyFrom(bb);";
_out << nl << "return h;";
_out << eb;
@@ -4875,7 +4886,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
assert(scopedIter != ids.end());
StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter);
- _out << sp << nl << "public static readonly string[] ids__ =";
+ //
+ // Need static-readonly for arrays in C# (not const)
+ //
+ _out << sp << nl << "private static readonly string[] _ids =";
_out << sb;
{
@@ -4893,25 +4907,25 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "public static string ice_staticId()";
_out << sb;
- _out << nl << "return ids__[" << scopedPos << "];";
+ _out << nl << "return _ids[" << scopedPos << "];";
_out << eb;
_out << sp << nl << "#endregion"; // Checked and unchecked cast operations
_out << sp << nl << "#region Marshaling support";
- _out << sp << nl << "public static void write(Ice.OutputStream os__, " << name << "Prx v__)";
+ _out << sp << nl << "public static void write(Ice.OutputStream ostr, " << name << "Prx v)";
_out << sb;
- _out << nl << "os__.writeProxy(v__);";
+ _out << nl << "ostr.writeProxy(v);";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx read(Ice.InputStream is__)";
+ _out << sp << nl << "public static " << name << "Prx read(Ice.InputStream istr)";
_out << sb;
- _out << nl << "Ice.ObjectPrx proxy = is__.readProxy();";
+ _out << nl << "Ice.ObjectPrx proxy = istr.readProxy();";
_out << nl << "if(proxy != null)";
_out << sb;
_out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
- _out << nl << "result.copyFrom__(proxy);";
+ _out << nl << "result.iceCopyFrom(proxy);";
_out << nl << "return result;";
_out << eb;
_out << nl << "return null;";
@@ -4946,16 +4960,16 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
_out << nl << "public sealed class " << p->name() << "Helper";
_out << sb;
- _out << sp << nl << "public static void write(Ice.OutputStream os__, " << typeS << " v__)";
+ _out << sp << nl << "public static void write(Ice.OutputStream ostr, " << typeS << " v)";
_out << sb;
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", true, false);
+ writeSequenceMarshalUnmarshalCode(_out, p, "v", true, false);
_out << eb;
- _out << sp << nl << "public static " << typeS << " read(Ice.InputStream is__)";
+ _out << sp << nl << "public static " << typeS << " read(Ice.InputStream istr)";
_out << sb;
- _out << nl << typeS << " v__;";
- writeSequenceMarshalUnmarshalCode(_out, p, "v__", false, false);
- _out << nl << "return v__;";
+ _out << nl << typeS << " v;";
+ writeSequenceMarshalUnmarshalCode(_out, p, "v", false, false);
+ _out << nl << "return v;";
_out << eb;
_out << eb;
@@ -5030,23 +5044,23 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << sp << nl << "public static void write(";
_out.useCurrentPosAsIndent();
- _out << "Ice.OutputStream os__,";
- _out << nl << name << " v__)";
+ _out << "Ice.OutputStream ostr,";
+ _out << nl << name << " v)";
_out.restoreIndent();
_out << sb;
- _out << nl << "if(v__ == null)";
+ _out << nl << "if(v == null)";
_out << sb;
- _out << nl << "os__.writeSize(0);";
+ _out << nl << "ostr.writeSize(0);";
_out << eb;
_out << nl << "else";
_out << sb;
- _out << nl << "os__.writeSize(v__.Count);";
+ _out << nl << "ostr.writeSize(v.Count);";
_out << nl << "foreach(_System.Collections.";
_out << "Generic.KeyValuePair<" << keyS << ", " << valueS << ">";
- _out << " e__ in v__)";
+ _out << " e in v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, key, "e__.Key", true);
- writeMarshalUnmarshalCode(_out, value, "e__.Value", true);
+ writeMarshalUnmarshalCode(_out, key, "e.Key", true);
+ writeMarshalUnmarshalCode(_out, value, "e.Value", true);
_out << eb;
_out << eb;
_out << eb;
@@ -5055,9 +5069,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
if(hasClassValue)
{
- _out << sp << nl << "public sealed class Patcher__";
+ _out << sp << nl << "public sealed class Patcher_";
_out << sb;
- _out << sp << nl << "internal Patcher__(string type, " << name << " m, " << keyS << " key)";
+ _out << sp << nl << "internal Patcher_(string type, " << name << " m, " << keyS << " key)";
_out << sb;
_out << nl << "_type = type;";
_out << nl << "_m = m;";
@@ -5089,56 +5103,56 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << eb;
}
- _out << sp << nl << "public static " << name << " read(Ice.InputStream is__)";
+ _out << sp << nl << "public static " << name << " read(Ice.InputStream istr)";
_out << sb;
- _out << nl << "int sz__ = is__.readSize();";
- _out << nl << name << " r__ = new " << name << "();";
- _out << nl << "for(int i__ = 0; i__ < sz__; ++i__)";
+ _out << nl << "int sz = istr.readSize();";
+ _out << nl << name << " r = new " << name << "();";
+ _out << nl << "for(int i = 0; i < sz; ++i)";
_out << sb;
- _out << nl << keyS << " k__;";
+ _out << nl << keyS << " k;";
StructPtr st = StructPtr::dynamicCast(key);
if(st)
{
if(isValueType(st))
{
- _out << nl << "k__ = new " << typeToString(key) << "();";
+ _out << nl << "k = new " << typeToString(key) << "();";
}
else
{
- _out << nl << "k__ = null;";
+ _out << nl << "k = null;";
}
}
- writeMarshalUnmarshalCode(_out, key, "k__", false);
+ writeMarshalUnmarshalCode(_out, key, "k", false);
string patcher;
if(hasClassValue)
{
- patcher = "new Patcher__(" + getStaticId(value) + ", r__, k__).patch";
+ patcher = "new Patcher_(" + getStaticId(value) + ", r, k).patch";
}
else
{
- _out << nl << valueS << " v__;";
+ _out << nl << valueS << " v;";
StructPtr st = StructPtr::dynamicCast(value);
if(st)
{
if(isValueType(st))
{
- _out << nl << "v__ = new " << typeToString(value) << "();";
+ _out << nl << "v = new " << typeToString(value) << "();";
}
else
{
- _out << nl << "v__ = null;";
+ _out << nl << "v = null;";
}
}
}
- writeMarshalUnmarshalCode(_out, value, hasClassValue ? patcher : "v__", false);
+ writeMarshalUnmarshalCode(_out, value, hasClassValue ? patcher : "v", false);
if(!hasClassValue)
{
- _out << nl << "r__[k__] = v__;";
+ _out << nl << "r[k] = v;";
}
_out << eb;
- _out << nl << "return r__;";
+ _out << nl << "return r;";
_out << eb;
_out << eb;
@@ -5391,7 +5405,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
_out << "override ";
}
- _out << "void " << opName << "_async" << spar << pDecl << "Ice.Current current__ = null" << epar;
+ _out << "void " << opName << "_async" << spar << pDecl << "Ice.Current current = null" << epar;
if(comment)
{
@@ -5402,7 +5416,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << sb;
if(ret)
{
- _out << nl << typeToString(ret) << " ret__ = " << writeValue(ret) << ';';
+ _out << nl << typeToString(ret) << " ret = " << writeValue(ret) << ';';
}
for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
{
@@ -5413,10 +5427,10 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << nl << typeToString(type) << ' ' << name << " = " << writeValue(type) << ';';
}
}
- _out << nl << "cb__.ice_response" << spar;
+ _out << nl << "cb.ice_response" << spar;
if(ret)
{
- _out << "ret__";
+ _out << "ret";
}
for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
{
@@ -5440,7 +5454,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
if(!cl->isLocal())
{
- _out << "Ice.Current current__ = null";
+ _out << "Ice.Current current = null";
}
_out << epar;
if(comment)
diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h
index 1b3096d415e..d4de81b812c 100644
--- a/cpp/src/slice2cs/Gen.h
+++ b/cpp/src/slice2cs/Gen.h
@@ -25,20 +25,21 @@ public:
protected:
- void writeMarshalUnmarshalParams(const ParamDeclList&, const OperationPtr&, bool, bool = false);
+ void writeMarshalUnmarshalParams(const ParamDeclList&, const OperationPtr&, bool, bool = false,
+ bool = false, const std::string& = "");
void writePostUnmarshalParams(const ParamDeclList&, const OperationPtr&);
- void writeMarshalDataMember(const DataMemberPtr&, const std::string&);
- void writeUnmarshalDataMember(const DataMemberPtr&, const std::string&, bool, int&);
+ void writeMarshalDataMember(const DataMemberPtr&, const std::string&, const std::string& = "");
+ void writeUnmarshalDataMember(const DataMemberPtr&, const std::string&, bool, int&, const std::string& = "");
virtual void writeInheritedOperations(const ClassDefPtr&);
virtual void writeDispatch(const ClassDefPtr&);
virtual void writeMarshaling(const ClassDefPtr&);
static std::vector<std::string> getParams(const OperationPtr&);
- static std::vector<std::string> getInParams(const OperationPtr&);
+ static std::vector<std::string> getInParams(const OperationPtr&, bool = false);
static std::vector<std::string> getOutParams(const OperationPtr&, bool, bool);
static std::vector<std::string> getArgs(const OperationPtr&);
- static std::vector<std::string> getInArgs(const OperationPtr&);
+ static std::vector<std::string> getInArgs(const OperationPtr&, bool = false);
static std::string getDispatchParams(const OperationPtr&, std::string&, std::vector<std::string>&, std::vector<std::string>&);
void emitAttributes(const ContainedPtr&);