summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rw-r--r--cpp/src/slice2cs/Gen.cpp820
1 files changed, 448 insertions, 372 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index b5dd7b25c61..e3fdca9b129 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -37,24 +37,24 @@ namespace
{
string
-sliceModeToIceMode(Operation::Mode opMode)
+sliceModeToIceMode(Operation::Mode opMode, string package)
{
string mode;
switch(opMode)
{
case Operation::Normal:
{
- mode = "Ice.OperationMode.Normal";
+ mode = CsGenerator::getUnqualified("Ice.OperationMode.Normal", package);
break;
}
case Operation::Nonmutating:
{
- mode = "Ice.OperationMode.Nonmutating";
+ mode = CsGenerator::getUnqualified("Ice.OperationMode.Nonmutating", package);
break;
}
case Operation::Idempotent:
{
- mode = "Ice.OperationMode.Idempotent";
+ mode = CsGenerator::getUnqualified("Ice.OperationMode.Idempotent", package);
break;
}
default:
@@ -67,18 +67,26 @@ sliceModeToIceMode(Operation::Mode opMode)
}
string
-opFormatTypeToString(const OperationPtr& op)
+opFormatTypeToString(const OperationPtr& op, string package)
{
- switch(op->format())
+ switch (op->format())
{
- case DefaultFormat:
- return "Ice.FormatType.DefaultFormat";
- case CompactFormat:
- return "Ice.FormatType.CompactFormat";
- case SlicedFormat:
- return "Ice.FormatType.SlicedFormat";
- default:
- assert(false);
+ case DefaultFormat:
+ {
+ return CsGenerator::getUnqualified("Ice.FormatType.DefaultFormat", package);
+ }
+ case CompactFormat:
+ {
+ return CsGenerator::getUnqualified("Ice.FormatType.CompactFormat", package);
+ }
+ case SlicedFormat:
+ {
+ return CsGenerator::getUnqualified("Ice.FormatType.SlicedFormat", package);
+ }
+ default:
+ {
+ assert(false);
+ }
}
return "???";
@@ -107,7 +115,7 @@ emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, const
string reason = getDeprecateReason(p1, p2, type);
if(!reason.empty())
{
- out << nl << "[_System.Obsolete(\"" << reason << "\")]";
+ out << nl << "[global::System.Obsolete(\"" << reason << "\")]";
}
}
@@ -165,7 +173,7 @@ Slice::CsVisitor::~CsVisitor()
void
Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const OperationPtr& op, bool marshal,
- const string& scope, bool resultStruct, bool publicNames,
+ const string& package, bool resultStruct, bool publicNames,
const string& customStream)
{
ParamDeclList optionals;
@@ -189,7 +197,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(type))
{
ostringstream os;
- os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }";
+ os << '(' << typeToString(type, package) << " v) => {" << paramPrefix << param << " = v; }";
param = os.str();
}
else
@@ -203,7 +211,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
}
else
{
- writeMarshalUnmarshalCode(_out, type, scope, param, marshal, customStream);
+ writeMarshalUnmarshalCode(_out, type, package, param, marshal, customStream);
}
}
@@ -216,7 +224,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
@@ -226,7 +234,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!op->returnIsOptional())
{
- writeMarshalUnmarshalCode(_out, ret, scope, param, marshal, customStream);
+ writeMarshalUnmarshalCode(_out, ret, package, param, marshal, customStream);
}
}
@@ -255,14 +263,14 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
{
param = paramPrefix + returnValueS;
}
- writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, ret, package, param, op->returnTag(), marshal, customStream);
checkReturnType = false;
}
@@ -271,7 +279,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(type))
{
ostringstream os;
- os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }";
+ os << '(' << typeToString(type, package) << " v) => {" << paramPrefix << param << " = v; }";
param = os.str();
}
else
@@ -279,7 +287,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
param = paramPrefix + param;
}
- writeOptionalMarshalUnmarshalCode(_out, type, scope, param, (*pli)->tag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, type, package, param, (*pli)->tag(), marshal, customStream);
}
if(checkReturnType)
@@ -288,24 +296,25 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
{
param = paramPrefix + returnValueS;
}
- writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, ret, package, param, op->returnTag(), marshal, customStream);
}
}
void
-Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct)
+Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& package,
+ bool forStruct)
{
if(member->optional())
{
assert(!forStruct);
- writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, name, member->tag(), true, "ostr_");
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), package, name, member->tag(), true, "ostr_");
}
else
{
@@ -316,18 +325,19 @@ Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const stri
memberName = "this." + memberName;
}
- writeMarshalUnmarshalCode(_out, member->type(), scope, memberName, true, stream);
+ writeMarshalUnmarshalCode(_out, member->type(), package, memberName, true, stream);
}
}
void
-Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct)
+Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, const string& package,
+ bool forStruct)
{
string param = name;
if(isClassType(member->type()))
{
ostringstream os;
- os << '(' << typeToString(member->type(), scope) << " v) => { this." << name << " = v; }";
+ os << '(' << typeToString(member->type(), package) << " v) => { this." << name << " = v; }";
param = os.str();
}
else if(forStruct)
@@ -338,18 +348,17 @@ Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const st
if(member->optional())
{
assert(!forStruct);
- writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, param, member->tag(), false, "istr_");
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), package, param, member->tag(), false, "istr_");
}
else
{
- writeMarshalUnmarshalCode(_out, member->type(), scope, param, false, forStruct ? "" : "istr_");
+ writeMarshalUnmarshalCode(_out, member->type(), package, param, false, forStruct ? "" : "istr_");
}
}
void
Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p)
{
- const string scope = fixId(p->scope());
ClassList bases = p->bases();
if(!bases.empty() && !bases.front()->isInterface())
{
@@ -371,7 +380,8 @@ Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p)
{
string retS;
vector<string> params, args;
- string name = getDispatchParams(*i, retS, params, args, scope);
+ string package = getPackage(p);
+ string name = getDispatchParams(*i, retS, params, args, package);
_out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';';
}
@@ -384,7 +394,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
string name = fixId(p->name());
string scoped = p->scoped();
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ClassList allBases = p->allBases();
StringList ids;
ClassList bases = p->bases();
@@ -430,9 +440,9 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override bool ice_isA(string s, " << getUnqualified("Ice.Current", scope) << " current = null)";
+ _out << nl << "public override bool ice_isA(string s, " << getUnqualified("Ice.Current", package) << " current = null)";
_out << sb;
- _out << nl << "return _System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;";
+ _out << nl << "return global::System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;";
_out << eb;
_out << sp;
@@ -440,7 +450,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string[] ice_ids(" << getUnqualified("Ice.Current", scope) << " current = null)";
+ _out << nl << "public override string[] ice_ids(" << getUnqualified("Ice.Current", package) << " current = null)";
_out << sb;
_out << nl << "return _ids;";
_out << eb;
@@ -450,7 +460,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string ice_id(" << getUnqualified("Ice.Current", scope) << " current = null)";
+ _out << nl << "public override string ice_id(" << getUnqualified("Ice.Current", package) << " current = null)";
_out << sb;
_out << nl << "return _ids[" << scopedPos << "];";
_out << eb;
@@ -483,21 +493,21 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
string opName = op->name();
_out << sp;
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]";
if(!p->isInterface())
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public static _System.Threading.Tasks.Task<" << getUnqualified("Ice.OutputStream", scope) << ">";
+ _out << nl << "public static global::System.Threading.Tasks.Task<" << getUnqualified("Ice.OutputStream", package) << ">";
_out << nl << "iceD_" << opName << "(" << name << (p->isInterface() ? "" : "Disp_") << " obj, "
- << "IceInternal.Incoming inS, " << getUnqualified("Ice.Current", scope) << " current)";
+ << "global::IceInternal.Incoming inS, " << getUnqualified("Ice.Current", package) << " current)";
_out << sb;
TypePtr ret = op->returnType();
ParamDeclList inParams = op->inParameters();
ParamDeclList outParams = op->outParameters();
- _out << nl << getUnqualified("Ice.ObjectImpl", scope) << ".iceCheckMode(" << sliceModeToIceMode(op->mode())
+ _out << nl << getUnqualified("Ice.ObjectImpl", package) << ".iceCheckMode(" << sliceModeToIceMode(op->mode(), package)
<< ", current.mode);";
if(!inParams.empty())
{
@@ -508,7 +518,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
string param = "iceP_" + (*pli)->name();
- string typeS = typeToString((*pli)->type(), scope, (*pli)->optional());
+ string typeS = typeToString((*pli)->type(), package, (*pli)->optional());
const bool isClass = isClassType((*pli)->type());
if((*pli)->optional())
@@ -516,7 +526,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << nl << typeS << ' ' << param;
if(isClass)
{
- _out << " = " << getUnqualified("Ice.Util", scope) << ".None";
+ _out << " = " << getUnqualified("Ice.Util", package) << ".None";
}
_out << ';';
}
@@ -534,7 +544,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
}
}
- writeMarshalUnmarshalParams(inParams, 0, false, scope);
+ writeMarshalUnmarshalParams(inParams, 0, false, package);
if(op->sendsClasses(false))
{
_out << nl << "istr.readPendingValues();";
@@ -548,7 +558,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
if(op->format() != DefaultFormat)
{
- _out << nl << "inS.setFormat(" << opFormatTypeToString(op) << ");";
+ _out << nl << "inS.setFormat(" << opFormatTypeToString(op, package) << ");";
}
vector<string> inArgs;
@@ -566,7 +576,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
else if(amd)
{
- string retS = resultType(op, scope);
+ string retS = resultType(op, package);
_out << nl << "return inS.setResultTask" << (retS.empty() ? "" : ('<' + retS + '>'));
_out << "(obj." << opName << "Async" << spar << inArgs << "current" << epar;
if(!retS.empty())
@@ -582,7 +592,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << nl << "(ostr, ret) =>";
}
_out << sb;
- writeMarshalUnmarshalParams(outParams, op, true, scope, true);
+ writeMarshalUnmarshalParams(outParams, op, true, package, true);
if(op->returnsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -597,7 +607,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- string typeS = typeToString((*pli)->type(), scope, (*pli)->optional());
+ string typeS = typeToString((*pli)->type(), package, (*pli)->optional());
_out << nl << typeS << ' ' << "iceP_" + (*pli)->name() << ";";
}
@@ -622,7 +632,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
if(!outParams.empty() || ret)
{
_out << nl << "var ostr = inS.startWriteParams();";
- writeMarshalUnmarshalParams(outParams, op, true, scope);
+ writeMarshalUnmarshalParams(outParams, op, true, package);
if(op->returnsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -667,14 +677,16 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override _System.Threading.Tasks.Task<Ice.OutputStream>";
- _out << nl << "iceDispatch(IceInternal.Incoming inS, " << getUnqualified("Ice.Current", scope) << " current)";
+ _out << nl << "public override global::System.Threading.Tasks.Task<"
+ << getUnqualified("Ice.OutputStream", package) << ">";
+ _out << nl << "iceDispatch(global::IceInternal.Incoming inS, "
+ << getUnqualified("Ice.Current", package) << " current)";
_out << sb;
- _out << nl << "int pos = _System.Array.BinarySearch(_all, current.operation, "
- << "IceUtilInternal.StringUtil.OrdinalStringComparer);";
+ _out << nl << "int pos = global::System.Array.BinarySearch(_all, current.operation, "
+ << "global::IceUtilInternal.StringUtil.OrdinalStringComparer);";
_out << nl << "if(pos < 0)";
_out << sb;
- _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", scope)
+ _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", package)
<< "(current.id, current.facet, current.operation);";
_out << eb;
_out << sp << nl << "switch(pos)";
@@ -688,19 +700,23 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sb;
if(opName == "ice_id")
{
- _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_id(this, inS, current);";
+ _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package)
+ << ".iceD_ice_id(this, inS, current);";
}
else if(opName == "ice_ids")
{
- _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_ids(this, inS, current);";
+ _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package)
+ << ".iceD_ice_ids(this, inS, current);";
}
else if(opName == "ice_isA")
{
- _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_isA(this, inS, current);";
+ _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package)
+ << ".iceD_ice_isA(this, inS, current);";
}
else if(opName == "ice_ping")
{
- _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_ping(this, inS, current);";
+ _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package)
+ << ".iceD_ice_ping(this, inS, current);";
}
else
{
@@ -720,8 +736,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
else
{
- _out << nl << "return " << getUnqualified(fixId(cl->scoped() + "Disp_"), scope) << ".iceD_"
- << opName << "(this, inS, current);";
+ _out << nl << "return " << getUnqualified(fixId(cl->scoped() + "Disp_"), package)
+ << ".iceD_" << opName << "(this, inS, current);";
}
break;
}
@@ -730,8 +746,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << eb;
}
_out << eb;
- _out << sp << nl << "_System.Diagnostics.Debug.Assert(false);";
- _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", scope)
+ _out << sp << nl << "global::System.Diagnostics.Debug.Assert(false);";
+ _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", package)
<< "(current.id, current.facet, current.operation);";
_out << eb;
}
@@ -747,7 +763,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
string name = fixId(p->name());
string scoped = p->scoped();
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ClassList allBases = p->allBases();
StringList ids;
ClassList bases = p->bases();
@@ -787,7 +803,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override " << getUnqualified("Ice.SlicedData", scope) << " ice_getSlicedData()";
+ _out << nl << "public override " << getUnqualified("Ice.SlicedData", package) << " ice_getSlicedData()";
_out << sb;
_out << nl << "return iceSlicedData_;";
_out << eb;
@@ -797,7 +813,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)";
+ _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", package) << " ostr_)";
_out << sb;
_out << nl << "ostr_.startValue(iceSlicedData_);";
_out << nl << "iceWriteImpl(ostr_);";
@@ -809,7 +825,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", scope) << " istr_)";
+ _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", package) << " istr_)";
_out << sb;
_out << nl << "istr_.startValue();";
_out << nl << "iceReadImpl(istr_);";
@@ -822,19 +838,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)";
+ _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", package) << " ostr_)";
_out << sb;
_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), scope);
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package);
}
_out << nl << "ostr_.endSlice();";
if(base)
@@ -848,19 +864,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", scope) << " istr_)";
+ _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", package) << " istr_)";
_out << sb;
_out << nl << "istr_.startSlice();";
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
if(!(*d)->optional())
{
- writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package);
}
_out << nl << "istr_.endSlice();";
if(base)
@@ -871,7 +887,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", scope) << " iceSlicedData_;";
+ _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", package) << " iceSlicedData_;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -894,7 +910,7 @@ Slice::CsVisitor::getParamAttributes(const ParamDeclPtr& p)
}
vector<string>
-Slice::CsVisitor::getParams(const OperationPtr& op, const string& scope)
+Slice::CsVisitor::getParams(const OperationPtr& op, const string& package)
{
vector<string> params;
ParamDeclList paramList = op->parameters();
@@ -906,14 +922,14 @@ Slice::CsVisitor::getParams(const OperationPtr& op, const string& scope)
{
param += "out ";
}
- param += typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name());
+ param += typeToString((*q)->type(), package, (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name());
params.push_back(param);
}
return params;
}
vector<string>
-Slice::CsVisitor::getInParams(const OperationPtr& op, const string& scope, bool internal)
+Slice::CsVisitor::getInParams(const OperationPtr& op, const string& package, bool internal)
{
vector<string> params;
@@ -922,14 +938,14 @@ Slice::CsVisitor::getInParams(const OperationPtr& op, const string& scope, bool
ParamDeclList paramList = op->inParameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal())
+ params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), package, (*q)->optional(), cl->isLocal())
+ " " + (internal ? "iceP_" + (*q)->name() : fixId((*q)->name())));
}
return params;
}
vector<string>
-Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool returnParam, bool outKeyword)
+Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& package, bool returnParam, bool outKeyword)
{
vector<string> params;
if(returnParam)
@@ -937,7 +953,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool
TypePtr ret = op->returnType();
if(ret)
{
- params.push_back(typeToString(ret, scope, op->returnIsOptional()) + " ret");
+ params.push_back(typeToString(ret, package, op->returnIsOptional()) + " ret");
}
}
@@ -949,7 +965,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool
{
s += "out ";
}
- s += typeToString((*q)->type(), scope, (*q)->optional()) + ' ' + fixId((*q)->name());
+ s += typeToString((*q)->type(), package, (*q)->optional()) + ' ' + fixId((*q)->name());
params.push_back(s);
}
@@ -990,7 +1006,7 @@ Slice::CsVisitor::getInArgs(const OperationPtr& op, bool internal)
string
Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector<string>& params, vector<string>& args,
- const string& scope)
+ const string& package)
{
string name;
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); // Get the class containing the op.
@@ -999,30 +1015,30 @@ Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector
if(cl->hasMetaData("amd") || op->hasMetaData("amd"))
{
name = op->name() + "Async";
- params = getInParams(op, scope);
+ params = getInParams(op, package);
args = getInArgs(op);
paramDecls = op->inParameters();
- retS = taskResultType(op, scope, true);
+ retS = taskResultType(op, package, true);
}
else if(op->hasMarshaledResult())
{
name = fixId(op->name(), DotNet::ICloneable, true);
- params = getInParams(op, scope);
+ params = getInParams(op, package);
args = getInArgs(op);
paramDecls = op->inParameters();
- retS = resultType(op, scope, true);
+ retS = resultType(op, package, true);
}
else
{
name = fixId(op->name(), DotNet::ICloneable, true);
- params = getParams(op, scope);
+ params = getParams(op, package);
args = getArgs(op);
paramDecls = op->parameters();
- retS = typeToString(op->returnType(), scope, op->returnIsOptional());
+ retS = typeToString(op->returnType(), package, op->returnIsOptional());
}
string currentParamName = getEscapedParamName(op, "current");
- params.push_back(getUnqualified("Ice.Current", scope) + " " + currentParamName + " = null");
+ params.push_back(getUnqualified("Ice.Current", package) + " " + currentParamName + " = null");
args.push_back(currentParamName);
return name;
}
@@ -1044,13 +1060,13 @@ Slice::CsVisitor::emitAttributes(const ContainedPtr& p)
void
Slice::CsVisitor::emitComVisibleAttribute()
{
- _out << nl << "[_System.Runtime.InteropServices.ComVisible(false)]";
+ _out << nl << "[global::System.Runtime.InteropServices.ComVisible(false)]";
}
void
Slice::CsVisitor::emitGeneratedCodeAttribute()
{
- _out << nl << "[_System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION << "\")]";
+ _out << nl << "[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION << "\")]";
}
void
@@ -1061,20 +1077,20 @@ Slice::CsVisitor::emitPartialTypeAttributes()
// FxCop may complain about naming convention violations. These attributes suppress those
// warnings, but only when the generated code is compiled with /define:CODE_ANALYSIS.
//
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1707\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1709\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1710\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1711\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1715\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1722\")]";
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1724\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1707\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1709\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1710\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1711\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1715\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1722\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1724\")]";
}
string
-Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope)
+Slice::CsVisitor::writeValue(const TypePtr& type, const string& package)
{
assert(type);
@@ -1117,7 +1133,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope)
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return typeToString(type, scope) + "." + fixId((*en->enumerators().begin())->name());
+ return typeToString(type, package) + "." + fixId((*en->enumerators().begin())->name());
}
StructPtr st = StructPtr::dynamicCast(type);
@@ -1129,7 +1145,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope)
}
else
{
- return "new " + typeToString(type, scope) + "()";
+ return "new " + typeToString(type, package) + "()";
}
}
@@ -1194,7 +1210,7 @@ Slice::CsVisitor::requiresDataMemberInitializers(const DataMemberList& members)
}
void
-Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, const string& scope, int baseTypes,
+Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, const string& package, int baseTypes,
bool propertyMapping)
{
for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p)
@@ -1217,7 +1233,7 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, con
else if((*p)->optional())
{
_out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new "
- << typeToString((*p)->type(), scope, true) << "();";
+ << typeToString((*p)->type(), package, true) << "();";
}
else
{
@@ -1230,7 +1246,7 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, con
StructPtr st = StructPtr::dynamicCast((*p)->type());
if(st)
{
- _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, scope, false)
+ _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, package, false)
<< "();";
}
}
@@ -1892,6 +1908,47 @@ Slice::CsVisitor::writeDocCommentParam(const OperationPtr& p, ParamDir paramType
}
}
+bool
+Slice::CsVisitor::visitModuleStart(const ModulePtr& p)
+{
+ if(!ContainedPtr::dynamicCast(p->container()))
+ {
+ string package = getPackage(p);
+ string name = fixId(p->name());
+ if(package != name)
+ {
+ vector<string> tokens;
+ IceUtilInternal::splitString(package, ".", tokens);
+ for(vector<string>::const_iterator p = tokens.begin(); p != tokens.end(); ++p)
+ {
+ _out << sp;
+ _out << nl << "namespace " << *p;
+ _out << sb;
+ }
+ }
+ }
+ return true;
+}
+
+void
+Slice::CsVisitor::visitModuleEnd(const ModulePtr& p)
+{
+ if(!ContainedPtr::dynamicCast(p->container()))
+ {
+ string package = getPackage(p);
+ string name = fixId(p->name());
+ if(package != name)
+ {
+ vector<string> tokens;
+ IceUtilInternal::splitString(package, ".", tokens);
+ for(vector<string>::const_iterator p = tokens.begin(); p != tokens.end(); ++p)
+ {
+ _out << eb;
+ }
+ }
+ }
+}
+
Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& dir,
bool tie, bool impl, bool implTie) :
_includePaths(includePaths),
@@ -2034,11 +2091,11 @@ Slice::Gen::generateChecksums(const UnitPtr& u)
_out << sb;
_out << nl << "namespace SliceChecksums";
_out << sb;
- _out << nl << "[_System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION
+ _out << nl << "[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION
<< "\")]";
_out << nl << "public sealed class " << className;
_out << sb;
- _out << nl << "public static _System.Collections.Hashtable map = new _System.Collections.Hashtable();";
+ _out << nl << "public static global::System.Collections.Hashtable map = new global::System.Collections.Hashtable();";
_out << sp << nl << "static " << className << "()";
_out << sb;
for(ChecksumMap::const_iterator p = map.begin(); p != map.end(); ++p)
@@ -2173,6 +2230,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
string name = fixId(p->name());
_out << sp;
emitAttributes(p);
@@ -2184,8 +2242,9 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p)
}
void
-Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -2194,7 +2253,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
string name = p->name();
string scoped = fixId(p->scoped());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ClassList bases = p->bases();
bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
@@ -2207,8 +2266,8 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
emitComVisibleAttribute();
OperationPtr o = p->allOperations().front();
- _out << nl << "public delegate " << typeToString(o->returnType(), scope, o->returnIsOptional()) << " ";
- _out << fixId(name) << spar << getParams(o, scope) << epar << ";";
+ _out << nl << "public delegate " << typeToString(o->returnType(), package, o->returnIsOptional()) << " ";
+ _out << fixId(name) << spar << getParams(o, package) << epar << ";";
return false;
}
@@ -2219,22 +2278,22 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "public partial interface " << fixId(name);
if(!p->isLocal())
{
- baseNames.push_back(getUnqualified("Ice.Object", scope));
+ baseNames.push_back(getUnqualified("Ice.Object", package));
baseNames.push_back(name + "Operations_");
}
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
- baseNames.push_back(getUnqualified(fixId((*q)->scoped()), scope));
+ baseNames.push_back(getUnqualified(*q, package));
}
}
else
{
emitComVisibleAttribute();
emitPartialTypeAttributes();
- _out << nl << "[_System.Serializable]";
+ _out << nl << "[global::System.Serializable]";
if(p->allOperations().size() > 0) // See bug 4747
{
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1012\")]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1012\")]";
}
_out << nl << "public ";
if(p->isLocal() && p->allOperations().size() > 0) // Don't use isAbstract() here - see bug 3739
@@ -2247,12 +2306,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(!p->isLocal())
{
- baseNames.push_back("Ice.Value");
+ baseNames.push_back(getUnqualified("Ice.Value", package));
}
}
else
{
- baseNames.push_back(fixId(bases.front()->scoped()));
+ baseNames.push_back(getUnqualified(bases.front(), package));
bases.pop_front();
}
@@ -2262,7 +2321,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if((*q)->isAbstract())
{
- baseNames.push_back(fixId((*q)->scoped()));
+ baseNames.push_back(getUnqualified(*q, package));
}
}
}
@@ -2290,7 +2349,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << ", ";
}
- _out << getUnqualified(*q, scope);
+ _out << *q;
}
}
@@ -2326,7 +2385,7 @@ void
Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
string name = fixId(p->name());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
DataMemberList classMembers = p->classDataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
DataMemberList dataMembers = p->dataMembers();
@@ -2368,7 +2427,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
_out << " : base()";
}
_out << sb;
- writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping);
+ writeDataMemberInitializers(dataMembers, package, DotNet::ICloneable, propertyMapping);
_out << nl << "ice_initialize();";
_out << eb;
@@ -2379,7 +2438,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d)
{
string memberName = fixId((*d)->name(), DotNet::ICloneable);
- string memberType = typeToString((*d)->type(), scope, (*d)->optional(), p->isLocal(), (*d)->getMetaData());
+ string memberType = typeToString((*d)->type(), package, (*d)->optional(), p->isLocal(), (*d)->getMetaData());
paramDecl.push_back(memberType + " " + memberName);
}
_out << paramDecl << epar;
@@ -2457,13 +2516,13 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
bool isLocal = cl->isLocal();
bool isInterface = cl->isInterface();
- string scope = fixId(cl->scope());
+ string package = getPackage(cl);
if(isLocal)
{
string name = fixId(p->name(), DotNet::ICloneable, true);
TypePtr ret = p->returnType();
- string retS = typeToString(ret, scope, p->returnIsOptional(), true);
+ string retS = typeToString(ret, package, p->returnIsOptional(), true);
_out << sp;
if(isInterface)
@@ -2481,11 +2540,11 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << retS << " " << name << spar << getParams(p, scope) << epar << ";";
+ _out << retS << " " << name << spar << getParams(p, package) << epar << ";";
if(cl->hasMetaData("async-oneway") || p->hasMetaData("async-oneway"))
{
- vector<string> inParams = getInParams(p, scope);
+ vector<string> inParams = getInParams(p, package);
ParamDeclList inParamDecls = p->inParameters();
//
@@ -2499,14 +2558,14 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << taskResultType(p, scope);
+ _out << taskResultType(p, package);
string progress = getEscapedParamName(p, "progress");
string cancel = getEscapedParamName(p, "cancel");
_out << " " << name << "Async" << spar << inParams
- << ("_System.IProgress<bool> " + progress + " = null")
- << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()")
+ << ("global::System.IProgress<bool> " + progress + " = null")
+ << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()")
<< epar << ";";
//
@@ -2520,8 +2579,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << getUnqualified("Ice.AsyncResult", scope) << " begin_" << name << spar << inParams
- << getUnqualified("Ice.AsyncCallback", scope) + " " + getEscapedParamName(p, "callback") + " = null"
+ _out << getUnqualified("Ice.AsyncResult", package) << " begin_" << name << spar << inParams
+ << getUnqualified("Ice.AsyncCallback", package) + " " + getEscapedParamName(p, "callback") + " = null"
<< "object " + getEscapedParamName(p, "cookie") + " = null" << epar << ';';
_out << sp;
@@ -2532,8 +2591,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << retS << " end_" << name << spar << getOutParams(p, scope, false, true)
- << (getUnqualified("Ice.AsyncResult", scope) + " " + getEscapedParamName(p, "asyncResult")) << epar << ';';
+ _out << retS << " end_" << name << spar << getOutParams(p, package, false, true)
+ << (getUnqualified("Ice.AsyncResult", package) + " " + getEscapedParamName(p, "asyncResult")) << epar << ';';
}
}
}
@@ -2550,7 +2609,7 @@ bool
Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
string name = fixId(p->name());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ExceptionPtr base = p->base();
_out << sp;
@@ -2561,18 +2620,18 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
// Suppress FxCop diagnostic about a missing constructor MyException(String).
//
- _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1032\")]";
- _out << nl << "[_System.Serializable]";
+ _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1032\")]";
+ _out << nl << "[global::System.Serializable]";
emitPartialTypeAttributes();
_out << nl << "public partial class " << name << " : ";
if(base)
{
- _out << getUnqualified(fixId(base->scoped()), scope);
+ _out << getUnqualified(base, package);
}
else
{
- _out << getUnqualified(p->isLocal() ? "Ice.LocalException" : "Ice.UserException", scope);
+ _out << getUnqualified(p->isLocal() ? "Ice.LocalException" : "Ice.UserException", package);
}
_out << sb;
@@ -2588,7 +2647,7 @@ void
Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
string name = fixId(p->name());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
DataMemberList allDataMembers = p->allDataMembers();
DataMemberList dataMembers = p->dataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
@@ -2599,7 +2658,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
string memberName = fixId((*q)->name());
- string memberType = typeToString((*q)->type(), scope, (*q)->optional());
+ string memberType = typeToString((*q)->type(), package, (*q)->optional());
allParamDecl.push_back(memberType + " " + memberName);
}
@@ -2613,7 +2672,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name());
- string memberType = typeToString((*q)->type(), scope, (*q)->optional());
+ string memberType = typeToString((*q)->type(), package, (*q)->optional());
paramDecl.push_back(memberType + " " + memberName);
}
@@ -2643,7 +2702,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "private void _initDM()";
_out << sb;
- writeDataMemberInitializers(dataMembers, scope, DotNet::Exception);
+ writeDataMemberInitializers(dataMembers, package, DotNet::Exception);
_out << eb;
}
@@ -2659,7 +2718,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public " << name << "(_System.Exception ex) : base(ex)";
+ _out << nl << "public " << name << "(global::System.Exception ex) : base(ex)";
_out << sb;
if(hasDataMemberInitializers)
{
@@ -2668,13 +2727,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_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 << "(global::System.Runtime.Serialization.SerializationInfo info, "
+ << "global::System.Runtime.Serialization.StreamingContext context) : base(info, 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(), scope, name, (*q)->optional(), (*q)->tag(), false);
+ writeSerializeDeserializeCode(_out, (*q)->type(), package, name, (*q)->optional(), (*q)->tag(), false);
}
_out << eb;
@@ -2712,7 +2771,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
vector<string> exceptionParam;
exceptionParam.push_back(exParam);
vector<string> exceptionDecl;
- exceptionDecl.push_back("_System.Exception " + exParam);
+ exceptionDecl.push_back("global::System.Exception " + exParam);
_out << sp;
emitGeneratedCodeAttribute();
_out << nl << "public " << name << spar << allParamDecl << exceptionDecl << epar << " : base" << spar;
@@ -2752,7 +2811,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << nl << "int h_ = 5381;";
}
- _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
+ _out << nl << "global::IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
writeMemberHashCode(dataMembers, DotNet::Exception);
_out << nl << "return h_;";
_out << eb;
@@ -2789,13 +2848,13 @@ 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(global::System.Runtime.Serialization.SerializationInfo info, "
+ << "global::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(), scope, name, (*q)->optional(), (*q)->tag(), true);
+ writeSerializeDeserializeCode(_out, (*q)->type(), package, name, (*q)->optional(), (*q)->tag(), true);
}
_out << sp << nl << "base.GetObjectData(info, context);";
_out << eb;
@@ -2835,14 +2894,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override " << getUnqualified("Ice.SlicedData", scope) << " ice_getSlicedData()";
+ _out << nl << "public override " << getUnqualified("Ice.SlicedData", package) << " ice_getSlicedData()";
_out << sb;
_out << nl << "return slicedData_;";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)";
+ _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", package) << " ostr_)";
_out << sb;
_out << nl << "ostr_.startException(slicedData_);";
_out << nl << "iceWriteImpl(ostr_);";
@@ -2851,7 +2910,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", scope) << " istr_)";
+ _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", package) << " istr_)";
_out << sb;
_out << nl << "istr_.startException();";
_out << nl << "iceReadImpl(istr_);";
@@ -2861,12 +2920,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)";
+ _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", package) << " ostr_)";
_out << sb;
_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), scope);
+ writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), package);
}
_out << nl << "ostr_.endSlice();";
if(base)
@@ -2877,13 +2936,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", scope) << " istr_)";
+ _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", package) << " istr_)";
_out << sb;
_out << nl << "istr_.startSlice();";
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), scope);
+ writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), package);
}
_out << nl << "istr_.endSlice();";
if(base)
@@ -2904,7 +2963,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", scope) << " slicedData_;";
+ _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", package) << " slicedData_;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -2917,20 +2976,20 @@ bool
Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
string name = fixId(p->name());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
_out << sp;
emitDeprecate(p, 0, _out, "type");
emitAttributes(p);
emitPartialTypeAttributes();
- _out << nl << "[_System.Serializable]";
+ _out << nl << "[global::System.Serializable]";
_out << nl << "public partial " << (isValueType(p) ? "struct" : "class") << ' ' << name;
StringList baseNames;
if(!isValueType(p))
{
- baseNames.push_back("_System.ICloneable");
+ baseNames.push_back("System.ICloneable");
}
//
@@ -2955,7 +3014,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
_out << ", ";
}
- _out << getUnqualified(*q, scope);
+ _out << getUnqualified(*q, package);
}
}
@@ -2971,6 +3030,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
{
string name = fixId(p->name());
string scope = fixId(p->scope());
+ string package = getPackage(p);
DataMemberList classMembers = p->classDataMembers();
DataMemberList dataMembers = p->dataMembers();
@@ -2994,7 +3054,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "public " << name << "()";
_out << sb;
- writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping);
+ writeDataMemberInitializers(dataMembers, package, DotNet::ICloneable, propertyMapping);
_out << nl << "ice_initialize();";
_out << eb;
}
@@ -3006,7 +3066,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0);
- string memberType = typeToString((*q)->type(), scope, false, p->isLocal());
+ string memberType = typeToString((*q)->type(), package, false, p->isLocal());
paramDecl.push_back(memberType + " " + memberName);
}
_out << paramDecl << epar;
@@ -3051,7 +3111,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << nl << "public override int GetHashCode()";
_out << sb;
_out << nl << "int h_ = 5381;";
- _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
+ _out << nl << "global::IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");";
writeMemberHashCode(dataMembers, isClass ? DotNet::ICloneable : 0);
_out << nl << "return h_;";
_out << eb;
@@ -3116,27 +3176,27 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void ice_writeMembers(" << getUnqualified("Ice.OutputStream", scope) << " ostr)";
+ _out << nl << "public void ice_writeMembers(" << getUnqualified("Ice.OutputStream", package) << " ostr)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true);
+ writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), package, true);
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void ice_readMembers(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << nl << "public void ice_readMembers(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true);
+ writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), package, true);
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static void ice_write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name
+ _out << nl << "public static void ice_write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name
<< " v)";
_out << sb;
if(isClass)
@@ -3158,7 +3218,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " ice_read(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << nl << "public static " << name << " ice_read(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
_out << nl << "var v = new " << name << "();";
_out << nl << "v.ice_readMembers(istr);";
@@ -3184,7 +3244,7 @@ void
Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
{
string name = fixId(p->name());
- string scope = fixId(p->scope());
+ string package = getPackage(p);
string scoped = fixId(p->scoped());
EnumeratorList enumerators = p->enumerators();
const bool explicitValue = p->explicitValue();
@@ -3216,17 +3276,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(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name << " v)";
+ _out << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name
+ << " v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, p, scope, "v", true);
+ writeMarshalUnmarshalCode(_out, p, package, "v", true);
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
_out << nl << name << " v;";
- writeMarshalUnmarshalCode(_out, p, scope, "v", false);
+ writeMarshalUnmarshalCode(_out, p, package, "v", false);
_out << nl << "return v;";
_out << eb;
@@ -3265,7 +3326,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
StructPtr st = StructPtr::dynamicCast(cont);
ExceptionPtr ex = ExceptionPtr::dynamicCast(cont);
ClassDefPtr cl = ClassDefPtr::dynamicCast(cont);
- string scope = fixId(cont->scope());
+ string package = getPackage(cont);
if(st)
{
isLocal = st->isLocal();
@@ -3301,7 +3362,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
emitDeprecate(p, cont, _out, "member");
- string type = typeToString(p->type(), scope, isOptional, isLocal, p->getMetaData());
+ string type = typeToString(p->type(), package, isOptional, isLocal, p->getMetaData());
string propertyName = fixId(p->name(), baseTypes, isClass);
string dataMemberName;
if(isProperty)
@@ -3367,7 +3428,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 << "global::IceInternal.HashUtil.hashAdd(ref h_, " << fixId((*q)->name(), baseTypes);
if((*q)->optional())
{
_out << ".Value";
@@ -3413,7 +3474,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
//
// Equals() for generic types does not have value semantics.
//
- _out << nl << "if(!IceUtilInternal.Collections.SequenceEquals(this." << memberName << ", o."
+ _out << nl << "if(!global::IceUtilInternal.Collections.SequenceEquals(this." << memberName << ", o."
<< memberName << "))";
}
}
@@ -3425,7 +3486,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i
//
// Equals() for generic types does not have value semantics.
//
- _out << nl << "if(!IceUtilInternal.Collections.DictionaryEquals(this." << memberName << ", o."
+ _out << nl << "if(!global::IceUtilInternal.Collections.DictionaryEquals(this." << memberName << ", o."
<< memberName << "))";
}
else
@@ -3498,6 +3559,7 @@ Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p)
{
if(hasResultType(p))
{
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
@@ -3506,8 +3568,9 @@ Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p)
}
void
-Slice::Gen::ResultVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::ResultVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -3526,7 +3589,7 @@ void
Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
- string scope = fixId(cl->scope());
+ string package = getPackage(cl);
if(cl->isLocal())
{
return;
@@ -3542,7 +3605,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
string retSName;
if(ret)
{
- retS = typeToString(ret, scope, p->returnIsOptional());
+ retS = typeToString(ret, package, p->returnIsOptional());
retSName = resultStructReturnValueName(outParams);
}
@@ -3560,7 +3623,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << (typeToString((*i)->type(), scope, (*i)->optional()) + " " + fixId((*i)->name()));
+ _out << (typeToString((*i)->type(), package, (*i)->optional()) + " " + fixId((*i)->name()));
}
_out << epar;
@@ -3589,7 +3652,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << nl << "public " << typeToString((*i)->type(), scope, (*i)->optional()) << " " << fixId((*i)->name())
+ _out << nl << "public " << typeToString((*i)->type(), package, (*i)->optional()) << " " << fixId((*i)->name())
<< ";";
}
_out << eb;
@@ -3601,18 +3664,18 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public struct " << name << " : " << getUnqualified("Ice.MarshaledResult", scope);
+ _out << nl << "public struct " << name << " : " << getUnqualified("Ice.MarshaledResult", package);
_out << sb;
//
// One shot constructor
//
- _out << nl << "public " << name << spar << getOutParams(p, scope, true, false)
- << getUnqualified("Ice.Current", scope) + " current" << epar;
+ _out << nl << "public " << name << spar << getOutParams(p, package, true, false)
+ << getUnqualified("Ice.Current", package) + " current" << epar;
_out << sb;
- _out << nl << "_ostr = IceInternal.Incoming.createResponseOutputStream(current);";
- _out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p) << ");";
- writeMarshalUnmarshalParams(outParams, p, true, scope, false, true, "_ostr");
+ _out << nl << "_ostr = global::IceInternal.Incoming.createResponseOutputStream(current);";
+ _out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p, package) << ");";
+ writeMarshalUnmarshalParams(outParams, p, true, package, false, true, "_ostr");
if(p->returnsClasses(false))
{
_out << nl << "_ostr.writePendingValues();";
@@ -3620,26 +3683,26 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
_out << nl << "_ostr.endEncapsulation();";
_out << eb;
_out << sp;
- _out << nl << "public " << getUnqualified("Ice.OutputStream", scope) << " getOutputStream("
- << getUnqualified("Ice.Current", scope) << " current)";
+ _out << nl << "public " << getUnqualified("Ice.OutputStream", package) << " getOutputStream("
+ << getUnqualified("Ice.Current", package) << " current)";
_out << sb;
_out << nl << "if(_ostr == null)";
_out << sb;
_out << nl << "return new " << name << spar;
if(ret)
{
- _out << writeValue(ret, scope);
+ _out << writeValue(ret, package);
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << writeValue((*i)->type(), scope);
+ _out << writeValue((*i)->type(), package);
}
_out << "current" << epar << ".getOutputStream(current);";
_out << eb;
_out << nl << "return _ostr;";
_out << eb;
_out << sp;
- _out << nl << "private " << getUnqualified("Ice.OutputStream", scope) << " _ostr;";
+ _out << nl << "private " << getUnqualified("Ice.OutputStream", package) << " _ostr;";
_out << eb;
}
}
@@ -3657,14 +3720,16 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
}
void
-Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -3677,7 +3742,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ClassList bases = p->bases();
_out << sp;
@@ -3691,13 +3756,13 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr def = *q;
if(def->isInterface() || def->allOperations().size() > 0)
{
- baseInterfaces.push_back(getUnqualified(fixId((*q)->scoped() + "Prx"), scope));
+ baseInterfaces.push_back(getUnqualified(fixId((*q)->scoped() + "Prx"), package));
}
}
if(baseInterfaces.empty())
{
- baseInterfaces.push_back(getUnqualified("Ice.ObjectPrx", scope));
+ baseInterfaces.push_back(getUnqualified("Ice.ObjectPrx", package));
}
for(vector<string>::const_iterator q = baseInterfaces.begin(); q != baseInterfaces.end();)
@@ -3723,11 +3788,11 @@ void
Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
- string scope = fixId(cl->scope());
+ string package = getPackage(cl);
string name = fixId(p->name(), DotNet::ICloneable, true);
- vector<string> inParams = getInParams(p, scope);
+ vector<string> inParams = getInParams(p, package);
ParamDeclList inParamDecls = p->inParameters();
- string retS = typeToString(p->returnType(), scope, p->returnIsOptional());
+ string retS = typeToString(p->returnType(), package, p->returnIsOptional());
string deprecateReason = getDeprecateReason(p, cl, "operation");
{
@@ -3740,11 +3805,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + context + " \">The Context map to send with the invocation.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << retS << " " << name << spar << getParams(p, scope)
- << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()") << epar << ';';
+ _out << nl << retS << " " << name << spar << getParams(p, package)
+ << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()") << epar << ';';
}
{
@@ -3762,14 +3827,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + cancel + "\">A cancellation token that receives the cancellation requests.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << taskResultType(p, scope);
+ _out << nl << taskResultType(p, package);
_out << " " << p->name() << "Async" << spar << inParams
- << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()")
- << ("_System.IProgress<bool> " + progress + " = null")
- << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()")
+ << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()")
+ << ("global::System.IProgress<bool> " + progress + " = null")
+ << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()")
<< epar << ";";
}
@@ -3789,12 +3854,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + context + "\">The Context map to send with the invocation.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << p->name() << spar
+ _out << nl << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << p->name() << spar
<< inParams
- << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()") << epar << ';';
+ << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()") << epar << ';';
//
// Type-unsafe begin_ methods.
@@ -3805,10 +3870,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + cookie + "\">Application data to store in the asynchronous result object.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << getUnqualified("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams
- << getUnqualified("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar << ';';
+ _out << nl << getUnqualified("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams
+ << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar << ';';
_out << sp;
writeDocCommentAMI(p, InParam, deprecateReason,
@@ -3817,11 +3882,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + cookie + "\">Application data to store in the asynchronous result object.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << getUnqualified("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams
- << getUnqualified("Ice.OptionalContext", scope) + " " + context
- << getUnqualified("Ice.AsyncCallback", scope) + " " + callback
+ _out << nl << getUnqualified("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams
+ << getUnqualified("Ice.OptionalContext", package) + " " + context
+ << getUnqualified("Ice.AsyncCallback", package) + " " + callback
<< "object " + cookie << epar << ';';
//
@@ -3832,10 +3897,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
"<param name=\"" + asyncResult + "\">The asynchronous result object for the invocation.</param>");
if(!deprecateReason.empty())
{
- _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
+ _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, scope, false, true)
- << getUnqualified("Ice.AsyncResult", scope) + " " + asyncResult << epar << ';';
+ _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, package, false, true)
+ << getUnqualified("Ice.AsyncResult", package) + " " + asyncResult << epar << ';';
}
}
@@ -3847,14 +3912,16 @@ Slice::Gen::AsyncDelegateVisitor::AsyncDelegateVisitor(IceUtilInternal::Output&
bool
Slice::Gen::AsyncDelegateVisitor::visitModuleStart(const ModulePtr& p)
{
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
}
void
-Slice::Gen::AsyncDelegateVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::AsyncDelegateVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -3882,9 +3949,9 @@ Slice::Gen::AsyncDelegateVisitor::visitOperation(const OperationPtr& p)
return;
}
- string scope = fixId(cl->scope());
- vector<string> paramDeclAMI = getOutParams(p, scope, false, false);
- string retS = typeToString(p->returnType(), scope, p->returnIsOptional());
+ string package = getPackage(cl);
+ vector<string> paramDeclAMI = getOutParams(p, package, false, false);
+ string retS = typeToString(p->returnType(), package, p->returnIsOptional());
string delName = "Callback_" + cl->name() + "_" + p->name();
_out << sp;
@@ -3909,15 +3976,16 @@ Slice::Gen::OpsVisitor::visitModuleStart(const ModulePtr& p)
{
return false;
}
-
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
}
void
-Slice::Gen::OpsVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::OpsVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -3932,7 +4000,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
string name = p->name();
- string scope = fixId(p->scope());
+ string package = getPackage(p);
string scoped = fixId(p->scoped());
ClassList bases = p->bases();
string opIntfName = "Operations";
@@ -3960,7 +4028,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string s = (*q)->scoped();
s += "Operations";
- _out << getUnqualified(fixId(s), scope) << '_';
+ _out << getUnqualified(fixId(s), package) << '_';
}
++q;
}
@@ -3974,7 +4042,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"));
string retS;
vector<string> params, args;
- string name = getDispatchParams(op, retS, params, args, scope);
+ string name = getDispatchParams(op, retS, params, args, package);
_out << sp;
if(amd)
{
@@ -4009,14 +4077,16 @@ Slice::Gen::HelperVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
}
void
-Slice::Gen::HelperVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::HelperVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -4029,14 +4099,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
- string scope = fixId(p->scope());
+ string package = getPackage(p);
ClassList bases = p->bases();
_out << sp;
emitComVisibleAttribute();
emitGeneratedCodeAttribute();
- _out << nl << "[_System.Serializable]";
- _out << nl << "public sealed class " << name << "PrxHelper : " << getUnqualified("Ice.ObjectPrxHelperBase", scope)
+ _out << nl << "[global::System.Serializable]";
+ _out << nl << "public sealed class " << name << "PrxHelper : " << getUnqualified("Ice.ObjectPrxHelperBase", package)
<< ", " << name << "Prx";
_out << sb;
@@ -4046,8 +4116,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(global::System.Runtime.Serialization.SerializationInfo info, "
+ << "global::System.Runtime.Serialization.StreamingContext context) : base(info, context)";
_out << sb;
_out << eb;
@@ -4064,9 +4134,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
string opName = fixId(op->name(), DotNet::ICloneable, true);
TypePtr ret = op->returnType();
- string retS = typeToString(ret, scope, op->returnIsOptional());
+ string retS = typeToString(ret, package, op->returnIsOptional());
- vector<string> params = getParams(op, scope);
+ vector<string> params = getParams(op, package);
vector<string> args = getArgs(op);
vector<string> argsAMI = getInArgs(op);
@@ -4095,8 +4165,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
_out << nl << "public " << retS << " " << opName << spar << params
- << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()") << epar;
+ << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()") << epar;
_out << sb;
_out << nl << "try";
_out << sb;
@@ -4119,7 +4189,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
_out << "_iceI_" << op->name() << "Async" << spar << argsAMI << context
- << "null" << "_System.Threading.CancellationToken.None" << "true" << epar;
+ << "null" << "global::System.Threading.CancellationToken.None" << "true" << epar;
if(ret || outParams.size() > 0)
{
@@ -4144,7 +4214,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
_out << eb;
- _out << nl << "catch(_System.AggregateException ex_)";
+ _out << nl << "catch(global::System.AggregateException ex_)";
_out << sb;
_out << nl << "throw ex_.InnerException;";
_out << eb;
@@ -4165,7 +4235,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationPtr op = *r;
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- vector<string> paramsAMI = getInParams(op, scope);
+ vector<string> paramsAMI = getInParams(op, package);
vector<string> argsAMI = getInArgs(op);
string opName = op->name();
@@ -4179,9 +4249,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
TypePtr ret = op->returnType();
- string retS = typeToString(ret, scope, op->returnIsOptional());
+ string retS = typeToString(ret, package, op->returnIsOptional());
- string returnTypeS = resultType(op, scope);
+ string returnTypeS = resultType(op, package);
ExceptionList throws = op->throws();
throws.sort();
@@ -4203,16 +4273,16 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the public Async method.
//
_out << sp;
- _out << nl << "public _System.Threading.Tasks.Task";
+ _out << nl << "public global::System.Threading.Tasks.Task";
if(!returnTypeS.empty())
{
_out << "<" << returnTypeS << ">";
}
_out << " " << opName << "Async" << spar << paramsAMI
- << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()")
- << ("_System.IProgress<bool> " + progress + " = null")
- << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()")
+ << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()")
+ << ("global::System.IProgress<bool> " + progress + " = null")
+ << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()")
<< epar;
_out << sb;
@@ -4224,15 +4294,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the Async method implementation.
//
_out << sp;
- _out << nl << "private _System.Threading.Tasks.Task";
+ _out << nl << "private global::System.Threading.Tasks.Task";
if(!returnTypeS.empty())
{
_out << "<" << returnTypeS << ">";
}
- _out << " _iceI_" << opName << "Async" << spar << getInParams(op, scope, true)
- << getUnqualified("Ice.OptionalContext", scope) + " context"
- << "_System.IProgress<bool> progress"
- << "_System.Threading.CancellationToken cancel"
+ _out << " _iceI_" << opName << "Async" << spar << getInParams(op, package, true)
+ << getUnqualified("Ice.OptionalContext", package) + " context"
+ << "global::System.IProgress<bool> progress"
+ << "global::System.Threading.CancellationToken cancel"
<< "bool synchronous" << epar;
_out << sb;
@@ -4244,12 +4314,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(returnTypeS.empty())
{
_out << nl << "var completed = "
- << "new IceInternal.OperationTaskCompletionCallback<object>(progress, cancel);";
+ << "new global::IceInternal.OperationTaskCompletionCallback<object>(progress, cancel);";
}
else
{
_out << nl << "var completed = "
- << "new IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);";
+ << "new global::IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);";
}
_out << nl << "_iceI_" << opName << spar << getInArgs(op, true) << "context" << "synchronous" << "completed"
@@ -4264,10 +4334,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the common invoke method
//
_out << sp << nl;
- _out << "private void _iceI_" << op->name() << spar << getInParams(op, scope, true)
- << "_System.Collections.Generic.Dictionary<string, string> context"
+ _out << "private void _iceI_" << op->name() << spar << getInParams(op, package, true)
+ << "global::System.Collections.Generic.Dictionary<string, string> context"
<< "bool synchronous"
- << "IceInternal.OutgoingAsyncCompletionCallback completed" << epar;
+ << "global::IceInternal.OutgoingAsyncCompletionCallback completed" << epar;
_out << sb;
if(returnTypeS.empty())
@@ -4282,16 +4352,16 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "outAsync.invoke(";
_out.inc();
_out << nl << flatName << ",";
- _out << nl << sliceModeToIceMode(op->sendMode()) << ",";
- _out << nl << opFormatTypeToString(op) << ",";
+ _out << nl << sliceModeToIceMode(op->sendMode(), package) << ",";
+ _out << nl << opFormatTypeToString(op, package) << ",";
_out << nl << "context,";
_out << nl << "synchronous";
if(!inParams.empty())
{
_out << ",";
- _out << nl << "write: (" << getUnqualified("Ice.OutputStream", scope) << " ostr) =>";
+ _out << nl << "write: (" << getUnqualified("Ice.OutputStream", package) << " ostr) =>";
_out << sb;
- writeMarshalUnmarshalParams(inParams, 0, true, scope);
+ writeMarshalUnmarshalParams(inParams, 0, true, package);
if(op->sendsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -4302,7 +4372,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!throws.empty())
{
_out << ",";
- _out << nl << "userException: (" << getUnqualified("Ice.UserException", scope) << " ex) =>";
+ _out << nl << "userException: (" << getUnqualified("Ice.UserException", package) << " ex) =>";
_out << sb;
_out << nl << "try";
_out << sb;
@@ -4314,13 +4384,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
//
for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
{
- _out << nl << "catch(" << getUnqualified(fixId((*i)->scoped()), scope) << ")";
+ _out << nl << "catch(" << getUnqualified(*i, package) << ")";
_out << sb;
_out << nl << "throw;";
_out << eb;
}
- _out << nl << "catch(" << getUnqualified("Ice.UserException", scope) << ")";
+ _out << nl << "catch(" << getUnqualified("Ice.UserException", package) << ")";
_out << sb;
_out << eb;
@@ -4330,7 +4400,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(ret || !outParams.empty())
{
_out << ",";
- _out << nl << "read: (" << getUnqualified("Ice.InputStream", scope) << " istr) =>";
+ _out << nl << "read: (" << getUnqualified("Ice.InputStream", package) << " istr) =>";
_out << sb;
if(outParams.empty())
{
@@ -4349,7 +4419,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(isClassType(ret))
{
- _out << " = " << getUnqualified("Ice.Util", scope) << ".None";
+ _out << " = " << getUnqualified("Ice.Util", package) << ".None";
}
_out << ";";
}
@@ -4360,14 +4430,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
TypePtr t = outParams.front()->type();
- _out << nl << typeToString(t, scope, (outParams.front()->optional())) << " iceP_"
+ _out << nl << typeToString(t, package, (outParams.front()->optional())) << " iceP_"
<< outParams.front()->name();
if(!outParams.front()->optional())
{
StructPtr st = StructPtr::dynamicCast(t);
if(st && isValueType(st))
{
- _out << " = " << "new " << typeToString(t, scope) << "()";
+ _out << " = " << "new " << typeToString(t, package) << "()";
}
else if(isClassType(t) || st)
{
@@ -4376,12 +4446,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(isClassType(t))
{
- _out << " = " << getUnqualified("Ice.Util", scope) << ".None";
+ _out << " = " << getUnqualified("Ice.Util", package) << ".None";
}
_out << ";";
}
- writeMarshalUnmarshalParams(outParams, op, false, scope, true);
+ writeMarshalUnmarshalParams(outParams, op, false, package, true);
if(op->returnsClasses(false))
{
_out << nl << "istr.readPendingValues();";
@@ -4413,48 +4483,48 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationPtr op = *r;
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- vector<string> paramsAMI = getInParams(op, scope);
+ vector<string> paramsAMI = getInParams(op, package);
vector<string> argsAMI = getInArgs(op);
string opName = op->name();
ParamDeclList inParams = op->inParameters();
ParamDeclList outParams = op->outParameters();
TypePtr ret = op->returnType();
- string retS = typeToString(ret, scope, op->returnIsOptional());
+ string retS = typeToString(ret, package, op->returnIsOptional());
- string returnTypeS = resultType(op, scope);
+ string returnTypeS = resultType(op, package);
//
// Write the begin_ methods.
//
- string clScope = fixId(cl->scope());
- string delType = getUnqualified(clScope + "Callback_" + cl->name() + "_" + op->name(), scope);
+ string clScope = getPackage(cl);
+ string delType = getUnqualified(clScope + ".Callback_" + cl->name() + "_" + op->name(), package);
string context = getEscapedParamName(op, "context");
string callback = getEscapedParamName(op, "callback");
string cookie = getEscapedParamName(op, "cookie");
_out << sp;
- _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName
- << spar << paramsAMI << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " +
- getUnqualified("Ice.OptionalContext", scope) + "()") << epar;
+ _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << opName
+ << spar << paramsAMI << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " +
+ getUnqualified("Ice.OptionalContext", package) + "()") << epar;
_out << sb;
_out << nl << "return begin_" << opName << spar << argsAMI << context << "null" << "null" << "false"
<< epar << ';';
_out << eb;
_out << sp;
- _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) << " begin_" << opName << spar << paramsAMI
- << getUnqualified("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar;
+ _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) << " begin_" << opName << spar << paramsAMI
+ << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar;
_out << sb;
_out << nl << "return begin_" << opName << spar << argsAMI
- << "new " + getUnqualified("Ice.OptionalContext", scope) + "()" << callback << cookie << "false" << epar << ';';
+ << "new " + getUnqualified("Ice.OptionalContext", package) + "()" << callback << cookie << "false" << epar << ';';
_out << eb;
_out << sp;
- _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) + " begin_" << opName << spar << paramsAMI
- << getUnqualified("Ice.OptionalContext", scope) + " " + context
- << getUnqualified("Ice.AsyncCallback", scope) + " " + callback
+ _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) + " begin_" << opName << spar << paramsAMI
+ << getUnqualified("Ice.OptionalContext", package) + " " + context
+ << getUnqualified("Ice.AsyncCallback", package) + " " + callback
<< "object " + cookie << epar;
_out << sb;
_out << nl << "return begin_" << opName << spar << argsAMI << context << callback
@@ -4467,19 +4537,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
string flatName = "_" + opName + "_name";
string asyncResult = getEscapedParamName(op, "asyncResult");
- _out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, scope, false, true)
- << getUnqualified("Ice.AsyncResult", scope) + " " + asyncResult << epar;
+ _out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, package, false, true)
+ << getUnqualified("Ice.AsyncResult", package) + " " + asyncResult << epar;
_out << sb;
- _out << nl << "var resultI_ = IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");";
+ _out << nl << "var resultI_ = global::IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");";
if(returnTypeS.empty())
{
- _out << nl << "((IceInternal.OutgoingAsyncT<object>)resultI_.OutgoingAsync).getResult(resultI_.wait());";
+ _out << nl << "((global::IceInternal.OutgoingAsyncT<object>)resultI_.OutgoingAsync).getResult(resultI_.wait());";
}
else
{
- _out << nl << "var outgoing_ = (IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI_.OutgoingAsync;";
+ _out << nl << "var outgoing_ = (global::IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI_.OutgoingAsync;";
if(outParams.empty())
{
_out << nl << "return outgoing_.getResult(resultI_.wait());";
@@ -4508,10 +4578,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the common begin_ implementation.
//
_out << sp;
- _out << nl << "private " << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName << spar
- << getInParams(op, scope, true)
- << "_System.Collections.Generic.Dictionary<string, string> context"
- << getUnqualified("Ice.AsyncCallback", scope) + " completedCallback" << "object cookie" << "bool synchronous"
+ _out << nl << "private " << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << opName << spar
+ << getInParams(op, package, true)
+ << "global::System.Collections.Generic.Dictionary<string, string> context"
+ << getUnqualified("Ice.AsyncCallback", package) + " completedCallback" << "object cookie" << "bool synchronous"
<< epar;
_out << sb;
@@ -4519,7 +4589,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << "iceCheckAsyncTwowayOnly(" << flatName << ");";
}
- _out << nl << "var completed = new IceInternal.OperationAsyncResultCompletionCallback<" << delType;
+ _out << nl << "var completed = new global::IceInternal.OperationAsyncResultCompletionCallback<" << delType;
_out << ", " << (returnTypeS.empty() ? "object" : returnTypeS);
_out << ">(";
@@ -4565,7 +4635,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "#endregion"; // Asynchronous operations
_out << sp << nl << "#region Checked and unchecked cast operations";
- _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b)";
+ _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4582,8 +4652,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
_out << sp << nl << "public static " << name
- << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope)
- << " b, _System.Collections.Generic.Dictionary<string, string> ctx)";
+ << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package)
+ << " b, global::System.Collections.Generic.Dictionary<string, string> ctx)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4599,14 +4669,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return r;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope)
+ _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package)
<< " b, string f)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
+ _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);";
_out << nl << "try";
_out << sb;
_out << nl << "if(bb.ice_isA(ice_staticId()))";
@@ -4616,21 +4686,21 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return h;";
_out << eb;
_out << eb;
- _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", scope) << ")";
+ _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", package) << ")";
_out << sb;
_out << eb;
_out << nl << "return null;";
_out << eb;
_out << sp << nl << "public static " << name
- << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b, string f, "
- << "_System.Collections.Generic.Dictionary<string, string> ctx)";
+ << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b, string f, "
+ << "global::System.Collections.Generic.Dictionary<string, string> ctx)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
+ _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);";
_out << nl << "try";
_out << sb;
_out << nl << "if(bb.ice_isA(ice_staticId(), ctx))";
@@ -4640,13 +4710,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return h;";
_out << eb;
_out << eb;
- _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", scope) << ")";
+ _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", package) << ")";
_out << sb;
_out << eb;
_out << nl << "return null;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b)";
+ _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4662,14 +4732,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return r;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", scope)
+ _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", package)
<< " b, string f)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
+ _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);";
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
_out << nl << "h.iceCopyFrom(bb);";
_out << nl << "return h;";
@@ -4719,15 +4789,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "#region Marshaling support";
- _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name
+ _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name
<< "Prx v)";
_out << sb;
_out << nl << "ostr.writeProxy(v);";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx read(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << sp << nl << "public static " << name << "Prx read(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
- _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " proxy = istr.readProxy();";
+ _out << nl << getUnqualified("Ice.ObjectPrx", package) << " proxy = istr.readProxy();";
_out << nl << "if(proxy != null)";
_out << sb;
_out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
@@ -4759,23 +4829,23 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
return;
}
- string scope = fixId(p->scope());
- string typeS = typeToString(p, scope);
+ string package = getPackage(p);
+ string typeS = typeToString(p, package);
_out << sp;
emitGeneratedCodeAttribute();
_out << nl << "public sealed class " << p->name() << "Helper";
_out << sb;
- _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << typeS
+ _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << typeS
<< " v)";
_out << sb;
- writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", true, false);
+ writeSequenceMarshalUnmarshalCode(_out, p, package, "v", true, false);
_out << eb;
- _out << sp << nl << "public static " << typeS << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << sp << nl << "public static " << typeS << " read(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
_out << nl << typeS << " v;";
- writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", false, false);
+ writeSequenceMarshalUnmarshalCode(_out, p, package, "v", false, false);
_out << nl << "return v;";
_out << eb;
_out << eb;
@@ -4840,10 +4910,10 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
genericType = meta.substr(prefix.size());
}
- string scope = fixId(p->scope());
- string keyS = typeToString(key, scope);
- string valueS = typeToString(value, scope);
- string name = "_System.Collections.Generic." + genericType + "<" + keyS + ", " + valueS + ">";
+ string package = getPackage(p);
+ string keyS = typeToString(key, package);
+ string valueS = typeToString(value, package);
+ string name = "global::System.Collections.Generic." + genericType + "<" + keyS + ", " + valueS + ">";
_out << sp;
emitGeneratedCodeAttribute();
@@ -4852,7 +4922,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << sp << nl << "public static void write(";
_out.useCurrentPosAsIndent();
- _out << getUnqualified("Ice.OutputStream", scope) << " ostr,";
+ _out << getUnqualified("Ice.OutputStream", package) << " ostr,";
_out << nl << name << " v)";
_out.restoreIndent();
_out << sb;
@@ -4863,17 +4933,17 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << nl << "else";
_out << sb;
_out << nl << "ostr.writeSize(v.Count);";
- _out << nl << "foreach(_System.Collections.";
+ _out << nl << "foreach(global::System.Collections.";
_out << "Generic.KeyValuePair<" << keyS << ", " << valueS << ">";
_out << " e in v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, key, scope, "e.Key", true);
- writeMarshalUnmarshalCode(_out, value, scope, "e.Value", true);
+ writeMarshalUnmarshalCode(_out, key, package, "e.Key", true);
+ writeMarshalUnmarshalCode(_out, value, package, "e.Value", true);
_out << eb;
_out << eb;
_out << eb;
- _out << sp << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)";
+ _out << sp << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", package) << " istr)";
_out << sb;
_out << nl << "int sz = istr.readSize();";
_out << nl << name << " r = new " << name << "();";
@@ -4885,20 +4955,20 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
{
if(isValueType(st))
{
- _out << nl << "k = new " << typeToString(key, scope) << "();";
+ _out << nl << "k = new " << typeToString(key, package) << "();";
}
else
{
_out << nl << "k = null;";
}
}
- writeMarshalUnmarshalCode(_out, key, scope, "k", false);
+ writeMarshalUnmarshalCode(_out, key, package, "k", false);
if(isClassType(value))
{
ostringstream os;
- os << '(' << typeToString(value, scope) << " v) => { r[k] = v; }";
- writeMarshalUnmarshalCode(_out, value, scope, os.str(), false);
+ os << '(' << typeToString(value, package) << " v) => { r[k] = v; }";
+ writeMarshalUnmarshalCode(_out, value, package, os.str(), false);
}
else
{
@@ -4908,14 +4978,14 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
{
if(isValueType(st))
{
- _out << nl << "v = new " << typeToString(value, scope) << "();";
+ _out << nl << "v = new " << typeToString(value, package) << "();";
}
else
{
_out << nl << "v = null;";
}
}
- writeMarshalUnmarshalCode(_out, value, scope, "v", false);
+ writeMarshalUnmarshalCode(_out, value, package, "v", false);
_out << nl << "r[k] = v;";
}
_out << eb;
@@ -4939,14 +5009,16 @@ Slice::Gen::DispatcherVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
return true;
}
void
-Slice::Gen::DispatcherVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::DispatcherVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -4961,8 +5033,8 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList bases = p->bases();
bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
string name = p->name();
- string scope = fixId(p->scope());
- string baseClass = getUnqualified("Ice.ObjectImpl", scope);
+ string package = getPackage(p);
+ string baseClass = getUnqualified("Ice.ObjectImpl", package);
if(hasBaseClass && !bases.front()->allOperations().empty())
{
baseClass = fixId(bases.front()->scoped() + "Disp_");
@@ -4992,7 +5064,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ClassList::const_iterator i = allBases.begin(); i != allBases.end(); ++i)
{
- _out << ", " << getUnqualified(fixId((*i)->scoped()), scope);
+ _out << ", " << getUnqualified(*i, package);
}
}
@@ -5008,7 +5080,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
{
string retS;
vector<string> params, args;
- string name = getDispatchParams(*i, retS, params, args, scope);
+ string name = getDispatchParams(*i, retS, params, args, package);
_out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';';
}
@@ -5032,7 +5104,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
emitComVisibleAttribute();
emitGeneratedCodeAttribute();
- _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, " << getUnqualified("Ice.TieBase", scope);
+ _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, " << getUnqualified("Ice.TieBase", package);
_out << sb;
@@ -5093,14 +5165,14 @@ Slice::Gen::DispatcherVisitor::visitClassDefEnd(const ClassDefPtr&)
void
Slice::Gen::DispatcherVisitor::writeTieOperations(const ClassDefPtr& p, NameSet* opNames)
{
- string scope = fixId(p->scope());
+ string package = getPackage(p);
OperationList ops = p->operations();
for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
string retS;
vector<string> params;
vector<string> args;
- string opName = getDispatchParams(*r, retS, params, args, scope);
+ string opName = getDispatchParams(*r, retS, params, args, package);
if(opNames)
{
if(opNames->find(opName) != opNames->end())
@@ -5149,7 +5221,7 @@ void
Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment, bool forTie)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- string scope = fixId(cl->scope());
+ string package = getPackage(cl);
string opName = op->name();
TypePtr ret = op->returnType();
ParamDeclList params = op->parameters();
@@ -5179,8 +5251,8 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
ParamDeclList::const_iterator i;
- vector<string> pDecl = getInParams(op, scope);
- string resultType = CsGenerator::resultType(op, scope, true);
+ vector<string> pDecl = getInParams(op, package);
+ string resultType = CsGenerator::resultType(op, package, true);
_out << "public ";
if(!forTie)
@@ -5188,12 +5260,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << "override ";
}
- _out << "_System.Threading.Tasks.Task";
+ _out << "global::System.Threading.Tasks.Task";
if(!resultType.empty())
{
_out << "<" << resultType << ">";
}
- _out << " " << opName << "Async" << spar << pDecl << getUnqualified("Ice.Current", scope) + " current = null"
+ _out << " " << opName << "Async" << spar << pDecl << getUnqualified("Ice.Current", package) + " current = null"
<< epar;
if(comment)
@@ -5205,7 +5277,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << sb;
if(ret)
{
- _out << nl << typeToString(ret, scope) << " ret = " << writeValue(ret, scope) << ';';
+ _out << nl << typeToString(ret, package) << " ret = " << writeValue(ret, package) << ';';
}
for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
{
@@ -5213,13 +5285,13 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
string name = fixId((*i)->name());
TypePtr type = (*i)->type();
- _out << nl << typeToString(type, scope) << ' ' << name << " = " << writeValue(type, scope) << ';';
+ _out << nl << typeToString(type, package) << ' ' << name << " = " << writeValue(type, package) << ';';
}
}
- _out << nl << "return _System.Threading.Tasks.Task.FromResult";
+ _out << nl << "return global::System.Threading.Tasks.Task.FromResult";
if(resultType.empty())
{
- _out << "<_System.Object>(null);";
+ _out << "<global::System.Object>(null);";
}
else
{
@@ -5263,9 +5335,9 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
string retS = op->hasMarshaledResult() ?
fixId(cl->scope() + resultStructName(cl->name(), op->name(), true)) :
- typeToString(ret, scope);
+ typeToString(ret, package);
- vector<string> pDecls = op->hasMarshaledResult() ? getInParams(op, scope) : getParams(op, scope);
+ vector<string> pDecls = op->hasMarshaledResult() ? getInParams(op, package) : getParams(op, package);
_out << "public ";
if(!forTie && !cl->isLocal())
@@ -5275,7 +5347,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
if(!cl->isLocal())
{
- _out << getUnqualified("Ice.Current", scope) + " current = null";
+ _out << getUnqualified("Ice.Current", package) + " current = null";
}
_out << epar;
if(comment)
@@ -5290,7 +5362,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
<< "(";
if(ret)
{
- _out << writeValue(ret, scope);
+ _out << writeValue(ret, package);
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
@@ -5298,7 +5370,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
_out << ", ";
}
- _out << writeValue((*i)->type(), scope);
+ _out << writeValue((*i)->type(), package);
}
_out << ", current);";
}
@@ -5308,12 +5380,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
string name = fixId((*i)->name());
TypePtr type = (*i)->type();
- _out << nl << name << " = " << writeValue(type, scope) << ';';
+ _out << nl << name << " = " << writeValue(type, package) << ';';
}
if(ret)
{
- _out << nl << "return " << writeValue(ret, scope) << ';';
+ _out << nl << "return " << writeValue(ret, package) << ';';
}
}
_out << eb;
@@ -5333,6 +5405,7 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
@@ -5340,8 +5413,9 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p)
}
void
-Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}
@@ -5401,6 +5475,7 @@ Slice::Gen::ImplTieVisitor::visitModuleStart(const ModulePtr& p)
return false;
}
+ CsVisitor::visitModuleStart(p);
_out << sp << nl << "namespace " << fixId(p->name());
_out << sb;
@@ -5408,8 +5483,9 @@ Slice::Gen::ImplTieVisitor::visitModuleStart(const ModulePtr& p)
}
void
-Slice::Gen::ImplTieVisitor::visitModuleEnd(const ModulePtr&)
+Slice::Gen::ImplTieVisitor::visitModuleEnd(const ModulePtr& p)
{
+ CsVisitor::visitModuleEnd(p);
_out << eb;
}