summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-10-30 12:40:46 +0100
committerJose <jose@zeroc.com>2017-10-30 12:40:46 +0100
commit164a436b839b41076fbee2fa5663af39e6ff56fe (patch)
tree77eb45d3b765adf57ef2ed91620a4901f147c994
parentICE-8457 - Ruby and Python string fixes (diff)
downloadice-164a436b839b41076fbee2fa5663af39e6ff56fe.tar.bz2
ice-164a436b839b41076fbee2fa5663af39e6ff56fe.tar.xz
ice-164a436b839b41076fbee2fa5663af39e6ff56fe.zip
Fix Overqualification in generated code
See ICE-7856
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp306
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.h15
-rw-r--r--cpp/src/Slice/JavaUtil.cpp55
-rw-r--r--cpp/src/Slice/JavaUtil.h7
-rw-r--r--cpp/src/slice2cpp/Gen.cpp832
-rw-r--r--cpp/src/slice2cpp/Gen.h24
-rw-r--r--cpp/src/slice2cs/CsUtil.cpp313
-rw-r--r--cpp/src/slice2cs/CsUtil.h25
-rw-r--r--cpp/src/slice2cs/Gen.cpp564
-rw-r--r--cpp/src/slice2cs/Gen.h19
-rw-r--r--cpp/src/slice2java/Gen.cpp268
-rw-r--r--cpp/src/slice2java/GenCompat.cpp306
-rw-r--r--csharp/test/Ice/optional/Test.ice2
-rw-r--r--csharp/test/Ice/optional/TestAMD.ice2
14 files changed, 1536 insertions, 1202 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 4c0667aa6ad..110775e5ed4 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -24,12 +24,6 @@ using namespace IceUtilInternal;
namespace
{
-string
-condString(bool ok, const string& str)
-{
- return ok ? str : "";
-}
-
string toTemplateArg(const string& arg)
{
if(arg.empty())
@@ -86,7 +80,7 @@ stringTypeToString(const TypePtr& type, const StringList& metaData, int typeCtx)
}
string
-sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typeCtx)
+sequenceTypeToString(const SequencePtr& seq, const string& scope, const StringList& metaData, int typeCtx)
{
string seqType = findMetaData(metaData, typeCtx);
if(!seqType.empty())
@@ -98,7 +92,7 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ
{
if(builtin && builtin->kind() == Builtin::KindByte)
{
- string s = typeToString(seq->type());
+ string s = typeToString(seq->type(), scope);
return "::std::pair<const " + s + "*, const " + s + "*>";
}
else if(builtin &&
@@ -106,18 +100,19 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ
builtin->kind() != Builtin::KindObject &&
builtin->kind() != Builtin::KindObjectProxy)
{
- string s = toTemplateArg(typeToString(builtin));
+ string s = toTemplateArg(typeToString(builtin, scope));
return "::std::pair< ::IceUtil::ScopedArray<" + s + ">, " +
"::std::pair<const " + s + "*, const " + s + "*> >";
}
else
{
- string s = toTemplateArg(typeToString(seq->type(), seq->typeMetaData(),
+ string s = toTemplateArg(typeToString(seq->type(), scope, seq->typeMetaData(),
inWstringModule(seq) ? TypeContextUseWstring : 0));
return "::std::vector<" + s + '>';
}
}
- string s = typeToString(seq->type(), seq->typeMetaData(), typeCtx | (inWstringModule(seq) ? TypeContextUseWstring : 0));
+ string s = typeToString(seq->type(), scope, seq->typeMetaData(),
+ typeCtx | (inWstringModule(seq) ? TypeContextUseWstring : 0));
return "::std::pair<const " + s + "*, const " + s + "*>";
}
else if(seqType.find("%range") == 0)
@@ -129,12 +124,14 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ
}
else
{
- s = fixKwd(seq->scoped());
+ s = getAbsolute(fixKwd(seq->scoped()), scope);
}
+
if(typeCtx & TypeContextAMIPrivateEnd)
{
return s;
}
+
if(s[0] == ':')
{
s = " " + s;
@@ -148,29 +145,29 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ
}
else
{
- return fixKwd(seq->scoped());
+ return getAbsolute(fixKwd(seq->scoped()), scope);
}
}
string
-dictionaryTypeToString(const DictionaryPtr& dict, const StringList& metaData, int typeCtx)
+dictionaryTypeToString(const DictionaryPtr& dict, const string& scope, const StringList& metaData, int typeCtx)
{
- string dictType = findMetaData(metaData, typeCtx);
- if(!dictType.empty())
+ const string dictType = findMetaData(metaData, typeCtx);
+ if(dictType.empty())
{
- return dictType;
+ return getAbsolute(fixKwd(dict->scoped()), scope);
}
else
{
- return fixKwd(dict->scoped());
+ return dictType;
}
}
void
-writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const string& fixedName,
+writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const string& scope, const string& fixedName,
const StringList& metaData, int typeCtx, bool endArg)
{
- string s = typeToString(type, metaData, typeCtx);
+ string s = typeToString(type, scope, metaData, typeCtx);
if(optional)
{
s = toOptional(s, typeCtx);
@@ -198,7 +195,7 @@ writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const st
string s;
if(seqType == "%array")
{
- s = typeToString(seq, metaData, TypeContextAMIPrivateEnd);
+ s = typeToString(seq, scope, metaData, TypeContextAMIPrivateEnd);
}
else if(seqType.find("%range") == 0)
{
@@ -207,7 +204,7 @@ writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const st
{
md.push_back("cpp:type:" + seqType.substr(strlen("%range:")));
}
- s = typeToString(seq, md, 0);
+ s = typeToString(seq, scope, md, 0);
}
if(!s.empty())
@@ -272,7 +269,8 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string&
out << nl << "if(!" << escapedParamName << "->empty())";
out << sb;
out << nl << paramName << "->first" << " = &(*" << escapedParamName << ")[0];";
- out << nl << paramName << "->second" << " = " << paramName << "->first + " << escapedParamName << "->size();";
+ out << nl << paramName << "->second" << " = " << paramName << "->first + " << escapedParamName
+ << "->size();";
out << eb;
out << nl << "else";
out << sb;
@@ -285,7 +283,8 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string&
out << nl << "if(!" << escapedParamName << ".empty())";
out << sb;
out << nl << paramName << ".first" << " = &" << escapedParamName << "[0];";
- out << nl << paramName << ".second" << " = " << paramName << ".first + " << escapedParamName << ".size();";
+ out << nl << paramName << ".second" << " = " << paramName << ".first + " << escapedParamName
+ << ".size();";
out << eb;
out << nl << "else";
out << sb;
@@ -316,7 +315,8 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string&
void
writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const OperationPtr& op, bool marshal,
- bool prepend, int typeCtx, const string& customStream = "", const string& retP = "", const string& obj = "")
+ bool prepend, int typeCtx, const string& customStream = "", const string& retP = "",
+ const string& obj = "")
{
string prefix = prepend ? paramPrefix : "";
string returnValueS = retP.empty() ? string("ret") : retP;
@@ -375,16 +375,16 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper
{
for(ParamDeclList::const_iterator p = requiredParams.begin(); p != requiredParams.end(); ++p)
{
- writeMarshalUnmarshalCode(out, (*p)->type(), false, 0, fixKwd(prefix + (*p)->name()), marshal, (*p)->getMetaData(),
- typeCtx, customStream, true, obj);
+ writeMarshalUnmarshalCode(out, (*p)->type(), false, 0, fixKwd(prefix + (*p)->name()), marshal,
+ (*p)->getMetaData(), typeCtx, customStream, true, obj);
}
if(op && op->returnType())
{
if(!op->returnIsOptional())
{
- writeMarshalUnmarshalCode(out, op->returnType(), false, 0, returnValueS, marshal, op->getMetaData(), typeCtx,
- customStream, true, obj);
+ writeMarshalUnmarshalCode(out, op->returnType(), false, 0, returnValueS, marshal, op->getMetaData(),
+ typeCtx, customStream, true, obj);
}
}
}
@@ -430,16 +430,16 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper
{
if(checkReturnType && op->returnTag() < (*p)->tag())
{
- os << condString(insertComma, ", ") << op->returnTag();
+ os << (insertComma ? ", " : "") << op->returnTag();
checkReturnType = false;
insertComma = true;
}
- os << condString(insertComma, ", ") << (*p)->tag();
+ os << (insertComma ? ", " : "") << (*p)->tag();
insertComma = true;
}
if(checkReturnType)
{
- os << condString(insertComma, ", ") << op->returnTag();
+ os << (insertComma ? ", " : "") << op->returnTag();
}
os << '}';
out << os.str();
@@ -488,8 +488,8 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper
}
if(checkReturnType)
{
- writeMarshalUnmarshalCode(out, op->returnType(), true, op->returnTag(), returnValueS, marshal, op->getMetaData(),
- typeCtx, customStream, true, obj);
+ writeMarshalUnmarshalCode(out, op->returnType(), true, op->returnTag(), returnValueS, marshal,
+ op->getMetaData(), typeCtx, customStream, true, obj);
}
}
}
@@ -610,7 +610,31 @@ Slice::isMovable(const TypePtr& type)
}
string
-Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx)
+Slice::getAbsolute(const std::string& type, const std::string& scope)
+{
+ if(type.find("::") != string::npos)
+ {
+ string prefix;
+ if(type.find("const ") == 0)
+ {
+ prefix += "const ";
+ }
+
+ if(type.find("::std::shared_ptr<", prefix.size()) == prefix.size())
+ {
+ prefix += "::std::shared_ptr<";
+ }
+
+ if(type.find(scope, prefix.size()) == prefix.size())
+ {
+ return prefix + type.substr(prefix.size() + scope.size());
+ }
+ }
+ return type;
+}
+
+string
+Slice::typeToString(const TypePtr& type, const string& scope, const StringList& metaData, int typeCtx)
{
bool cpp11 = (typeCtx & TypeContextCpp11) != 0;
@@ -667,24 +691,21 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
{
return stringTypeToString(type, metaData, typeCtx);
}
- else
+ else if(cpp11)
{
- if(cpp11)
+ if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
{
- if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
- {
- return "::std::shared_ptr<::Ice::Value>";
- }
- else
- {
- return cpp11BuiltinTable[builtin->kind()];
- }
+ return getAbsolute(cpp11BuiltinTable[Builtin::KindValue], scope);
}
else
{
- return builtinTable[builtin->kind()];
+ return getAbsolute(cpp11BuiltinTable[builtin->kind()], scope);
}
}
+ else
+ {
+ return getAbsolute(builtinTable[builtin->kind()], scope);
+ }
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
@@ -694,20 +715,20 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return fixKwd(cl->scoped());
+ return getAbsolute(fixKwd(cl->scoped()), scope);
}
else if(cl->isInterface() && !cl->isLocal())
{
- return "::std::shared_ptr<::Ice::Value>";
+ return getAbsolute(cpp11BuiltinTable[Builtin::KindValue], scope);
}
else
{
- return "::std::shared_ptr<" + cl->scoped() + ">";
+ return "::std::shared_ptr<" + getAbsolute(cl->scoped(), scope) + ">";
}
}
else
{
- return cl->scoped() + "Ptr";
+ return getAbsolute(cl->scoped() + "Ptr", scope);
}
}
@@ -719,9 +740,12 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
//
if(!cpp11 && findMetaData(st->getMetaData()) == "%class")
{
- return fixKwd(st->scoped() + "Ptr");
+ return getAbsolute(fixKwd(st->scoped() + "Ptr"), scope);
+ }
+ else
+ {
+ return getAbsolute(fixKwd(st->scoped()), scope);
}
- return fixKwd(st->scoped());
}
ProxyPtr proxy = ProxyPtr::dynamicCast(type);
@@ -736,61 +760,56 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
//
if(def && !def->isInterface() && def->allOperations().empty())
{
- return "::std::shared_ptr<::Ice::ObjectPrx>";
+ return getAbsolute(cpp11BuiltinTable[Builtin::KindObjectProxy], scope);
}
else
{
- return "::std::shared_ptr<" + fixKwd(proxy->_class()->scoped() + "Prx") + ">";
+ return "::std::shared_ptr<" + getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx"), scope) + ">";
}
}
else
{
- return fixKwd(proxy->_class()->scoped() + "Prx");
+ return getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx"), scope);
}
}
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ return getAbsolute(fixKwd(en->scoped()), scope);
+ }
+
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return sequenceTypeToString(seq, metaData, typeCtx);
+ return sequenceTypeToString(seq, scope, metaData, typeCtx);
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- return dictionaryTypeToString(dict, metaData, typeCtx);
- }
-
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
- {
- return fixKwd(contained->scoped());
- }
-
- EnumPtr en = EnumPtr::dynamicCast(type);
- if(en)
- {
- return fixKwd(en->scoped());
+ return dictionaryTypeToString(dict, scope, metaData, typeCtx);
}
return "???";
}
string
-Slice::typeToString(const TypePtr& type, bool optional, const StringList& metaData, int typeCtx)
+Slice::typeToString(const TypePtr& type, bool optional, const string& scope, const StringList& metaData, int typeCtx)
{
if(optional)
{
- return toOptional(typeToString(type, metaData, typeCtx), typeCtx);
+ return toOptional(typeToString(type, scope, metaData, typeCtx), typeCtx);
}
else
{
- return typeToString(type, metaData, typeCtx);
+ return typeToString(type, scope, metaData, typeCtx);
}
}
string
-Slice::returnTypeToString(const TypePtr& type, bool optional, const StringList& metaData, int typeCtx)
+Slice::returnTypeToString(const TypePtr& type, bool optional, const string& scope, const StringList& metaData,
+ int typeCtx)
{
if(!type)
{
@@ -799,14 +818,15 @@ Slice::returnTypeToString(const TypePtr& type, bool optional, const StringList&
if(optional)
{
- return toOptional(typeToString(type, metaData, typeCtx), typeCtx);
+ return toOptional(typeToString(type, scope, metaData, typeCtx), typeCtx);
}
- return typeToString(type, metaData, typeCtx);
+ return typeToString(type, scope, metaData, typeCtx);
}
string
-Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& metaData, int typeCtx)
+Slice::inputTypeToString(const TypePtr& type, bool optional, const string& scope, const StringList& metaData,
+ int typeCtx)
{
bool cpp11 = (typeCtx & TypeContextCpp11) != 0;
@@ -846,7 +866,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
if(optional)
{
- return "const " + toOptional(typeToString(type, metaData, typeCtx), typeCtx) + '&';
+ return "const " + toOptional(typeToString(type, scope, metaData, typeCtx), typeCtx) + '&';
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -856,24 +876,21 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
return string("const ") + stringTypeToString(type, metaData, typeCtx) + '&';
}
- else
+ else if(cpp11)
{
- if(cpp11)
+ if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
{
- if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
- {
- return "const ::std::shared_ptr<::Ice::Value>&";
- }
- else
- {
- return cpp11InputBuiltinTable[builtin->kind()];
- }
+ return getAbsolute(cpp11InputBuiltinTable[Builtin::KindValue], scope);
}
else
{
- return cpp98InputBuiltinTable[builtin->kind()];
+ return getAbsolute(cpp11InputBuiltinTable[builtin->kind()], scope);
}
}
+ else
+ {
+ return getAbsolute(cpp98InputBuiltinTable[builtin->kind()], scope);
+ }
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
@@ -883,20 +900,20 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return fixKwd(cl->scoped());
+ return getAbsolute(fixKwd(cl->scoped()), scope);
}
else if(cl->isInterface() && !cl->isLocal())
{
- return "const ::std::shared_ptr<::Ice::Value>&";
+ return getAbsolute(cpp11InputBuiltinTable[Builtin::KindValue], scope);
}
else
{
- return "const ::std::shared_ptr<" + fixKwd(cl->scoped()) + ">&";
+ return "const ::std::shared_ptr<" + getAbsolute(fixKwd(cl->scoped()), scope) + ">&";
}
}
else
{
- return "const " + fixKwd(cl->scoped() + "Ptr&");
+ return "const " + getAbsolute(fixKwd(cl->scoped() + "Ptr&"), scope);
}
}
@@ -905,17 +922,17 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
if(cpp11)
{
- return "const " + fixKwd(st->scoped()) + "&";
+ return "const " + getAbsolute(fixKwd(st->scoped()), scope) + "&";
}
else
{
if(findMetaData(st->getMetaData()) == "%class")
{
- return "const " + fixKwd(st->scoped() + "Ptr&");
+ return "const " + getAbsolute(fixKwd(st->scoped() + "Ptr"), scope) + "&";
}
else
{
- return "const " + fixKwd(st->scoped()) + "&";
+ return "const " + getAbsolute(fixKwd(st->scoped()), scope) + "&";
}
}
}
@@ -928,48 +945,43 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
ClassDefPtr def = proxy->_class()->definition();
if(def && !def->isInterface() && def->allOperations().empty())
{
- return "const ::std::shared_ptr<::Ice::ObjectPrx>&";
+ return getAbsolute(cpp11InputBuiltinTable[Builtin::KindObjectProxy], scope);
}
else
{
- return "const ::std::shared_ptr<" + fixKwd(proxy->_class()->scoped() + "Prx") + ">&";
+ return "const ::std::shared_ptr<" + getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx"), scope) + ">&";
}
}
else
{
- return "const " + fixKwd(proxy->_class()->scoped() + "Prx&");
+ return "const " + getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx"), scope) + "&";
}
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixKwd(en->scoped());
+ return getAbsolute(fixKwd(en->scoped()), scope);
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return "const " + sequenceTypeToString(seq, metaData, typeCtx) + "&";
+ return "const " + sequenceTypeToString(seq, scope, metaData, typeCtx) + "&";
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- return "const " + dictionaryTypeToString(dict, metaData, typeCtx) + "&";
- }
-
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
- {
- return "const " + fixKwd(contained->scoped()) + "&";
+ return "const " + dictionaryTypeToString(dict, scope, metaData, typeCtx) + "&";
}
return "???";
}
string
-Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList& metaData, int typeCtx)
+Slice::outputTypeToString(const TypePtr& type, bool optional, const string& scope, const StringList& metaData,
+ int typeCtx)
{
bool cpp11 = (typeCtx & TypeContextCpp11) != 0;
@@ -1007,7 +1019,7 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
if(optional)
{
- return toOptional(typeToString(type, metaData, typeCtx), typeCtx) + '&';
+ return toOptional(typeToString(type, scope, metaData, typeCtx), typeCtx) + '&';
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -1017,24 +1029,21 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
{
return stringTypeToString(type, metaData, typeCtx) + "&";
}
- else
+ else if(cpp11)
{
- if(cpp11)
+ if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
{
- if(builtin->kind() == Builtin::KindObject && !(typeCtx & TypeContextLocal))
- {
- return "::std::shared_ptr<::Ice::Value>";
- }
- else
- {
- return cpp11OutputBuiltinTable[builtin->kind()];
- }
+ return getAbsolute(cpp11OutputBuiltinTable[Builtin::KindValue], scope);
}
else
{
- return outputBuiltinTable[builtin->kind()];
+ return getAbsolute(cpp11OutputBuiltinTable[builtin->kind()], scope);
}
}
+ else
+ {
+ return getAbsolute(outputBuiltinTable[builtin->kind()], scope);
+ }
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
@@ -1044,20 +1053,20 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return fixKwd(cl->scoped()) + "&";
+ return getAbsolute(fixKwd(cl->scoped()), scope) + "&";
}
else if(cl->isInterface() && !cl->isLocal())
{
- return "::std::shared_ptr<::Ice::Value>&";
+ return getAbsolute(cpp11OutputBuiltinTable[Builtin::KindValue], scope);
}
else
{
- return "::std::shared_ptr<" + fixKwd(cl->scoped()) + ">&";
+ return "::std::shared_ptr<" + getAbsolute(fixKwd(cl->scoped()), scope) + ">&";
}
}
else
{
- return fixKwd(cl->scoped() + "Ptr&");
+ return getAbsolute(fixKwd(cl->scoped() + "Ptr&"), scope);
}
}
@@ -1066,11 +1075,11 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
{
if(!cpp11 && findMetaData(st->getMetaData()) == "%class")
{
- return fixKwd(st->scoped() + "Ptr&");
+ return getAbsolute(fixKwd(st->scoped() + "Ptr&"), scope);
}
else
{
- return fixKwd(st->scoped()) + "&";
+ return getAbsolute(fixKwd(st->scoped()), scope) + "&";
}
}
@@ -1086,35 +1095,35 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
//
if(def && !def->isInterface() && def->allOperations().empty())
{
- return "::std::shared_ptr<::Ice::ObjectPrx>";
+ return getAbsolute(cpp11OutputBuiltinTable[Builtin::KindObjectProxy], scope);
}
else
{
- return "::std::shared_ptr<" + fixKwd(proxy->_class()->scoped() + "Prx") + ">&";
+ return "::std::shared_ptr<" + getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx"), scope) + ">&";
}
}
else
{
- return fixKwd(proxy->_class()->scoped() + "Prx&");
+ return getAbsolute(fixKwd(proxy->_class()->scoped() + "Prx&"), scope);
}
}
+ EnumPtr en = EnumPtr::dynamicCast(type);
+ if(en)
+ {
+ return getAbsolute(fixKwd(en->scoped()), scope) + "&";
+ }
+
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return sequenceTypeToString(seq, metaData, typeCtx) + "&";
+ return sequenceTypeToString(seq, scope, metaData, typeCtx) + "&";
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- return dictionaryTypeToString(dict, metaData, typeCtx) + "&";
- }
-
- ContainedPtr contained = ContainedPtr::dynamicCast(type);
- if(contained)
- {
- return fixKwd(contained->scoped()) + "&";
+ return dictionaryTypeToString(dict, scope, metaData, typeCtx) + "&";
}
return "???";
@@ -1265,8 +1274,8 @@ Slice::fixKwd(const string& name)
void
Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, bool optional, int tag, const string& param,
- bool marshal, const StringList& metaData, int typeCtx, const string& customStream, bool pointer,
- const string& obj)
+ bool marshal, const StringList& metaData, int typeCtx, const string& customStream,
+ bool pointer, const string& obj)
{
string objPrefix = obj.empty() ? obj : obj + ".";
@@ -1351,8 +1360,8 @@ Slice::writeUnmarshalCode(Output& out, const ParamDeclList& params, const Operat
}
void
-Slice::writeAllocateCode(Output& out, const ParamDeclList& params, const OperationPtr& op, bool prepend, int typeCtx,
- const string& customRet)
+Slice::writeAllocateCode(Output& out, const ParamDeclList& params, const OperationPtr& op, bool prepend,
+ const string& clScope, int typeCtx, const string& customRet)
{
string prefix = prepend ? paramPrefix : "";
string returnValueS = customRet;
@@ -1363,16 +1372,16 @@ Slice::writeAllocateCode(Output& out, const ParamDeclList& params, const Operati
for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p)
{
- writeParamAllocateCode(out, (*p)->type(), (*p)->optional(), fixKwd(prefix + (*p)->name()), (*p)->getMetaData(),
- typeCtx, getEndArg((*p)->type(), (*p)->getMetaData(), (*p)->name()) != (*p)->name());
+ writeParamAllocateCode(out, (*p)->type(), (*p)->optional(), clScope, fixKwd(prefix + (*p)->name()),
+ (*p)->getMetaData(), typeCtx, getEndArg((*p)->type(), (*p)->getMetaData(),
+ (*p)->name()) != (*p)->name());
}
if(op && op->returnType())
{
- writeParamAllocateCode(out, op->returnType(), op->returnIsOptional(), returnValueS, op->getMetaData(), typeCtx,
- getEndArg(op->returnType(), op->getMetaData(), returnValueS) != returnValueS);
+ writeParamAllocateCode(out, op->returnType(), op->returnIsOptional(), clScope, returnValueS, op->getMetaData(),
+ typeCtx, getEndArg(op->returnType(), op->getMetaData(), returnValueS) != returnValueS);
}
-
}
string
@@ -1616,7 +1625,7 @@ Slice::writeStreamHelpers(Output& out,
}
void
-Slice::writeIceTuple(::IceUtilInternal::Output& out, DataMemberList dataMembers, int typeCtx)
+Slice::writeIceTuple(::IceUtilInternal::Output& out, const string& scope, DataMemberList dataMembers, int typeCtx)
{
out << sp << nl << "std::tuple<";
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
@@ -1626,7 +1635,8 @@ Slice::writeIceTuple(::IceUtilInternal::Output& out, DataMemberList dataMembers,
out << ", ";
}
out << "const ";
- out << typeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx | TypeContextCpp11) << "&";
+ out << typeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), typeCtx | TypeContextCpp11)
+ << "&";
}
out << "> ice_tuple() const";
diff --git a/cpp/src/Slice/CPlusPlusUtil.h b/cpp/src/Slice/CPlusPlusUtil.h
index c018c74996d..cb09e016dba 100644
--- a/cpp/src/Slice/CPlusPlusUtil.h
+++ b/cpp/src/Slice/CPlusPlusUtil.h
@@ -37,11 +37,12 @@ const int TypeContextCpp11 = 64;
bool isMovable(const TypePtr&);
-std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0);
-std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
-std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0);
+std::string getAbsolute(const std::string&, const std::string&);
+std::string typeToString(const TypePtr&, const std::string& = "", const StringList& = StringList(), int = 0);
+std::string typeToString(const TypePtr&, bool, const std::string& = "", const StringList& = StringList(), int = 0);
+std::string returnTypeToString(const TypePtr&, bool, const std::string& = "", const StringList& = StringList(), int = 0);
+std::string inputTypeToString(const TypePtr&, bool, const std::string& = "", const StringList& = StringList(), int = 0);
+std::string outputTypeToString(const TypePtr&, bool, const std::string& = "", const StringList& = StringList(), int = 0);
std::string operationModeToString(Operation::Mode, bool = false);
std::string opFormatTypeToString(const OperationPtr&, bool);
@@ -55,7 +56,7 @@ void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const Op
int = 0, const std::string& = "", const std::string& = "");
void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0,
const std::string& = "", const std::string& = "", const std::string& = "");
-void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool,
+void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, const std::string&,
int = 0, const std::string& = "");
std::string getEndArg(const TypePtr&, const StringList&, const std::string&);
@@ -63,7 +64,7 @@ void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const Operat
void writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, bool);
void writeMarshalUnmarshalAllInHolder(IceUtilInternal::Output&, const std::string&, const DataMemberList&, bool, bool);
void writeStreamHelpers(::IceUtilInternal::Output&, const ContainedPtr&, DataMemberList, bool, bool, bool);
-void writeIceTuple(::IceUtilInternal::Output&, DataMemberList, int);
+void writeIceTuple(::IceUtilInternal::Output&, const std::string&, DataMemberList, int);
bool findMetaData(const std::string&, const ClassDeclPtr&, std::string&);
bool findMetaData(const std::string&, const StringList&, std::string&);
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index b5c7f669604..3cc4a2e3967 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -964,6 +964,16 @@ Slice::JavaCompatGenerator::getPackage(const ContainedPtr& cont) const
}
string
+Slice::JavaCompatGenerator::getAbsolute(const std::string& type, const std::string& package) const
+{
+ if(type.find(".") != string::npos && type.find(package) == 0 && type.find(".", package.size() + 1) == string::npos)
+ {
+ return type.substr(package.size() + 1);
+ }
+ return type;
+}
+
+string
Slice::JavaCompatGenerator::getAbsolute(const ContainedPtr& cont,
const string& package,
const string& prefix,
@@ -3408,6 +3418,16 @@ Slice::JavaGenerator::getPackage(const ContainedPtr& cont) const
}
string
+Slice::JavaGenerator::getAbsolute(const std::string& type, const std::string& package) const
+{
+ if(type.find(".") != string::npos && type.find(package) == 0 && type.find(".", package.size() + 1) == string::npos)
+ {
+ return type.substr(package.size() + 1);
+ }
+ return type;
+}
+
+string
Slice::JavaGenerator::getAbsolute(const ContainedPtr& cont,
const string& package,
const string& prefix,
@@ -3443,11 +3463,11 @@ Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) co
if(b && b->kind() == Builtin::KindObject)
{
- return "com.zeroc.Ice.Object.ice_staticId()";
+ return getAbsolute("com.zeroc.Ice.Object", package) + ".ice_staticId()";
}
else if(b && b->kind() == Builtin::KindValue)
{
- return "com.zeroc.Ice.Value.ice_staticId()";
+ return getAbsolute("com.zeroc.Ice.Value", package) + ".ice_staticId()";
}
else
{
@@ -3578,26 +3598,12 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
"float",
"double",
"String",
- "com.zeroc.Ice.Value",
- "com.zeroc.Ice.ObjectPrx",
- "java.lang.Object",
- "com.zeroc.Ice.Value"
- };
- static const char* builtinLocalTable[] =
- {
- "byte",
- "boolean",
- "short",
- "int",
- "long",
- "float",
- "double",
- "String",
"com.zeroc.Ice.Object",
"com.zeroc.Ice.ObjectPrx",
"java.lang.Object",
"com.zeroc.Ice.Value"
};
+
static const char* builtinOptionalTable[] =
{
"java.util.Optional<java.lang.Byte>",
@@ -3649,7 +3655,7 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
case Builtin::KindFloat:
case Builtin::KindDouble:
{
- return builtinOptionalTable[builtin->kind()];
+ return getAbsolute(builtinOptionalTable[builtin->kind()], package);
}
case Builtin::KindString:
case Builtin::KindObject:
@@ -3663,7 +3669,14 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
else
{
- return local ? builtinLocalTable[builtin->kind()] : builtinTable[builtin->kind()];
+ if(!local && builtin->kind() == Builtin::KindObject)
+ {
+ return getAbsolute(builtinTable[Builtin::KindValue], package);
+ }
+ else
+ {
+ return getAbsolute(builtinTable[builtin->kind()], package);
+ }
}
}
@@ -3678,7 +3691,7 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
{
if(cl->isInterface() && !local)
{
- return "com.zeroc.Ice.Value";
+ return getAbsolute("com.zeroc.Ice.Value", package);
}
else
{
@@ -3697,7 +3710,7 @@ Slice::JavaGenerator::typeToString(const TypePtr& type,
}
else
{
- return "com.zeroc.Ice.ObjectPrx";
+ return getAbsolute("com.zeroc.Ice.ObjectPrx", package);
}
}
diff --git a/cpp/src/Slice/JavaUtil.h b/cpp/src/Slice/JavaUtil.h
index 2ae8f2ebd3d..efb0297ea7d 100644
--- a/cpp/src/Slice/JavaUtil.h
+++ b/cpp/src/Slice/JavaUtil.h
@@ -107,6 +107,7 @@ protected:
//
std::string getPackage(const ContainedPtr&) const;
+ std::string getAbsolute(const std::string&, const std::string&) const;
//
// Returns the Java name for a Contained entity. If the optional
// package argument matches the entity's package name, then the
@@ -274,6 +275,12 @@ protected:
std::string getPackage(const ContainedPtr&) const;
//
+ // Returns the Java type without a package if the package
+ // matches the current package
+ //
+ std::string getAbsolute(const std::string&, const std::string&) const;
+
+ //
// Returns the Java name for a Contained entity. If the optional
// package argument matches the entity's package name, then the
// package is removed from the result.
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 81b0ef1dcc5..94a3bd16f21 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -98,12 +98,13 @@ getDeprecateSymbol(const ContainedPtr& p1, const ContainedPtr& p2)
void
writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const SyntaxTreeBasePtr& valueType,
- const string& value, int useWstring, const StringList& metaData, bool cpp11 = false)
+ const string& value, int useWstring, const StringList& metaData, const string& scope,
+ bool cpp11 = false)
{
ConstPtr constant = ConstPtr::dynamicCast(valueType);
if(constant)
{
- out << fixKwd(constant->scoped());
+ out << getAbsolute(fixKwd(constant->scoped()), scope);
}
else
{
@@ -155,18 +156,17 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt
if(unscoped)
{
- out << fixKwd(ep->scope() + enumerator->name());
+ out << getAbsolute(fixKwd(ep->scope() + enumerator->name()), scope);
}
else
{
if(cpp11)
{
- out << fixKwd(enumerator->scoped());
+ out << getAbsolute(fixKwd(enumerator->scoped()), scope);
}
else
{
- out << fixKwd(ep->scope() + ep->name() + enumerator->name())
-;
+ out << getAbsolute(fixKwd(ep->scope() + ep->name() + enumerator->name()), scope);
}
}
}
@@ -205,11 +205,14 @@ toDllMemberExport(const string& dllExport)
}
void
-writeDataMemberInitializers(IceUtilInternal::Output& C, const DataMemberList& members, int useWstring, bool cpp11 = false)
+writeDataMemberInitializers(IceUtilInternal::Output& C, const DataMemberList& members, int useWstring,
+ bool cpp11 = false)
{
bool first = true;
for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p)
{
+ ContainedPtr contained = ContainedPtr::dynamicCast((*p)->container());
+ string scope = contained->scope();
if((*p)->defaultValueType())
{
string memberName = fixKwd((*p)->name());
@@ -224,14 +227,15 @@ writeDataMemberInitializers(IceUtilInternal::Output& C, const DataMemberList& me
}
C << nl << memberName << '(';
writeConstantValue(C, (*p)->type(), (*p)->defaultValueType(), (*p)->defaultValue(), useWstring,
- (*p)->getMetaData(), cpp11);
+ (*p)->getMetaData(), scope, cpp11);
C << ')';
}
}
}
void
-writeInParamsLambda(IceUtilInternal::Output& C, const OperationPtr& p, const ParamDeclList& inParams)
+writeInParamsLambda(IceUtilInternal::Output& C, const OperationPtr& p, const ParamDeclList& inParams,
+ const string& scope)
{
if(inParams.empty())
{
@@ -239,7 +243,7 @@ writeInParamsLambda(IceUtilInternal::Output& C, const OperationPtr& p, const Par
}
else
{
- C << "[&](::Ice::OutputStream* ostr)";
+ C << "[&](" << getAbsolute("::Ice::OutputStream*", scope) << " ostr)";
C << sb;
writeMarshalCode(C, inParams, 0, true, TypeContextInParam | TypeContextCpp11);
if(p->sendsClasses(false))
@@ -251,7 +255,7 @@ writeInParamsLambda(IceUtilInternal::Output& C, const OperationPtr& p, const Par
}
void
-throwUserExceptionLambda(IceUtilInternal::Output& C, ExceptionList throws)
+throwUserExceptionLambda(IceUtilInternal::Output& C, ExceptionList throws, const string& scope)
{
if(throws.empty())
{
@@ -270,7 +274,7 @@ throwUserExceptionLambda(IceUtilInternal::Output& C, ExceptionList throws)
//
throws.sort(Slice::DerivedToBaseCompare());
- C << "[](const ::Ice::UserException& ex)";
+ C << "[](const " << getAbsolute("::Ice::UserException&", scope) << " ex)";
C << sb;
C << nl << "try";
C << sb;
@@ -282,12 +286,12 @@ throwUserExceptionLambda(IceUtilInternal::Output& C, ExceptionList throws)
for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
{
string scoped = (*i)->scoped();
- C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)";
+ C << nl << "catch(const " << getAbsolute(fixKwd((*i)->scoped()), scope) << "&)";
C << sb;
C << nl << "throw;";
C << eb;
}
- C << nl << "catch(const ::Ice::UserException&)";
+ C << nl << "catch(const " << getAbsolute("::Ice::UserException&", scope) << ")";
C << sb;
C << eb;
C << eb;
@@ -312,8 +316,13 @@ emitOpNameResult(IceUtilInternal::Output& H, const OperationPtr& p, int useWstri
{
string name = p->name();
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string clScope = fixKwd(cl->scope());
+
TypePtr ret = p->returnType();
- string retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(), useWstring | TypeContextCpp11);
+ string retS = returnTypeToString(ret, p->returnIsOptional(), clScope, p->getMetaData(),
+ useWstring | TypeContextCpp11);
ParamDeclList outParams;
ParamDeclList paramList = p->parameters();
@@ -336,7 +345,7 @@ emitOpNameResult(IceUtilInternal::Output& H, const OperationPtr& p, int useWstri
for(ParamDeclList::iterator q = outParams.begin(); q != outParams.end(); ++q)
{
- string typeString = typeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ string typeString = typeToString((*q)->type(), (*q)->optional(), clScope, (*q)->getMetaData(),
useWstring | TypeContextCpp11);
dataMembers.push_back(typeString + " " + fixKwd((*q)->name()));
@@ -369,12 +378,6 @@ condMove(bool moveIt, const string& str)
return moveIt ? string("::std::move(") + str + ")" : str;
}
-string
-condString(bool ok, const string& str)
-{
- return ok ? str : "";
-}
-
}
Slice::Gen::Gen(const string& base, const string& headerExtension, const string& sourceExtension,
@@ -961,6 +964,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
string scoped = fixKwd(p->scoped());
ExceptionPtr base = p->base();
DataMemberList dataMembers = p->dataMembers();
@@ -973,7 +977,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring);
allTypes.push_back(typeName);
allParamDecls.push_back(typeName + " iceP_" + (*q)->name());
}
@@ -990,13 +994,13 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << sp << nl << "class " << _dllExport << name << " : ";
H.useCurrentPosAsIndent();
H << "public ";
- if(!base)
+ if(base)
{
- H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
+ H << getAbsolute(fixKwd(base->scoped()), scope);
}
else
{
- H << fixKwd(base->scoped());
+ H << getAbsolute(p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException", scope);
}
H.restoreIndent();
H << sb;
@@ -1054,7 +1058,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
C << sp << nl << scoped.substr(2) << "::" << name << spar << "const char* file_" << "int line_" << epar
<< " :";
C.inc();
- emitUpcall(base, "(file_, line_)", true);
+ emitUpcall(base, "(file_, line_)", scope, true);
if(p->hasDefaultValues())
{
C << ",";
@@ -1109,7 +1113,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
upcall += ",";
}
- emitUpcall(base, upcall, p->isLocal());
+ emitUpcall(base, upcall, scope, p->isLocal());
}
for(DataMemberList::const_iterator d = dataMembers.begin(); d != dataMembers.end(); ++d)
{
@@ -1209,10 +1213,10 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
H << sp << nl << "protected:";
H.inc();
- H << sp << nl << "virtual void _writeImpl(::Ice::OutputStream*) const;";
- H << nl << "virtual void _readImpl(::Ice::InputStream*);";
+ H << sp << nl << "virtual void _writeImpl(" << getAbsolute("::Ice::OutputStream*", scope) << ") const;";
+ H << nl << "virtual void _readImpl(" << getAbsolute("::Ice::InputStream*", scope) << ");";
- string baseName = base ? fixKwd(base->scoped()) : string("::Ice::UserException");
+ string baseName = getAbsolute(base ? fixKwd(base->scoped()) : "::Ice::UserException", scope);
if(preserved && !basePreserved)
{
@@ -1225,14 +1229,16 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << nl << "return _slicedData;";
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_write(::Ice::OutputStream* ostr) const";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_write("
+ << getAbsolute("::Ice::OutputStream*", scope) << " ostr) const";
C << sb;
C << nl << "ostr->startException(_slicedData);";
C << nl << "_writeImpl(ostr);";
C << nl << "ostr->endException();";
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_read(::Ice::InputStream* istr)";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_read("
+ << getAbsolute("::Ice::InputStream*", scope) << " istr)";
C << sb;
C << nl << "istr->startException();";
C << nl << "_readImpl(istr);";
@@ -1240,25 +1246,29 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << eb;
}
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_writeImpl(::Ice::OutputStream* ostr) const";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_writeImpl("
+ << getAbsolute("::Ice::OutputStream*", scope) << " ostr) const";
C << sb;
C << nl << "ostr->startSlice(\"" << p->scoped() << "\", -1, " << (!base ? "true" : "false") << ");";
- C << nl << "Ice::StreamWriter< ::" << scoped.substr(2) << ", ::Ice::OutputStream>::write(ostr, *this);";
+ C << nl << getAbsolute("::Ice::StreamWriter", scope) << "< " << name << ", "
+ << getAbsolute("::Ice::OutputStream", scope) << ">::write(ostr, *this);";
C << nl << "ostr->endSlice();";
if(base)
{
- emitUpcall(base, "::_writeImpl(ostr);");
+ emitUpcall(base, "::_writeImpl(ostr);", scope);
}
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_readImpl(::Ice::InputStream* istr)";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_readImpl("
+ << getAbsolute("::Ice::InputStream*", scope) << " istr)";
C << sb;
C << nl << "istr->startSlice();";
- C << nl << "Ice::StreamReader< ::" << scoped.substr(2) << ", ::Ice::InputStream>::read(istr, *this);";
+ C << nl << getAbsolute("::Ice::StreamReader", scope) << "< " << name << ", "
+ << getAbsolute("::Ice::InputStream", scope) << ">::read(istr, *this);";
C << nl << "istr->endSlice();";
if(base)
{
- emitUpcall(base, "::_readImpl(istr);");
+ emitUpcall(base, "::_readImpl(istr);", scope);
}
C << eb;
}
@@ -1286,7 +1296,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
DataMemberList dataMembers = p->dataMembers();
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
-
+ string scope = fixKwd(p->scope());
string name = fixKwd(p->name());
bool classMetaData = findMetaData(p->getMetaData()) == "%class";
@@ -1338,7 +1348,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
vector<string> types;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring);
types.push_back(typeName);
paramDecls.push_back(typeName + " iceP_" + (*q)->name());
}
@@ -1457,8 +1467,22 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
void
Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
+ ContainerPtr container = p->container();
string name = fixKwd(p->name());
- H << nl << typeToString(p->type(), p->optional(), p->getMetaData(), _useWstring) << ' ' << name << ';';
+
+ string scope = "";
+ StructPtr st = StructPtr::dynamicCast(container);
+ if(st)
+ {
+ scope = fixKwd(st->scope());
+ }
+
+ ExceptionPtr ex = ExceptionPtr::dynamicCast(container);
+ if(ex)
+ {
+ scope = fixKwd(ex->scope());
+ }
+ H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), _useWstring) << ' ' << name << ';';
}
void
@@ -1466,7 +1490,9 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
{
string name = fixKwd(p->name());
TypePtr type = p->type();
- string s = typeToString(type, p->typeMetaData(), _useWstring);
+ ContainedPtr cont = ContainedPtr::dynamicCast(p->container());
+ string scope = fixKwd(cont->scope());
+ string s = typeToString(type, scope, p->typeMetaData(), _useWstring);
StringList metaData = p->getMetaData();
string seqType = findMetaData(metaData, _useWstring);
@@ -1486,6 +1512,8 @@ void
Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
{
string name = fixKwd(p->name());
+ ContainedPtr cont = ContainedPtr::dynamicCast(p->container());
+ string scope = fixKwd(cont->scope());
string dictType = findMetaData(p->getMetaData());
if(dictType.empty())
@@ -1496,12 +1524,12 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
TypePtr keyType = p->keyType();
TypePtr valueType = p->valueType();
- string ks = typeToString(keyType, p->keyMetaData(), _useWstring);
+ string ks = typeToString(keyType, scope, p->keyMetaData(), _useWstring);
if(ks[0] == ':')
{
ks.insert(0, " ");
}
- string vs = typeToString(valueType, p->valueMetaData(), _useWstring);
+ string vs = typeToString(valueType, scope, p->valueMetaData(), _useWstring);
H << sp << nl << "typedef ::std::map<" << ks << ", " << vs << "> " << name << ';';
}
@@ -1553,18 +1581,27 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
void
Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
{
+ string scope = fixKwd(p->scope());
H << sp;
- H << nl << "const " << typeToString(p->type(), p->typeMetaData(), _useWstring) << " " << fixKwd(p->name())
+ H << nl << "const " << typeToString(p->type(), scope, p->typeMetaData(), _useWstring) << " " << fixKwd(p->name())
<< " = ";
- writeConstantValue(H, p->type(), p->valueType(), p->value(), _useWstring, p->typeMetaData());
+ writeConstantValue(H, p->type(), p->valueType(), p->value(), _useWstring, p->typeMetaData(), scope);
H << ';';
}
void
-Slice::Gen::TypesVisitor::emitUpcall(const ExceptionPtr& base, const string& call, bool isLocal)
+Slice::Gen::TypesVisitor::emitUpcall(const ExceptionPtr& base, const string& call, const string& scope, bool isLocal)
{
- C << nl << (base ? fixKwd(base->scoped()) : string(isLocal ? "::Ice::LocalException" : "::Ice::UserException"))
- << call;
+ C << nl;
+ if(base)
+ {
+ C << getAbsolute(fixKwd(base->scoped()), scope);
+ }
+ else
+ {
+ C << getAbsolute(isLocal ? "::Ice::LocalException" : "::Ice::UserException", scope);
+ }
+ C << call;
}
Slice::Gen::ProxyDeclVisitor::ProxyDeclVisitor(Output& h, Output&, const string& dllExport) :
@@ -1763,11 +1800,11 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl
<< _dllExport
- << "::IceProxy::Ice::Object* ::IceProxy" << scope << "upCast(::IceProxy" << scoped << "* p) { return p; }";
+ << "::IceProxy::Ice::Object* ::IceProxy" << scope << "upCast(" << name << "* p) { return p; }";
C << sp;
C << nl << "void" << nl << "::IceProxy" << scope << "_readProxy(::Ice::InputStream* istr, "
- << "::IceInternal::ProxyHandle< ::IceProxy" << scoped << ">& v)";
+ << "::IceInternal::ProxyHandle< " << name << ">& v)";
C << sb;
C << nl << "::Ice::ObjectPrx proxy;";
C << nl << "istr->read(proxy);";
@@ -1777,7 +1814,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
C << eb;
C << nl << "else";
C << sb;
- C << nl << "v = new ::IceProxy" << scoped << ';';
+ C << nl << "v = new " << name << ';';
C << nl << "v->_copyFrom(proxy);";
C << eb;
C << eb;
@@ -1824,8 +1861,8 @@ usePrivateEnd(const OperationPtr& p)
{
TypePtr ret = p->returnType();
bool retIsOpt = p->returnIsOptional();
- string retSEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIEnd);
- string retSPrivateEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIPrivateEnd);
+ string retSEnd = returnTypeToString(ret, retIsOpt, "", p->getMetaData(), TypeContextAMIEnd);
+ string retSPrivateEnd = returnTypeToString(ret, retIsOpt, "", p->getMetaData(), TypeContextAMIPrivateEnd);
ParamDeclList outParams;
vector<string> outDeclsEnd;
@@ -1836,9 +1873,9 @@ usePrivateEnd(const OperationPtr& p)
{
if((*q)->isOutParam())
{
- outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), "", (*q)->getMetaData(),
TypeContextAMIEnd));
- outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), "", (*q)->getMetaData(),
TypeContextAMIPrivateEnd));
}
}
@@ -1859,9 +1896,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
TypePtr ret = p->returnType();
bool retIsOpt = p->returnIsOptional();
- string retS = returnTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextAMIEnd);
- string retSEndAMI = returnTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd);
- string retInS = retS != "void" ? inputTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring) : "";
+ string retS = returnTypeToString(ret, retIsOpt, "", p->getMetaData(), _useWstring | TypeContextAMIEnd);
+ string retSEndAMI = returnTypeToString(ret, retIsOpt, "", p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd);
+ string retInS = retS != "void" ? inputTypeToString(ret, retIsOpt, "", p->getMetaData(), _useWstring) : "";
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
@@ -1898,13 +1935,13 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string typeStringEndAMI;
if((*q)->isOutParam())
{
- typeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring | TypeContextAMIEnd);
- typeStringEndAMI = outputTypeToString((*q)->type(), (*q)->optional(), metaData,
+ typeString = outputTypeToString((*q)->type(), (*q)->optional(), "", metaData, _useWstring | TypeContextAMIEnd);
+ typeStringEndAMI = outputTypeToString((*q)->type(), (*q)->optional(), "", metaData,
_useWstring | TypeContextAMIPrivateEnd);
}
else
{
- typeString = inputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring);
+ typeString = inputTypeToString((*q)->type(), (*q)->optional(), "", metaData, _useWstring);
}
params.push_back(typeString);
@@ -1925,7 +1962,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
outParamsDeclAMI.push_back(typeString + ' ' + paramName);
outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + paramName);
outParams.push_back(*q);
- outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), "", (*q)->getMetaData(), _useWstring));
outEndArgs.push_back(getEndArg((*q)->type(), (*q)->getMetaData(), outParamNamesAMI.back()));
}
}
@@ -1943,7 +1980,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
bool generatePrivateEnd = retS != retSEndAMI || outParamsDeclAMI != outParamsDeclEndAMI;
if(ret && generatePrivateEnd)
{
- string typeStringEndAMI = outputTypeToString(ret, p->returnIsOptional(), p->getMetaData(),
+ string typeStringEndAMI = outputTypeToString(ret, p->returnIsOptional(), "", p->getMetaData(),
_useWstring | TypeContextAMIPrivateEnd);
outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + "ret");
}
@@ -2070,7 +2107,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
// access violations errors with the test/Ice/slicing/objects test on VC9
// and Windows 64 bits when compiled with optimization (see bug 4400).
//
- writeAllocateCode(C, ParamDeclList(), p, true, _useWstring | TypeContextAMIEnd);
+ writeAllocateCode(C, ParamDeclList(), p, true, "", _useWstring | TypeContextAMIEnd);
C << nl << "if(!result->_waitForResponse())";
C << sb;
C << nl << "try";
@@ -2214,6 +2251,7 @@ void
Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
string scoped = fixKwd(p->scoped());
H << sp << nl << "class " << name << ';';
@@ -2223,8 +2261,8 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
// upCast is not _upCast nor _iceUpCast for historical reasons. IceInternal::Handle
// depends on this name
//
- H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);";
- H << nl << "typedef ::IceInternal::Handle< " << scoped << "> " << p->name() << "Ptr;";
+ H << nl << _dllExport << getAbsolute("::Ice::Object*", scope) << " upCast(" << name << "*);";
+ H << nl << "typedef ::IceInternal::Handle< " << name << "> " << p->name() << "Ptr;";
H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << p->name() << "Prx;";
H << nl << "typedef " << p->name() << "Prx " << p->name() << "PrxPtr;";
@@ -2232,12 +2270,14 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
// _ice prefix because this function is in the Slice module namespace, where the user
// is allowed to define classes, functions etc. that start with _.
//
- H << nl << _dllExport << "void _icePatchObjectPtr(" << p->name() << "Ptr&, const ::Ice::ObjectPtr&);";
+ H << nl << _dllExport << "void _icePatchObjectPtr(" << p->name() << "Ptr&, const "
+ << getAbsolute("::Ice::ObjectPtr&", scope) << ");";
}
else
{
- H << nl << _dllExport << "::Ice::LocalObject* upCast(" << scoped << "*);";
- H << nl << "typedef ::IceInternal::Handle< " << scoped << "> " << p->name() << "Ptr;";
+ H << nl << _dllExport << getAbsolute("::Ice::LocalObject*", scope) << " upCast("
+ << getAbsolute(scoped, scope) << "*);";
+ H << nl << "typedef ::IceInternal::Handle< " << name << "> " << p->name() << "Ptr;";
}
}
@@ -2306,14 +2346,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
if(bases.empty())
{
- if(p->isLocal())
- {
- H << "public virtual ::Ice::LocalObject";
- }
- else
- {
- H << "public virtual ::Ice::Object";
- }
+ H << "public virtual " << getAbsolute(p->isLocal() ? "::Ice::LocalObject" : "::Ice::Object", scope);
}
else
{
@@ -2326,7 +2359,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
H << "virtual ";
}
- H << "public " << fixKwd((*q)->scoped());
+ H << "public " << getAbsolute(fixKwd((*q)->scoped()), scope);
if(++q != bases.end())
{
H << ',' << nl;
@@ -2378,7 +2411,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring);
allTypes.push_back(typeName);
allParamDecls.push_back(typeName + " iceP_" + (*q)->name());
}
@@ -2407,7 +2440,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
C << sp << nl
<< _dllExport
- << "::Ice::Object* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }"
+ << "::Ice::Object* " << scope.substr(2) << "upCast(" << name << "* p) { return p; }"
<< nl;
//
@@ -2417,7 +2450,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface())
{
- H << sp << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
+ H << sp << nl << "virtual " << getAbsolute("::Ice::ObjectPtr", scope) << " ice_clone() const;";
if(hasGCObjectBaseClass)
{
@@ -2434,7 +2467,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sb;
if(!p->isAbstract())
{
- C << nl << "::Ice::Object* p = new " << name << "(*this);";
+ C << nl << getAbsolute("::Ice::Object*", scope) << " p = new " << name << "(*this);";
C << nl << "return p;";
}
else
@@ -2442,7 +2475,8 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// We need this ice_clone for abstract classes derived from concrete classes
//
- C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
+ C << nl << "throw " << getAbsolute("::Ice::CloneNotImplementedException", scope)
+ << "(__FILE__, __LINE__);";
}
C << eb;
if(hasGCObjectBaseClass)
@@ -2470,9 +2504,12 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
StringList::difference_type scopedPos = IceUtilInternal::distance(firstIter, scopedIter);
H << sp;
- H << nl << "virtual bool ice_isA(const ::std::string&, const ::Ice::Current& = ::Ice::emptyCurrent) const;";
- H << nl << "virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::emptyCurrent) const;";
- H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::emptyCurrent) const;";
+ H << nl << "virtual bool ice_isA(const ::std::string&, const " << getAbsolute("::Ice::Current&", scope)
+ << " = " << getAbsolute("::Ice::emptyCurrent", scope) << ") const;";
+ H << nl << "virtual ::std::vector< ::std::string> ice_ids(const " << getAbsolute("::Ice::Current&", scope)
+ << " = " << getAbsolute("::Ice::emptyCurrent", scope) << ") const;";
+ H << nl << "virtual const ::std::string& ice_id(const " << getAbsolute("::Ice::Current&", scope)
+ << " = " << getAbsolute("::Ice::emptyCurrent", scope) << ") const;";
H << sp << nl << "static const ::std::string& ice_staticId();";
string flatName = "iceC" + p->flattenedScope() + p->name() + "_ids";
@@ -2495,14 +2532,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sp;
C << nl << "bool" << nl << scoped.substr(2)
- << "::ice_isA(const ::std::string& s, const ::Ice::Current&) const";
+ << "::ice_isA(const ::std::string& s, const " << getAbsolute("::Ice::Current&", scope) << ") const";
C << sb;
C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", s);";
C << eb;
C << sp;
C << nl << "::std::vector< ::std::string>" << nl << scoped.substr(2)
- << "::ice_ids(const ::Ice::Current&) const";
+ << "::ice_ids(const " << getAbsolute("::Ice::Current&", scope) << ") const";
C << sb;
C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName
<< '[' << ids.size() << "]);";
@@ -2510,7 +2547,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << sp;
C << nl << "const ::std::string&" << nl << scoped.substr(2)
- << "::ice_id(const ::Ice::Current&) const";
+ << "::ice_id(const " << getAbsolute("::Ice::Current&", scope) << ") const";
C << sb;
C << nl << "return ice_staticId();";
C << eb;
@@ -2538,7 +2575,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
C << sp << nl
<< _dllExport
- << "::Ice::LocalObject* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }";
+ << "::Ice::LocalObject* " << scope.substr(2) << "upCast(" << getAbsolute(scoped, scope) << "* p) { return p; }";
}
return true;
@@ -2547,6 +2584,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
void
Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
+ string name = fixKwd(p->name());
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
ClassList bases = p->bases();
@@ -2577,7 +2615,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
allOpNames.unique();
H << sp;
- H << nl << "virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&);";
+ H << nl << "virtual bool _iceDispatch(::IceInternal::Incoming&, const "
+ << getAbsolute("::Ice::Current&", scope) << ");";
string flatName = "iceC" + p->flattenedScope() + p->name() + "_all";
C << sp << nl << "namespace";
@@ -2597,7 +2636,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << sp << nl << "}";
C << sp;
C << nl << "bool";
- C << nl << scoped.substr(2) << "::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
+ C << nl << scoped.substr(2) << "::_iceDispatch(::IceInternal::Incoming& in, const "
+ << getAbsolute("::Ice::Current&", scope) << " current)";
C << sb;
C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = "
@@ -2605,8 +2645,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
<< ", current.operation);";
C << nl << "if(r.first == r.second)";
C << sb;
- C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, "
- << "current.facet, current.operation);";
+ C << nl << "throw " << getAbsolute("::Ice::OperationNotExistException", scope)
+ << "(__FILE__, __LINE__, current.id, " << "current.facet, current.operation);";
C << eb;
C << sp;
C << nl << "switch(r.first - " << flatName << ')';
@@ -2622,8 +2662,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "default:";
C << sb;
C << nl << "assert(false);";
- C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, "
- << "current.facet, current.operation);";
+ C << nl << "throw " << getAbsolute("::Ice::OperationNotExistException", scope)
+ << "(__FILE__, __LINE__, current.id, " << "current.facet, current.operation);";
C << eb;
C << eb;
C << eb;
@@ -2644,8 +2684,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!attributesMap.empty())
{
H << sp;
- H << nl
- << "virtual ::Ice::Int ice_operationAttributes(const ::std::string&) const;";
+ H << nl << "virtual " << getAbsolute("::Ice::Int", scope)
+ << " ice_operationAttributes(const ::std::string&) const;";
string opAttrFlatName = "iceC" + p->flattenedScope() + p->name() + "_operationAttributes";
@@ -2696,16 +2736,16 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isAbstract())
{
- H << sp << nl << "static ::Ice::ValueFactoryPtr ice_factory();";
+ H << sp << nl << "static " << getAbsolute("::Ice::ValueFactoryPtr", scope) << " ice_factory();";
}
if(preserved && !basePreserved)
{
- H << sp << nl << "virtual ::Ice::SlicedDataPtr ice_getSlicedData() const;";
+ H << sp << nl << "virtual " << getAbsolute("::Ice::SlicedDataPtr", scope) << " ice_getSlicedData() const;";
H << sp;
- H << nl << "virtual void _iceWrite(::Ice::OutputStream*) const;";
- H << nl << "virtual void _iceRead(::Ice::InputStream*);";
+ H << nl << "virtual void _iceWrite(" << getAbsolute("::Ice::OutputStream*", scope) << ") const;";
+ H << nl << "virtual void _iceRead(" << getAbsolute("::Ice::InputStream*", scope) << ");";
}
H.dec();
@@ -2713,8 +2753,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
inProtected = true;
H.inc();
- H << sp << nl << "virtual void _iceWriteImpl(::Ice::OutputStream*) const;";
- H << nl << "virtual void _iceReadImpl(::Ice::InputStream*);";
+ H << sp << nl << "virtual void _iceWriteImpl(" << getAbsolute("::Ice::OutputStream*", scope) << ") const;";
+ H << nl << "virtual void _iceReadImpl(" << getAbsolute("::Ice::InputStream*", scope) << ");";
if(preserved && !basePreserved)
{
@@ -2725,7 +2765,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceWrite(::Ice::OutputStream* ostr) const";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceWrite(" << getAbsolute("::Ice::OutputStream*", scope)
+ << "ostr) const";
C << sb;
C << nl << "ostr->startValue(_iceSlicedData);";
C << nl << "_iceWriteImpl(ostr);";
@@ -2733,7 +2774,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceRead(::Ice::InputStream* istr)";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceRead(" << getAbsolute("::Ice::InputStream*", scope)
+ << " istr)";
C << sb;
C << nl << "istr->startValue();";
C << nl << "_iceReadImpl(istr);";
@@ -2742,26 +2784,30 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceWriteImpl(::Ice::OutputStream* ostr) const";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceWriteImpl(" << getAbsolute("::Ice::OutputStream*", scope)
+ << " ostr) const";
C << sb;
C << nl << "ostr->startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
- C << nl << "Ice::StreamWriter< ::" << scoped.substr(2) << ", ::Ice::OutputStream>::write(ostr, *this);";
+ C << nl << getAbsolute("::Ice::StreamWriter", scope) << "< " << name << ", "
+ << getAbsolute("::Ice::OutputStream", scope) << ">::write(ostr, *this);";
C << nl << "ostr->endSlice();";
if(base)
{
- emitUpcall(base, "::_iceWriteImpl(ostr);");
+ emitUpcall(base, "::_iceWriteImpl(ostr);", scope);
}
C << eb;
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceReadImpl(::Ice::InputStream* istr)";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceReadImpl(" << getAbsolute("::Ice::InputStream*", scope)
+ << " istr)";
C << sb;
C << nl << "istr->startSlice();";
- C << nl << "Ice::StreamReader< ::" << scoped.substr(2) << ", ::Ice::InputStream>::read(istr, *this);";
+ C << nl << getAbsolute("::Ice::StreamReader", scope) << "< " << name << ", "
+ << getAbsolute("::Ice::InputStream", scope) << ">::read(istr, *this);";
C << nl << "istr->endSlice();";
if(base)
{
- emitUpcall(base, "::_iceReadImpl(istr);");
+ emitUpcall(base, "::_iceReadImpl(istr);", scope);
}
C << eb;
@@ -2882,35 +2928,40 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << sp;
H << nl << "inline bool operator==(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)";
H << sb;
- H << nl << "return static_cast<const ::Ice::LocalObject&>(lhs) == static_cast<const ::Ice::LocalObject&>(rhs);";
+ H << nl << "return static_cast<const " << getAbsolute("::Ice::LocalObject&", scope)
+ << ">(lhs) == static_cast<const " << getAbsolute("::Ice::LocalObject&", scope) << ">(rhs);";
H << eb;
H << sp;
H << nl << "inline bool operator<(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)";
H << sb;
- H << nl << "return static_cast<const ::Ice::LocalObject&>(lhs) < static_cast<const ::Ice::LocalObject&>(rhs);";
+ H << nl << "return static_cast<const " << getAbsolute("::Ice::LocalObject&", scope)
+ << ">(lhs) < static_cast<const " << getAbsolute("::Ice::LocalObject&", scope) << ">(rhs);";
H << eb;
}
else
{
C << sp << nl << "void";
- C << nl << scope.substr(2) << "_icePatchObjectPtr(" << p->name() << "Ptr& handle, const ::Ice::ObjectPtr& v)";
+ C << nl << scope.substr(2) << "_icePatchObjectPtr(" << p->name() << "Ptr& handle, const "
+ << getAbsolute("::Ice::ObjectPtr&", scope) << " v)";
C << sb;
- C << nl << "handle = " << scope << p->name() << "Ptr::dynamicCast(v);";
+ C << nl << "handle = " << p->name() << "Ptr::dynamicCast(v);";
C << nl << "if(v && !handle)";
C << sb;
- C << nl << "IceInternal::Ex::throwUOE(" << scoped << "::ice_staticId(), v);";
+ C << nl << "IceInternal::Ex::throwUOE(" << name << "::ice_staticId(), v);";
C << eb;
C << eb;
H << sp;
H << nl << "inline bool operator==(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)";
H << sb;
- H << nl << "return static_cast<const ::Ice::Object&>(lhs) == static_cast<const ::Ice::Object&>(rhs);";
+ H << nl << "return static_cast<const " << getAbsolute("::Ice::Object&", scope)
+ << ">(lhs) == static_cast<const " << getAbsolute("::Ice::Object&", scope) << ">(rhs);";
H << eb;
H << sp;
H << nl << "inline bool operator<(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)";
H << sb;
- H << nl << "return static_cast<const ::Ice::Object&>(lhs) < static_cast<const ::Ice::Object&>(rhs);";
+ H << nl << "return static_cast<const " << getAbsolute("::Ice::Object&", scope)
+ << ">(lhs) < static_cast<const " << getAbsolute("::Ice::Object&", scope) << ">(rhs);";
H << eb;
}
@@ -2936,19 +2987,19 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
string scoped = fixKwd(p->scoped());
string scope = fixKwd(p->scope());
- TypePtr ret = p->returnType();
- string retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring);
-
- string params = "(";
- string paramsDecl = "(";
- string args = "(";
-
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string classNameAMD = "AMD_" + cl->name();
string classScope = fixKwd(cl->scope());
string classScopedAMD = classScope + classNameAMD;
+ TypePtr ret = p->returnType();
+ string retS = returnTypeToString(ret, p->returnIsOptional(), classScope, p->getMetaData(), _useWstring);
+
+ string params = "(";
+ string paramsDecl = "(";
+ string args = "(";
+
string paramsAMD = "(const " + classScopedAMD + '_' + name + "Ptr&, ";
string argsAMD = "(new IceAsync" + classScopedAMD + '_' + name + "(inS), ";
@@ -2965,12 +3016,12 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(isOutParam)
{
outParams.push_back(*q);
- typeString = outputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ typeString = outputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), _useWstring);
}
else
{
inParams.push_back(*q);
- typeString = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ typeString = inputTypeToString((*q)->type(), (*q)->optional(), classScope, (*q)->getMetaData(), _useWstring);
}
if(q != paramList.begin())
@@ -2995,7 +3046,8 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
}
else
{
- outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), classScope, (*q)->getMetaData(),
+ _useWstring));
}
}
@@ -3008,8 +3060,9 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
args += ", ";
}
- params += "const ::Ice::Current& = ::Ice::emptyCurrent)";
- paramsDecl += "const ::Ice::Current& current)";
+ params += "const " + getAbsolute("::Ice::Current&", classScope) + " = " +
+ getAbsolute("::Ice::emptyCurrent", classScope) + ")";
+ paramsDecl += "const " + getAbsolute("::Ice::Current&", classScope) + " current)";
args += "current)";
}
else
@@ -3019,7 +3072,8 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
args += ')';
}
- paramsAMD += "const ::Ice::Current& = ::Ice::emptyCurrent)";
+ paramsAMD += "const " + getAbsolute("::Ice::Current&", classScope) + " = " +
+ getAbsolute("::Ice::emptyCurrent", classScope) + ")";
argsAMD += "current)";
string isConst = ((p->mode() == Operation::Nonmutating) || p->hasMetaData("cpp:const")) ? " const" : "";
@@ -3042,21 +3096,22 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(!cl->isLocal())
{
- H << nl << "bool _iceD_" << name << "(::IceInternal::Incoming&, const ::Ice::Current&)" << isConst << ';';
+ H << nl << "bool _iceD_" << name << "(::IceInternal::Incoming&, const " << getAbsolute("::Ice::Current&", scope)
+ << ")" << isConst << ';';
C << sp;
//
// inS, ret, current etc. may shadow class-with-operations data members in C++98
//
C << nl << "bool" << nl << scope.substr(2) << "_iceD_" << name << "(::IceInternal::Incoming& inS"
- << ", const ::Ice::Current& current)" << isConst;
+ << ", const " << getAbsolute("::Ice::Current&", classScope) << " current)" << isConst;
C << sb;
C << nl << "_iceCheckMode(" << operationModeToString(p->mode()) << ", current.mode);";
if(!inParams.empty())
{
- C << nl << "::Ice::InputStream* istr = inS.startReadParams();";
- writeAllocateCode(C, inParams, 0, true, _useWstring | TypeContextInParam);
+ C << nl << getAbsolute("::Ice::InputStream*", classScope) << " istr = inS.startReadParams();";
+ writeAllocateCode(C, inParams, 0, true, classScope, _useWstring | TypeContextInParam);
writeUnmarshalCode(C, inParams, 0, true, TypeContextInParam);
if(p->sendsClasses(false))
{
@@ -3075,7 +3130,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
if(!amd)
{
- writeAllocateCode(C, outParams, 0, true, _useWstring, "ret");
+ writeAllocateCode(C, outParams, 0, true, classScope, _useWstring, "ret");
C << nl;
if(ret)
{
@@ -3084,7 +3139,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
C << "this->" << fixKwd(name) << args << ';';
if(ret || !outParams.empty())
{
- C << nl << "::Ice::OutputStream* ostr = inS.startWriteParams();";
+ C << nl << getAbsolute("::Ice::OutputStream*", classScope) << " ostr = inS.startWriteParams();";
writeMarshalCode(C, outParams, p, true, 0);
if(p->returnsClasses(false))
{
@@ -3120,12 +3175,12 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
string typeString;
if((*r)->isOutParam())
{
- typeString = outputTypeToString((*r)->type(), (*r)->optional(), metaData,
+ typeString = outputTypeToString((*r)->type(), (*r)->optional(), classScope, metaData,
_useWstring | TypeContextAMIEnd);
}
else
{
- typeString = inputTypeToString((*r)->type(), (*r)->optional(), metaData, _useWstring);
+ typeString = inputTypeToString((*r)->type(), (*r)->optional(), classScope, metaData, _useWstring);
}
if(!(*r)->isOutParam())
@@ -3138,22 +3193,24 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
}
}
- H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar << " = 0;";
+ H << sp << nl << "virtual " << getAbsolute("::Ice::AsyncResultPtr", classScope) << " begin_" << name << spar
+ << paramsDeclAMI << epar << " = 0;";
- H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI
- << "const ::Ice::CallbackPtr& del"
- << "const ::Ice::LocalObjectPtr& cookie = 0" << epar << " = 0;";
+ H << sp << nl << "virtual " << getAbsolute("::Ice::AsyncResultPtr", classScope) << " begin_" << name << spar
+ << paramsDeclAMI
+ << ("const " + getAbsolute("::Ice::CallbackPtr&", classScope) + " del")
+ << ("const " + getAbsolute("::Ice::LocalObjectPtr&", classScope) + " cookie = 0")
+ << epar << " = 0;";
- string clScope = fixKwd(cl->scope());
string delName = "Callback_" + cl->name() + "_" + name;
- string delNameScoped = clScope + delName;
- H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI
- << "const " + delNameScoped + "Ptr& del"
- << "const ::Ice::LocalObjectPtr& cookie = 0" << epar << " = 0;";
+ H << sp << nl << "virtual " << getAbsolute("::Ice::AsyncResultPtr", classScope) << " begin_" << name << spar
+ << paramsDeclAMI
+ << ("const " + delName + "Ptr& del")
+ << ("const " + getAbsolute("::Ice::LocalObjectPtr&", classScope) + " cookie = 0") << epar << " = 0;";
H << sp << nl << "virtual " << retS << " end_" << name << spar << outParamsDeclAMI
- << "const ::Ice::AsyncResultPtr&" << epar << " = 0;";
+ << ("const " + getAbsolute("::Ice::AsyncResultPtr&", classScope)) << epar << " = 0;";
}
}
@@ -3164,13 +3221,15 @@ Slice::Gen::ObjectVisitor::emitDataMember(const DataMemberPtr& p)
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
int typeContext = cl->isLocal() ? TypeContextLocal | _useWstring : _useWstring;
- H << nl << typeToString(p->type(), p->optional(), p->getMetaData(), typeContext) << ' ' << name << ';';
+ H << nl << typeToString(p->type(), p->optional(), fixKwd(cl->scope()), p->getMetaData(), typeContext) << ' '
+ << name << ';';
}
void
Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
{
string scoped = fixKwd(p->scoped());
+ string scope = fixKwd(p->scope());
ClassList bases = p->bases();
ClassDefPtr base;
if(!bases.empty() && !bases.front()->isInterface())
@@ -3204,7 +3263,7 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
bool hasCyclicBase = base && base->canBeCyclic();
if(hasCyclicBase || basePreserved)
{
- emitUpcall(bases.front(), "::_iceGcVisitMembers(v_);");
+ emitUpcall(bases.front(), "::_iceGcVisitMembers(v_);", scope);
}
if(preserved && !basePreserved)
@@ -3351,6 +3410,7 @@ void
Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
DataMemberList allDataMembers = p->allDataMembers();
+ string scope = fixKwd(p->scope());
if(!allDataMembers.empty())
{
@@ -3365,7 +3425,7 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeContext);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), typeContext);
bool dataMember = std::find(dataMembers.begin(), dataMembers.end(), (*q)) != dataMembers.end();
allParamDecls.push_back(typeName + ((dataMember || callBaseConstuctors) ?
(" iceP_" + (*q)->name()) : (" /*iceP_" + (*q)->name() + "*/")));
@@ -3418,9 +3478,18 @@ Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
}
void
-Slice::Gen::ObjectVisitor::emitUpcall(const ClassDefPtr& base, const string& call)
+Slice::Gen::ObjectVisitor::emitUpcall(const ClassDefPtr& base, const string& call, const string& scope)
{
- C << nl << (base ? fixKwd(base->scoped()) : string("::Ice::Object")) << call;
+ C << nl;
+ if(base)
+ {
+ C << getAbsolute(fixKwd(base->scoped()), scope);
+ }
+ else
+ {
+ C << getAbsolute("::Ice::Object", scope);
+ }
+ C << call;
}
Slice::Gen::AsyncCallbackVisitor::AsyncCallbackVisitor(Output& h, Output&, const string& dllExport) :
@@ -3554,7 +3623,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr&
string delTmplName = (withCookie ? "Callback_" : "CallbackNC_") + clName + "_" + p->name();
TypePtr ret = p->returnType();
- string retS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring);
+ string retS = inputTypeToString(ret, p->returnIsOptional(), clScope, p->getMetaData(), _useWstring);
string retEndArg = getEndArg(ret, p->getMetaData(), "ret");
ParamDeclList outParams;
@@ -3571,7 +3640,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr&
outParams.push_back(*q);
outArgs.push_back("iceP_" + (*q)->name());
outEndArgs.push_back(getEndArg((*q)->type(), (*q)->getMetaData(), outArgs.back()));
- outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), clScope, (*q)->getMetaData(), _useWstring));
}
}
@@ -3656,11 +3725,11 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr&
//
// completed.
//
- H << sp << nl << "virtual void completed(const ::Ice::AsyncResultPtr& result) const";
+ H << sp << nl << "virtual void completed(const " << getAbsolute("::Ice::AsyncResultPtr&", clScope)
+ << " result) const";
H << sb;
- H << nl << clScope << clName << "Prx proxy = " << clScope << clName
- << "Prx::uncheckedCast(result->getProxy());";
- writeAllocateCode(H, outParams, p, true, _useWstring | TypeContextInParam | TypeContextAMICallPrivateEnd);
+ H << nl << clName << "Prx proxy = " << clName << "Prx::uncheckedCast(result->getProxy());";
+ writeAllocateCode(H, outParams, p, true, clScope, _useWstring | TypeContextInParam | TypeContextAMICallPrivateEnd);
H << nl << "try";
H << sb;
H << nl;
@@ -3792,7 +3861,7 @@ Slice::Gen::ImplVisitor::ImplVisitor(Output& h, Output& c, const string& dllExpo
}
string
-Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const StringList& metaData) const
+Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const string& scope, const StringList& metaData) const
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
@@ -3840,26 +3909,26 @@ Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const StringList& met
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- return fixKwd(st->scoped()) + "()";
+ return getAbsolute(fixKwd(st->scoped()), scope) + "()";
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
EnumeratorList enumerators = en->enumerators();
- return fixKwd(en->scope() + enumerators.front()->name());
+ return getAbsolute(fixKwd(en->scope() + enumerators.front()->name()), scope);
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return typeToString(seq, metaData, _useWstring | TypeContextCpp11) + "()";
+ return typeToString(seq, scope, metaData, _useWstring | TypeContextCpp11) + "()";
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- return fixKwd(dict->scoped()) + "()";
+ return getAbsolute(fixKwd(dict->scoped()), scope) + "()";
}
}
@@ -3867,12 +3936,6 @@ Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const StringList& met
return "???";
}
-void
-Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const StringList& metaData)
-{
- out << nl << "return " << defaultValue(type, metaData) << ";";
-}
-
bool
Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p)
{
@@ -3925,10 +3988,10 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
string opName = op->name();
string isConst = ((op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const")) ? " const" : "";
- string classScopedAMD = scope + "AMD_" + ClassDefPtr::dynamicCast(op->container())->name();
+ string classScopedAMD = "AMD_" + ClassDefPtr::dynamicCast(op->container())->name();
TypePtr ret = op->returnType();
- string retS = returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), _useWstring);
+ string retS = returnTypeToString(ret, op->returnIsOptional(), "", op->getMetaData(), _useWstring);
if(!p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")))
{
@@ -3941,7 +4004,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(!(*q)->isOutParam())
{
- H << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ H << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(),
_useWstring);
}
}
@@ -3956,7 +4019,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(!(*q)->isOutParam())
{
- C << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ C << ',' << nl << inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(),
_useWstring) << ' ' << fixKwd((*q)->name());
}
}
@@ -3978,7 +4041,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << opName << "CB->ice_response(";
if(ret)
{
- C << defaultValue(ret, op->getMetaData());
+ C << defaultValue(ret, scope, op->getMetaData());
}
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
@@ -3988,7 +4051,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
C << ", ";
}
- C << defaultValue((*q)->type(), op->getMetaData());
+ C << defaultValue((*q)->type(), scope, op->getMetaData());
}
}
C << ");";
@@ -3997,7 +4060,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else
{
- H << sp << nl << "virtual " << retS << ' ' << fixKwd(opName) << '(';
+ H << sp << nl << "virtual " << getAbsolute(retS, scope) << ' ' << fixKwd(opName) << '(';
H.useCurrentPosAsIndent();
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
@@ -4008,11 +4071,11 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if((*q)->isOutParam())
{
- H << outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ H << outputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring);
}
else
{
- H << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ H << inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring);
}
}
if(!p->isLocal())
@@ -4040,12 +4103,12 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if((*q)->isOutParam())
{
- C << outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring) << " "
+ C << outputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring) << " "
<< fixKwd((*q)->name());
}
else
{
- C << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring) << " /*"
+ C << inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring) << " /*"
<< fixKwd((*q)->name()) << "*/";
}
}
@@ -4064,7 +4127,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
if(ret)
{
- writeReturn(C, ret, op->getMetaData());
+ C << nl << "return " << defaultValue(ret, scope, op->getMetaData()) << ";";
}
C << eb;
@@ -4150,12 +4213,12 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
paramsInvoke.push_back("const " + proxyName + "&");
TypePtr ret = p->returnType();
- string retS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring);
+ string retS = inputTypeToString(ret, p->returnIsOptional(), classScope, p->getMetaData(), _useWstring);
if(ret)
{
params.push_back(retS);
- paramsAMD.push_back(inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring));
+ paramsAMD.push_back(inputTypeToString(ret, p->returnIsOptional(), classScope, p->getMetaData(), _useWstring));
paramsDecl.push_back(retS + " ret");
args.push_back("ret");
}
@@ -4167,12 +4230,12 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
{
string paramName = fixKwd((*q)->name());
TypePtr type = (*q)->type();
- string typeString = inputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ string typeString = inputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), _useWstring);
if((*q)->isOutParam())
{
params.push_back(typeString);
- paramsAMD.push_back(inputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ paramsAMD.push_back(inputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), _useWstring));
paramsDecl.push_back(typeString + ' ' + paramName);
args.push_back(paramName);
@@ -4185,14 +4248,14 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
}
}
- paramsInvoke.push_back("const ::Ice::Context&");
+ paramsInvoke.push_back(getAbsolute("const ::Ice::Context&", classScope));
if(cl->hasMetaData("amd") || p->hasMetaData("amd"))
{
string cbName = classNameAMD + '_' + name;
- H << sp << nl << "class " << _dllExport << cbName
- << " : public virtual ::Ice::AMDCallback";
+ H << sp << nl << "class " << _dllExport << cbName << " : public virtual "
+ << getAbsolute("::Ice::AMDCallback", classScope);
H << sb;
H.dec();
H << nl << "public:";
@@ -4297,7 +4360,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
string args;
TypePtr ret = p->returnType();
- string retS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring);
+ string retS = inputTypeToString(ret, p->returnIsOptional(), "", p->getMetaData(), _useWstring);
if(ret)
{
@@ -4316,7 +4379,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p)
{
string paramName = fixKwd((*q)->name());
TypePtr type = (*q)->type();
- string typeString = inputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), _useWstring);
+ string typeString = inputTypeToString(type, (*q)->optional(), "", (*q)->getMetaData(), _useWstring);
if(ret || !outParams.empty())
{
@@ -5373,6 +5436,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
_useWstring = setUseWstring(p, _useWstringHist, _useWstring);
string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
string scoped = fixKwd(p->scoped());
ExceptionPtr base = p->base();
DataMemberList dataMembers = p->dataMembers();
@@ -5391,7 +5455,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(),
_useWstring | TypeContextCpp11);
allTypes.push_back(typeName);
allParamDecls.push_back(typeName + " iceP_" + (*q)->name());
@@ -5406,12 +5470,14 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
}
}
- string helperClass = p->isLocal() ? "Ice::LocalExceptionHelper" : "Ice::UserExceptionHelper";
- string baseClass = base ? fixKwd(base->scoped()) : (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException");
+ string helperClass = getAbsolute(p->isLocal() ? "::Ice::LocalExceptionHelper" : "::Ice::UserExceptionHelper", scope);
+ string baseClass = base ?
+ getAbsolute(fixKwd(base->scoped()), scope) :
+ getAbsolute(p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException", scope);
string templateParameters = name + ", " + baseClass;
H << sp << nl;
- H << "class " << _dllClassExport << name << " : public ::" << helperClass << "<" << templateParameters << ">";
+ H << "class " << _dllClassExport << name << " : public " << helperClass << "<" << templateParameters << ">";
H << sb;
H.dec();
@@ -5432,7 +5498,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
if(p->isLocal())
{
H << sp << nl << name << "(const char* file_, int line_) : ";
- H << "::Ice::LocalExceptionHelper" << "<" << templateParameters << ">";
+ H << getAbsolute("::Ice::LocalExceptionHelper", scope) << "<" << templateParameters << ">";
H << "(file_, line_)";
H << sb;
H << eb;
@@ -5466,7 +5532,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H.inc();
if(base && (p->isLocal() || !baseDataMembers.empty()))
{
- H << nl << "::" << helperClass << "<" << templateParameters << ">" << "(";
+ H << nl << helperClass << "<" << templateParameters << ">" << "(";
if(p->isLocal())
{
H << "file_, line_";
@@ -5500,7 +5566,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
}
else if(p->isLocal())
{
- H << " ::Ice::LocalExceptionHelper" << "<" << templateParameters << ">";
+ H << " " << getAbsolute("::Ice::LocalExceptionHelper", scope) << "<" << templateParameters << ">";
H << "(file_, line_)";
if(!dataMembers.empty())
{
@@ -5529,7 +5595,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << eb;
}
- writeIceTuple(H, p->allDataMembers(), _useWstring);
+ writeIceTuple(H, scope, p->allDataMembers(), _useWstring);
H << sp;
H << nl << _dllMemberExport << "static const ::std::string& ice_staticId();";
@@ -5587,12 +5653,15 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
H << sp;
- H << nl << _dllMemberExport << "virtual ::std::shared_ptr<::Ice::SlicedData> ice_getSlicedData() const override;";
+ H << nl << _dllMemberExport << "virtual ::std::shared_ptr<" << getAbsolute("::Ice::SlicedData", scope)
+ << "> ice_getSlicedData() const override;";
H << sp;
- H << nl << _dllMemberExport << "virtual void _write(::Ice::OutputStream*) const override;";
- H << nl << _dllMemberExport << "virtual void _read(::Ice::InputStream*) override;";
+ H << nl << _dllMemberExport << "virtual void _write(" << getAbsolute("::Ice::OutputStream*", scope)
+ << ") const override;";
+ H << nl << _dllMemberExport << "virtual void _read(" << getAbsolute("::Ice::InputStream*", scope)
+ << ") override;";
- H << sp << nl << "::std::shared_ptr<::Ice::SlicedData> _slicedData;";
+ H << sp << nl << "::std::shared_ptr<" << getAbsolute("::Ice::SlicedData", scope) << "> _slicedData;";
C << sp;
C << nl << "::std::shared_ptr<::Ice::SlicedData>" << nl << scoped.substr(2) << "::ice_getSlicedData() const";
@@ -5600,14 +5669,16 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
C << nl << "return _slicedData;";
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_write(::Ice::OutputStream* ostr) const";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_write("
+ << getAbsolute("::Ice::OutputStream*", scope) << " ostr) const";
C << sb;
C << nl << "ostr->startException(_slicedData);";
C << nl << "_writeImpl(ostr);";
C << nl << "ostr->endException();";
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::_read(::Ice::InputStream* istr)";
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::_read(" << getAbsolute("::Ice::InputStream*", scope)
+ << " istr)";
C << sb;
C << nl << "istr->startException();";
C << nl << "_readImpl(istr);";
@@ -5648,7 +5719,7 @@ Slice::Gen::Cpp11TypesVisitor::visitStructStart(const StructPtr& p)
void
Slice::Gen::Cpp11TypesVisitor::visitStructEnd(const StructPtr& p)
{
- writeIceTuple(H, p->dataMembers(), _useWstring);
+ writeIceTuple(H, fixKwd(p->scope()), p->dataMembers(), _useWstring);
H << eb << ';';
_useWstring = resetUseWstring(_useWstringHist);
}
@@ -5656,8 +5727,9 @@ Slice::Gen::Cpp11TypesVisitor::visitStructEnd(const StructPtr& p)
void
Slice::Gen::Cpp11TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
+ string scope = fixKwd(ContainedPtr::dynamicCast(p->container())->scope());
string name = fixKwd(p->name());
- H << nl << typeToString(p->type(), p->optional(), p->getMetaData(), _useWstring | TypeContextCpp11)
+ H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), _useWstring | TypeContextCpp11)
<< ' ' << name;
string defaultValue = p->defaultValue();
@@ -5670,13 +5742,15 @@ Slice::Gen::Cpp11TypesVisitor::visitDataMember(const DataMemberPtr& p)
// = "<string literal>" doesn't work for optional<std::string>
//
H << '{';
- writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), true);
+ writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), scope,
+ true);
H << '}';
}
else
{
H << " = ";
- writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), true);
+ writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), scope,
+ true);
}
}
@@ -5687,9 +5761,10 @@ void
Slice::Gen::Cpp11TypesVisitor::visitSequence(const SequencePtr& p)
{
string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
TypePtr type = p->type();
int typeCtx = p->isLocal() ? (_useWstring | TypeContextLocal) : _useWstring;
- string s = typeToString(type, p->typeMetaData(), typeCtx | TypeContextCpp11);
+ string s = typeToString(type, scope, p->typeMetaData(), typeCtx | TypeContextCpp11);
StringList metaData = p->getMetaData();
string seqType = findMetaData(metaData, _useWstring);
@@ -5709,6 +5784,7 @@ void
Slice::Gen::Cpp11TypesVisitor::visitDictionary(const DictionaryPtr& p)
{
string name = fixKwd(p->name());
+ string scope = fixKwd(p->scope());
string dictType = findMetaData(p->getMetaData());
int typeCtx = p->isLocal() ? (_useWstring | TypeContextLocal) : _useWstring;
if(dictType.empty())
@@ -5718,8 +5794,8 @@ Slice::Gen::Cpp11TypesVisitor::visitDictionary(const DictionaryPtr& p)
//
TypePtr keyType = p->keyType();
TypePtr valueType = p->valueType();
- string ks = typeToString(keyType, p->keyMetaData(), typeCtx | TypeContextCpp11);
- string vs = typeToString(valueType, p->valueMetaData(), typeCtx | TypeContextCpp11);
+ string ks = typeToString(keyType, scope, p->keyMetaData(), typeCtx | TypeContextCpp11);
+ string vs = typeToString(valueType, scope, p->valueMetaData(), typeCtx | TypeContextCpp11);
H << sp << nl << "using " << name << " = ::std::map<" << ks << ", " << vs << ">;";
}
@@ -5793,18 +5869,18 @@ Slice::Gen::Cpp11ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
base = bases.front();
}
- H << sp << nl << "class " << _dllClassExport << p->name() << "Prx : public virtual ::Ice::Proxy<"
- << fixKwd(p->name() + "Prx") << ", ";
+ H << sp << nl << "class " << _dllClassExport << p->name() << "Prx : public virtual "
+ << getAbsolute("::Ice::Proxy", scope) << "<" << fixKwd(p->name() + "Prx") << ", ";
if(bases.empty() || (base && base->allOperations().empty()))
{
- H << "::Ice::ObjectPrx";
+ H << getAbsolute("::Ice::ObjectPrx", scope);
}
else
{
ClassList::const_iterator q = bases.begin();
while(q != bases.end())
{
- H << fixKwd((*q)->scoped() + "Prx");
+ H << getAbsolute(fixKwd((*q)->scoped() + "Prx"), scope);
if(++q != bases.end())
{
H << ", ";
@@ -5824,31 +5900,33 @@ void
Slice::Gen::Cpp11ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
string prx = fixKwd(p->name() + "Prx");
+ const string suffix = p->isInterface() ? "" : "Disp";
+ const string scoped = fixKwd(p->scoped() + "Prx");
+ const string scope = fixKwd(p->scope());
H << sp << nl << _dllMemberExport << "static const ::std::string& ice_staticId();";
H.dec();
H << sp << nl << "protected:";
H.inc();
- H << sp << nl << prx << "() = default;";
- H << nl << "friend ::std::shared_ptr<" << prx << "> IceInternal::createProxy<" << prx << ">();";
+ H << sp << nl << getAbsolute(prx, scope) << "() = default;";
+ H << nl << "friend ::std::shared_ptr<" << getAbsolute(prx, scope) << "> IceInternal::createProxy<"
+ << getAbsolute(prx, scope) << ">();";
H << sp;
- H << nl << _dllMemberExport << "virtual ::std::shared_ptr<::Ice::ObjectPrx> _newInstance() const override;";
+ H << nl << _dllMemberExport << "virtual ::std::shared_ptr<" << getAbsolute("::Ice::ObjectPrx", scope)
+ << "> _newInstance() const override;";
H << eb << ';';
- string suffix = p->isInterface() ? "" : "Disp";
- string scoped = fixKwd(p->scoped() + "Prx");
-
C << sp;
C << nl << "::std::shared_ptr<::Ice::ObjectPrx>";
C << nl << scoped.substr(2) << "::_newInstance() const";
C << sb;
- C << nl << "return ::IceInternal::createProxy<" << prx << ">();";
+ C << nl << "return ::IceInternal::createProxy<" << getAbsolute(prx, scope) << ">();";
C << eb;
C << sp;
C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()";
C << sb;
- C << nl << "return "<< fixKwd(p->scope() + p->name() + suffix).substr(2) << "::ice_staticId();";
+ C << nl << "return "<< fixKwd(p->name() + suffix) << "::ice_staticId();";
C << eb;
_useWstring = resetUseWstring(_useWstringHist);
@@ -5860,13 +5938,14 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
string name = p->name();
string flatName = "iceC" + p->flattenedScope() + p->name() + "_name";
+ ContainerPtr container = p->container();
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string clScope = fixKwd(cl->scope());
+
TypePtr ret = p->returnType();
bool retIsOpt = p->returnIsOptional();
- string retS = returnTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextCpp11);
-
- ContainerPtr container = p->container();
- ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string retS = returnTypeToString(ret, retIsOpt, clScope, p->getMetaData(), _useWstring | TypeContextCpp11);
vector<string> params;
vector<string> paramsDecl;
@@ -5886,10 +5965,10 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
if(ret)
{
- futureOutParams.push_back(typeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextCpp11));
+ futureOutParams.push_back(typeToString(ret, retIsOpt, clScope, p->getMetaData(), _useWstring | TypeContextCpp11));
- lambdaOutParams.push_back(
- typeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextInParam | TypeContextCpp11));
+ lambdaOutParams.push_back(typeToString(ret, retIsOpt, clScope, p->getMetaData(), _useWstring |
+ TypeContextInParam | TypeContextCpp11));
outParamsHasOpt |= p->returnIsOptional();
}
@@ -5901,12 +5980,12 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
if((*q)->isOutParam())
{
- futureOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), metaData,
+ futureOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), clScope, metaData,
_useWstring | TypeContextCpp11));
- lambdaOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), metaData,
+ lambdaOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), clScope, metaData,
_useWstring | TypeContextInParam | TypeContextCpp11));
- string outputTypeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData,
+ string outputTypeString = outputTypeToString((*q)->type(), (*q)->optional(), clScope, metaData,
_useWstring | TypeContextCpp11);
params.push_back(outputTypeString);
@@ -5922,7 +6001,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
}
else
{
- string typeString = inputTypeToString((*q)->type(), (*q)->optional(), metaData,
+ string typeString = inputTypeToString((*q)->type(), (*q)->optional(), clScope, metaData,
_useWstring | TypeContextCpp11);
params.push_back(typeString);
@@ -5947,8 +6026,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
}
else
{
- string resultScope = fixKwd(cl->scope() + cl->name());
- futureT = resultStructName(name, resultScope);
+ futureT = resultStructName(name, fixKwd(cl->name()));
}
string deprecateSymbol = getDeprecateSymbol(p, cl);
@@ -5957,7 +6035,8 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
// Synchronous operation
//
H << sp << nl << deprecateSymbol << retS << ' ' << fixKwd(name) << spar << paramsDecl;
- H << "const ::Ice::Context& context = Ice::noExplicitContext" << epar;
+ H << ("const " + getAbsolute("::Ice::Context&", clScope) + " context = "
+ + getAbsolute("Ice::noExplicitContext", clScope.substr(2))) << epar;
H << sb;
H << nl;
if(futureOutParams.size() == 1)
@@ -5976,9 +6055,9 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << "auto result = ";
}
- H << "_makePromiseOutgoing<" << futureT << ">";
+ H << "_makePromiseOutgoing<" << getAbsolute(futureT, cl->scoped()) << ">";
- H << spar << "true, this" << string("&" + scoped + "_iceI_" + name);
+ H << spar << "true, this" << "&" + cl->name() + "Prx::_iceI_" + name;
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
H << fixKwd(paramPrefix + (*q)->name());
@@ -6004,7 +6083,8 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << sp;
H << nl << "template<template<typename> class P = ::std::promise>";
H << nl << deprecateSymbol << "auto " << name << "Async" << spar << inParamsDecl;
- H << "const ::Ice::Context& context = Ice::noExplicitContext" << epar;
+ H << ("const " + getAbsolute("::Ice::Context&", clScope) + " context = "
+ + getAbsolute("::Ice::noExplicitContext", clScope)) << epar;
H.inc();
H << nl << "-> decltype(::std::declval<P<" << futureT << ">>().get_future())";
H.dec();
@@ -6012,7 +6092,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl << "return _makePromiseOutgoing<" << futureT << ", P>" << spar;
- H << "false, this" << string("&" + scoped + "_iceI_" + name);
+ H << "false, this" << string("&" + cl->name() + "Prx::_iceI_" + name);
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
H << fixKwd(paramPrefix + (*q)->name());
@@ -6064,13 +6144,14 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
}
H << "::std::function<void" << spar << lambdaOutParams << epar << ">"
- + condString(!lambdaCustomOut, " response") + ",";
+ + string(!lambdaCustomOut ? " response": "") + ",";
H << nl << "::std::function<void(::std::exception_ptr)>"
- + condString(!lambdaCustomOut, " ex") + " = nullptr,";
+ + string(!lambdaCustomOut ? " ex" : "") + " = nullptr,";
H << nl << "::std::function<void(bool)>"
- + condString(!lambdaCustomOut," sent") + " = nullptr,";
- H << nl << "const ::Ice::Context&"
- + condString(!lambdaCustomOut, " context") + " = Ice::noExplicitContext)" + condString(lambdaCustomOut, ";");
+ + string(!lambdaCustomOut ? " sent" : "") + " = nullptr,";
+ H << nl << "const " << getAbsolute("::Ice::Context&", clScope)
+ + string(!lambdaCustomOut ? " context" : "") + " = "
+ + getAbsolute("Ice::noExplicitContext", clScope.substr(2)) + ")" + string(lambdaCustomOut ? ";" : "");
H.restoreIndent();
if(lambdaCustomOut)
@@ -6112,7 +6193,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "read = [response](::Ice::InputStream* istr)";
C << sb;
C << nl << "istr->startEncapsulation();";
- writeAllocateCode(C, outParams, p, true, _useWstring | TypeContextInParam | TypeContextCpp11);
+ writeAllocateCode(C, outParams, p, true, clScope, _useWstring | TypeContextInParam | TypeContextCpp11);
writeUnmarshalCode(C, outParams, p, true, _useWstring | TypeContextInParam | TypeContextCpp11);
if(p->returnsClasses(false))
@@ -6147,9 +6228,9 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
C.inc();
C << nl;
- writeInParamsLambda(C, p, inParams);
+ writeInParamsLambda(C, p, inParams, clScope);
C << "," << nl;
- throwUserExceptionLambda(C, p->throws());
+ throwUserExceptionLambda(C, p->throws(), clScope);
C.dec();
C << ");";
@@ -6183,7 +6264,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl << "return _makeLamdaOutgoing<" << futureT << ">" << spar;
H << (futureOutParams.size() > 1 ? "responseCb" : "response") << "ex" << "sent" << "this";
- H << string("&" + scoped + "_iceI_" + name);
+ H << string("&" + getAbsolute(scoped, clScope.substr(2)) + "_iceI_" + name);
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
H << fixKwd(paramPrefix + (*q)->name());
@@ -6200,13 +6281,13 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << nl << _dllMemberExport << "void _iceI_" << name << spar;
H << "const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<" + futureT + ">>&";
H << inParamsS;
- H << "const ::Ice::Context&";
+ H << ("const " + getAbsolute("::Ice::Context&", clScope));
H << epar << ";";
C << sp;
C << nl << "void" << nl << scoped << "_iceI_" << name << spar;
C << "const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<" + futureT + ">>& outAsync";
- C << inParamsDecl << "const ::Ice::Context& context";
+ C << inParamsDecl << ("const " + getAbsolute("::Ice::Context&", clScope) + " context");
C << epar;
C << sb;
if(p->returnsData())
@@ -6214,13 +6295,14 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
C << nl << "_checkTwowayOnly(" << flatName << ");";
}
C << nl << "outAsync->invoke(" << flatName << ", ";
- C << operationModeToString(p->sendMode(), true) << ", " << opFormatTypeToString(p, true) << ", context,";
+ C << getAbsolute(operationModeToString(p->sendMode(), true), clScope) << ", "
+ << getAbsolute(opFormatTypeToString(p, true), clScope) << ", context,";
C.inc();
C << nl;
- writeInParamsLambda(C, p, inParams);
+ writeInParamsLambda(C, p, inParams, clScope);
C << "," << nl;
- throwUserExceptionLambda(C, p->throws());
+ throwUserExceptionLambda(C, p->throws(), clScope);
if(futureOutParams.size() > 1)
{
@@ -6229,7 +6311,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
// only one, we rely on the default read method from LambdaOutgoing
// except if the unique ret/out is optional or is an array/range.
//
- C << "," << nl << "[](::Ice::InputStream* istr)";
+ C << "," << nl << "[](" << getAbsolute("::Ice::InputStream*", clScope) << " istr)";
C << sb;
C << nl << futureT << " v;";
writeUnmarshalCode(C, outParams, p, false, _useWstring | TypeContextCpp11, "", returnValueS, "v");
@@ -6248,10 +6330,10 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
// a read method, we can't rely on the default read method which wouldn't
// known which tag to use.
//
- C << "," << nl << "[](::Ice::InputStream* istr)";
+ C << "," << nl << "[](" << getAbsolute("::Ice::InputStream*", clScope) << " istr)";
C << sb;
- writeAllocateCode(C, outParams, p, true, _useWstring | TypeContextCpp11);
+ writeAllocateCode(C, outParams, p, true, clScope, _useWstring | TypeContextCpp11);
writeUnmarshalCode(C, outParams, p, true, _useWstring | TypeContextCpp11);
if(p->returnsClasses(false))
@@ -6317,19 +6399,28 @@ Slice::Gen::Cpp11TypesVisitor::visitEnum(const EnumPtr& p)
void
Slice::Gen::Cpp11TypesVisitor::visitConst(const ConstPtr& p)
{
+ const string scope = fixKwd(p->scope());
H << sp;
H << nl << (isConstexprType(p->type()) ? "constexpr " : "const ")
- << typeToString(p->type(), p->typeMetaData(), _useWstring | TypeContextCpp11) << " " << fixKwd(p->name())
+ << typeToString(p->type(), scope, p->typeMetaData(), _useWstring | TypeContextCpp11) << " " << fixKwd(p->name())
<< " = ";
- writeConstantValue(H, p->type(), p->valueType(), p->value(), _useWstring, p->typeMetaData(), true);
+ writeConstantValue(H, p->type(), p->valueType(), p->value(), _useWstring, p->typeMetaData(), scope, true);
H << ';';
}
void
-Slice::Gen::Cpp11TypesVisitor::emitUpcall(const ExceptionPtr& base, const string& call, bool isLocal)
+Slice::Gen::Cpp11TypesVisitor::emitUpcall(const ExceptionPtr& base, const string& call, const string& scope, bool isLocal)
{
- C << nl << (base ? fixKwd(base->scoped()) : string(isLocal ? "::Ice::LocalException" : "::Ice::UserException"))
- << call;
+ C << nl;
+ if(base)
+ {
+ C << getAbsolute(fixKwd(base->scoped()), scope);
+ }
+ else
+ {
+ getAbsolute(isLocal ? "::Ice::LocalException" : "::Ice::UserException", scope);
+ }
+ C << call;
}
Slice::Gen::Cpp11ObjectVisitor::Cpp11ObjectVisitor(::IceUtilInternal::Output& h,
@@ -6351,12 +6442,13 @@ Slice::Gen::Cpp11ObjectVisitor::emitDataMember(const DataMemberPtr& p)
int typeContext = _useWstring | TypeContextCpp11;
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string scope = fixKwd(cl->scope());
if(cl->isLocal())
{
typeContext |= TypeContextLocal;
}
- H << nl << typeToString(p->type(), p->optional(), p->getMetaData(), typeContext) << ' ' << name;
+ H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), typeContext) << ' ' << name;
string defaultValue = p->defaultValue();
if(!defaultValue.empty())
@@ -6368,28 +6460,48 @@ Slice::Gen::Cpp11ObjectVisitor::emitDataMember(const DataMemberPtr& p)
// = "<string literal>" doesn't work for optional<std::string>
//
H << '{';
- writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), true);
+ writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), scope,
+ true);
H << '}';
}
else
{
H << " = ";
- writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), true);
+ writeConstantValue(H, p->type(), p->defaultValueType(), defaultValue, _useWstring, p->getMetaData(), scope,
+ true);
}
}
H << ";";
}
void
-Slice::Gen::Cpp11InterfaceVisitor::emitUpcall(const ClassDefPtr& base, const string& call)
+Slice::Gen::Cpp11InterfaceVisitor::emitUpcall(const ClassDefPtr& base, const string& call, const string& scope)
{
- C << nl << (base ? fixKwd(base->scoped()) : string("::Ice::Object")) << call;
+ C << nl;
+ if(base)
+ {
+ C << getAbsolute(fixKwd(base->scoped()), scope);
+ }
+ else
+ {
+ C << getAbsolute("::Ice::Object", scope);
+ }
+ C << call;
}
void
-Slice::Gen::Cpp11ValueVisitor::emitUpcall(const ClassDefPtr& base, const string& call)
+Slice::Gen::Cpp11ValueVisitor::emitUpcall(const ClassDefPtr& base, const string& call, const string& scope)
{
- C << nl << (base ? fixKwd(base->scoped()) : string("::Ice::Value")) << call;
+ C << nl;
+ if(base)
+ {
+ C << getAbsolute(fixKwd(base->scoped()), scope);
+ }
+ else
+ {
+ C << getAbsolute("::Ice::Value", scope);
+ }
+ C << call;
}
Slice::Gen::Cpp11LocalObjectVisitor::Cpp11LocalObjectVisitor(::IceUtilInternal::Output& h,
@@ -6430,7 +6542,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = fixKwd(p->name());
-
+ string scope = fixKwd(p->scope());
if(p->isDelegate())
{
int typeCtx = _useWstring | TypeContextLocal | TypeContextCpp11;
@@ -6441,7 +6553,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
// A delegate only has one operation
OperationPtr op = p->allOperations().front();
TypePtr ret = op->returnType();
- string retS = returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), typeCtx);
+ string retS = returnTypeToString(ret, op->returnIsOptional(), scope, op->getMetaData(), typeCtx);
H << "::std::function<" << retS << "(";
@@ -6450,11 +6562,11 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if((*q)->isOutParam())
{
- H << outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ H << outputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), typeCtx);
}
else
{
- H << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ H << inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), typeCtx);
}
H << (IceUtilInternal::distance(q, paramList.end()) == 1 ? "" : ", ");
}
@@ -6463,7 +6575,6 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
- string scope = fixKwd(p->scope());
string scoped = fixKwd(p->scoped());
ClassList bases = p->bases();
ClassDefPtr base;
@@ -6522,7 +6633,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring | TypeContextLocal);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), _useWstring | TypeContextLocal);
allTypes.push_back(typeName);
allParamDecls.push_back(typeName + " iceP_" + (*q)->name());
}
@@ -6637,7 +6748,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitOperation(const OperationPtr& p)
int typeCtx = _useWstring | TypeContextLocal | TypeContextCpp11;
TypePtr ret = p->returnType();
- string retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(),
+ string retS = returnTypeToString(ret, p->returnIsOptional(), scope, p->getMetaData(),
typeCtx);
string params = "(";
@@ -6661,12 +6772,12 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitOperation(const OperationPtr& p)
if(isOutParam)
{
outParams.push_back(*q);
- typeString = outputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ typeString = outputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), typeCtx);
}
else
{
inParams.push_back(*q);
- typeString = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ typeString = inputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), typeCtx);
}
if(q != paramList.begin())
@@ -6711,7 +6822,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitOperation(const OperationPtr& p)
string typeString;
if(!(*r)->isOutParam())
{
- typeString = inputTypeToString((*r)->type(), (*r)->optional(), metaData, typeCtx);
+ typeString = inputTypeToString((*r)->type(), (*r)->optional(), classScope, metaData, typeCtx);
paramsDeclAMI.push_back(typeString + ' ' + paramName);
paramsArgAMI.push_back(paramName);
}
@@ -6836,7 +6947,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
if(bases.empty() || (base && base->allOperations().empty()))
{
- H << "public virtual ::Ice::Object";
+ H << "public virtual " << getAbsolute("::Ice::Object", scope);
}
else
{
@@ -6846,7 +6957,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p)
string baseSuffix = (*q)->isInterface() ? "" : "Disp";
string baseScoped = fixKwd((*q)->scope() + (*q)->name() + baseSuffix);
- H << "public virtual " << baseScoped;
+ H << "public virtual " << getAbsolute(baseScoped, scope);
if(++q != bases.end())
{
H << ',' << nl;
@@ -6885,28 +6996,33 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p)
assert(scopedIter != ids.end());
H << sp;
- H << nl << "virtual bool ice_isA(::std::string, const ::Ice::Current&) const override;";
+ H << nl << "virtual bool ice_isA(::std::string, const " << getAbsolute("::Ice::Current&", scope)
+ << ") const override;";
H << nl
- << "virtual ::std::vector<::std::string> ice_ids(const ::Ice::Current&) const override;";
- H << nl << "virtual ::std::string ice_id(const ::Ice::Current&) const override;";
+ << "virtual ::std::vector<::std::string> ice_ids(const " << getAbsolute("::Ice::Current&", scope)
+ << ") const override;";
+ H << nl << "virtual ::std::string ice_id(const " << getAbsolute("::Ice::Current&", scope) << ") const override;";
H << sp << nl << "static const ::std::string& ice_staticId();";
string flatName = "iceC" + p->flattenedScope() + p->name() + "_ids";
C << sp;
- C << nl << "bool" << nl << scoped.substr(2) << "::ice_isA(::std::string s, const ::Ice::Current&) const";
+ C << nl << "bool" << nl << scoped.substr(2) << "::ice_isA(::std::string s, const "
+ << getAbsolute("::Ice::Current&", scope) << ") const";
C << sb;
C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", s);";
C << eb;
C << sp;
- C << nl << "::std::vector<::std::string>" << nl << scoped.substr(2) << "::ice_ids(const ::Ice::Current&) const";
+ C << nl << "::std::vector<::std::string>" << nl << scoped.substr(2) << "::ice_ids(const "
+ << getAbsolute("::Ice::Current&", scope) << ") const";
C << sb;
C << nl << "return ::std::vector<::std::string>(&" << flatName << "[0], &" << flatName << '[' << ids.size() << "]);";
C << eb;
C << sp;
- C << nl << "::std::string" << nl << scoped.substr(2) << "::ice_id(const ::Ice::Current&) const";
+ C << nl << "::std::string" << nl << scoped.substr(2) << "::ice_id(const " << getAbsolute("::Ice::Current&", scope)
+ << ") const";
C << sb;
C << nl << "return ice_staticId();";
C << eb;
@@ -6953,18 +7069,21 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefEnd(const ClassDefPtr& p)
string flatName = "iceC" + p->flattenedScope() + p->name() + "_ops";
H << sp;
- H << nl << "virtual bool _iceDispatch(::IceInternal::Incoming&, const ::Ice::Current&) override;";
+ H << nl << "virtual bool _iceDispatch(::IceInternal::Incoming&, const " << getAbsolute("::Ice::Current&", scope)
+ << ") override;";
C << sp;
C << nl << "bool";
- C << nl << scoped.substr(2) << "::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)";
+ C << nl << scoped.substr(2) << "::_iceDispatch(::IceInternal::Incoming& in, const "
+ << getAbsolute("::Ice::Current&", scope) << " current)";
C << sb;
C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = "
<< "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size() << ", current.operation);";
C << nl << "if(r.first == r.second)";
C << sb;
- C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);";
+ C << nl << "throw " << getAbsolute("::Ice::OperationNotExistException", scope)
+ << "(__FILE__, __LINE__, current.id, current.facet, current.operation);";
C << eb;
C << sp;
C << nl << "switch(r.first - " << flatName << ')';
@@ -6980,7 +7099,8 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "default:";
C << sb;
C << nl << "assert(false);";
- C << nl << "throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);";
+ C << nl << "throw " << getAbsolute("::Ice::OperationNotExistException", scope)
+ << "(__FILE__, __LINE__, current.id, current.facet, current.operation);";
C << eb;
C << eb;
C << eb;
@@ -7027,7 +7147,8 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
bool amd = (cl->hasMetaData("amd") || p->hasMetaData("amd"));
if(ret)
{
- string typeS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextCpp11);
+ string typeS = inputTypeToString(ret, p->returnIsOptional(), classScope, p->getMetaData(),
+ _useWstring | TypeContextCpp11);
responseParams.push_back(typeS);
responseParamsDecl.push_back(typeS + " ret");
}
@@ -7043,7 +7164,8 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
}
else
{
- retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextCpp11);
+ retS = returnTypeToString(ret, p->returnIsOptional(), classScope, p->getMetaData(),
+ _useWstring | TypeContextCpp11);
}
ParamDeclList inParams;
@@ -7059,7 +7181,8 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
if(!isOutParam)
{
inParams.push_back(*q);
- params.push_back(typeToString(type, (*q)->optional(), (*q)->getMetaData(), typeCtx | TypeContextInParam));
+ params.push_back(typeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(),
+ typeCtx | TypeContextInParam));
args.push_back(condMove(isMovable(type) && !isOutParam, paramName));
}
else
@@ -7067,11 +7190,12 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
outParams.push_back(*q);
if(!p->hasMarshaledResult() && !amd)
{
- params.push_back(outputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), typeCtx));
+ params.push_back(outputTypeToString(type, (*q)->optional(), classScope, (*q)->getMetaData(), typeCtx));
args.push_back(condMove(isMovable(type) && !isOutParam, paramName));
}
- string responseTypeS = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ string responseTypeS = inputTypeToString((*q)->type(), (*q)->optional(), classScope, (*q)->getMetaData(),
+ typeCtx);
responseParams.push_back(responseTypeS);
responseParamsDecl.push_back(responseTypeS + " " + paramName);
}
@@ -7092,7 +7216,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
params.push_back("::std::function<void(::std::exception_ptr)>");
args.push_back("inA->exception()");
}
- params.push_back("const ::Ice::Current&");
+ params.push_back("const " + getAbsolute("::Ice::Current&", classScope));
args.push_back("current");
if(cl->isInterface())
@@ -7104,16 +7228,18 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
{
string resultName = resultStructName(name, "", true);
H << sp;
- H << nl << "class " << resultName << " : public ::Ice::MarshaledResult";
+ H << nl << "class " << resultName << " : public " << getAbsolute("::Ice::MarshaledResult", classScope);
H << sb;
H.dec();
H << nl << "public:";
H.inc();
- H << nl << resultName << spar << responseParams << "const ::Ice::Current&" << epar << ";";
+ H << nl << resultName << spar << responseParams << ("const " + getAbsolute("::Ice::Current&", classScope))
+ << epar << ";";
H << eb << ';';
C << sp << nl << scope.substr(2) << resultName << "::" << resultName;
- C << spar << responseParamsDecl << "const ::Ice::Current& current" << epar << ":";
+ C << spar << responseParamsDecl << ("const " + getAbsolute("::Ice::Current&", classScope) + " current")
+ << epar << ":";
C.inc();
C << nl << "MarshaledResult(current)";
C.dec();
@@ -7135,19 +7261,21 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
H << sp;
H << nl << deprecateSymbol << "virtual " << retS << ' ' << opName << spar << params << epar << isConst << " = 0;";
- H << nl << "bool _iceD_" << name << "(::IceInternal::Incoming&, const ::Ice::Current&)" << isConst << ';';
+ H << nl << "bool _iceD_" << name << "(::IceInternal::Incoming&, const "
+ << getAbsolute("::Ice::Current&", classScope) << ")" << isConst << ';';
C << sp;
C << nl << "bool";
C << nl << scope.substr(2);
- C << "_iceD_" << name << "(::IceInternal::Incoming& inS" << ", const ::Ice::Current& current)" << isConst;
+ C << "_iceD_" << name << "(::IceInternal::Incoming& inS" << ", const " << getAbsolute("::Ice::Current&", classScope)
+ << " current)" << isConst;
C << sb;
- C << nl << "_iceCheckMode(" << operationModeToString(p->mode(), true) << ", current.mode);";
+ C << nl << "_iceCheckMode(" << getAbsolute(operationModeToString(p->mode(), true), classScope) << ", current.mode);";
if(!inParams.empty())
{
C << nl << "auto istr = inS.startReadParams();";
- writeAllocateCode(C, inParams, 0, true, _useWstring | TypeContextInParam | TypeContextCpp11);
+ writeAllocateCode(C, inParams, 0, true, classScope, _useWstring | TypeContextInParam | TypeContextCpp11);
writeUnmarshalCode(C, inParams, 0, true, _useWstring | TypeContextInParam | TypeContextCpp11);
if(p->sendsClasses(false))
{
@@ -7166,7 +7294,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
if(!amd)
{
- writeAllocateCode(C, outParams, 0, true, _useWstring | TypeContextCpp11);
+ writeAllocateCode(C, outParams, 0, true, classScope, _useWstring | TypeContextCpp11);
if(p->hasMarshaledResult())
{
C << nl << "inS.setMarshaledResult(";
@@ -7279,15 +7407,16 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p)
DataMemberList dataMembers = p->dataMembers();
DataMemberList allDataMembers = p->allDataMembers();
- H << sp << nl << "class " << _dllClassExport << name << " : public ::Ice::ValueHelper<" << name << ", ";
+ H << sp << nl << "class " << _dllClassExport << name << " : public " << getAbsolute("::Ice::ValueHelper", scope)
+ << "<" << name << ", ";
if(!base || (base && base->isInterface()))
{
- H << "Ice::Value";
+ H << getAbsolute("::Ice::Value", scope);
}
else
{
- H << fixKwd(base->scoped());
+ H << getAbsolute(fixKwd(base->scoped()), scope);
}
H << ">";
H << sb;
@@ -7318,7 +7447,7 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p)
emitOneShotConstructor(p);
- writeIceTuple(H, p->allDataMembers(), _useWstring);
+ writeIceTuple(H, fixKwd(p->scope()), p->allDataMembers(), _useWstring);
H << sp << nl << _dllMemberExport << "static const ::std::string& ice_staticId();";
return true;
@@ -7341,7 +7470,8 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(preserved && !basePreserved)
{
- H << sp << nl << "virtual ::std::shared_ptr<::Ice::SlicedData> ice_getSlicedData() const override;";
+ H << sp << nl << "virtual ::std::shared_ptr<" << getAbsolute("::Ice::SlicedData", scope)
+ << "> ice_getSlicedData() const override;";
C << sp;
C << nl << "::std::shared_ptr<::Ice::SlicedData>" << nl << scoped.substr(2) << "::ice_getSlicedData() const";
@@ -7350,11 +7480,12 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
H << sp;
- H << nl << "virtual void _iceWrite(::Ice::OutputStream*) const override;";
- H << nl << "virtual void _iceRead(::Ice::InputStream*) override;";
+ H << nl << "virtual void _iceWrite(" << getAbsolute("::Ice::OutputStream*", scope) << ") const override;";
+ H << nl << "virtual void _iceRead(" << getAbsolute("::Ice::InputStream*", scope) << ") override;";
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceWrite(::Ice::OutputStream* ostr) const";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceWrite(" << getAbsolute("::Ice::OutputStream*", scope)
+ << " ostr) const";
C << sb;
C << nl << "ostr->startValue(_iceSlicedData);";
C << nl << "_iceWriteImpl(ostr);";
@@ -7362,7 +7493,8 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::_iceRead(::Ice::InputStream* istr)";
+ C << nl << "void" << nl << scoped.substr(2) << "::_iceRead(" << getAbsolute("::Ice::InputStream*", scope)
+ << " istr)";
C << sb;
C << nl << "istr->startValue();";
C << nl << "_iceReadImpl(istr);";
@@ -7433,7 +7565,7 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p)
H.inc();
inProtected = true;
}
- H << sp << nl << "::std::shared_ptr<::Ice::SlicedData> _iceSlicedData;";
+ H << sp << nl << "::std::shared_ptr<" << getAbsolute("::Ice::SlicedData", scope) << "> _iceSlicedData;";
}
if(generateFriend)
@@ -7490,6 +7622,7 @@ Slice::Gen::Cpp11ValueVisitor::visitOperation(const OperationPtr& p)
bool
Slice::Gen::Cpp11ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& derived, const ClassDefPtr& base)
{
+ const string scope = fixKwd(derived->scope());
DataMemberList allDataMembers = base->allDataMembers();
if(allDataMembers.empty())
{
@@ -7516,11 +7649,12 @@ Slice::Gen::Cpp11ObjectVisitor::emitVirtualBaseInitializers(const ClassDefPtr& d
if(base->isLocal())
{
- H << nl << fixKwd(base->scoped());
+ H << nl << getAbsolute(fixKwd(base->scoped()), scope);
}
else
{
- H << nl << "Ice::ValueHelper<" << fixKwd(derived->scoped()) << ", " << fixKwd(base->scoped()) << ">";
+ H << nl << "Ice::ValueHelper<" << getAbsolute(fixKwd(derived->scoped()), scope)
+ << ", " << getAbsolute(fixKwd(base->scoped()), scope) << ">";
}
H << upcall;
return true;
@@ -7530,7 +7664,7 @@ void
Slice::Gen::Cpp11ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
DataMemberList allDataMembers = p->allDataMembers();
-
+ string scope = fixKwd(p->scope());
if(!allDataMembers.empty())
{
vector<string> allParamDecls;
@@ -7544,7 +7678,7 @@ Slice::Gen::Cpp11ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q)
{
- string typeName = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeContext);
+ string typeName = inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(), typeContext);
allParamDecls.push_back(typeName + " iceP_" + (*q)->name());
}
@@ -7764,7 +7898,7 @@ Slice::Gen::Cpp11ImplVisitor::Cpp11ImplVisitor(Output& h, Output& c, const strin
}
string
-Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const StringList& metaData) const
+Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const string& scope, const StringList& metaData) const
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
@@ -7812,26 +7946,26 @@ Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const StringList
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- return fixKwd(st->scoped()) + "()";
+ return getAbsolute(fixKwd(st->scoped()), scope) + "()";
}
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
EnumeratorList enumerators = en->enumerators();
- return fixKwd(en->scoped() + "::" + enumerators.front()->name());
+ return getAbsolute(fixKwd(en->scoped() + "::" + enumerators.front()->name()), scope);
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return typeToString(seq, metaData, _useWstring | TypeContextCpp11) + "()";
+ return typeToString(seq, scope, metaData, _useWstring | TypeContextCpp11) + "()";
}
DictionaryPtr dict = DictionaryPtr::dynamicCast(type);
if(dict)
{
- return fixKwd(dict->scoped()) + "()";
+ return getAbsolute(fixKwd(dict->scoped()), scope) + "()";
}
}
@@ -7839,12 +7973,6 @@ Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const StringList
return "???";
}
-void
-Slice::Gen::Cpp11ImplVisitor::writeReturn(Output& out, const TypePtr& type, const StringList& metaData)
-{
- out << nl << "return " << defaultValue(type, metaData) << ";";
-}
-
bool
Slice::Gen::Cpp11ImplVisitor::visitModuleStart(const ModulePtr& p)
{
@@ -7917,7 +8045,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
TypePtr ret = op->returnType();
string retS = op->hasMarshaledResult() ?
scoped + "::" + resultStructName(opName, "", true) :
- returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), _useWstring | TypeContextCpp11);
+ returnTypeToString(ret, op->returnIsOptional(), "", op->getMetaData(), _useWstring | TypeContextCpp11);
ParamDeclList params = op->parameters();
ParamDeclList outParams;
@@ -7942,7 +8070,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
H.useCurrentPosAsIndent();
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
- H << typeToString((*q)->type(), (*q)->optional(),
+ H << typeToString((*q)->type(), (*q)->optional(), scope,
(*q)->getMetaData(), _useWstring | TypeContextInParam | TypeContextCpp11)
<< "," << nl;
}
@@ -7955,7 +8083,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
if(ret)
{
- responseParams = inputTypeToString(ret, op->returnIsOptional(), op->getMetaData(),
+ responseParams = inputTypeToString(ret, op->returnIsOptional(), scope, op->getMetaData(),
_useWstring | TypeContextCpp11);
if(!outParams.empty())
{
@@ -7969,7 +8097,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
responseParams += ", ";
}
- responseParams += inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ responseParams += inputTypeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(),
_useWstring | TypeContextCpp11);
}
}
@@ -7985,7 +8113,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C.useCurrentPosAsIndent();
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
{
- C << typeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ C << typeToString((*q)->type(), (*q)->optional(), scope, (*q)->getMetaData(),
_useWstring | TypeContextInParam | TypeContextCpp11);
C << ' ' << fixKwd((*q)->name()) << "," << nl;
}
@@ -8004,11 +8132,11 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C << spar;
if(ret)
{
- C << defaultValue(ret, op->getMetaData());
+ C << defaultValue(ret, scope, op->getMetaData());
}
for(ParamDeclList::const_iterator q = outParams.begin(); q != outParams.end(); ++q)
{
- C << defaultValue((*q)->type(), op->getMetaData());
+ C << defaultValue((*q)->type(), scope, op->getMetaData());
}
if(op->hasMarshaledResult())
@@ -8024,7 +8152,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else
{
- H << sp << nl << "virtual " << retS << ' ' << fixKwd(opName) << '(';
+ H << sp << nl << "virtual " << getAbsolute(retS, scope) << ' ' << fixKwd(opName) << '(';
H.useCurrentPosAsIndent();
ParamDeclList paramList = op->hasMarshaledResult() ? inParams : op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
@@ -8037,12 +8165,12 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
string typeString;
if((*q)->isOutParam())
{
- typeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData,
+ typeString = outputTypeToString((*q)->type(), (*q)->optional(), scope, metaData,
_useWstring | TypeContextCpp11);
}
else
{
- typeString = typeToString((*q)->type(), (*q)->optional(), metaData,
+ typeString = typeToString((*q)->type(), (*q)->optional(), scope, metaData,
_useWstring | TypeContextInParam | TypeContextCpp11);
}
H << typeString;
@@ -8074,13 +8202,13 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
string typeString;
if((*q)->isOutParam())
{
- C << outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring | TypeContextCpp11)
+ C << outputTypeToString((*q)->type(), (*q)->optional(), scope, metaData, _useWstring | TypeContextCpp11)
<< " "
<< fixKwd((*q)->name());
}
else
{
- C << typeToString((*q)->type(), (*q)->optional(), metaData,
+ C << typeToString((*q)->type(), (*q)->optional(), scope, metaData,
_useWstring | TypeContextInParam | TypeContextCpp11)
<< " /*" << fixKwd((*q)->name()) << "*/";
}
@@ -8105,7 +8233,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "return " << scoped << "::" << resultStructName(opName, "", true) << "(";
if(ret)
{
- C << defaultValue(ret, op->getMetaData());
+ C << defaultValue(ret, scope, op->getMetaData());
if(!outParams.empty())
{
C << ", ";
@@ -8114,7 +8242,7 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ParamDeclList::const_iterator q = outParams.begin(); q != outParams.end();)
{
- C << defaultValue((*q)->type(), op->getMetaData());
+ C << defaultValue((*q)->type(), scope, op->getMetaData());
if(++q != outParams.end())
{
C << ", ";
@@ -8127,12 +8255,12 @@ Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
{
for(ParamDeclList::const_iterator q = outParams.begin(); q != outParams.end(); ++q)
{
- C << nl << fixKwd((*q)->name()) << " = " << defaultValue((*q)->type(), op->getMetaData()) << ";";
+ C << nl << fixKwd((*q)->name()) << " = " << defaultValue((*q)->type(), scope, op->getMetaData()) << ";";
}
if(ret)
{
- writeReturn(C, ret, op->getMetaData());
+ C << nl << "return " << defaultValue(ret, scope, op->getMetaData()) << ";";
}
}
C << eb;
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index 139f9ecd8c3..9e8bca138b9 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -98,7 +98,7 @@ private:
private:
- void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
+ void emitUpcall(const ExceptionPtr&, const std::string&, const std::string&, bool = false);
::IceUtilInternal::Output& H;
::IceUtilInternal::Output& C;
@@ -195,7 +195,7 @@ private:
void emitGCClearCode(const TypePtr&, const std::string&, const std::string&, int);
bool emitVirtualBaseInitializers(const ClassDefPtr&, bool virtualInheritance, bool direct);
void emitOneShotConstructor(const ClassDefPtr&);
- void emitUpcall(const ClassDefPtr&, const std::string&);
+ void emitUpcall(const ClassDefPtr&, const std::string&, const std::string&);
::IceUtilInternal::Output& H;
::IceUtilInternal::Output& C;
@@ -274,12 +274,7 @@ private:
//
// Get the default value returned for a type
//
- std::string defaultValue(const TypePtr&, const StringList&) const;
-
- //
- // Generate code to return a dummy value
- //
- void writeReturn(::IceUtilInternal::Output&, const TypePtr&, const StringList&);
+ std::string defaultValue(const TypePtr&, const std::string&, const StringList&) const;
};
class AsyncVisitor : private ::IceUtil::noncopyable, public ParserVisitor
@@ -394,7 +389,7 @@ private:
private:
- void emitUpcall(const ExceptionPtr&, const std::string&, bool = false);
+ void emitUpcall(const ExceptionPtr&, const std::string&, const std::string&, bool = false);
::IceUtilInternal::Output& H;
::IceUtilInternal::Output& C;
@@ -483,7 +478,7 @@ private:
virtual bool visitExceptionStart(const ExceptionPtr&);
virtual bool visitStructStart(const StructPtr&);
virtual void visitOperation(const OperationPtr&);
- void emitUpcall(const ClassDefPtr&, const std::string&);
+ void emitUpcall(const ClassDefPtr&, const std::string&, const std::string&);
};
class Cpp11ValueVisitor : private ::IceUtil::noncopyable, public Cpp11ObjectVisitor
@@ -499,7 +494,7 @@ private:
virtual bool visitExceptionStart(const ExceptionPtr&);
virtual bool visitStructStart(const StructPtr&);
virtual void visitOperation(const OperationPtr&);
- void emitUpcall(const ClassDefPtr&, const std::string&);
+ void emitUpcall(const ClassDefPtr&, const std::string&, const std::string&);
};
class Cpp11StreamVisitor : private ::IceUtil::noncopyable, public ParserVisitor
@@ -558,14 +553,9 @@ private:
std::list<int> _useWstringHist;
//
- // Generate code to return a dummy value
- //
- void writeReturn(::IceUtilInternal::Output&, const TypePtr&, const StringList&);
-
- //
// Get the default value returned for a type
//
- std::string defaultValue(const TypePtr&, const StringList&) const;
+ std::string defaultValue(const TypePtr&, const std::string&, const StringList&) const;
};
private:
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp
index e546f183172..a5c89f5742f 100644
--- a/cpp/src/slice2cs/CsUtil.cpp
+++ b/cpp/src/slice2cs/CsUtil.cpp
@@ -1,3 +1,4 @@
+
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
@@ -98,6 +99,16 @@ splitScopedName(const string& scoped)
}
+string
+Slice::CsGenerator::getAbsolute(const string& type, const string& scope)
+{
+ if(type.find(".") != string::npos && type.find(scope) == 0 && type.find(".", scope.size()) == string::npos)
+ {
+ return type.substr(scope.size());
+ }
+ return type;
+}
+
//
// If the passed name is a scoped name, return the identical scoped name,
// but with all components that are C# keywords replaced by
@@ -141,7 +152,8 @@ Slice::CsGenerator::fixId(const ContainedPtr& cont, int baseTypes, bool mangleCa
ContainerPtr container = cont->container();
ContainedPtr contained = ContainedPtr::dynamicCast(container);
if(contained && contained->hasMetaData("cs:property") &&
- (contained->containedType() == Contained::ContainedTypeClass || contained->containedType() == Contained::ContainedTypeStruct))
+ (contained->containedType() == Contained::ContainedTypeClass ||
+ contained->containedType() == Contained::ContainedTypeStruct))
{
return "_" + cont->name();
}
@@ -152,9 +164,10 @@ Slice::CsGenerator::fixId(const ContainedPtr& cont, int baseTypes, bool mangleCa
}
string
-Slice::CsGenerator::getOptionalFormat(const TypePtr& type)
+Slice::CsGenerator::getOptionalFormat(const TypePtr& type, const string& scope)
{
BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
+ string prefix = getAbsolute("Ice.OptionalFormat", scope);
if(bp)
{
switch(bp->kind())
@@ -162,33 +175,33 @@ Slice::CsGenerator::getOptionalFormat(const TypePtr& type)
case Builtin::KindByte:
case Builtin::KindBool:
{
- return "Ice.OptionalFormat.F1";
+ return prefix + ".F1";
}
case Builtin::KindShort:
{
- return "Ice.OptionalFormat.F2";
+ return prefix + ".F2";
}
case Builtin::KindInt:
case Builtin::KindFloat:
{
- return "Ice.OptionalFormat.F4";
+ return prefix + ".F4";
}
case Builtin::KindLong:
case Builtin::KindDouble:
{
- return "Ice.OptionalFormat.F8";
+ return prefix + ".F8";
}
case Builtin::KindString:
{
- return "Ice.OptionalFormat.VSize";
+ return prefix + ".VSize";
}
case Builtin::KindObject:
{
- return "Ice.OptionalFormat.Class";
+ return prefix + ".Class";
}
case Builtin::KindObjectProxy:
{
- return "Ice.OptionalFormat.FSize";
+ return prefix + ".FSize";
}
case Builtin::KindLocalObject:
{
@@ -197,43 +210,63 @@ Slice::CsGenerator::getOptionalFormat(const TypePtr& type)
}
case Builtin::KindValue:
{
- return "Ice.OptionalFormat.Class";
+ return prefix + ".Class";
}
}
}
if(EnumPtr::dynamicCast(type))
{
- return "Ice.OptionalFormat.Size";
+ return prefix + ".Size";
}
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- return seq->type()->isVariableLength() ? "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
+ if(seq->type()->isVariableLength())
+ {
+ return prefix + ".FSize";
+ }
+ else
+ {
+ return prefix + ".VSize";
+ }
}
DictionaryPtr d = DictionaryPtr::dynamicCast(type);
if(d)
{
- return (d->keyType()->isVariableLength() || d->valueType()->isVariableLength()) ?
- "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
+ if(d->keyType()->isVariableLength() || d->valueType()->isVariableLength())
+ {
+ return prefix + ".FSize";
+ }
+ else
+ {
+ return prefix + ".VSize";
+ }
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- return st->isVariableLength() ? "Ice.OptionalFormat.FSize" : "Ice.OptionalFormat.VSize";
+ if(st->isVariableLength())
+ {
+ return prefix + ".FSize";
+ }
+ else
+ {
+ return prefix + ".VSize";
+ }
}
if(ProxyPtr::dynamicCast(type))
{
- return "Ice.OptionalFormat.FSize";
+ return prefix + ".FSize";
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
assert(cl);
- return "Ice.OptionalFormat.Class";
+ return prefix + ".Class";
}
string
@@ -261,7 +294,8 @@ Slice::CsGenerator::getStaticId(const TypePtr& type)
}
string
-Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local, const StringList& metaData)
+Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool optional, bool local,
+ const StringList& metaData)
{
if(!type)
{
@@ -270,25 +304,9 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
if(optional)
{
- return "Ice.Optional<" + typeToString(type, false, local) + ">";
+ return getAbsolute("Ice.Optional", scope) + "<" + typeToString(type, scope, false, local) + ">";
}
- static const char* localBuiltinTable[] =
- {
- "byte",
- "bool",
- "short",
- "int",
- "long",
- "float",
- "double",
- "string",
- "Ice.Object",
- "Ice.ObjectPrx",
- "_System.Object",
- "Ice.Value"
- };
-
static const char* builtinTable[] =
{
"byte",
@@ -299,7 +317,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
"float",
"double",
"string",
- "Ice.Value",
+ "Ice.Object",
"Ice.ObjectPrx",
"_System.Object",
"Ice.Value"
@@ -321,7 +339,14 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
if(builtin)
{
- return local ? localBuiltinTable[builtin->kind()] : builtinTable[builtin->kind()];
+ if(!local && builtin->kind() == Builtin::KindObject)
+ {
+ return getAbsolute(builtinTable[Builtin::KindValue], scope);
+ }
+ else
+ {
+ return getAbsolute(builtinTable[builtin->kind()], scope);
+ }
}
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
@@ -329,11 +354,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
{
if(cl->isInterface() && !local)
{
- return "Ice.Value";
+ return getAbsolute("Ice.Value", scope);
}
else
{
- return fixId(cl->scoped());
+ return getAbsolute(fixId(cl->scoped()), scope);
}
}
@@ -343,11 +368,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
ClassDefPtr def = proxy->_class()->definition();
if(def->isInterface() || def->allOperations().size() > 0)
{
- return fixId(proxy->_class()->scoped() + "Prx");
+ return getAbsolute(fixId(proxy->_class()->scoped() + "Prx"), scope);
}
else
{
- return "Ice.ObjectPrx";
+ return getAbsolute("Ice.ObjectPrx", scope);
}
}
@@ -361,11 +386,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
string type = meta.substr(prefix.size());
if(type == "List" || type == "LinkedList" || type == "Queue" || type == "Stack")
{
- return "_System.Collections.Generic." + type + "<" + typeToString(seq->type(), optional, local) + ">";
+ return "_System.Collections.Generic." + type + "<" + typeToString(seq->type(), scope, optional, local) + ">";
}
else
{
- return "global::" + type + "<" + typeToString(seq->type(), optional, local) + ">";
+ return "global::" + type + "<" + typeToString(seq->type(), scope, optional, local) + ">";
}
}
@@ -376,7 +401,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
return "global::" + type;
}
- return typeToString(seq->type(), optional, local) + "[]";
+ return typeToString(seq->type(), scope, optional, local) + "[]";
}
DictionaryPtr d = DictionaryPtr::dynamicCast(type);
@@ -393,14 +418,15 @@ Slice::CsGenerator::typeToString(const TypePtr& type, bool optional, bool local,
{
typeName = "Dictionary";
}
- return "_System.Collections.Generic." + typeName
- + "<" + typeToString(d->keyType(), optional, local) + ", " + typeToString(d->valueType(), optional, local) + ">";
+ return "_System.Collections.Generic." + typeName + "<" +
+ typeToString(d->keyType(), scope, optional, local) + ", " +
+ typeToString(d->valueType(), scope, optional, local) + ">";
}
ContainedPtr contained = ContainedPtr::dynamicCast(type);
if(contained)
{
- return fixId(contained->scoped());
+ return getAbsolute(fixId(contained->scoped()), scope);
}
return "???";
@@ -419,12 +445,12 @@ Slice::CsGenerator::resultStructName(const string& className, const string& opNa
}
string
-Slice::CsGenerator::resultType(const OperationPtr& op, bool dispatch)
+Slice::CsGenerator::resultType(const OperationPtr& op, const string& scope, bool dispatch)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); // Get the class containing the op.
if(dispatch && op->hasMarshaledResult())
{
- return fixId(cl->scope() + resultStructName(cl->name(), op->name(), true));
+ return getAbsolute(fixId(cl->scope() + resultStructName(cl->name(), op->name(), true)), scope);
}
string t;
@@ -433,16 +459,16 @@ Slice::CsGenerator::resultType(const OperationPtr& op, bool dispatch)
{
if(outParams.empty())
{
- t = typeToString(op->returnType(), op->returnIsOptional(), cl->isLocal());
+ t = typeToString(op->returnType(), scope, op->returnIsOptional(), cl->isLocal());
}
else if(op->returnType() || outParams.size() > 1)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- t = fixId(cl->scope()) + resultStructName(cl->name(), op->name());
+ t = getAbsolute(fixId(cl->scope()) + resultStructName(cl->name(), op->name()), scope);
}
else
{
- t = typeToString(outParams.front()->type(), outParams.front()->optional(), cl->isLocal());
+ t = typeToString(outParams.front()->type(), scope, outParams.front()->optional(), cl->isLocal());
}
}
@@ -450,16 +476,16 @@ Slice::CsGenerator::resultType(const OperationPtr& op, bool dispatch)
}
string
-Slice::CsGenerator::taskResultType(const OperationPtr& op, bool dispatch)
+Slice::CsGenerator::taskResultType(const OperationPtr& op, const string& scope, bool dispatch)
{
- string t = resultType(op, dispatch);
+ string t = resultType(op, scope, dispatch);
if(t.empty())
{
return "_System.Threading.Tasks.Task";
}
else
{
- return "_System.Threading.Tasks.Task<" + resultType(op, dispatch) + '>';
+ return "_System.Threading.Tasks.Task<" + t + '>';
}
}
@@ -525,6 +551,7 @@ Slice::CsGenerator::isValueType(const TypePtr& type)
void
Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
const TypePtr& type,
+ const string& scope,
const string& param,
bool marshal,
const string& customStream)
@@ -651,7 +678,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
case Builtin::KindObjectProxy:
{
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
if(marshal)
{
out << nl << stream << ".writeProxy(" << param << ");";
@@ -677,7 +704,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
ClassDefPtr def = prx->_class()->definition();
if(def->isInterface() || def->allOperations().size() > 0)
{
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
if (marshal)
{
out << nl << typeS << "Helper.write(" << stream << ", " << param << ");";
@@ -722,7 +749,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(!isValueType(st))
{
- out << nl << typeToString(st) << ".ice_write(" << stream << ", " << param << ");";
+ out << nl << typeToString(st, scope) << ".ice_write(" << stream << ", " << param << ");";
}
else
{
@@ -733,7 +760,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(!isValueType(st))
{
- out << nl << param << " = " << typeToString(type) << ".ice_read(" << stream << ");";
+ out << nl << param << " = " << typeToString(type, scope) << ".ice_read(" << stream << ");";
}
else
{
@@ -752,7 +779,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << param << " = (" << fixId(en->scoped()) << ')' << stream << ".readEnum(" << en->maxValue()
+ out << nl << param << " = (" << typeToString(type, scope) << ')' << stream << ".readEnum(" << en->maxValue()
<< ");";
}
return;
@@ -761,7 +788,7 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- writeSequenceMarshalUnmarshalCode(out, seq, param, marshal, true, stream);
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, param, marshal, true, stream);
return;
}
@@ -774,21 +801,23 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- typeS = typeToString(type);
+ typeS = typeToString(type, scope);
}
+ string helperName = getAbsolute(typeS + "Helper", scope);
if(marshal)
{
- out << nl << typeS << "Helper.write(" << stream << ", " << param << ");";
+ out << nl << helperName << ".write(" << stream << ", " << param << ");";
}
else
{
- out << nl << param << " = " << typeS << "Helper.read(" << stream << ')' << ';';
+ out << nl << param << " = " << helperName << ".read(" << stream << ')' << ';';
}
}
void
Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
const TypePtr& type,
+ const string& scope,
const string& param,
int tag,
bool marshal,
@@ -916,15 +945,15 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
case Builtin::KindObjectProxy:
{
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
if(marshal)
{
out << nl << stream << ".writeProxy(" << tag << ", " << param << ");";
}
else
{
- out << nl << param << " = new Ice.Optional<Ice.ObjectPrx>(" << stream << ".readProxy(" << tag
- << "));";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<"
+ << getAbsolute("Ice.ObjectPrx", scope) << ">(" << stream << ".readProxy(" << tag << "));";
}
break;
}
@@ -943,27 +972,28 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag
- << ", Ice.OptionalFormat.FSize))";
+ << ", " << getAbsolute("Ice.OptionalFormat", scope) << ".FSize))";
out << sb;
out << nl << "int pos = " << stream << ".startSize();";
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
+ writeMarshalUnmarshalCode(out, type, scope, param + ".Value", marshal, customStream);
out << nl << stream << ".endSize(pos);";
out << eb;
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", Ice.OptionalFormat.FSize))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getAbsolute("Ice.OptionalFormat", scope)
+ << ".FSize))";
out << sb;
out << nl << stream << ".skip(4);";
string tmp = "tmpVal";
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
out << nl << typeS << ' ' << tmp << ';';
- writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
+ writeMarshalUnmarshalCode(out, type, scope, tmp, marshal, customStream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">();";
out << eb;
}
return;
@@ -989,7 +1019,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
- << getOptionalFormat(st) << "))";
+ << getOptionalFormat(st, scope) << "))";
out << sb;
if(st->isVariableLength())
{
@@ -999,7 +1029,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
{
out << nl << stream << ".writeSize(" << st->minWireSize() << ");";
}
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
+ writeMarshalUnmarshalCode(out, type, scope, param + ".Value", marshal, customStream);
if(st->isVariableLength())
{
out << nl << stream << ".endSize(pos);";
@@ -1008,7 +1038,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(st) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(st, scope) << "))";
out << sb;
if(st->isVariableLength())
{
@@ -1018,7 +1048,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
{
out << nl << stream << ".skipSize();";
}
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
string tmp = "tmpVal";
if(isValueType(st))
{
@@ -1028,12 +1058,12 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
{
out << nl << typeS << ' ' << tmp << " = null;";
}
- writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
+ writeMarshalUnmarshalCode(out, type, scope, tmp, marshal, customStream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">();";
out << eb;
}
return;
@@ -1052,17 +1082,18 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", Ice.OptionalFormat.Size))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getAbsolute("Ice.OptionalFormat", scope)
+ << ".Size))";
out << sb;
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
string tmp = "tmpVal";
out << nl << typeS << ' ' << tmp << ';';
- writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
+ writeMarshalUnmarshalCode(out, type, scope, tmp, marshal, customStream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">();";
out << eb;
}
return;
@@ -1071,7 +1102,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- writeOptionalSequenceMarshalUnmarshalCode(out, seq, param, tag, marshal, stream);
+ writeOptionalSequenceMarshalUnmarshalCode(out, seq, scope, param, tag, marshal, stream);
return;
}
@@ -1082,7 +1113,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
- << getOptionalFormat(d) << "))";
+ << getOptionalFormat(d, scope) << "))";
out << sb;
if(keyType->isVariableLength() || valueType->isVariableLength())
{
@@ -1094,7 +1125,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
<< (keyType->minWireSize() + valueType->minWireSize()) << " + (" << param
<< ".Value.Count > 254 ? 5 : 1));";
}
- writeMarshalUnmarshalCode(out, type, param + ".Value", marshal, customStream);
+ writeMarshalUnmarshalCode(out, type, scope, param + ".Value", marshal, customStream);
if(keyType->isVariableLength() || valueType->isVariableLength())
{
out << nl << stream << ".endSize(pos);";
@@ -1103,7 +1134,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(d) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(d, scope) << "))";
out << sb;
if(keyType->isVariableLength() || valueType->isVariableLength())
{
@@ -1113,15 +1144,15 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
{
out << nl << stream << ".skipSize();";
}
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
string tmp = "tmpVal";
out << nl << typeS << ' ' << tmp << " = new " << typeS << "();";
- writeMarshalUnmarshalCode(out, type, tmp, marshal, customStream);
- out << nl << param << " = new Ice.Optional<" << typeS << ">(" << tmp << ");";
+ writeMarshalUnmarshalCode(out, type, scope, tmp, marshal, customStream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << typeS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << typeS << ">();";
out << eb;
}
}
@@ -1129,6 +1160,7 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
void
Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
+ const string& scope,
const string& param,
bool marshal,
bool useHelper,
@@ -1140,11 +1172,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
stream = marshal ? "ostr" : "istr";
}
+ ContainedPtr cont = ContainedPtr::dynamicCast(seq->container());
+ assert(cont);
if(useHelper)
{
- ContainedPtr cont = ContainedPtr::dynamicCast(seq->container());
- assert(cont);
- string helperName = fixId(cont->scoped(), DotNet::ICloneable) + "." + seq->name() + "Helper";
+ string helperName = getAbsolute(fixId(cont->scoped(), DotNet::ICloneable) + "." + seq->name() + "Helper", scope);
if(marshal)
{
out << nl << helperName << ".write(" << stream << ", " << param << ");";
@@ -1157,7 +1189,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
TypePtr type = seq->type();
- string typeS = typeToString(type);
+ string typeS = typeToString(type, scope);
const string genericPrefix = "cs:generic:";
string genericType;
@@ -1232,7 +1264,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
// If the collection is a stack, write in top-to-bottom order. Stacks
// cannot contain Ice.Object.
//
- out << nl << "Ice.ObjectPrx[] " << param << "_tmp = " << param << ".ToArray();";
+ out << nl << getAbsolute("Ice.ObjectPrx", scope) << "[] " << param << "_tmp = " << param
+ << ".ToArray();";
out << nl << "for(int ix = 0; ix < " << param << "_tmp.Length; ++ix)";
out << sb;
out << nl << stream << ".writeProxy(" << param << "_tmp[ix]);";
@@ -1352,7 +1385,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << param << " = (" << typeToString(seq) << ")" << stream << ".readSerializable();";
+ out << nl << param << " = (" << typeToString(seq, scope) << ")" << stream << ".readSerializable();";
}
break;
}
@@ -1387,7 +1420,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << sb;
out << nl << param << " = new " << "global::" << genericType << "<"
- << typeToString(type) << ">();";
+ << typeToString(type, scope) << ">();";
out << nl << "int szx = " << stream << ".readSize();";
out << nl << "for(int ix = 0; ix < szx; ++ix)";
out << sb;
@@ -1709,11 +1742,11 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
string helperName;
if(ProxyPtr::dynamicCast(type))
{
- helperName = fixId(ProxyPtr::dynamicCast(type)->_class()->scoped() + "PrxHelper");
+ helperName = getAbsolute(fixId(ProxyPtr::dynamicCast(type)->_class()->scoped() + "PrxHelper"), scope);
}
else
{
- helperName = fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper");
+ helperName = getAbsolute(fixId(ContainedPtr::dynamicCast(type)->scoped() + "Helper"), scope);
}
string func;
@@ -1808,6 +1841,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
void
Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
const SequencePtr& seq,
+ const string& scope,
const string& param,
int tag,
bool marshal,
@@ -1820,8 +1854,8 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
}
const TypePtr type = seq->type();
- const string typeS = typeToString(type);
- const string seqS = typeToString(seq);
+ const string typeS = typeToString(type, scope);
+ const string seqS = typeToString(seq, scope);
string meta;
const bool isArray = !seq->findMetaData("cs:generic:", meta);
@@ -1850,7 +1884,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
if(isSerializable)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag
- << ", Ice.OptionalFormat.VSize))";
+ << ", " << getAbsolute("Ice.OptionalFormat", scope) << ".VSize))";
out << sb;
out << nl << stream << ".writeSerializable(" << param << ".Value);";
out << eb;
@@ -1870,7 +1904,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq, scope) << "))";
out << sb;
if(builtin->isVariableLength())
{
@@ -1882,12 +1916,13 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
}
string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, tmp, marshal, true, stream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">(" << tmp
+ << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">();";
out << eb;
}
break;
@@ -1900,26 +1935,27 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
- << getOptionalFormat(seq) << "))";
+ << getOptionalFormat(seq, scope) << "))";
out << sb;
out << nl << "int pos = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, param + ".Value", marshal, true, stream);
out << nl << stream << ".endSize(pos);";
out << eb;
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq, scope) << "))";
out << sb;
out << nl << stream << ".skip(4);";
string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, tmp, marshal, true, stream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">(" << tmp
+ << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">();";
out << eb;
}
break;
@@ -1938,7 +1974,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
- << getOptionalFormat(seq) << "))";
+ << getOptionalFormat(seq, scope) << "))";
out << sb;
if(st->isVariableLength())
{
@@ -1949,7 +1985,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
out << nl << stream << ".writeSize(" << param << ".Value == null ? 1 : " << length << " * "
<< st->minWireSize() << " + (" << length << " > 254 ? 5 : 1));";
}
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, param + ".Value", marshal, true, stream);
if(st->isVariableLength())
{
out << nl << stream << ".endSize(pos);";
@@ -1958,7 +1994,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq, scope) << "))";
out << sb;
if(st->isVariableLength())
{
@@ -1970,12 +2006,12 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
}
string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, tmp, marshal, true, stream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">();";
out << eb;
}
return;
@@ -1987,26 +2023,26 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
if(marshal)
{
out << nl << "if(" << param << ".HasValue && " << stream << ".writeOptional(" << tag << ", "
- << getOptionalFormat(seq) << "))";
+ << getOptionalFormat(seq, scope) << "))";
out << sb;
out << nl << "int pos = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, seq, param + ".Value", marshal, true, stream);
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, param + ".Value", marshal, true, stream);
out << nl << stream << ".endSize(pos);";
out << eb;
}
else
{
- out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq) << "))";
+ out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(seq, scope) << "))";
out << sb;
out << nl << stream << ".skip(4);";
string tmp = "tmpVal";
out << nl << seqS << ' ' << tmp << ';';
- writeSequenceMarshalUnmarshalCode(out, seq, tmp, marshal, true, stream);
- out << nl << param << " = new Ice.Optional<" << seqS << ">(" << tmp << ");";
+ writeSequenceMarshalUnmarshalCode(out, seq, scope, tmp, marshal, true, stream);
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">(" << tmp << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << param << " = new Ice.Optional<" << seqS << ">();";
+ out << nl << param << " = new " << getAbsolute("Ice.Optional", scope) << "<" << seqS << ">();";
out << eb;
}
}
@@ -2014,6 +2050,7 @@ Slice::CsGenerator::writeOptionalSequenceMarshalUnmarshalCode(Output& out,
void
Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
const TypePtr& type,
+ const string& scope,
const string& param,
bool optional,
int tag,
@@ -2025,7 +2062,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
string dataMember = "this." + param;
if(optional)
{
- const string typeName = typeToString(type, true);
+ const string typeName = typeToString(type, scope, true);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2131,8 +2168,8 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
{
if(serialize)
{
- out << nl << "info.AddValue(\"" << param << "\", " << dataMember << " == null ? \"\" : " << dataMember
- << ");";
+ out << nl << "info.AddValue(\"" << param << "\", " << dataMember << " == null ? \"\" : "
+ << dataMember << ");";
}
else
{
@@ -2144,7 +2181,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
case Builtin::KindObject:
case Builtin::KindLocalObject:
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2177,7 +2214,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
ProxyPtr prx = ProxyPtr::dynamicCast(type);
if(prx)
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "Helper));";
@@ -2193,7 +2230,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type);
if(cl)
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2209,7 +2246,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2225,7 +2262,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2241,7 +2278,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
SequencePtr seq = SequencePtr::dynamicCast(type);
if(seq)
{
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
@@ -2256,7 +2293,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out,
DictionaryPtr d = DictionaryPtr::dynamicCast(type);
assert(d);
- const string typeName = typeToString(type, false);
+ const string typeName = typeToString(type, scope, false);
if(serialize)
{
out << nl << "info.AddValue(\"" << param << "\", " << dataMember << ", typeof(" << typeName << "));";
diff --git a/cpp/src/slice2cs/CsUtil.h b/cpp/src/slice2cs/CsUtil.h
index d5ad2bea645..fe7eecf299f 100644
--- a/cpp/src/slice2cs/CsUtil.h
+++ b/cpp/src/slice2cs/CsUtil.h
@@ -34,30 +34,33 @@ public:
protected:
+ static std::string getAbsolute(const std::string&, const std::string&);
static std::string resultStructName(const std::string&, const std::string&, bool = false);
- static std::string resultType(const OperationPtr&, bool = false);
- static std::string taskResultType(const OperationPtr&, bool = false);
+ static std::string resultType(const OperationPtr&, const std::string&, bool = false);
+ static std::string taskResultType(const OperationPtr&, const std::string&, bool = false);
static std::string fixId(const std::string&, int = 0, bool = false);
static std::string fixId(const ContainedPtr&, int = 0, bool = false);
- static std::string getOptionalFormat(const TypePtr&);
+ static std::string getOptionalFormat(const TypePtr&, const std::string&);
static std::string getStaticId(const TypePtr&);
- static std::string typeToString(const TypePtr&, bool = false, bool = false, const StringList& = StringList());
+ static std::string typeToString(const TypePtr&, const std::string&, bool = false, bool = false,
+ const StringList& = StringList());
static bool isClassType(const TypePtr&);
static bool isValueType(const TypePtr&);
//
// Generate code to marshal or unmarshal a type
//
- void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool,
- const std::string& = "");
- void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, bool,
- const std::string& = "");
+ void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, const std::string&,
+ bool, const std::string& = "");
+ void writeOptionalMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&,
+ const std::string&, int, bool, const std::string& = "");
void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- bool, bool, const std::string& = "");
+ const std::string&, bool, bool, const std::string& = "");
void writeOptionalSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const SequencePtr&, const std::string&,
- int, bool, const std::string& = "");
+ const std::string&, int, bool, const std::string& = "");
- void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, int, bool);
+ void writeSerializeDeserializeCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&,
+ const std::string&, bool, int, bool);
private:
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index b70aae7be01..a5356187564 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -165,7 +165,8 @@ Slice::CsVisitor::~CsVisitor()
void
Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const OperationPtr& op, bool marshal,
- bool resultStruct, bool publicNames, const string& customStream)
+ const string& scope, bool resultStruct, bool publicNames,
+ const string& customStream)
{
ParamDeclList optionals;
@@ -188,7 +189,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(type))
{
ostringstream os;
- os << '(' << typeToString(type) << " v) => {" << paramPrefix << param << " = v; }";
+ os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }";
param = os.str();
}
else
@@ -202,7 +203,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
}
else
{
- writeMarshalUnmarshalCode(_out, type, param, marshal, customStream);
+ writeMarshalUnmarshalCode(_out, type, scope, param, marshal, customStream);
}
}
@@ -215,7 +216,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
@@ -225,7 +226,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!op->returnIsOptional())
{
- writeMarshalUnmarshalCode(_out, ret, param, marshal, customStream);
+ writeMarshalUnmarshalCode(_out, ret, scope, param, marshal, customStream);
}
}
@@ -254,14 +255,14 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
{
param = paramPrefix + returnValueS;
}
- writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream);
checkReturnType = false;
}
@@ -270,7 +271,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(type))
{
ostringstream os;
- os << '(' << typeToString(type) << " v) => {" << paramPrefix << param << " = v; }";
+ os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }";
param = os.str();
}
else
@@ -278,7 +279,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
param = paramPrefix + param;
}
- writeOptionalMarshalUnmarshalCode(_out, type, param, (*pli)->tag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, type, scope, param, (*pli)->tag(), marshal, customStream);
}
if(checkReturnType)
@@ -287,24 +288,24 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const
if(!marshal && isClassType(ret))
{
ostringstream os;
- os << '(' << typeToString(ret) << " v) => {" << paramPrefix << returnValueS << " = v; }";
+ os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }";
param = os.str();
}
else
{
param = paramPrefix + returnValueS;
}
- writeOptionalMarshalUnmarshalCode(_out, ret, param, op->returnTag(), marshal, customStream);
+ writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream);
}
}
void
-Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, bool forStruct)
+Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct)
{
if(member->optional())
{
assert(!forStruct);
- writeOptionalMarshalUnmarshalCode(_out, member->type(), name, member->tag(), true, "ostr_");
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, name, member->tag(), true, "ostr_");
}
else
{
@@ -315,18 +316,18 @@ Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const stri
memberName = "this." + memberName;
}
- writeMarshalUnmarshalCode(_out, member->type(), memberName, true, stream);
+ writeMarshalUnmarshalCode(_out, member->type(), scope, memberName, true, stream);
}
}
void
-Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, bool forStruct)
+Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct)
{
string param = name;
if(isClassType(member->type()))
{
ostringstream os;
- os << '(' << typeToString(member->type()) << " v) => { this." << name << " = v; }";
+ os << '(' << typeToString(member->type(), scope) << " v) => { this." << name << " = v; }";
param = os.str();
}
else if(forStruct)
@@ -337,17 +338,18 @@ Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const st
if(member->optional())
{
assert(!forStruct);
- writeOptionalMarshalUnmarshalCode(_out, member->type(), param, member->tag(), false, "istr_");
+ writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, param, member->tag(), false, "istr_");
}
else
{
- writeMarshalUnmarshalCode(_out, member->type(), param, false, forStruct ? "" : "istr_");
+ writeMarshalUnmarshalCode(_out, member->type(), scope, 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())
{
@@ -369,7 +371,7 @@ Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p)
{
string retS;
vector<string> params, args;
- string name = getDispatchParams(*i, retS, params, args);
+ string name = getDispatchParams(*i, retS, params, args, scope);
_out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';';
}
@@ -382,6 +384,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
string name = fixId(p->name());
string scoped = p->scoped();
+ string scope = fixId(p->scope());
ClassList allBases = p->allBases();
StringList ids;
ClassList bases = p->bases();
@@ -427,7 +430,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override bool ice_isA(string s, Ice.Current current = null)";
+ _out << nl << "public override bool ice_isA(string s, " << getAbsolute("Ice.Current", scope) << " current = null)";
_out << sb;
_out << nl << "return _System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;";
_out << eb;
@@ -437,7 +440,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string[] ice_ids(Ice.Current current = null)";
+ _out << nl << "public override string[] ice_ids(" << getAbsolute("Ice.Current", scope) << " current = null)";
_out << sb;
_out << nl << "return _ids;";
_out << eb;
@@ -447,7 +450,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override string ice_id(Ice.Current current = null)";
+ _out << nl << "public override string ice_id(" << getAbsolute("Ice.Current", scope) << " current = null)";
_out << sb;
_out << nl << "return _ids[" << scopedPos << "];";
_out << eb;
@@ -485,16 +488,17 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public static _System.Threading.Tasks.Task<Ice.OutputStream>";
+ _out << nl << "public static _System.Threading.Tasks.Task<" << getAbsolute("Ice.OutputStream", scope) << ">";
_out << nl << "iceD_" << opName << "(" << name << (p->isInterface() ? "" : "Disp_") << " obj, "
- << "IceInternal.Incoming inS, Ice.Current current)";
+ << "IceInternal.Incoming inS, " << getAbsolute("Ice.Current", scope) << " current)";
_out << sb;
TypePtr ret = op->returnType();
ParamDeclList inParams = op->inParameters();
ParamDeclList outParams = op->outParameters();
- _out << nl << "Ice.ObjectImpl.iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
+ _out << nl << getAbsolute("Ice.ObjectImpl", scope) << ".iceCheckMode(" << sliceModeToIceMode(op->mode())
+ << ", current.mode);";
if(!inParams.empty())
{
//
@@ -504,12 +508,17 @@ 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(), (*pli)->optional());
+ string typeS = typeToString((*pli)->type(), scope, (*pli)->optional());
const bool isClass = isClassType((*pli)->type());
if((*pli)->optional())
{
- _out << nl << typeS << ' ' << param << (isClass ? " = Ice.Util.None" : "") << ';';
+ _out << nl << typeS << ' ' << param;
+ if(isClass)
+ {
+ _out << " = " << getAbsolute("Ice.Util", scope) << ".None";
+ }
+ _out << ';';
}
else
{
@@ -525,7 +534,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
}
}
- writeMarshalUnmarshalParams(inParams, 0, false);
+ writeMarshalUnmarshalParams(inParams, 0, false, scope);
if(op->sendsClasses(false))
{
_out << nl << "istr.readPendingValues();";
@@ -557,7 +566,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
else if(amd)
{
- string retS = resultType(op);
+ string retS = resultType(op, scope);
_out << nl << "return inS.setResultTask" << (retS.empty() ? "" : ('<' + retS + '>'));
_out << "(obj." << opName << "Async" << spar << inArgs << "current" << epar;
if(!retS.empty())
@@ -573,7 +582,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << nl << "(ostr, ret) =>";
}
_out << sb;
- writeMarshalUnmarshalParams(outParams, op, true, true);
+ writeMarshalUnmarshalParams(outParams, op, true, scope, true);
if(op->returnsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -588,7 +597,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
{
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- string typeS = typeToString((*pli)->type(), (*pli)->optional());
+ string typeS = typeToString((*pli)->type(), scope, (*pli)->optional());
_out << nl << typeS << ' ' << "iceP_" + (*pli)->name() << ";";
}
@@ -613,7 +622,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
if(!outParams.empty() || ret)
{
_out << nl << "var ostr = inS.startWriteParams();";
- writeMarshalUnmarshalParams(outParams, op, true);
+ writeMarshalUnmarshalParams(outParams, op, true, scope);
if(op->returnsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -659,13 +668,14 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
emitGeneratedCodeAttribute();
}
_out << nl << "public override _System.Threading.Tasks.Task<Ice.OutputStream>";
- _out << nl << "iceDispatch(IceInternal.Incoming inS, Ice.Current current)";
+ _out << nl << "iceDispatch(IceInternal.Incoming inS, " << getAbsolute("Ice.Current", scope) << " current)";
_out << sb;
_out << nl << "int pos = _System.Array.BinarySearch(_all, current.operation, "
<< "IceUtilInternal.StringUtil.OrdinalStringComparer);";
_out << nl << "if(pos < 0)";
_out << sb;
- _out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ _out << nl << "throw new " << getAbsolute("Ice.OperationNotExistException", scope)
+ << "(current.id, current.facet, current.operation);";
_out << eb;
_out << sp << nl << "switch(pos)";
_out << sb;
@@ -678,19 +688,19 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
_out << sb;
if(opName == "ice_id")
{
- _out << nl << "return Ice.ObjectImpl.iceD_ice_id(this, inS, current);";
+ _out << nl << "return " << getAbsolute("Ice.ObjectImpl", scope) << ".iceD_ice_id(this, inS, current);";
}
else if(opName == "ice_ids")
{
- _out << nl << "return Ice.ObjectImpl.iceD_ice_ids(this, inS, current);";
+ _out << nl << "return " << getAbsolute("Ice.ObjectImpl", scope) << ".iceD_ice_ids(this, inS, current);";
}
else if(opName == "ice_isA")
{
- _out << nl << "return Ice.ObjectImpl.iceD_ice_isA(this, inS, current);";
+ _out << nl << "return " << getAbsolute("Ice.ObjectImpl", scope) << ".iceD_ice_isA(this, inS, current);";
}
else if(opName == "ice_ping")
{
- _out << nl << "return Ice.ObjectImpl.iceD_ice_ping(this, inS, current);";
+ _out << nl << "return " << getAbsolute("Ice.ObjectImpl", scope) << ".iceD_ice_ping(this, inS, current);";
}
else
{
@@ -710,7 +720,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
else
{
- _out << nl << "return " << fixId(cl->scoped() + "Disp_") << ".iceD_" << opName << "(this, inS, current);";
+ _out << nl << "return " << getAbsolute(fixId(cl->scoped() + "Disp_"), scope) << ".iceD_"
+ << opName << "(this, inS, current);";
}
break;
}
@@ -720,7 +731,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p)
}
_out << eb;
_out << sp << nl << "_System.Diagnostics.Debug.Assert(false);";
- _out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ _out << nl << "throw new " << getAbsolute("Ice.OperationNotExistException", scope)
+ << "(current.id, current.facet, current.operation);";
_out << eb;
}
@@ -735,6 +747,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
string name = fixId(p->name());
string scoped = p->scoped();
+ string scope = fixId(p->scope());
ClassList allBases = p->allBases();
StringList ids;
ClassList bases = p->bases();
@@ -774,7 +787,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override Ice.SlicedData ice_getSlicedData()";
+ _out << nl << "public override " << getAbsolute("Ice.SlicedData", scope) << " ice_getSlicedData()";
_out << sb;
_out << nl << "return iceSlicedData_;";
_out << eb;
@@ -784,7 +797,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void iceWrite(Ice.OutputStream ostr_)";
+ _out << nl << "public override void iceWrite(" << getAbsolute("Ice.OutputStream", scope) << " ostr_)";
_out << sb;
_out << nl << "ostr_.startValue(iceSlicedData_);";
_out << nl << "iceWriteImpl(ostr_);";
@@ -796,7 +809,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void iceRead(Ice.InputStream istr_)";
+ _out << nl << "public override void iceRead(" << getAbsolute("Ice.InputStream", scope) << " istr_)";
_out << sb;
_out << nl << "istr_.startValue();";
_out << nl << "iceReadImpl(istr_);";
@@ -809,19 +822,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void iceWriteImpl(Ice.OutputStream ostr_)";
+ _out << nl << "protected override void iceWriteImpl(" << getAbsolute("Ice.OutputStream", scope) << " 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));
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true));
+ writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
}
_out << nl << "ostr_.endSlice();";
if(base)
@@ -835,19 +848,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "protected override void iceReadImpl(Ice.InputStream istr_)";
+ _out << nl << "protected override void iceReadImpl(" << getAbsolute("Ice.InputStream", scope) << " 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));
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
}
}
for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d)
{
- writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true));
+ writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope);
}
_out << nl << "istr_.endSlice();";
if(base)
@@ -858,7 +871,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p)
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected Ice.SlicedData iceSlicedData_;";
+ _out << sp << nl << "protected " << getAbsolute("Ice.SlicedData", scope) << " iceSlicedData_;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -881,7 +894,7 @@ Slice::CsVisitor::getParamAttributes(const ParamDeclPtr& p)
}
vector<string>
-Slice::CsVisitor::getParams(const OperationPtr& op)
+Slice::CsVisitor::getParams(const OperationPtr& op, const string& scope)
{
vector<string> params;
ParamDeclList paramList = op->parameters();
@@ -893,40 +906,38 @@ Slice::CsVisitor::getParams(const OperationPtr& op)
{
param += "out ";
}
- param += typeToString((*q)->type(), (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name());
+ param += typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name());
params.push_back(param);
}
return params;
}
vector<string>
-Slice::CsVisitor::getInParams(const OperationPtr& op, bool internal)
+Slice::CsVisitor::getInParams(const OperationPtr& op, const string& scope, bool internal)
{
vector<string> params;
string name = fixId(op->name());
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); // Get the class containing the op.
-
ParamDeclList paramList = op->inParameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), (*q)->optional(), cl->isLocal())
+ params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal())
+ " " + (internal ? "iceP_" + (*q)->name() : fixId((*q)->name())));
}
return params;
}
vector<string>
-Slice::CsVisitor::getOutParams(const OperationPtr& op, bool returnParam, bool outKeyword)
+Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool returnParam, bool outKeyword)
{
vector<string> params;
-
if(returnParam)
{
TypePtr ret = op->returnType();
if(ret)
{
- params.push_back(typeToString(ret, op->returnIsOptional()) + " ret");
+ params.push_back(typeToString(ret, scope, op->returnIsOptional()) + " ret");
}
}
@@ -938,7 +949,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, bool returnParam, bool ou
{
s += "out ";
}
- s += typeToString((*q)->type(), (*q)->optional()) + ' ' + fixId((*q)->name());
+ s += typeToString((*q)->type(), scope, (*q)->optional()) + ' ' + fixId((*q)->name());
params.push_back(s);
}
@@ -978,40 +989,40 @@ Slice::CsVisitor::getInArgs(const OperationPtr& op, bool internal)
}
string
-Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector<string>& params, vector<string>& args)
+Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector<string>& params, vector<string>& args,
+ const string& scope)
{
string name;
-
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); // Get the class containing the op.
ParamDeclList paramDecls;
- ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
if(cl->hasMetaData("amd") || op->hasMetaData("amd"))
{
name = op->name() + "Async";
- params = getInParams(op);
+ params = getInParams(op, scope);
args = getInArgs(op);
paramDecls = op->inParameters();
- retS = taskResultType(op, true);
+ retS = taskResultType(op, scope, true);
}
else if(op->hasMarshaledResult())
{
name = fixId(op->name(), DotNet::ICloneable, true);
- params = getInParams(op);
+ params = getInParams(op, scope);
args = getInArgs(op);
paramDecls = op->inParameters();
- retS = resultType(op, true);
+ retS = resultType(op, scope, true);
}
else
{
name = fixId(op->name(), DotNet::ICloneable, true);
- params = getParams(op);
+ params = getParams(op, scope);
args = getArgs(op);
paramDecls = op->parameters();
- retS = typeToString(op->returnType(), op->returnIsOptional());
+ retS = typeToString(op->returnType(), scope, op->returnIsOptional());
}
string currentParamName = getEscapedParamName(op, "current");
- params.push_back("Ice.Current " + currentParamName + " = null");
+ params.push_back(getAbsolute("Ice.Current", scope) + " " + currentParamName + " = null");
args.push_back(currentParamName);
return name;
}
@@ -1063,7 +1074,7 @@ Slice::CsVisitor::emitPartialTypeAttributes()
}
string
-Slice::CsVisitor::writeValue(const TypePtr& type)
+Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope)
{
assert(type);
@@ -1106,13 +1117,20 @@ Slice::CsVisitor::writeValue(const TypePtr& type)
EnumPtr en = EnumPtr::dynamicCast(type);
if(en)
{
- return fixId(en->scoped()) + "." + fixId((*en->enumerators().begin())->name());
+ return typeToString(type, scope) + "." + fixId((*en->enumerators().begin())->name());
}
StructPtr st = StructPtr::dynamicCast(type);
if(st)
{
- return st->hasMetaData("cs:class") ? string("null") : "new " + fixId(st->scoped()) + "()";
+ if(st->hasMetaData("cs:class"))
+ {
+ return "null";
+ }
+ else
+ {
+ return "new " + typeToString(type, scope) + "()";
+ }
}
return "null";
@@ -1176,7 +1194,8 @@ Slice::CsVisitor::requiresDataMemberInitializers(const DataMemberList& members)
}
void
-Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, int baseTypes, bool propertyMapping)
+Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, const string& scope, int baseTypes,
+ bool propertyMapping)
{
for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p)
{
@@ -1197,8 +1216,8 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, int
}
else if((*p)->optional())
{
- _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString((*p)->type(), true)
- << "();";
+ _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new "
+ << typeToString((*p)->type(), scope, true) << "();";
}
else
{
@@ -1211,7 +1230,8 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, int
StructPtr st = StructPtr::dynamicCast((*p)->type());
if(st)
{
- _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, false) << "();";
+ _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, scope, false)
+ << "();";
}
}
}
@@ -2174,6 +2194,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
string name = p->name();
string scoped = fixId(p->scoped());
+ string scope = fixId(p->scope());
ClassList bases = p->bases();
bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
@@ -2186,8 +2207,8 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
emitComVisibleAttribute();
OperationPtr o = p->allOperations().front();
- _out << nl << "public delegate " << typeToString(o->returnType(), o->returnIsOptional()) << " ";
- _out << fixId(name) << spar << getParams(o) << epar << ";";
+ _out << nl << "public delegate " << typeToString(o->returnType(), scope, o->returnIsOptional()) << " ";
+ _out << fixId(name) << spar << getParams(o, scope) << epar << ";";
return false;
}
@@ -2198,12 +2219,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "public partial interface " << fixId(name);
if(!p->isLocal())
{
- baseNames.push_back("Ice.Object");
+ baseNames.push_back(getAbsolute("Ice.Object", scope));
baseNames.push_back(name + "Operations_");
}
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
- baseNames.push_back(fixId((*q)->scoped()));
+ baseNames.push_back(getAbsolute(fixId((*q)->scoped()), scope));
}
}
else
@@ -2269,7 +2290,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << ", ";
}
- _out << *q;
+ _out << getAbsolute(*q, scope);
}
}
@@ -2305,6 +2326,7 @@ void
Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
string name = fixId(p->name());
+ string scope = fixId(p->scope());
DataMemberList classMembers = p->classDataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
DataMemberList dataMembers = p->dataMembers();
@@ -2334,7 +2356,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
_out << " : base()";
}
_out << sb;
- writeDataMemberInitializers(dataMembers, DotNet::ICloneable, propertyMapping);
+ writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping);
_out << eb;
_out << sp;
@@ -2344,7 +2366,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(), (*d)->optional(), p->isLocal(), (*d)->getMetaData());
+ string memberType = typeToString((*d)->type(), scope, (*d)->optional(), p->isLocal(), (*d)->getMetaData());
paramDecl.push_back(memberType + " " + memberName);
}
_out << paramDecl << epar;
@@ -2421,12 +2443,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());
if(isLocal)
{
string name = fixId(p->name(), DotNet::ICloneable, true);
TypePtr ret = p->returnType();
- string retS = typeToString(ret, p->returnIsOptional(), true);
+ string retS = typeToString(ret, scope, p->returnIsOptional(), true);
_out << sp;
if(isInterface)
@@ -2444,11 +2467,11 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << retS << " " << name << spar << getParams(p) << epar << ";";
+ _out << retS << " " << name << spar << getParams(p, scope) << epar << ";";
if(cl->hasMetaData("async-oneway") || p->hasMetaData("async-oneway"))
{
- vector<string> inParams = getInParams(p);
+ vector<string> inParams = getInParams(p, scope);
ParamDeclList inParamDecls = p->inParameters();
//
@@ -2462,7 +2485,7 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << taskResultType(p);
+ _out << taskResultType(p, scope);
string progress = getEscapedParamName(p, "progress");
string cancel = getEscapedParamName(p, "cancel");
@@ -2483,8 +2506,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << "Ice.AsyncResult begin_" << name << spar << inParams
- << "Ice.AsyncCallback " + getEscapedParamName(p, "callback") + " = null"
+ _out << getAbsolute("Ice.AsyncResult", scope) << " begin_" << name << spar << inParams
+ << getAbsolute("Ice.AsyncCallback", scope) + " " + getEscapedParamName(p, "callback") + " = null"
<< "object " + getEscapedParamName(p, "cookie") + " = null" << epar << ';';
_out << sp;
@@ -2495,8 +2518,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p)
{
_out << "public abstract ";
}
- _out << retS << " end_" << name << spar << getOutParams(p, false, true)
- << "Ice.AsyncResult " + getEscapedParamName(p, "asyncResult") << epar << ';';
+ _out << retS << " end_" << name << spar << getOutParams(p, scope, false, true)
+ << (getAbsolute("Ice.AsyncResult", scope) + " " + getEscapedParamName(p, "asyncResult")) << epar << ';';
}
}
}
@@ -2513,6 +2536,7 @@ bool
Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
string name = fixId(p->name());
+ string scope = fixId(p->scope());
ExceptionPtr base = p->base();
_out << sp;
@@ -2530,11 +2554,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
_out << nl << "public partial class " << name << " : ";
if(base)
{
- _out << fixId(base->scoped());
+ _out << getAbsolute(fixId(base->scoped()), scope);
}
else
{
- _out << (p->isLocal() ? "Ice.LocalException" : "Ice.UserException");
+ _out << getAbsolute(p->isLocal() ? "Ice.LocalException" : "Ice.UserException", scope);
}
_out << sb;
@@ -2550,7 +2574,7 @@ void
Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
string name = fixId(p->name());
-
+ string scope = fixId(p->scope());
DataMemberList allDataMembers = p->allDataMembers();
DataMemberList dataMembers = p->dataMembers();
DataMemberList allClassMembers = p->allClassDataMembers();
@@ -2561,7 +2585,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(), (*q)->optional());
+ string memberType = typeToString((*q)->type(), scope, (*q)->optional());
allParamDecl.push_back(memberType + " " + memberName);
}
@@ -2575,7 +2599,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(), (*q)->optional());
+ string memberType = typeToString((*q)->type(), scope, (*q)->optional());
paramDecl.push_back(memberType + " " + memberName);
}
@@ -2605,7 +2629,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "private void _initDM()";
_out << sb;
- writeDataMemberInitializers(dataMembers, DotNet::Exception);
+ writeDataMemberInitializers(dataMembers, scope, DotNet::Exception);
_out << eb;
}
@@ -2636,7 +2660,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string name = fixId((*q)->name(), DotNet::Exception, false);
- writeSerializeDeserializeCode(_out, (*q)->type(), name, (*q)->optional(), (*q)->tag(), false);
+ writeSerializeDeserializeCode(_out, (*q)->type(), scope, name, (*q)->optional(), (*q)->tag(), false);
}
_out << eb;
@@ -2757,7 +2781,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string name = fixId((*q)->name(), DotNet::Exception, false);
- writeSerializeDeserializeCode(_out, (*q)->type(), name, (*q)->optional(), (*q)->tag(), true);
+ writeSerializeDeserializeCode(_out, (*q)->type(), scope, name, (*q)->optional(), (*q)->tag(), true);
}
_out << sp << nl << "base.GetObjectData(info, context);";
_out << eb;
@@ -2797,14 +2821,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override Ice.SlicedData ice_getSlicedData()";
+ _out << nl << "public override " << getAbsolute("Ice.SlicedData", scope) << " ice_getSlicedData()";
_out << sb;
_out << nl << "return slicedData_;";
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void iceWrite(Ice.OutputStream ostr_)";
+ _out << nl << "public override void iceWrite(" << getAbsolute("Ice.OutputStream", scope) << " ostr_)";
_out << sb;
_out << nl << "ostr_.startException(slicedData_);";
_out << nl << "iceWriteImpl(ostr_);";
@@ -2813,7 +2837,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void iceRead(Ice.InputStream istr_)";
+ _out << nl << "public override void iceRead(" << getAbsolute("Ice.InputStream", scope) << " istr_)";
_out << sb;
_out << nl << "istr_.startException();";
_out << nl << "iceReadImpl(istr_);";
@@ -2823,12 +2847,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void iceWriteImpl(Ice.OutputStream ostr_)";
+ _out << nl << "protected override void iceWriteImpl(" << getAbsolute("Ice.OutputStream", scope) << " 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));
+ writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), scope);
}
_out << nl << "ostr_.endSlice();";
if(base)
@@ -2839,13 +2863,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "protected override void iceReadImpl(Ice.InputStream istr_)";
+ _out << nl << "protected override void iceReadImpl(" << getAbsolute("Ice.InputStream", scope) << " 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));
+ writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), scope);
}
_out << nl << "istr_.endSlice();";
if(base)
@@ -2866,7 +2890,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- _out << sp << nl << "protected Ice.SlicedData slicedData_;";
+ _out << sp << nl << "protected " << getAbsolute("Ice.SlicedData", scope) << " slicedData_;";
}
_out << sp << nl << "#endregion"; // Marshalling support
@@ -2879,7 +2903,7 @@ bool
Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
string name = fixId(p->name());
-
+ string scope = fixId(p->scope());
_out << sp;
emitDeprecate(p, 0, _out, "type");
@@ -2917,7 +2941,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
{
_out << ", ";
}
- _out << *q;
+ _out << getAbsolute(*q, scope);
}
}
@@ -2932,7 +2956,7 @@ void
Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
{
string name = fixId(p->name());
-
+ string scope = fixId(p->scope());
DataMemberList classMembers = p->classDataMembers();
DataMemberList dataMembers = p->dataMembers();
@@ -2956,7 +2980,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "public " << name << "()";
_out << sb;
- writeDataMemberInitializers(dataMembers, DotNet::ICloneable, propertyMapping);
+ writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping);
_out << eb;
}
@@ -2967,7 +2991,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(), false, p->isLocal());
+ string memberType = typeToString((*q)->type(), scope, false, p->isLocal());
paramDecl.push_back(memberType + " " + memberName);
}
_out << paramDecl << epar;
@@ -3076,27 +3100,28 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void ice_writeMembers(Ice.OutputStream ostr)";
+ _out << nl << "public void ice_writeMembers(" << getAbsolute("Ice.OutputStream", scope) << " ostr)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), true);
+ writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true);
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public void ice_readMembers(Ice.InputStream istr)";
+ _out << nl << "public void ice_readMembers(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
- writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), true);
+ writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true);
}
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static void ice_write(Ice.OutputStream ostr, " << name << " v)";
+ _out << nl << "public static void ice_write(" << getAbsolute("Ice.OutputStream", scope) << " ostr, " << name
+ << " v)";
_out << sb;
if(isClass)
{
@@ -3117,7 +3142,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " ice_read(Ice.InputStream istr)";
+ _out << nl << "public static " << name << " ice_read(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
_out << nl << "var v = new " << name << "();";
_out << nl << "v.ice_readMembers(istr);";
@@ -3143,6 +3168,7 @@ void
Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
{
string name = fixId(p->name());
+ string scope = fixId(p->scope());
string scoped = fixId(p->scoped());
EnumeratorList enumerators = p->enumerators();
const bool explicitValue = p->explicitValue();
@@ -3174,17 +3200,17 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
_out << nl << "public sealed class " << p->name() << "Helper";
_out << sb;
_out << sp;
- _out << nl << "public static void write(Ice.OutputStream ostr, " << name << " v)";
+ _out << nl << "public static void write(" << getAbsolute("Ice.OutputStream", scope) << " ostr, " << name << " v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, p, "v", true);
+ writeMarshalUnmarshalCode(_out, p, scope, "v", true);
_out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public static " << name << " read(Ice.InputStream istr)";
+ _out << nl << "public static " << name << " read(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
_out << nl << name << " v;";
- writeMarshalUnmarshalCode(_out, p, "v", false);
+ writeMarshalUnmarshalCode(_out, p, scope, "v", false);
_out << nl << "return v;";
_out << eb;
@@ -3201,7 +3227,7 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
emitGeneratedCodeAttribute();
_out << nl << "public abstract class " << name;
_out << sb;
- _out << sp << nl << "public const " << typeToString(p->type()) << " value = ";
+ _out << sp << nl << "public const " << typeToString(p->type(), "") << " value = ";
writeConstantValue(p->type(), p->valueType(), p->value());
_out << ";";
_out << eb;
@@ -3223,6 +3249,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());
if(st)
{
isLocal = st->isLocal();
@@ -3258,7 +3285,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
emitDeprecate(p, cont, _out, "member");
- string type = typeToString(p->type(), isOptional, isLocal, p->getMetaData());
+ string type = typeToString(p->type(), scope, isOptional, isLocal, p->getMetaData());
string propertyName = fixId(p->name(), baseTypes, isClass);
string dataMemberName;
if(isProperty)
@@ -3483,6 +3510,7 @@ void
Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
+ string scope = fixId(cl->scope());
if(cl->isLocal())
{
return;
@@ -3498,7 +3526,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
string retSName;
if(ret)
{
- retS = typeToString(ret, p->returnIsOptional());
+ retS = typeToString(ret, scope, p->returnIsOptional());
retSName = resultStructReturnValueName(outParams);
}
@@ -3516,7 +3544,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << (typeToString((*i)->type(), (*i)->optional()) + " " + fixId((*i)->name()));
+ _out << (typeToString((*i)->type(), scope, (*i)->optional()) + " " + fixId((*i)->name()));
}
_out << epar;
@@ -3545,7 +3573,8 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << nl << "public " << typeToString((*i)->type(), (*i)->optional()) << " " << fixId((*i)->name()) << ";";
+ _out << nl << "public " << typeToString((*i)->type(), scope, (*i)->optional()) << " " << fixId((*i)->name())
+ << ";";
}
_out << eb;
}
@@ -3556,17 +3585,18 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public struct " << name << " : Ice.MarshaledResult";
+ _out << nl << "public struct " << name << " : " << getAbsolute("Ice.MarshaledResult", scope);
_out << sb;
//
// One shot constructor
//
- _out << nl << "public " << name << spar << getOutParams(p, true, false) << "Ice.Current current" << epar;
+ _out << nl << "public " << name << spar << getOutParams(p, scope, true, false)
+ << getAbsolute("Ice.Current", scope) + " current" << epar;
_out << sb;
_out << nl << "_ostr = IceInternal.Incoming.createResponseOutputStream(current);";
_out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p) << ");";
- writeMarshalUnmarshalParams(outParams, p, true, false, true, "_ostr");
+ writeMarshalUnmarshalParams(outParams, p, true, scope, false, true, "_ostr");
if(p->returnsClasses(false))
{
_out << nl << "_ostr.writePendingValues();";
@@ -3574,25 +3604,26 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p)
_out << nl << "_ostr.endEncapsulation();";
_out << eb;
_out << sp;
- _out << nl << "public Ice.OutputStream getOutputStream(Ice.Current current)";
+ _out << nl << "public " << getAbsolute("Ice.OutputStream", scope) << " getOutputStream("
+ << getAbsolute("Ice.Current", scope) << " current)";
_out << sb;
_out << nl << "if(_ostr == null)";
_out << sb;
_out << nl << "return new " << name << spar;
if(ret)
{
- _out << writeValue(ret);
+ _out << writeValue(ret, scope);
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
- _out << writeValue((*i)->type());
+ _out << writeValue((*i)->type(), scope);
}
_out << "current" << epar << ".getOutputStream(current);";
_out << eb;
_out << nl << "return _ostr;";
_out << eb;
_out << sp;
- _out << nl << "private Ice.OutputStream _ostr;";
+ _out << nl << "private " << getAbsolute("Ice.OutputStream", scope) << " _ostr;";
_out << eb;
}
}
@@ -3630,6 +3661,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
+ string scope = fixId(p->scope());
ClassList bases = p->bases();
_out << sp;
@@ -3643,13 +3675,13 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassDefPtr def = *q;
if(def->isInterface() || def->allOperations().size() > 0)
{
- baseInterfaces.push_back(fixId((*q)->scoped() + "Prx"));
+ baseInterfaces.push_back(getAbsolute(fixId((*q)->scoped() + "Prx"), scope));
}
}
if(baseInterfaces.empty())
{
- baseInterfaces.push_back("Ice.ObjectPrx");
+ baseInterfaces.push_back(getAbsolute("Ice.ObjectPrx", scope));
}
for(vector<string>::const_iterator q = baseInterfaces.begin(); q != baseInterfaces.end();)
@@ -3675,10 +3707,11 @@ void
Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container());
+ string scope = fixId(cl->scope());
string name = fixId(p->name(), DotNet::ICloneable, true);
- vector<string> inParams = getInParams(p);
+ vector<string> inParams = getInParams(p, scope);
ParamDeclList inParamDecls = p->inParameters();
- string retS = typeToString(p->returnType(), p->returnIsOptional());
+ string retS = typeToString(p->returnType(), scope, p->returnIsOptional());
string deprecateReason = getDeprecateReason(p, cl, "operation");
{
@@ -3693,8 +3726,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << retS << " " << name << spar << getParams(p)
- << ("Ice.OptionalContext " + context + " = new Ice.OptionalContext()") << epar << ';';
+ _out << nl << retS << " " << name << spar << getParams(p, scope)
+ << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()") << epar << ';';
}
{
@@ -3714,9 +3748,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << taskResultType(p);
+ _out << nl << taskResultType(p, scope);
_out << " " << p->name() << "Async" << spar << inParams
- << ("Ice.OptionalContext " + context + " = new Ice.OptionalContext()")
+ << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()")
<< ("_System.IProgress<bool> " + progress + " = null")
<< ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()")
<< epar << ";";
@@ -3726,8 +3761,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
//
// Write the async versions of the operation (using IAsyncResult API)
//
- string clScope = fixId(cl->scope());
- string delType = clScope + "Callback_" + cl->name() + "_" + p->name();
+ string delType = "Callback_" + cl->name() + "_" + p->name();
string context = getEscapedParamName(p, "context");
string callback = getEscapedParamName(p, "callback");
@@ -3741,8 +3775,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << "Ice.AsyncResult<" << delType << "> begin_" << p->name() << spar << inParams
- << ("Ice.OptionalContext " + context + " = new Ice.OptionalContext()") << epar << ';';
+ _out << nl << getAbsolute("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << p->name() << spar
+ << inParams
+ << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()") << epar << ';';
//
// Type-unsafe begin_ methods.
@@ -3755,8 +3791,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << "Ice.AsyncResult begin_" << p->name() << spar << inParams
- << "Ice.AsyncCallback " + callback << "object " + cookie << epar << ';';
+ _out << nl << getAbsolute("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams
+ << getAbsolute("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar << ';';
_out << sp;
writeDocCommentAMI(p, InParam, deprecateReason,
@@ -3767,8 +3803,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << "Ice.AsyncResult begin_" << p->name() << spar << inParams
- << "Ice.OptionalContext " + context << "Ice.AsyncCallback " + callback << "object " + cookie << epar << ';';
+ _out << nl << getAbsolute("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams
+ << getAbsolute("Ice.OptionalContext", scope) + " " + context
+ << getAbsolute("Ice.AsyncCallback", scope) + " " + callback
+ << "object " + cookie << epar << ';';
//
// end_ method.
@@ -3780,8 +3818,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
_out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]";
}
- _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, false, true)
- << "Ice.AsyncResult " + asyncResult << epar << ';';
+ _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, scope, false, true)
+ << getAbsolute("Ice.AsyncResult", scope) + " " + asyncResult << epar << ';';
}
}
@@ -3828,8 +3866,9 @@ Slice::Gen::AsyncDelegateVisitor::visitOperation(const OperationPtr& p)
return;
}
- vector<string> paramDeclAMI = getOutParams(p, false, false);
- string retS = typeToString(p->returnType(), p->returnIsOptional());
+ string scope = fixId(cl->scope());
+ vector<string> paramDeclAMI = getOutParams(p, scope, false, false);
+ string retS = typeToString(p->returnType(), scope, p->returnIsOptional());
string delName = "Callback_" + cl->name() + "_" + p->name();
_out << sp;
@@ -3877,6 +3916,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
string name = p->name();
+ string scope = fixId(p->scope());
string scoped = fixId(p->scoped());
ClassList bases = p->bases();
string opIntfName = "Operations";
@@ -3904,7 +3944,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string s = (*q)->scoped();
s += "Operations";
- _out << fixId(s) << '_';
+ _out << getAbsolute(fixId(s), scope) << '_';
}
++q;
}
@@ -3918,7 +3958,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);
+ string name = getDispatchParams(op, retS, params, args, scope);
_out << sp;
if(amd)
{
@@ -3973,13 +4013,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
+ string scope = fixId(p->scope());
ClassList bases = p->bases();
_out << sp;
emitComVisibleAttribute();
emitGeneratedCodeAttribute();
_out << nl << "[_System.Serializable]";
- _out << nl << "public sealed class " << name << "PrxHelper : Ice.ObjectPrxHelperBase, " << name << "Prx";
+ _out << nl << "public sealed class " << name << "PrxHelper : " << getAbsolute("Ice.ObjectPrxHelperBase", scope)
+ << ", " << name << "Prx";
_out << sb;
_out << sp;
@@ -4006,9 +4048,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, op->returnIsOptional());
+ string retS = typeToString(ret, scope, op->returnIsOptional());
- vector<string> params = getParams(op);
+ vector<string> params = getParams(op, scope);
vector<string> args = getArgs(op);
vector<string> argsAMI = getInArgs(op);
@@ -4037,7 +4079,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
_out << nl << "public " << retS << " " << opName << spar << params
- << ("Ice.OptionalContext " + context + " = new Ice.OptionalContext()") << epar;
+ << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()") << epar;
_out << sb;
_out << nl << "try";
_out << sb;
@@ -4106,8 +4149,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationPtr op = *r;
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- string clScope = fixId(cl->scope());
- vector<string> paramsAMI = getInParams(op);
+ vector<string> paramsAMI = getInParams(op, scope);
vector<string> argsAMI = getInArgs(op);
string opName = op->name();
@@ -4121,9 +4163,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
TypePtr ret = op->returnType();
- string retS = typeToString(ret, op->returnIsOptional());
+ string retS = typeToString(ret, scope, op->returnIsOptional());
- string returnTypeS = resultType(op);
+ string returnTypeS = resultType(op, scope);
ExceptionList throws = op->throws();
throws.sort();
@@ -4151,7 +4193,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << "<" << returnTypeS << ">";
}
_out << " " << opName << "Async" << spar << paramsAMI
- << ("Ice.OptionalContext " + context + " = new Ice.OptionalContext()")
+ << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()")
<< ("_System.IProgress<bool> " + progress + " = null")
<< ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()")
<< epar;
@@ -4170,8 +4213,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << "<" << returnTypeS << ">";
}
- _out << " _iceI_" << opName << "Async" << spar << getInParams(op, true)
- << "Ice.OptionalContext context"
+ _out << " _iceI_" << opName << "Async" << spar << getInParams(op, scope, true)
+ << getAbsolute("Ice.OptionalContext", scope) + " context"
<< "_System.IProgress<bool> progress"
<< "_System.Threading.CancellationToken cancel"
<< "bool synchronous" << epar;
@@ -4205,7 +4248,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the common invoke method
//
_out << sp << nl;
- _out << "private void _iceI_" << op->name() << spar << getInParams(op, true)
+ _out << "private void _iceI_" << op->name() << spar << getInParams(op, scope, true)
<< "_System.Collections.Generic.Dictionary<string, string> context"
<< "bool synchronous"
<< "IceInternal.OutgoingAsyncCompletionCallback completed" << epar;
@@ -4230,9 +4273,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!inParams.empty())
{
_out << ",";
- _out << nl << "write: (Ice.OutputStream ostr) =>";
+ _out << nl << "write: (" << getAbsolute("Ice.OutputStream", scope) << " ostr) =>";
_out << sb;
- writeMarshalUnmarshalParams(inParams, 0, true);
+ writeMarshalUnmarshalParams(inParams, 0, true, scope);
if(op->sendsClasses(false))
{
_out << nl << "ostr.writePendingValues();";
@@ -4243,7 +4286,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!throws.empty())
{
_out << ",";
- _out << nl << "userException: (Ice.UserException ex) =>";
+ _out << nl << "userException: (" << getAbsolute("Ice.UserException", scope) << " ex) =>";
_out << sb;
_out << nl << "try";
_out << sb;
@@ -4255,13 +4298,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
//
for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i)
{
- _out << nl << "catch(" << fixId((*i)->scoped()) << ")";
+ _out << nl << "catch(" << getAbsolute(fixId((*i)->scoped()), scope) << ")";
_out << sb;
_out << nl << "throw;";
_out << eb;
}
- _out << nl << "catch(Ice.UserException)";
+ _out << nl << "catch(" << getAbsolute("Ice.UserException", scope) << ")";
_out << sb;
_out << eb;
@@ -4271,7 +4314,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(ret || !outParams.empty())
{
_out << ",";
- _out << nl << "read: (Ice.InputStream istr) =>";
+ _out << nl << "read: (" << getAbsolute("Ice.InputStream", scope) << " istr) =>";
_out << sb;
if(outParams.empty())
{
@@ -4290,7 +4333,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(isClassType(ret))
{
- _out << " = Ice.Util.None";
+ _out << " = " << getAbsolute("Ice.Util", scope) << ".None";
}
_out << ";";
}
@@ -4301,13 +4344,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
else
{
TypePtr t = outParams.front()->type();
- _out << nl << typeToString(t, (outParams.front()->optional())) << " iceP_" << outParams.front()->name();
+ _out << nl << typeToString(t, scope, (outParams.front()->optional())) << " iceP_"
+ << outParams.front()->name();
if(!outParams.front()->optional())
{
StructPtr st = StructPtr::dynamicCast(t);
if(st && isValueType(st))
{
- _out << " = " << "new " << typeToString(t) << "()";
+ _out << " = " << "new " << typeToString(t, scope) << "()";
}
else if(isClassType(t) || st)
{
@@ -4316,12 +4360,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(isClassType(t))
{
- _out << " = Ice.Util.None";
+ _out << " = " << getAbsolute("Ice.Util", scope) << ".None";
}
_out << ";";
}
- writeMarshalUnmarshalParams(outParams, op, false, true);
+ writeMarshalUnmarshalParams(outParams, op, false, scope, true);
if(op->returnsClasses(false))
{
_out << nl << "istr.readPendingValues();";
@@ -4353,47 +4397,49 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationPtr op = *r;
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- string clScope = fixId(cl->scope());
- vector<string> paramsAMI = getInParams(op);
+ vector<string> paramsAMI = getInParams(op, scope);
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, op->returnIsOptional());
+ string retS = typeToString(ret, scope, op->returnIsOptional());
- string returnTypeS = resultType(op);
+ string returnTypeS = resultType(op, scope);
//
// Write the begin_ methods.
//
- string delType = clScope + "Callback_" + cl->name() + "_" + op->name();
+ string clScope = fixId(cl->scope());
+ string delType = getAbsolute(clScope + "Callback_" + cl->name() + "_" + op->name(), scope);
string context = getEscapedParamName(op, "context");
string callback = getEscapedParamName(op, "callback");
string cookie = getEscapedParamName(op, "cookie");
_out << sp;
- _out << nl << "public Ice.AsyncResult<" << delType << "> begin_" << opName << spar << paramsAMI
- << "Ice.OptionalContext " + context + " = new Ice.OptionalContext()" << epar;
+ _out << nl << "public " << getAbsolute("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName
+ << spar << paramsAMI << (getAbsolute("Ice.OptionalContext", scope) + " " + context + " = new " +
+ getAbsolute("Ice.OptionalContext", scope) + "()") << epar;
_out << sb;
_out << nl << "return begin_" << opName << spar << argsAMI << context << "null" << "null" << "false"
<< epar << ';';
_out << eb;
_out << sp;
- _out << nl << "public Ice.AsyncResult begin_" << opName << spar << paramsAMI
- << "Ice.AsyncCallback " + callback << "object " + cookie << epar;
+ _out << nl << "public " << getAbsolute("Ice.AsyncResult", scope) << " begin_" << opName << spar << paramsAMI
+ << getAbsolute("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar;
_out << sb;
- _out << nl << "return begin_" << opName << spar << argsAMI << "new Ice.OptionalContext()" << callback
- << cookie << "false" << epar << ';';
+ _out << nl << "return begin_" << opName << spar << argsAMI
+ << "new " + getAbsolute("Ice.OptionalContext", scope) + "()" << callback << cookie << "false" << epar << ';';
_out << eb;
_out << sp;
- _out << nl << "public Ice.AsyncResult begin_" << opName << spar << paramsAMI
- << "Ice.OptionalContext " + context << "Ice.AsyncCallback " + callback
- << "object " + cookie << epar;
+ _out << nl << "public " << getAbsolute("Ice.AsyncResult", scope) + " begin_" << opName << spar << paramsAMI
+ << getAbsolute("Ice.OptionalContext", scope) + " " + context
+ << getAbsolute("Ice.AsyncCallback", scope) + " " + callback
+ << "object " + cookie << epar;
_out << sb;
_out << nl << "return begin_" << opName << spar << argsAMI << context << callback
<< cookie << "false" << epar << ';';
@@ -4405,8 +4451,8 @@ 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, false, true)
- << "Ice.AsyncResult " + asyncResult << epar;
+ _out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, scope, false, true)
+ << getAbsolute("Ice.AsyncResult", scope) + " " + asyncResult << epar;
_out << sb;
_out << nl << "var resultI_ = IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");";
@@ -4446,10 +4492,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
// Write the common begin_ implementation.
//
_out << sp;
- _out << nl << "private Ice.AsyncResult<" << delType << "> begin_" << opName << spar << getInParams(op, true)
- << "_System.Collections.Generic.Dictionary<string, string> context"
- << "Ice.AsyncCallback completedCallback" << "object cookie" << "bool synchronous"
- << epar;
+ _out << nl << "private " << getAbsolute("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName << spar
+ << getInParams(op, scope, true)
+ << "_System.Collections.Generic.Dictionary<string, string> context"
+ << getAbsolute("Ice.AsyncCallback", scope) + " completedCallback" << "object cookie" << "bool synchronous"
+ << epar;
_out << sb;
if(op->returnsData())
@@ -4494,14 +4541,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "this, " << flatName << ", cookie, completedCallback);";
_out.dec();
- _out << nl << "_iceI_" << op->name() << spar << getInArgs(op, true) << "context" << "synchronous" << "completed" << epar << ";";
+ _out << nl << "_iceI_" << op->name() << spar << getInArgs(op, true) << "context" << "synchronous" << "completed"
+ << epar << ";";
_out << nl << "return completed;";
_out << eb;
}
_out << sp << nl << "#endregion"; // Asynchronous operations
_out << sp << nl << "#region Checked and unchecked cast operations";
- _out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx b)";
+ _out << sp << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", scope) << " b)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4518,7 +4566,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << eb;
_out << sp << nl << "public static " << name
- << "Prx checkedCast(Ice.ObjectPrx b, _System.Collections.Generic.Dictionary<string, string> ctx)";
+ << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", scope)
+ << " b, _System.Collections.Generic.Dictionary<string, string> ctx)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4534,13 +4583,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return r;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx b, string f)";
+ _out << sp << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", scope)
+ << " b, string f)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);";
+ _out << nl << getAbsolute("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
_out << nl << "try";
_out << sb;
_out << nl << "if(bb.ice_isA(ice_staticId()))";
@@ -4550,21 +4600,21 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return h;";
_out << eb;
_out << eb;
- _out << nl << "catch(Ice.FacetNotExistException)";
+ _out << nl << "catch(" << getAbsolute("Ice.FacetNotExistException", scope) << ")";
_out << sb;
_out << eb;
_out << nl << "return null;";
_out << eb;
_out << sp << nl << "public static " << name
- << "Prx checkedCast(Ice.ObjectPrx b, string f, "
+ << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", scope) << " b, string f, "
<< "_System.Collections.Generic.Dictionary<string, string> ctx)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);";
+ _out << nl << getAbsolute("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
_out << nl << "try";
_out << sb;
_out << nl << "if(bb.ice_isA(ice_staticId(), ctx))";
@@ -4574,13 +4624,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return h;";
_out << eb;
_out << eb;
- _out << nl << "catch(Ice.FacetNotExistException)";
+ _out << nl << "catch(" << getAbsolute("Ice.FacetNotExistException", scope) << ")";
_out << sb;
_out << eb;
_out << nl << "return null;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx b)";
+ _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getAbsolute("Ice.ObjectPrx", scope) << " b)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
@@ -4596,13 +4646,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "return r;";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx b, string f)";
+ _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getAbsolute("Ice.ObjectPrx", scope)
+ << " b, string f)";
_out << sb;
_out << nl << "if(b == null)";
_out << sb;
_out << nl << "return null;";
_out << eb;
- _out << nl << "Ice.ObjectPrx bb = b.ice_facet(f);";
+ _out << nl << getAbsolute("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);";
_out << nl << name << "PrxHelper h = new " << name << "PrxHelper();";
_out << nl << "h.iceCopyFrom(bb);";
_out << nl << "return h;";
@@ -4652,14 +4703,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "#region Marshaling support";
- _out << sp << nl << "public static void write(Ice.OutputStream ostr, " << name << "Prx v)";
+ _out << sp << nl << "public static void write(" << getAbsolute("Ice.OutputStream", scope) << " ostr, " << name
+ << "Prx v)";
_out << sb;
_out << nl << "ostr.writeProxy(v);";
_out << eb;
- _out << sp << nl << "public static " << name << "Prx read(Ice.InputStream istr)";
+ _out << sp << nl << "public static " << name << "Prx read(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
- _out << nl << "Ice.ObjectPrx proxy = istr.readProxy();";
+ _out << nl << getAbsolute("Ice.ObjectPrx", scope) << " proxy = istr.readProxy();";
_out << nl << "if(proxy != null)";
_out << sb;
_out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
@@ -4691,22 +4743,23 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
return;
}
- string typeS = typeToString(p);
-
+ string scope = fixId(p->scope());
+ string typeS = typeToString(p, scope);
_out << sp;
emitGeneratedCodeAttribute();
_out << nl << "public sealed class " << p->name() << "Helper";
_out << sb;
- _out << sp << nl << "public static void write(Ice.OutputStream ostr, " << typeS << " v)";
+ _out << sp << nl << "public static void write(" << getAbsolute("Ice.OutputStream", scope) << " ostr, " << typeS
+ << " v)";
_out << sb;
- writeSequenceMarshalUnmarshalCode(_out, p, "v", true, false);
+ writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", true, false);
_out << eb;
- _out << sp << nl << "public static " << typeS << " read(Ice.InputStream istr)";
+ _out << sp << nl << "public static " << typeS << " read(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
_out << nl << typeS << " v;";
- writeSequenceMarshalUnmarshalCode(_out, p, "v", false, false);
+ writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", false, false);
_out << nl << "return v;";
_out << eb;
_out << eb;
@@ -4771,8 +4824,9 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
genericType = meta.substr(prefix.size());
}
- string keyS = typeToString(key);
- string valueS = typeToString(value);
+ string scope = fixId(p->scope());
+ string keyS = typeToString(key, scope);
+ string valueS = typeToString(value, scope);
string name = "_System.Collections.Generic." + genericType + "<" + keyS + ", " + valueS + ">";
_out << sp;
@@ -4782,7 +4836,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << sp << nl << "public static void write(";
_out.useCurrentPosAsIndent();
- _out << "Ice.OutputStream ostr,";
+ _out << getAbsolute("Ice.OutputStream", scope) << " ostr,";
_out << nl << name << " v)";
_out.restoreIndent();
_out << sb;
@@ -4797,13 +4851,13 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
_out << "Generic.KeyValuePair<" << keyS << ", " << valueS << ">";
_out << " e in v)";
_out << sb;
- writeMarshalUnmarshalCode(_out, key, "e.Key", true);
- writeMarshalUnmarshalCode(_out, value, "e.Value", true);
+ writeMarshalUnmarshalCode(_out, key, scope, "e.Key", true);
+ writeMarshalUnmarshalCode(_out, value, scope, "e.Value", true);
_out << eb;
_out << eb;
_out << eb;
- _out << sp << nl << "public static " << name << " read(Ice.InputStream istr)";
+ _out << sp << nl << "public static " << name << " read(" << getAbsolute("Ice.InputStream", scope) << " istr)";
_out << sb;
_out << nl << "int sz = istr.readSize();";
_out << nl << name << " r = new " << name << "();";
@@ -4815,20 +4869,20 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
{
if(isValueType(st))
{
- _out << nl << "k = new " << typeToString(key) << "();";
+ _out << nl << "k = new " << typeToString(key, scope) << "();";
}
else
{
_out << nl << "k = null;";
}
}
- writeMarshalUnmarshalCode(_out, key, "k", false);
+ writeMarshalUnmarshalCode(_out, key, scope, "k", false);
if(isClassType(value))
{
ostringstream os;
- os << '(' << typeToString(value) << " v) => { r[k] = v; }";
- writeMarshalUnmarshalCode(_out, value, os.str(), false);
+ os << '(' << typeToString(value, scope) << " v) => { r[k] = v; }";
+ writeMarshalUnmarshalCode(_out, value, scope, os.str(), false);
}
else
{
@@ -4838,14 +4892,14 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
{
if(isValueType(st))
{
- _out << nl << "v = new " << typeToString(value) << "();";
+ _out << nl << "v = new " << typeToString(value, scope) << "();";
}
else
{
_out << nl << "v = null;";
}
}
- writeMarshalUnmarshalCode(_out, value, "v", false);
+ writeMarshalUnmarshalCode(_out, value, scope, "v", false);
_out << nl << "r[k] = v;";
}
_out << eb;
@@ -4890,14 +4944,14 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
ClassList bases = p->bases();
bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
- string baseClass = "Ice.ObjectImpl";
+ string name = p->name();
+ string scope = fixId(p->scope());
+ string baseClass = getAbsolute("Ice.ObjectImpl", scope);
if(hasBaseClass && !bases.front()->allOperations().empty())
{
baseClass = fixId(bases.front()->scoped() + "Disp_");
}
- string name = p->name();
-
_out << sp;
emitComVisibleAttribute();
emitGeneratedCodeAttribute();
@@ -4922,7 +4976,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
for(ClassList::const_iterator i = allBases.begin(); i != allBases.end(); ++i)
{
- _out << ", " << fixId((*i)->scoped());
+ _out << ", " << getAbsolute(fixId((*i)->scoped()), scope);
}
}
@@ -4938,7 +4992,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
{
string retS;
vector<string> params, args;
- string name = getDispatchParams(*i, retS, params, args);
+ string name = getDispatchParams(*i, retS, params, args, scope);
_out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';';
}
@@ -4962,7 +5016,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
emitComVisibleAttribute();
emitGeneratedCodeAttribute();
- _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, Ice.TieBase";
+ _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, " << getAbsolute("Ice.TieBase", scope);
_out << sb;
@@ -5023,13 +5077,14 @@ Slice::Gen::DispatcherVisitor::visitClassDefEnd(const ClassDefPtr&)
void
Slice::Gen::DispatcherVisitor::writeTieOperations(const ClassDefPtr& p, NameSet* opNames)
{
+ string scope = fixId(p->scope());
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);
+ string opName = getDispatchParams(*r, retS, params, args, scope);
if(opNames)
{
if(opNames->find(opName) != opNames->end())
@@ -5078,6 +5133,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 opName = op->name();
TypePtr ret = op->returnType();
ParamDeclList params = op->parameters();
@@ -5107,8 +5163,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);
- string resultType = CsGenerator::resultType(op, true);
+ vector<string> pDecl = getInParams(op, scope);
+ string resultType = CsGenerator::resultType(op, scope, true);
_out << "public ";
if(!forTie)
@@ -5121,7 +5177,8 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
_out << "<" << resultType << ">";
}
- _out << " " << opName << "Async" << spar << pDecl << "Ice.Current current = null" << epar;
+ _out << " " << opName << "Async" << spar << pDecl << getAbsolute("Ice.Current", scope) + " current = null"
+ << epar;
if(comment)
{
@@ -5132,7 +5189,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << sb;
if(ret)
{
- _out << nl << typeToString(ret) << " ret = " << writeValue(ret) << ';';
+ _out << nl << typeToString(ret, scope) << " ret = " << writeValue(ret, scope) << ';';
}
for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
{
@@ -5140,7 +5197,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
string name = fixId((*i)->name());
TypePtr type = (*i)->type();
- _out << nl << typeToString(type) << ' ' << name << " = " << writeValue(type) << ';';
+ _out << nl << typeToString(type, scope) << ' ' << name << " = " << writeValue(type, scope) << ';';
}
}
_out << nl << "return _System.Threading.Tasks.Task.FromResult";
@@ -5151,7 +5208,8 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
else
{
- bool returnStruct = (op->returnType() && !outParams.empty()) || outParams.size() > 1 || op->hasMarshaledResult();
+ bool returnStruct = (op->returnType() && !outParams.empty()) || outParams.size() > 1 ||
+ op->hasMarshaledResult();
if(returnStruct)
{
@@ -5188,10 +5246,10 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
else
{
string retS = op->hasMarshaledResult() ?
- fixId(cl->scope() + resultStructName(cl->name(), op->name(), true)) :
- typeToString(ret);
+ fixId(cl->scope() + resultStructName(cl->name(), op->name(), true)) :
+ typeToString(ret, scope);
- vector<string> pDecls = op->hasMarshaledResult() ? getInParams(op) : getParams(op);
+ vector<string> pDecls = op->hasMarshaledResult() ? getInParams(op, scope) : getParams(op, scope);
_out << "public ";
if(!forTie && !cl->isLocal())
@@ -5201,7 +5259,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
_out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
if(!cl->isLocal())
{
- _out << "Ice.Current current = null";
+ _out << getAbsolute("Ice.Current", scope) + " current = null";
}
_out << epar;
if(comment)
@@ -5216,7 +5274,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
<< "(";
if(ret)
{
- _out << writeValue(ret);
+ _out << writeValue(ret, scope);
}
for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i)
{
@@ -5224,7 +5282,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
_out << ", ";
}
- _out << writeValue((*i)->type());
+ _out << writeValue((*i)->type(), scope);
}
_out << ", current);";
}
@@ -5234,12 +5292,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment
{
string name = fixId((*i)->name());
TypePtr type = (*i)->type();
- _out << nl << name << " = " << writeValue(type) << ';';
+ _out << nl << name << " = " << writeValue(type, scope) << ';';
}
if(ret)
{
- _out << nl << "return " << writeValue(ret) << ';';
+ _out << nl << "return " << writeValue(ret, scope) << ';';
}
}
_out << eb;
diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h
index 35833ae19af..c80e096a6e8 100644
--- a/cpp/src/slice2cs/Gen.h
+++ b/cpp/src/slice2cs/Gen.h
@@ -24,21 +24,22 @@ public:
protected:
- void writeMarshalUnmarshalParams(const ParamDeclList&, const OperationPtr&, bool, bool = false,
+ void writeMarshalUnmarshalParams(const ParamDeclList&, const OperationPtr&, bool, const std::string&, bool = false,
bool = false, const std::string& = "");
- void writeMarshalDataMember(const DataMemberPtr&, const std::string&, bool = false);
- void writeUnmarshalDataMember(const DataMemberPtr&, const std::string&, bool = false);
+ void writeMarshalDataMember(const DataMemberPtr&, const std::string&, const std::string&, bool = false);
+ void writeUnmarshalDataMember(const DataMemberPtr&, const std::string&, const std::string&, bool = false);
virtual void writeInheritedOperations(const ClassDefPtr&);
virtual void writeDispatch(const ClassDefPtr&);
virtual void writeMarshaling(const ClassDefPtr&);
- static std::vector<std::string> getParams(const OperationPtr&);
- static std::vector<std::string> getInParams(const OperationPtr&, bool = false);
- static std::vector<std::string> getOutParams(const OperationPtr&, bool, bool);
+ static std::vector<std::string> getParams(const OperationPtr&, const std::string&);
+ static std::vector<std::string> getInParams(const OperationPtr&, const std::string&, bool = false);
+ static std::vector<std::string> getOutParams(const OperationPtr&, const std::string&, bool, bool);
static std::vector<std::string> getArgs(const OperationPtr&);
static std::vector<std::string> getInArgs(const OperationPtr&, bool = false);
- static std::string getDispatchParams(const OperationPtr&, std::string&, std::vector<std::string>&, std::vector<std::string>&);
+ static std::string getDispatchParams(const OperationPtr&, std::string&, std::vector<std::string>&,
+ std::vector<std::string>&, const std::string&);
void emitAttributes(const ContainedPtr&);
void emitComVisibleAttribute();
@@ -47,7 +48,7 @@ protected:
static std::string getParamAttributes(const ParamDeclPtr&);
- std::string writeValue(const TypePtr&);
+ std::string writeValue(const TypePtr&, const std::string&);
void writeConstantValue(const TypePtr&, const SyntaxTreeBasePtr&, const std::string&);
@@ -55,7 +56,7 @@ protected:
// Generate assignment statements for those data members that have default values.
//
bool requiresDataMemberInitializers(const DataMemberList&);
- void writeDataMemberInitializers(const DataMemberList&, int = 0, bool = false);
+ void writeDataMemberInitializers(const DataMemberList&, const std::string&, int = 0, bool = false);
std::string toCsIdent(const std::string&);
std::string editMarkup(const std::string&);
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index e6a225a11a6..9f15d3496f9 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -394,7 +394,7 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
ParamDeclList required, optional;
op->outParameters(required, optional);
- out << sp << nl << "public void write(com.zeroc.Ice.OutputStream ostr)";
+ out << sp << nl << "public void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr)";
out << sb;
int iter = 0;
@@ -437,7 +437,7 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
out << eb;
- out << sp << nl << "public void read(com.zeroc.Ice.InputStream istr)";
+ out << sp << nl << "public void read(" << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr)";
out << sb;
iter = 0;
@@ -495,18 +495,18 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
const DocCommentPtr& dc)
{
string opName = op->name();
- opName[0] = toupper(static_cast<unsigned char>(opName[0]));
-
- out << sp << nl << "public static class " << opName << "MarshaledResult implements com.zeroc.Ice.MarshaledResult";
- out << sb;
-
const TypePtr ret = op->returnType();
const ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
assert(cl);
+ opName[0] = toupper(static_cast<unsigned char>(opName[0]));
+
+ out << sp << nl << "public static class " << opName << "MarshaledResult implements "
+ << getAbsolute("com.zeroc.Ice.MarshaledResult", package) << sb;
+
const ParamDeclList outParams = op->outParameters();
const string retval = getEscapedParamName(op, "returnValue");
const string currentParamName = getEscapedParamName(op, "current");
- const string currentParam = "com.zeroc.Ice.Current " + currentParamName;
+ const string currentParam = getAbsolute("com.zeroc.Ice.Current", package) + " " + currentParamName;
out << sp;
@@ -554,7 +554,8 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
}
out << currentParam << epar;
out << sb;
- out << nl << "_ostr = com.zeroc.IceInternal.Incoming.createResponseOutputStream(" << currentParamName << ");";
+ out << nl << "_ostr = " << getAbsolute("com.zeroc.IceInternal.Incoming", package) << ".createResponseOutputStream("
+ << currentParamName << ");";
out << nl << "_ostr.startEncapsulation(" << currentParamName << ".encoding, " << opFormatTypeToString(op) << ");";
ParamDeclList required, optional;
@@ -683,13 +684,13 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
out << sp;
out << nl << "@Override"
- << nl << "public com.zeroc.Ice.OutputStream getOutputStream()"
+ << nl << "public " << getAbsolute("com.zeroc.Ice.OutputStream", package) << " getOutputStream()"
<< sb
<< nl << "return _ostr;"
<< eb;
out << sp;
- out << nl << "private com.zeroc.Ice.OutputStream _ostr;";
+ out << nl << "private " << getAbsolute("com.zeroc.Ice.OutputStream", package) << " _ostr;";
out << eb;
}
@@ -704,7 +705,7 @@ Slice::JavaVisitor::allocatePatcher(Output& out, const TypePtr& type, const stri
string clsName;
if(b || cl->isInterface())
{
- clsName = "com.zeroc.Ice.Value";
+ clsName = getAbsolute("com.zeroc.Ice.Value", package);
}
else
{
@@ -729,7 +730,7 @@ Slice::JavaVisitor::getPatcher(const TypePtr& type, const string& package, const
string clsName;
if(b || cl->isInterface())
{
- clsName = "com.zeroc.Ice.Value";
+ clsName = getAbsolute("com.zeroc.Ice.Value", package);
}
else
{
@@ -993,7 +994,7 @@ Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList
if(op && (op->hasMetaData("java:UserException") || op->hasMetaData("UserException")))
{
out.inc();
- out << nl << "throws com.zeroc.Ice.UserException";
+ out << nl << "throws " << getAbsolute("com.zeroc.Ice.UserException", package);
out.dec();
}
else if(throws.size() > 0)
@@ -1104,7 +1105,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
vector<string> params = getParams(op, package);
- const string currentParam = "com.zeroc.Ice.Current " + getEscapedParamName(op, "current");
+ const string currentParam = getAbsolute("com.zeroc.Ice.Current", package) + " " +
+ getEscapedParamName(op, "current");
const bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
@@ -1162,12 +1164,14 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
out << eb << ';';
- out << sp << nl << "@Override" << nl << "default String[] ice_ids(com.zeroc.Ice.Current current)";
+ out << sp << nl << "@Override" << nl << "default String[] ice_ids(" << getAbsolute("com.zeroc.Ice.Current", package)
+ << " current)";
out << sb;
out << nl << "return _iceIds;";
out << eb;
- out << sp << nl << "@Override" << nl << "default String ice_id(com.zeroc.Ice.Current current)";
+ out << sp << nl << "@Override" << nl << "default String ice_id(" << getAbsolute("com.zeroc.Ice.Current", package)
+ << " current)";
out << sb;
out << nl << "return ice_staticId();";
out << eb;
@@ -1203,7 +1207,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "static java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> _iceD_" << opName << '(';
+ out << nl << "static java.util.concurrent.CompletionStage<" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << "> _iceD_" << opName << '(';
if(p->isInterface())
{
out << name;
@@ -1212,11 +1217,12 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
out << p->name() << "Disp";
}
- out << " obj, final com.zeroc.IceInternal.Incoming inS, com.zeroc.Ice.Current current)";
+ out << " obj, final " << getAbsolute("com.zeroc.IceInternal.Incoming", package) << " inS, "
+ << getAbsolute("com.zeroc.Ice.Current", package) << " current)";
if(!op->throws().empty() || op->hasMetaData("java:UserException") || op->hasMetaData("UserException"))
{
out.inc();
- out << nl << "throws com.zeroc.Ice.UserException";
+ out << nl << "throws " << getAbsolute("com.zeroc.Ice.UserException", package);
out.dec();
}
out << sb;
@@ -1228,7 +1234,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
const ParamDeclList inParams = op->inParameters();
const ParamDeclList outParams = op->outParameters();
- out << nl << "com.zeroc.Ice.Object._iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
+ out << nl << getAbsolute("com.zeroc.Ice.Object", package) << "._iceCheckMode(" << sliceModeToIceMode(op->mode())
+ << ", current.mode);";
if(!inParams.empty())
{
@@ -1237,7 +1244,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// Declare 'in' parameters.
//
- out << nl << "com.zeroc.Ice.InputStream istr = inS.startReadParams();";
+ out << nl << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr = inS.startReadParams();";
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
const TypePtr paramType = (*pli)->type();
@@ -1342,7 +1349,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
else if(ret || !outParams.empty())
{
- out << nl << "com.zeroc.Ice.OutputStream ostr = inS.startWriteParams();";
+ out << nl << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr = inS.startWriteParams();";
writeMarshalServantResults(out, package, op, "ret");
out << nl << "inS.endWriteParams(ostr);";
out << nl << "return inS.setResult(ostr);";
@@ -1397,17 +1404,19 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
}
out << nl << "@Override" << nl
- << "default java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> _iceDispatch("
- << "com.zeroc.IceInternal.Incoming in, com.zeroc.Ice.Current current)";
+ << "default java.util.concurrent.CompletionStage<" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << "> _iceDispatch(" << getAbsolute("com.zeroc.IceInternal.Incoming", package) << " in, "
+ << getAbsolute("com.zeroc.Ice.Current", package) << " current)";
out.inc();
- out << nl << "throws com.zeroc.Ice.UserException";
+ out << nl << "throws " << getAbsolute("com.zeroc.Ice.UserException", package);
out.dec();
out << sb;
out << nl << "int pos = java.util.Arrays.binarySearch(_iceOps, current.operation);";
out << nl << "if(pos < 0)";
out << sb;
out << nl << "throw new "
- << "com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ << getAbsolute("com.zeroc.Ice.OperationNotExistException", package)
+ << "(current.id, current.facet, current.operation);";
out << eb;
out << sp << nl << "switch(pos)";
out << sb;
@@ -1420,19 +1429,23 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sb;
if(opName == "ice_id")
{
- out << nl << "return com.zeroc.Ice.Object._iceD_ice_id(this, in, current);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.Object", package)
+ << "._iceD_ice_id(this, in, current);";
}
else if(opName == "ice_ids")
{
- out << nl << "return com.zeroc.Ice.Object._iceD_ice_ids(this, in, current);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.Object", package)
+ << "._iceD_ice_ids(this, in, current);";
}
else if(opName == "ice_isA")
{
- out << nl << "return com.zeroc.Ice.Object._iceD_ice_isA(this, in, current);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.Object", package)
+ << "._iceD_ice_isA(this, in, current);";
}
else if(opName == "ice_ping")
{
- out << nl << "return com.zeroc.Ice.Object._iceD_ice_ping(this, in, current);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.Object", package)
+ << "._iceD_ice_ping(this, in, current);";
}
else
{
@@ -1471,8 +1484,8 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
out << eb;
out << sp << nl << "assert(false);";
- out << nl << "throw new "
- << "com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ out << nl << "throw new " << getAbsolute("com.zeroc.Ice.OperationNotExistException", package)
+ << "(current.id, current.facet, current.operation);";
out << eb;
}
}
@@ -1500,14 +1513,14 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
{
out << sp;
out << nl << "@Override";
- out << nl << "public com.zeroc.Ice.SlicedData ice_getSlicedData()";
+ out << nl << "public " << getAbsolute("com.zeroc.Ice.SlicedData", package) << " ice_getSlicedData()";
out << sb;
out << nl << "return _iceSlicedData;";
out << eb;
out << sp;
out << nl << "@Override";
- out << nl << "public void _iceWrite(com.zeroc.Ice.OutputStream ostr)";
+ out << nl << "public void _iceWrite(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.startValue(_iceSlicedData);";
out << nl << "_iceWriteImpl(ostr);";
@@ -1516,7 +1529,7 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "public void _iceRead(com.zeroc.Ice.InputStream istr)";
+ out << nl << "public void _iceRead(" << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr)";
out << sb;
out << nl << "istr.startValue();";
out << nl << "_iceReadImpl(istr);";
@@ -1526,7 +1539,7 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void _iceWriteImpl(com.zeroc.Ice.OutputStream ostr_)";
+ out << nl << "protected void _iceWriteImpl(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr_)";
out << sb;
out << nl << "ostr_.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
iter = 0;
@@ -1553,7 +1566,7 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void _iceReadImpl(com.zeroc.Ice.InputStream istr_)";
+ out << nl << "protected void _iceReadImpl(" << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr_)";
out << sb;
out << nl << "istr_.startSlice();";
@@ -1579,7 +1592,7 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected com.zeroc.Ice.SlicedData _iceSlicedData;";
+ out << sp << nl << "protected " << getAbsolute("com.zeroc.Ice.SlicedData", package) << " _iceSlicedData;";
}
}
@@ -2200,7 +2213,7 @@ Slice::JavaVisitor::writeServantDocComment(Output& out, const OperationPtr& p, c
if(p->hasMetaData("java:UserException") || p->hasMetaData("UserException"))
{
- out << nl << " * @throws com.zeroc.Ice.UserException";
+ out << nl << " * @throws " << getAbsolute("com.zeroc.Ice.UserException", package);
}
else
{
@@ -2415,7 +2428,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out.useCurrentPosAsIndent();
if(!p->isLocal() && bases.empty())
{
- out << "com.zeroc.Ice.Object";
+ out << getAbsolute("com.zeroc.Ice.Object", package);
}
else if(q != bases.end())
{
@@ -2453,7 +2466,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(!p->isLocal())
{
- out << " extends com.zeroc.Ice.Value";
+ out << " extends " << getAbsolute("com.zeroc.Ice.Value", package);
}
if(p->isLocal())
@@ -2860,11 +2873,11 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
if(p->isLocal())
{
- out << "com.zeroc.Ice.LocalException";
+ out << getAbsolute("com.zeroc.Ice.LocalException", package);
}
else
{
- out << "com.zeroc.Ice.UserException";
+ out << getAbsolute("com.zeroc.Ice.UserException", package);
}
}
else
@@ -3136,14 +3149,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
out << sp;
out << nl << "@Override";
- out << nl << "public com.zeroc.Ice.SlicedData ice_getSlicedData()";
+ out << nl << "public " << getAbsolute("com.zeroc.Ice.SlicedData", package) << " ice_getSlicedData()";
out << sb;
out << nl << "return _slicedData;";
out << eb;
out << sp;
out << nl << "@Override";
- out << nl << "public void _write(com.zeroc.Ice.OutputStream ostr)";
+ out << nl << "public void _write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.startException(_slicedData);";
out << nl << "_writeImpl(ostr);";
@@ -3152,7 +3165,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "public void _read(com.zeroc.Ice.InputStream istr)";
+ out << nl << "public void _read(" << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr)";
out << sb;
out << nl << "istr.startException();";
out << nl << "_readImpl(istr);";
@@ -3162,7 +3175,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void _writeImpl(com.zeroc.Ice.OutputStream ostr_)";
+ out << nl << "protected void _writeImpl(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr_)";
out << sb;
out << nl << "ostr_.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -3189,7 +3202,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void _readImpl(com.zeroc.Ice.InputStream istr_)";
+ out << nl << "protected void _readImpl(" << getAbsolute("com.zeroc.Ice.InputStream", package) << " istr_)";
out << sb;
out << nl << "istr_.startSlice();";
iter = 0;
@@ -3226,7 +3239,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected com.zeroc.Ice.SlicedData _slicedData;";
+ out << sp << nl << "protected " << getAbsolute("com.zeroc.Ice.SlicedData", package) << " _slicedData;";
}
}
@@ -3503,7 +3516,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void ice_writeMembers(com.zeroc.Ice.OutputStream ostr)";
+ out << sp << nl << "public void ice_writeMembers(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -3514,7 +3528,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
DataMemberList classMembers = p->classDataMembers();
- out << sp << nl << "public void ice_readMembers(com.zeroc.Ice.InputStream istr)";
+ out << sp << nl << "public void ice_readMembers(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -3523,7 +3538,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
- out << sp << nl << "static public void ice_write(com.zeroc.Ice.OutputStream ostr, " << name << " v)";
+ out << sp << nl << "static public void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, " << name << " v)";
out << sb;
out << nl << "if(v == null)";
out << sb;
@@ -3535,7 +3551,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
out << eb;
- out << sp << nl << "static public " << name << " ice_read(com.zeroc.Ice.InputStream istr)";
+ out << sp << nl << "static public " << name << " ice_read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << name << " v = new " << name << "();";
out << nl << "v.ice_readMembers(istr);";
@@ -3544,7 +3561,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
string optName = "java.util.Optional<" + name + ">";
out << sp;
- out << nl << "static public void ice_write(com.zeroc.Ice.OutputStream ostr, int tag, " << optName << " v)";
+ out << nl << "static public void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << optName << " v)";
out << sb;
out << nl << "if(v != null && v.isPresent())";
out << sb;
@@ -3553,7 +3571,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
out << sp;
- out << nl << "static public void ice_write(com.zeroc.Ice.OutputStream ostr, int tag, " << name << " v)";
+ out << nl << "static public void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << name << " v)";
out << sb;
out << nl << "if(ostr.writeOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -3572,7 +3591,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
out << sp;
- out << nl << "static public " << optName << " ice_read(com.zeroc.Ice.InputStream istr, int tag)";
+ out << nl << "static public " << optName << " ice_read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr, int tag)";
out << sb;
out << nl << "if(istr.readOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -3986,6 +4006,7 @@ void
Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
{
string name = fixKwd(p->name());
+ string package = getPackage(p);
string absolute = getAbsolute(p);
EnumeratorList enumerators = p->enumerators();
@@ -4054,12 +4075,13 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void ice_write(com.zeroc.Ice.OutputStream ostr)";
+ out << sp << nl << "public void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.writeEnum(_value, " << p->maxValue() << ");";
out << eb;
- out << sp << nl << "public static void ice_write(com.zeroc.Ice.OutputStream ostr, " << name << " v)";
+ out << sp << nl << "public static void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, " << name << " v)";
out << sb;
out << nl << "if(v == null)";
out << sb;
@@ -4072,7 +4094,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << eb;
- out << sp << nl << "public static " << name << " ice_read(com.zeroc.Ice.InputStream istr)";
+ out << sp << nl << "public static " << name << " ice_read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << "int v = istr.readEnum(" << p->maxValue() << ");";
out << nl << "return validate(v);";
@@ -4080,7 +4103,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
string optName = "java.util.Optional<" + name + ">";
out << sp;
- out << nl << "public static void ice_write(com.zeroc.Ice.OutputStream ostr, int tag, " << optName << " v)";
+ out << nl << "public static void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << optName << " v)";
out << sb;
out << nl << "if(v != null && v.isPresent())";
out << sb;
@@ -4089,7 +4113,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << sp;
- out << nl << "public static void ice_write(com.zeroc.Ice.OutputStream ostr, int tag, " << name << " v)";
+ out << nl << "public static void ice_write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << name << " v)";
out << sb;
out << nl << "if(ostr.writeOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -4098,7 +4123,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << sp;
- out << nl << "public static " << optName << " ice_read(com.zeroc.Ice.InputStream istr, int tag)";
+ out << nl << "public static " << optName << " ice_read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr, int tag)";
out << sb;
out << nl << "if(istr.readOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -4115,7 +4141,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "final " << name << " e = valueOf(v);";
out << nl << "if(e == null)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.MarshalException(\"enumerator value \" + v + \" is out of range\");";
+ out << nl << "throw new " << getAbsolute("com.zeroc.Ice.MarshalException", package)
+ << "(\"enumerator value \" + v + \" is out of range\");";
out << eb;
out << nl << "return e;";
out << eb;
@@ -4300,7 +4327,8 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, " << typeS << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, " << typeS << " v)";
out << sb;
iter = 0;
writeSequenceMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
@@ -4311,7 +4339,8 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << " read(com.zeroc.Ice.InputStream istr)";
+ out << nl << "public static " << typeS << " read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << "final " << typeS << " v;";
iter = 0;
@@ -4323,7 +4352,8 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
string optTypeS = "java.util.Optional<" + typeS + ">";
out << sp;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, int tag, " << optTypeS << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << optTypeS << " v)";
out << sb;
if(!hasTypeMetaData(p) && builtin && builtin->kind() < Builtin::KindObject)
{
@@ -4339,7 +4369,8 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << eb;
out << sp;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, int tag, " << typeS << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package)
+ << " ostr, int tag, " << typeS << " v)";
out << sb;
if(!hasTypeMetaData(p) && builtin && builtin->kind() < Builtin::KindObject)
{
@@ -4387,7 +4418,8 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << eb;
out << sp;
- out << nl << "public static " << optTypeS << " read(com.zeroc.Ice.InputStream istr, int tag)";
+ out << nl << "public static " << optTypeS << " read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr, int tag)";
out << sb;
if(!hasTypeMetaData(p) && builtin && builtin->kind() < Builtin::KindObject)
{
@@ -4449,13 +4481,15 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, " << formalType << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr, "
+ << formalType << " v)";
out << sb;
iter = 0;
writeDictionaryMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
out << eb;
- out << sp << nl << "public static " << formalType << " read(com.zeroc.Ice.InputStream istr)";
+ out << sp << nl << "public static " << formalType << " read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << formalType << " v;";
iter = 0;
@@ -4465,7 +4499,8 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
string optTypeS = "java.util.Optional<" + formalType + ">";
out << sp;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, int tag, " << optTypeS << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr, int tag, "
+ << optTypeS << " v)";
out << sb;
out << nl << "if(v != null && v.isPresent())";
out << sb;
@@ -4474,7 +4509,8 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << eb;
out << sp;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, int tag, " << formalType << " v)";
+ out << nl << "public static void write(" << getAbsolute("com.zeroc.Ice.OutputStream", package) << " ostr, int tag, "
+ << formalType << " v)";
out << sb;
out << nl << "if(ostr.writeOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -4497,7 +4533,8 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << eb;
out << sp;
- out << nl << "public static " << optTypeS << " read(com.zeroc.Ice.InputStream istr, int tag)";
+ out << nl << "public static " << optTypeS << " read(" << getAbsolute("com.zeroc.Ice.InputStream", package)
+ << " istr, int tag)";
out << sb;
out << nl << "if(istr.readOptional(tag, " << getOptionalFormat(p) << "))";
out << sb;
@@ -4577,7 +4614,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
out.useCurrentPosAsIndent();
if(bases.empty())
{
- out << "com.zeroc.Ice.ObjectPrx";
+ out << getAbsolute("com.zeroc.Ice.ObjectPrx", package);
}
else
{
@@ -4604,6 +4641,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
DocCommentPtr dc = parseDocComment(p);
+ const string package = getPackage(p);
const string contextParam = "java.util.Map<String, String> context";
out << sp;
@@ -4612,10 +4650,10 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"Raises a local exception if a communication error occurs.\n"
"@param obj The untyped proxy.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj)";
+ out << nl << "static " << p->name() << "Prx checkedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package) << " obj)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, ice_staticId(), " << p->name()
- << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package) << "._checkedCast(obj, ice_staticId(), "
+ << p->name() << "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
out << sp;
@@ -4625,10 +4663,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, " << contextParam << ')';
+ out << nl << "static " << p->name() << "Prx checkedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << " obj, " << contextParam << ')';
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, context, ice_staticId(), " << p->name()
- << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << "._checkedCast(obj, context, ice_staticId(), " << p->name() << "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
out << sp;
@@ -4638,10 +4677,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param facet The name of the desired facet.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, String facet)";
+ out << nl << "static " << p->name() << "Prx checkedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << " obj, String facet)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, facet, ice_staticId(), " << p->name()
- << "Prx.class, _" << p->name() << "PrxI.class);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << "._checkedCast(obj, facet, ice_staticId(), " << p->name() << "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
out << sp;
@@ -4652,10 +4692,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param facet The name of the desired facet.\n"
"@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, String facet, "
- << contextParam << ')';
+ out << nl << "static " << p->name() << "Prx checkedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << " obj, String facet, " << contextParam << ')';
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, facet, context, ice_staticId(), " << p->name()
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << "._checkedCast(obj, facet, context, ice_staticId(), " << p->name()
<< "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
@@ -4664,10 +4705,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"Downcasts the given proxy to this type without contacting the remote server.\n"
"@param obj The untyped proxy.\n"
"@return A proxy for this type.");
- out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx obj)";
+ out << nl << "static " << p->name() << "Prx uncheckedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << " obj)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._uncheckedCast(obj, " << p->name() << "Prx.class, _"
- << p->name() << "PrxI.class);";
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package) << "._uncheckedCast(obj, " << p->name()
+ << "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
out << sp;
@@ -4676,9 +4718,11 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param facet The name of the desired facet.\n"
"@return A proxy for this type.");
- out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx obj, String facet)";
+ out << nl << "static " << p->name() << "Prx uncheckedCast(" << getAbsolute("com.zeroc.Ice.ObjectPrx", package)
+ << " obj, String facet)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx._uncheckedCast(obj, facet, " << p->name() << "Prx.class, _"
+ out << nl << "return " << getAbsolute("com.zeroc.Ice.ObjectPrx", package) << "._uncheckedCast(obj, facet, "
+ << p->name() << "Prx.class, _"
<< p->name() << "PrxI.class);";
out << eb;
@@ -4710,7 +4754,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param newEndpoints The endpoints for the new proxy.\n"
"@return A proxy with the specified endpoints.");
out << nl << "@Override";
- out << nl << "default " << p->name() << "Prx ice_endpoints(com.zeroc.Ice.Endpoint[] newEndpoints)";
+ out << nl << "default " << p->name() << "Prx ice_endpoints(" << getAbsolute("com.zeroc.Ice.Endpoint", package) << "[] newEndpoints)";
out << sb;
out << nl << "return (" << p->name() << "Prx)_ice_endpoints(newEndpoints);";
out << eb;
@@ -4754,7 +4798,9 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param newType The new endpoint selection policy.\n"
"@return A proxy with the specified endpoint selection policy.");
out << nl << "@Override";
- out << nl << "default " << p->name() << "Prx ice_endpointSelection(com.zeroc.Ice.EndpointSelectionType newType)";
+ out << nl << "default " << p->name() << "Prx ice_endpointSelection("
+ << getAbsolute("com.zeroc.Ice.EndpointSelectionType", package)
+ << " newType)";
out << sb;
out << nl << "return (" << p->name() << "Prx)_ice_endpointSelection(newType);";
out << eb;
@@ -4778,7 +4824,8 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param e The encoding version to use to marshal request parameters.\n"
"@return A proxy with the specified encoding version.");
out << nl << "@Override";
- out << nl << "default " << p->name() << "Prx ice_encodingVersion(com.zeroc.Ice.EncodingVersion e)";
+ out << nl << "default " << p->name() << "Prx ice_encodingVersion(" << getAbsolute("com.zeroc.Ice.EncodingVersion", package)
+ << " e)";
out << sb;
out << nl << "return (" << p->name() << "Prx)_ice_encodingVersion(e);";
out << eb;
@@ -4802,7 +4849,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param router The router for the new proxy.\n"
"@return A proxy with the specified router.");
out << nl << "@Override";
- out << nl << "default " << p->name() << "Prx ice_router(com.zeroc.Ice.RouterPrx router)";
+ out << nl << "default " << p->name() << "Prx ice_router(" << getAbsolute("com.zeroc.Ice.RouterPrx", package) << " router)";
out << sb;
out << nl << "return (" << p->name() << "Prx)_ice_router(router);";
out << eb;
@@ -4813,7 +4860,8 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
"@param locator The locator for the new proxy.\n"
"@return A proxy with the specified locator.");
out << nl << "@Override";
- out << nl << "default " << p->name() << "Prx ice_locator(com.zeroc.Ice.LocatorPrx locator)";
+ out << nl << "default " << p->name() << "Prx ice_locator(" << getAbsolute("com.zeroc.Ice.LocatorPrx", package)
+ << " locator)";
out << sb;
out << nl << "return (" << p->name() << "Prx)_ice_locator(locator);";
out << eb;
@@ -4932,8 +4980,8 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
{
outi << nl << "@Deprecated";
}
- outi << nl << "public class _" << p->name() << "PrxI extends com.zeroc.Ice._ObjectPrxI implements " << p->name()
- << "Prx";
+ outi << nl << "public class _" << p->name() << "PrxI extends " << getAbsolute("com.zeroc.Ice._ObjectPrxI", package)
+ << " implements " << p->name() << "Prx";
outi << sb;
outi << sp << nl << "public static final long serialVersionUID = 0L;";
outi << eb;
@@ -5042,9 +5090,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << nl << "throw ex;";
out << eb;
}
- out << nl << "catch(com.zeroc.Ice.UserException ex)";
+ out << nl << "catch(" << getAbsolute("com.zeroc.Ice.UserException", package) << " ex)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.UnknownUserException(ex.ice_id(), ex);";
+ out << nl << "throw new " << getAbsolute("com.zeroc.Ice.UnknownUserException", package) << "(ex.ice_id(), ex);";
out << eb;
}
out << eb;
@@ -5108,9 +5156,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << nl << "throw ex;";
out << eb;
}
- out << nl << "catch(com.zeroc.Ice.UserException ex)";
+ out << nl << "catch(" << getAbsolute("com.zeroc.Ice.UserException", package) << " ex)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.UnknownUserException(ex.ice_id(), ex);";
+ out << nl << "throw new " << getAbsolute("com.zeroc.Ice.UnknownUserException", package)
+ << "(ex.ice_id(), ex);";
out << eb;
}
out << eb;
@@ -5152,8 +5201,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< "java.util.Map<String, String> context"
<< "boolean sync" << epar;
out << sb;
- out << nl << futureImpl << " f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", sync, "
+ out << nl << futureImpl << " f = new " << getAbsolute("com.zeroc.IceInternal.OutgoingAsync", package)
+ << "<>(this, \"" << p->name() << "\", " << sliceModeToIceMode(p->sendMode()) << ", sync, "
<< (throws.empty() ? "null" : "_iceE_" + p->name()) << ");";
out << nl << "f.invoke(";
@@ -5239,8 +5288,8 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< "java.util.Map<String, String> context"
<< "boolean sync" << epar;
out << sb;
- out << nl << futureImpl << " f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", sync, "
+ out << nl << futureImpl << " f = new " << getAbsolute("com.zeroc.IceInternal.OutgoingAsync", package)
+ << "<>(this, \"" << p->name() << "\", " << sliceModeToIceMode(p->sendMode()) << ", sync, "
<< (throws.empty() ? "null" : "_iceE_" + p->name()) << ");";
out << nl << "f.invoke(";
@@ -5319,7 +5368,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
if(bases.empty())
{
- out << " extends com.zeroc.Ice.Object";
+ out << " extends " << getAbsolute("com.zeroc.Ice.Object", package);
}
else
{
@@ -5574,8 +5623,9 @@ Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, cons
const ContainerPtr container = op->container();
const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+
const vector<string> params = getParams(op, package);
- const string currentParam = "com.zeroc.Ice.Current " + getEscapedParamName(op, "current");
+ const string currentParam = getAbsolute("com.zeroc.Ice.Current", package) + " " + getEscapedParamName(op, "current");
if(local)
{
diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp
index e09db4c6c3b..a02c4d10fad 100644
--- a/cpp/src/slice2java/GenCompat.cpp
+++ b/cpp/src/slice2java/GenCompat.cpp
@@ -253,7 +253,8 @@ Slice::JavaCompatVisitor::getParams(const OperationPtr& op, const string& packag
}
vector<string>
-Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping, bool internal)
+Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping,
+ bool internal)
{
vector<string> params;
@@ -371,7 +372,7 @@ Slice::JavaCompatVisitor::getAsyncCallbackInterface(const OperationPtr& op, cons
if(!ret && outParams.empty())
{
- return throws ? "Ice.TwowayCallbackVoidUE" : "Ice.OnewayCallback";
+ return throws ? getAbsolute("Ice.TwowayCallbackVoidUE", package) : getAbsolute("Ice.OnewayCallback", package);
}
else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
{
@@ -391,7 +392,7 @@ Slice::JavaCompatVisitor::getAsyncCallbackInterface(const OperationPtr& op, cons
case Builtin::KindFloat:
case Builtin::KindDouble:
{
- return prefix + builtinAsyncCallbackTable[builtin->kind()] + suffix;
+ return getAbsolute(prefix + builtinAsyncCallbackTable[builtin->kind()] + suffix, package);
}
default:
{
@@ -400,13 +401,13 @@ Slice::JavaCompatVisitor::getAsyncCallbackInterface(const OperationPtr& op, cons
}
}
- return "Ice.TwowayCallbackArg1" + suffix + "<" +
+ return getAbsolute("Ice.TwowayCallbackArg1" + suffix, package) + "<" +
typeToString(t, TypeModeIn, package, op->getMetaData(), true, optional) + ">";
}
else
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
- return getPackage(cl) + "._Callback_" + cl->name() + "_" + op->name();
+ return getAbsolute(getPackage(cl) + "._Callback_" + cl->name(), package) + "_" + op->name();
}
}
@@ -416,7 +417,8 @@ Slice::JavaCompatVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool
assert(op->returnsData());
TypePtr ret = op->returnType();
ParamDeclList outParams = getOutParams(op);
-
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
+ const string package = getPackage(cl);
bool throws = !op->throws().empty();
const string suffix = throws ? "UE" : "";
if(!ret && outParams.empty())
@@ -424,7 +426,7 @@ Slice::JavaCompatVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool
assert(throws);
return functional ?
"IceInternal.Functional_TwowayCallbackVoidUE" :
- "IceInternal.TwowayCallback implements Ice.TwowayCallbackVoidUE";
+ "IceInternal.TwowayCallback implements " + getAbsolute("Ice.TwowayCallbackVoidUE", package);
}
else if((ret && outParams.empty()) || (!ret && outParams.size() == 1))
{
@@ -444,8 +446,15 @@ Slice::JavaCompatVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool
case Builtin::KindDouble:
{
ostringstream os;
- os << (functional ? "IceInternal.Functional_" : "IceInternal.TwowayCallback implements Ice.")
- << builtinAsyncCallbackTable[builtin->kind()] + suffix;
+ if(functional)
+ {
+ os << "IceInternal.Functional_" << builtinAsyncCallbackTable[builtin->kind()] << suffix;
+ }
+ else
+ {
+ os << "IceInternal.TwowayCallback implements "
+ << getAbsolute(string("Ice.") + builtinAsyncCallbackTable[builtin->kind()] + suffix, package);
+ }
return os.str();
}
default:
@@ -462,14 +471,13 @@ Slice::JavaCompatVisitor::getAsyncCallbackBaseClass(const OperationPtr& op, bool
}
else
{
- os << "IceInternal.TwowayCallback implements Ice.TwowayCallbackArg1";
+ os << "IceInternal.TwowayCallback implements " << getAbsolute("Ice.TwowayCallbackArg1", package);
}
os << suffix << "<" << typeToString(t, TypeModeIn, getPackage(op), op->getMetaData(), true, optional) + ">";
return os.str();
}
else
{
- ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
ostringstream os;
if(functional)
{
@@ -572,10 +580,12 @@ Slice::JavaCompatVisitor::getParamsAsyncLambda(const OperationPtr& op, const str
if(!op->throws().empty())
{
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> " + userExceptionCbParamName);
+ params.push_back("IceInternal.Functional_GenericCallback1<" + getAbsolute("Ice.UserException", package) + "> " +
+ userExceptionCbParamName);
}
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> " + exceptionCbParamName);
+ params.push_back("IceInternal.Functional_GenericCallback1<" + getAbsolute("Ice.Exception", package) + "> " +
+ exceptionCbParamName);
if(sentCB)
{
@@ -818,8 +828,9 @@ Slice::JavaCompatVisitor::writeThrowsClause(const string& package, const Excepti
if(op && (op->hasMetaData("java:UserException") || op->hasMetaData("UserException")))
{
+ ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
out.inc();
- out << nl << "throws Ice.UserException";
+ out << nl << "throws " << getAbsolute("Ice.UserException", getPackage(cl));
out.dec();
}
else if(throws.size() > 0)
@@ -843,7 +854,8 @@ Slice::JavaCompatVisitor::writeThrowsClause(const string& package, const Excepti
}
void
-Slice::JavaCompatVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter, bool forStruct)
+Slice::JavaCompatVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member,
+ int& iter, bool forStruct)
{
if(!member->optional())
{
@@ -913,7 +925,7 @@ void
Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const DataMemberList& classMembers,
const DataMemberList& optionalMembers)
{
- out << sp << nl << "private class Patcher implements Ice.ReadValueCallback";
+ out << sp << nl << "private class Patcher implements " << getAbsolute("Ice.ReadValueCallback", package);
out << sb;
if(classMembers.size() > 1)
{
@@ -923,7 +935,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out << eb;
}
- out << sp << nl << "public void" << nl << "valueReady(Ice.Object v)";
+ out << sp << nl << "public void" << nl << "valueReady(" << getAbsolute("Ice.Object", package) << " v)";
out << sb;
if(classMembers.size() > 1)
{
@@ -951,7 +963,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out.inc();
if(b)
{
- out << nl << "_typeId = Ice.ObjectImpl.ice_staticId();";
+ out << nl << "_typeId = " << getAbsolute("Ice.ObjectImpl", package) << ".ice_staticId();";
}
else
{
@@ -1005,7 +1017,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out.inc();
if(b)
{
- out << nl << "_typeId = Ice.ObjectImpl.ice_staticId();";
+ out << nl << "_typeId = " << getAbsolute("Ice.ObjectImpl", package) << ".ice_staticId();";
}
else
{
@@ -1114,7 +1126,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << nl << "return java.util.Arrays.binarySearch(_ids, s) >= 0;";
out << eb;
- out << sp << nl << "public boolean ice_isA(String s, Ice.Current current)";
+ out << sp << nl << "public boolean ice_isA(String s, " << getAbsolute("Ice.Current", package) << " current)";
out << sb;
out << nl << "return java.util.Arrays.binarySearch(_ids, s) >= 0;";
out << eb;
@@ -1124,7 +1136,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << nl << "return _ids;";
out << eb;
- out << sp << nl << "public String[] ice_ids(Ice.Current current)";
+ out << sp << nl << "public String[] ice_ids(" << getAbsolute("Ice.Current", package) << " current)";
out << sb;
out << nl << "return _ids;";
out << eb;
@@ -1134,7 +1146,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << nl << "return _ids[" << scopedPos << "];";
out << eb;
- out << sp << nl << "public String ice_id(Ice.Current current)";
+ out << sp << nl << "public String ice_id(" << getAbsolute("Ice.Current", package) << " current)";
out << sb;
out << nl << "return _ids[" << scopedPos << "];";
out << eb;
@@ -1269,9 +1281,9 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << sp;
writeSuppressDeprecation(out, op);
out << nl << "public static boolean _iceD_" << opName << '(' << name
- << " obj, IceInternal.Incoming inS, Ice.Current current)";
+ << " obj, IceInternal.Incoming inS, " << getAbsolute("Ice.Current", package) << " current)";
out.inc();
- out << nl << "throws Ice.UserException";
+ out << nl << "throws " << getAbsolute("Ice.UserException", package);
out.dec();
out << sb;
@@ -1307,7 +1319,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
//
// Unmarshal 'in' parameters.
//
- out << nl << "Ice.InputStream istr = inS.startReadParams();";
+ out << nl << getAbsolute("Ice.InputStream", package) << " istr = inS.startReadParams();";
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
@@ -1398,7 +1410,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
//
if(!outParams.empty() || ret)
{
- out << nl << "Ice.OutputStream ostr = inS.startWriteParams();";
+ out << nl << getAbsolute("Ice.OutputStream", package) << " ostr = inS.startWriteParams();";
writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true, "", true);
if(op->returnsClasses(false))
{
@@ -1435,7 +1447,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
//
// Unmarshal 'in' parameters.
//
- out << nl << "Ice.InputStream istr = inS.startReadParams();";
+ out << nl << getAbsolute("Ice.InputStream", package) << " istr = inS.startReadParams();";
iter = 0;
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
@@ -1557,7 +1569,8 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << nl << "int pos = java.util.Arrays.binarySearch(_all, current.operation);";
out << nl << "if(pos < 0)";
out << sb;
- out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ out << nl << "throw new " << getAbsolute("Ice.OperationNotExistException", package)
+ << "(current.id, current.facet, current.operation);";
out << eb;
out << sp << nl << "switch(pos)";
out << sb;
@@ -1621,7 +1634,8 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
out << eb;
out << sp << nl << "assert(false);";
- out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
+ out << nl << "throw new " << getAbsolute("Ice.OperationNotExistException", package)
+ << "(current.id, current.facet, current.operation);";
out << eb;
//
@@ -1680,19 +1694,19 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
if(preserved && !basePreserved)
{
- out << sp << nl << "public Ice.SlicedData ice_getSlicedData()";
+ out << sp << nl << "public " << getAbsolute("Ice.SlicedData", package) << " ice_getSlicedData()";
out << sb;
out << nl << "return _iceSlicedData;";
out << eb;
- out << sp << nl << "public void _iceWrite(Ice.OutputStream ostr)";
+ out << sp << nl << "public void _iceWrite(" << getAbsolute("Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.startValue(_iceSlicedData);";
out << nl << "_iceWriteImpl(ostr);";
out << nl << "ostr.endValue();";
out << eb;
- out << sp << nl << "public void _iceRead(Ice.InputStream istr)";
+ out << sp << nl << "public void _iceRead(" << getAbsolute("Ice.InputStream", package) << " istr)";
out << sb;
out << nl << "istr.startValue();";
out << nl << "_iceReadImpl(istr);";
@@ -1700,7 +1714,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << eb;
}
- out << sp << nl << "protected void _iceWriteImpl(Ice.OutputStream ostr_)";
+ out << sp << nl << "protected void _iceWriteImpl(" << getAbsolute("Ice.OutputStream", package) << " ostr_)";
out << sb;
out << nl << "ostr_.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
iter = 0;
@@ -1730,7 +1744,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
writePatcher(out, package, classMembers, optionalMembers);
}
- out << sp << nl << "protected void _iceReadImpl(Ice.InputStream istr_)";
+ out << sp << nl << "protected void _iceReadImpl(" << getAbsolute("Ice.InputStream", package) << " istr_)";
out << sb;
out << nl << "istr_.startSlice();";
@@ -1757,7 +1771,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
if(preserved && !basePreserved)
{
- out << sp << nl << "protected Ice.SlicedData _iceSlicedData;";
+ out << sp << nl << "protected " << getAbsolute("Ice.SlicedData", package) << " _iceSlicedData;";
}
}
@@ -1865,7 +1879,8 @@ Slice::JavaCompatVisitor::writeDataMemberInitializers(Output& out, const DataMem
if(en)
{
string firstEnum = fixKwd(en->enumerators().front()->name());
- out << nl << "this." << fixKwd((*p)->name()) << " = " << getAbsolute(en, package) << '.' << firstEnum << ';';
+ out << nl << "this." << fixKwd((*p)->name()) << " = " << getAbsolute(en, package) << '.' << firstEnum
+ << ';';
}
StructPtr st = StructPtr::dynamicCast(t);
@@ -2588,7 +2603,7 @@ Slice::GenCompat::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurre
out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
if(!noCurrent && !p->isLocal())
{
- out << "Ice.Current " + currentParamName;
+ out << getAbsolute("Ice.Current", package) + " " + currentParamName;
}
out << epar;
writeThrowsClause(package, throws, op);
@@ -2684,7 +2699,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << '_' << name << "Operations, _" << name << "OperationsNC";
if(bases.empty())
{
- out << "," << nl << "Ice.Object";
+ out << "," << nl << getAbsolute("Ice.Object", package);
}
}
else if(q != bases.end())
@@ -2723,7 +2738,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
else if(!p->isLocal())
{
- out << " extends Ice.ObjectImpl";
+ out << " extends " << getAbsolute("Ice.ObjectImpl", package);
}
else
{
@@ -2816,7 +2831,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << epar << ';';
+ out << getAbsolute("Ice.AsyncResult", package) << " begin_" << opname << spar << inParams << epar << ';';
out << sp;
writeDocCommentAMI(out, op, InParam, "@param " + getEscapedParamName(op, "cb") + " A generic callback.");
@@ -2825,8 +2840,8 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << "Ice.Callback " + getEscapedParamName(op, "cb")
- << epar << ';';
+ out << getAbsolute("Ice.AsyncResult", package) << " begin_" << opname << spar << inParams
+ << ("Ice.Callback " + getEscapedParamName(op, "cb")) << epar << ';';
out << sp;
writeDocCommentAMI(out, op, InParam, "@param " + getEscapedParamName(op, "cb") + " A typed callback.");
@@ -2836,7 +2851,8 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << "public abstract ";
}
string cb = "Callback_" + name + "_" + opname + " " + getEscapedParamName(op, "cb");
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << cb << epar << ';';
+ out << getAbsolute("Ice.AsyncResult", package) << " begin_" << opname << spar << inParams << cb << epar
+ << ';';
out << sp;
writeDocCommentAMI(out, op, InParam,
@@ -2848,7 +2864,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- out << "Ice.AsyncResult begin_" << opname;
+ out << getAbsolute("Ice.AsyncResult", package) << " begin_" << opname;
writeParamList(out, getParamsAsyncLambda(op, package, false, true));
out << ';';
@@ -2862,7 +2878,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << retS << " end_" << opname << spar << outParams
- << "Ice.AsyncResult " + getEscapedParamName(op, "result") << epar << ';';
+ << (getAbsolute("Ice.AsyncResult", package) + " " + getEscapedParamName(op, "result")) << epar << ';';
}
}
}
@@ -3013,17 +3029,17 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface() && p->allOperations().size() == 0 && !p->isLocal())
{
out << sp;
- out << nl << "private static class _F implements Ice.ValueFactory";
+ out << nl << "private static class _F implements " << getAbsolute("Ice.ValueFactory", package);
out << sb;
- out << nl << "public Ice.Object create(String type)";
+ out << nl << "public " << getAbsolute("Ice.Object", package) << " create(String type)";
out << sb;
out << nl << "assert(type.equals(ice_staticId()));";
out << nl << "return new " << fixKwd(name) << "();";
out << eb;
out << eb;
- out << nl << "private static Ice.ValueFactory _factory = new _F();";
+ out << nl << "private static " << getAbsolute("Ice.ValueFactory", package) << " _factory = new _F();";
out << sp;
- out << nl << "public static Ice.ValueFactory" << nl << "ice_factory()";
+ out << nl << "public static " << getAbsolute("Ice.ValueFactory", package) << nl << "ice_factory()";
out << sb;
out << nl << "return _factory;";
out << eb;
@@ -3152,11 +3168,11 @@ Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
if(p->isLocal())
{
- out << "Ice.LocalException";
+ out << getAbsolute("Ice.LocalException", package);
}
else
{
- out << "Ice.UserException";
+ out << getAbsolute("Ice.UserException", package);
}
}
else
@@ -3423,19 +3439,19 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
out << sp;
- out << nl << "public Ice.SlicedData " << nl << "ice_getSlicedData()";
+ out << nl << "public " << getAbsolute("Ice.SlicedData", package) << " " << nl << "ice_getSlicedData()";
out << sb;
out << nl << "return _slicedData;";
out << eb;
- out << sp << nl << "public void" << nl << "_write(Ice.OutputStream ostr)";
+ out << sp << nl << "public void" << nl << "_write(" << getAbsolute("Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.startException(_slicedData);";
out << nl << "_writeImpl(ostr);";
out << nl << "ostr.endException();";
out << eb;
- out << sp << nl << "public void" << nl << "_read(Ice.InputStream istr)";
+ out << sp << nl << "public void" << nl << "_read(" << getAbsolute("Ice.InputStream", package) << " istr)";
out << sb;
out << nl << "istr.startException();";
out << nl << "_readImpl(istr);";
@@ -3443,7 +3459,8 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << eb;
}
- out << sp << nl << "protected void" << nl << "_writeImpl(Ice.OutputStream ostr_)";
+ out << sp << nl << "protected void" << nl << "_writeImpl(" << getAbsolute("Ice.OutputStream", package)
+ << " ostr_)";
out << sb;
out << nl << "ostr_.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -3472,7 +3489,8 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
writePatcher(out, package, classMembers, optionalMembers);
}
- out << sp << nl << "protected void" << nl << "_readImpl(Ice.InputStream istr_)";
+ out << sp << nl << "protected void" << nl << "_readImpl(" << getAbsolute("Ice.InputStream", package)
+ << " istr_)";
out << sb;
out << nl << "istr_.startSlice();";
iter = 0;
@@ -3509,7 +3527,7 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected Ice.SlicedData _slicedData;";
+ out << sp << nl << "protected " << getAbsolute("Ice.SlicedData", package) << " _slicedData;";
}
}
@@ -3780,7 +3798,8 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void" << nl << "ice_writeMembers(Ice.OutputStream ostr)";
+ out << sp << nl << "public void" << nl << "ice_writeMembers(" << getAbsolute("Ice.OutputStream", package)
+ << " ostr)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -3796,7 +3815,8 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
writePatcher(out, package, classMembers, DataMemberList());
}
- out << sp << nl << "public void" << nl << "ice_readMembers(Ice.InputStream istr)";
+ out << sp << nl << "public void" << nl << "ice_readMembers(" << getAbsolute("Ice.InputStream", package)
+ << " istr)";
out << sb;
iter = 0;
int patchIter = 0;
@@ -3807,7 +3827,8 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
}
out << eb;
- out << sp << nl << "static public void" << nl << "ice_write(Ice.OutputStream ostr, " << name << " v)";
+ out << sp << nl << "static public void" << nl << "ice_write(" << getAbsolute("Ice.OutputStream", package)
+ << " ostr, " << name << " v)";
out << sb;
out << nl << "if(v == null)";
out << sb;
@@ -3819,7 +3840,8 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
out << eb;
out << eb;
- out << sp << nl << "static public " << name << nl << "ice_read(Ice.InputStream istr)";
+ out << sp << nl << "static public " << name << nl << "ice_read(" << getAbsolute("Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << name << " v = new " << name << "();";
out << nl << "v.ice_readMembers(istr);";
@@ -4156,6 +4178,7 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
{
string name = fixKwd(p->name());
string absolute = getAbsolute(p);
+ string package = getPackage(p);
EnumeratorList enumerators = p->enumerators();
open(absolute, p->file());
@@ -4214,12 +4237,13 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void ice_write(Ice.OutputStream ostr)";
+ out << sp << nl << "public void ice_write(" << getAbsolute("Ice.OutputStream", package) << " ostr)";
out << sb;
out << nl << "ostr.writeEnum(_value, " << p->maxValue() << ");";
out << eb;
- out << sp << nl << "public static void ice_write(Ice.OutputStream ostr, " << name << " v)";
+ out << sp << nl << "public static void ice_write(" << getAbsolute("Ice.OutputStream", package) << " ostr, "
+ << name << " v)";
out << sb;
out << nl << "if(v == null)";
out << sb;
@@ -4232,7 +4256,8 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
out << eb;
out << eb;
- out << sp << nl << "public static " << name << " ice_read(Ice.InputStream istr)";
+ out << sp << nl << "public static " << name << " ice_read(" << getAbsolute("Ice.InputStream", package)
+ << " istr)";
out << sb;
out << nl << "int v = istr.readEnum(" << p->maxValue() << ");";
out << nl << "return validate(v);";
@@ -4243,7 +4268,8 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "final " << name << " e = valueOf(v);";
out << nl << "if(e == null)";
out << sb;
- out << nl << "throw new Ice.MarshalException(\"enumerator value \" + v + \" is out of range\");";
+ out << nl << "throw new " << getAbsolute("Ice.MarshalException", package)
+ << "(\"enumerator value \" + v + \" is out of range\");";
out << eb;
out << nl << "return e;";
out << eb;
@@ -4399,6 +4425,7 @@ Slice::GenCompat::HolderVisitor::writeHolder(const TypePtr& p)
ContainedPtr contained = ContainedPtr::dynamicCast(p);
assert(contained);
string name = contained->name();
+ string package = getPackage(contained);
string absolute = getAbsolute(contained, "", "", "Holder");
string file;
@@ -4422,10 +4449,10 @@ Slice::GenCompat::HolderVisitor::writeHolder(const TypePtr& p)
out << nl << "public final class " << name << "Holder";
if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
{
- out << " extends Ice.ObjectHolderBase<" << typeS << ">";
+ out << " extends " << getAbsolute("Ice.ObjectHolderBase", package) << "<" << typeS << ">";
}
else {
- out << " extends Ice.Holder<" << typeS << ">";
+ out << " extends " << getAbsolute("Ice.Holder", package) << "<" << typeS << ">";
}
out << sb;
if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl))
@@ -4439,7 +4466,7 @@ Slice::GenCompat::HolderVisitor::writeHolder(const TypePtr& p)
out << eb;
out << sp << nl << "public void";
- out << nl << "valueReady(Ice.Object v)";
+ out << nl << "valueReady(" << getAbsolute("Ice.Object", package) << " v)";
out << sb;
out << nl << "if(v == null || v instanceof " << typeS << ")";
out << sb;
@@ -4528,8 +4555,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
- out << nl << "public final class " << name << "PrxHelper extends Ice.ObjectPrxHelperBase implements " << name
- << "Prx";
+ out << nl << "public final class " << name << "PrxHelper extends "
+ << getAbsolute("Ice.ObjectPrxHelperBase", package) << " implements " << name << "Prx";
out << sb;
@@ -4573,7 +4600,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sp;
const string iresultParamName = getEscapedParamName(op, "iresult");
out << nl << "public " << retS << " end_" << op->name() << spar << outParams
- << "Ice.AsyncResult " + iresultParamName << epar;
+ << (getAbsolute("Ice.AsyncResult", package) + " " + iresultParamName) << epar;
writeThrowsClause(package, throws);
out << sb;
if(op->returnsData())
@@ -4607,15 +4634,15 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "throw ex_;";
out << eb;
}
- out << nl << "catch(Ice.UserException ex_)";
+ out << nl << "catch(" << getAbsolute("Ice.UserException", package) << " ex_)";
out << sb;
- out << nl << "throw new Ice.UnknownUserException(ex_.ice_id(), ex_);";
+ out << nl << "throw new " << getAbsolute("Ice.UnknownUserException", package) << "(ex_.ice_id(), ex_);";
out << eb;
out << eb;
if(ret || !outParams.empty())
{
- out << nl << "Ice.InputStream istr_ = result_.startReadParams();";
+ out << nl << getAbsolute("Ice.InputStream", package) << " istr_ = result_.startReadParams();";
const ParamDeclList paramList = op->parameters();
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
@@ -4714,18 +4741,18 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << eb;
if(!throws.empty())
{
- out << nl << "catch(Ice.UserException ex)";
+ out << nl << "catch(" << getAbsolute("Ice.UserException", package) << " ex)";
out << sb;
out << nl << "cb.exception(ex);";
out << nl << "return;";
out << eb;
}
- out << nl << "catch(Ice.LocalException ex)";
+ out << nl << "catch(" << getAbsolute("Ice.LocalException", package) << " ex)";
out << sb;
out << nl << "cb.exception(ex);";
out << nl << "return;";
out << eb;
- out << nl << "catch(Ice.SystemException ex)";
+ out << nl << "catch(" << getAbsolute("Ice.SystemException", package) << " ex)";
out << sb;
out << nl << "cb.exception(ex);";
out << nl << "return;";
@@ -4759,7 +4786,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"Raises a local exception if a communication error occurs.\n"
"@param obj The untyped proxy.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj)";
+ out << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", package) << " obj)";
out << sb;
out << nl << "return checkedCastImpl(obj, ice_staticId(), " << name << "Prx.class, "
<< name << "PrxHelper.class);";
@@ -4772,7 +4799,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, " << contextParam << ')';
+ out << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", package) << " obj, "
+ << contextParam << ')';
out << sb;
out << nl << "return checkedCastImpl(obj, context, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.class);";
@@ -4785,7 +4813,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param facet The name of the desired facet.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, String facet)";
+ out << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", package)
+ << " obj, String facet)";
out << sb;
out << nl << "return checkedCastImpl(obj, facet, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.class);";
@@ -4799,8 +4828,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"@param facet The name of the desired facet.\n"
"@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, String facet, "
- << contextParam << ')';
+ out << nl << "public static " << name << "Prx checkedCast(" << getAbsolute("Ice.ObjectPrx", package)
+ << " obj, String facet, " << contextParam << ')';
out << sb;
out << nl << "return checkedCastImpl(obj, facet, context, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.class);";
@@ -4811,7 +4840,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"Downcasts the given proxy to this type without contacting the remote server.\n"
"@param obj The untyped proxy.\n"
"@return A proxy for this type.");
- out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx obj)";
+ out << nl << "public static " << name << "Prx uncheckedCast(" << getAbsolute("Ice.ObjectPrx", package) << " obj)";
out << sb;
out << nl << "return uncheckedCastImpl(obj, " << name << "Prx.class, " << name
<< "PrxHelper.class);";
@@ -4823,7 +4852,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"@param obj The untyped proxy.\n"
"@param facet The name of the desired facet.\n"
"@return A proxy for this type.");
- out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx obj, String facet)";
+ out << nl << "public static " << name << "Prx uncheckedCast(" << getAbsolute("Ice.ObjectPrx", package)
+ << " obj, String facet)";
out << sb;
out << nl << "return uncheckedCastImpl(obj, facet, " << name << "Prx.class, " << name
<< "PrxHelper.class);";
@@ -4866,14 +4896,15 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return _ids[" << scopedPos << "];";
out << eb;
- out << sp << nl << "public static void write(Ice.OutputStream ostr, " << name << "Prx v)";
+ out << sp << nl << "public static void write(" << getAbsolute("Ice.OutputStream", package) << " ostr, " << name
+ << "Prx v)";
out << sb;
out << nl << "ostr.writeProxy(v);";
out << eb;
- out << sp << nl << "public static " << name << "Prx read(Ice.InputStream istr)";
+ out << sp << nl << "public static " << name << "Prx read(" << getAbsolute("Ice.InputStream", package) << " istr)";
out << sb;
- out << nl << "Ice.ObjectPrx proxy = istr.readProxy();";
+ out << nl << getAbsolute("Ice.ObjectPrx", package) << " proxy = istr.readProxy();";
out << nl << "if(proxy != null)";
out << sb;
out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
@@ -4984,7 +5015,8 @@ Slice::GenCompat::HelperVisitor::visitSequence(const SequencePtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream ostr, " << typeS << " v)";
+ out << nl << "public static void" << nl << "write(" << getAbsolute("Ice.OutputStream", package) << " ostr, "
+ << typeS << " v)";
out << sb;
iter = 0;
writeSequenceMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
@@ -4995,7 +5027,7 @@ Slice::GenCompat::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << nl << "read(Ice.InputStream istr)";
+ out << nl << "public static " << typeS << nl << "read(" << getAbsolute("Ice.InputStream", package) << " istr)";
out << sb;
out << nl << typeS << " v;";
iter = 0;
@@ -5036,14 +5068,15 @@ Slice::GenCompat::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream ostr, " << formalType << " v)";
+ out << nl << "public static void" << nl << "write(" << getAbsolute("Ice.OutputStream", package) << " ostr, "
+ << formalType << " v)";
out << sb;
iter = 0;
writeDictionaryMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
out << eb;
out << sp << nl << "public static " << formalType
- << nl << "read(Ice.InputStream istr)";
+ << nl << "read(" << getAbsolute("Ice.InputStream", package) << " istr)";
out << sb;
out << nl << formalType << " v;";
iter = 0;
@@ -5168,36 +5201,39 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
vector<string> inParams = getInOutParams(op, package, InParam, true, optionalMapping);
vector<string> inArgs = getInOutArgs(op, InParam);
const string callbackParamName = getEscapedParamName(op, "cb");
- const string callbackParam = "Ice.Callback " + callbackParamName;
+ const string callbackParam = getAbsolute("Ice.Callback", package) + " " + callbackParamName;
const ParamDeclList paramList = op->parameters();
int iter;
//
// Type-unsafe begin methods
//
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null"
+ << epar << ';';
out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << contextParam << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << "null" << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false"
+ << "null" << epar << ';';
out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << callbackParam << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << callbackParam << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << callbackParamName << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false"
+ << callbackParamName << epar << ';';
out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
- << callbackParam << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << contextParam << callbackParam << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << callbackParamName << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false"
+ << callbackParamName << epar << ';';
out << eb;
//
@@ -5214,32 +5250,32 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
string opClassName = getAbsolute(cl, package, "Callback_", '_' + op->name());
typeSafeCallbackParam = opClassName + " " + getEscapedParamName(op, "cb");
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << typeSafeCallbackParam
- << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << typeSafeCallbackParam << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << callbackParamName << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false"
+ << callbackParamName << epar << ';';
out << eb;
- out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
- << typeSafeCallbackParam << epar;
+ out << sp << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name() << spar
+ << inParams << contextParam << typeSafeCallbackParam << epar;
out << sb;
- out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << callbackParamName << epar
- << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false"
+ << callbackParamName << epar << ';';
out << eb;
//
// Async methods that accept Java 8 lambda callbacks.
//
out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, false, false, optionalMapping));
out << sb;
out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package) << epar << ';';
out << eb;
out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, false, true, optionalMapping));
out << sb;
out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, false, true) << epar
@@ -5247,14 +5283,14 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << eb;
out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, true, false, optionalMapping));
out << sb;
out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true) << epar << ';';
out << eb;
out << sp;
- out << nl << "public Ice.AsyncResult begin_" << op->name();
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, true, true, optionalMapping));
out << sb;
out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true, true) << epar
@@ -5269,7 +5305,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
copy(asyncParams.begin(), asyncParams.end(), back_inserter(params));
out << sp;
- out << nl << "private Ice.AsyncResult _iceI_begin_" << op->name();
+ out << nl << "private " << getAbsolute("Ice.AsyncResult", package) << " _iceI_begin_" << op->name();
writeParamList(out, params);
out << sb;
@@ -5327,7 +5363,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << eb;
out << sp;
- out << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
+ out << nl << "public final void _iceCompleted(" << getAbsolute("Ice.AsyncResult", package) << " result)";
out << sb;
out << nl << p->name() << "PrxHelper._iceI_" << op->name() << "_completed(this, result);";
out << eb;
@@ -5356,7 +5392,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
"new " + baseClass + "(responseCb, userExceptionCb, exceptionCb, sentCb)");
out.inc();
out << sb;
- out << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
+ out << nl << "public final void _iceCompleted(" << getAbsolute("Ice.AsyncResult", package) << " result)";
out << sb;
out << nl << p->name() << "PrxHelper._iceI_" << op->name() << "_completed(this, result);";
out << eb;
@@ -5377,7 +5413,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
params.push_back("IceInternal.CallbackBase cb");
out << sp;
- out << nl << "private Ice.AsyncResult _iceI_begin_" << op->name();
+ out << nl << "private " << getAbsolute("Ice.AsyncResult", package) << " _iceI_begin_" << op->name();
writeParamList(out, params);
out << sb;
if(op->returnsData())
@@ -5395,7 +5431,8 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
iter = 0;
if(!inArgs.empty())
{
- out << nl << "Ice.OutputStream ostr = result.startWriteParams(" << opFormatTypeToString(op) << ");";
+ out << nl << getAbsolute("Ice.OutputStream", package) << " ostr = result.startWriteParams("
+ << opFormatTypeToString(op) << ");";
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
{
@@ -5418,7 +5455,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << nl << "result.invoke();";
out << eb;
- out << nl << "catch(Ice.Exception ex)";
+ out << nl << "catch(" << getAbsolute("Ice.Exception", package) << " ex)";
out << sb;
out << nl << "result.abort(ex);";
out << eb;
@@ -5457,7 +5494,7 @@ Slice::GenCompat::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "public interface " << name << "Prx extends ";
if(bases.empty())
{
- out << "Ice.ObjectPrx";
+ out << getAbsolute("Ice.ObjectPrx", package);
}
else
{
@@ -5558,16 +5595,18 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
// Start with the type-unsafe begin methods.
//
vector<string> inParams = getInOutParams(p, package, InParam, true, true);
- string callbackParam = "Ice.Callback " + getEscapedParamName(p, "cb");
+ string callbackParam = getAbsolute("Ice.Callback", package) + " " + getEscapedParamName(p, "cb");
string callbackDoc = "@param cb The asynchronous callback object.";
out << sp;
writeDocCommentAMI(out, p, InParam);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << epar << ';';
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams
+ << epar << ';';
out << sp;
writeDocCommentAMI(out, p, InParam, contextDoc);
- out << nl << "public Ice.AsyncResult begin_" << p->name() << spar << inParams << contextParam << epar << ';';
+ out << nl << "public " << getAbsolute("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams
+ << contextParam << epar << ';';
out << sp;
writeDocCommentAMI(out, p, InParam, callbackDoc);
@@ -6406,7 +6445,7 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
{
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
-
+ const string package = getPackage(cl);
if(cl->isLocal())
{
return;
@@ -6447,7 +6486,7 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
writeDocCommentOp(out, p);
out << sp << nl << "public interface " << ("_Callback_" + cl->name()) << '_' << name
- << " extends " << (throws.empty() ? "Ice.TwowayCallback" : "Ice.TwowayCallbackUE");
+ << " extends " << getAbsolute(throws.empty() ? "Ice.TwowayCallback" : "Ice.TwowayCallbackUE", package);
out << sb;
out << nl << "public void response" << spar << params << epar << ';';
out << eb;
@@ -6472,7 +6511,8 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
out.dec();
out << sb;
- out << sp << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
+ out << sp << nl << "public final void _iceCompleted(" << getAbsolute("Ice.AsyncResult", package)
+ << " result)";
out << sb;
out << nl << cl->name() << "PrxHelper._iceI_" << p->name() << "_completed(this, result);";
out << eb;
@@ -6481,7 +6521,7 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
}
else
{
- out << " extends Ice.OnewayCallback";
+ out << " extends " << getAbsolute("Ice.OnewayCallback", package);
out << sb;
out << eb;
}
@@ -6507,7 +6547,7 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
writeDocCommentOp(out, p);
out << sp << nl << "public interface " << classNameAMD << '_' << name;
- out << " extends Ice.AMDCallback";
+ out << " extends " << getAbsolute("Ice.AMDCallback", package);
out << sb;
out << sp;
writeDocCommentAsync(out, p, OutParam);
@@ -6552,7 +6592,7 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
iter = 0;
if(ret || !outParams.empty())
{
- out << nl << "Ice.OutputStream ostr_ = this.startWriteParams();";
+ out << nl << getAbsolute("Ice.OutputStream", package) << " ostr_ = this.startWriteParams();";
writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false, "ret", false);
if(p->returnsClasses(false))
{
diff --git a/csharp/test/Ice/optional/Test.ice b/csharp/test/Ice/optional/Test.ice
index aa6f87fd318..970a2331150 100644
--- a/csharp/test/Ice/optional/Test.ice
+++ b/csharp/test/Ice/optional/Test.ice
@@ -62,9 +62,7 @@ sequence<VarStruct> VarStructSeq;
sequence<OneOptional> OneOptionalSeq;
sequence<OneOptional*> OneOptionalPrxSeq;
-#if !defined(COMPACT) && !defined(SILVERLIGHT)
["clr:serializable:Test.SerializableClass"]
-#endif
sequence<byte> Serializable;
dictionary<int, int> IntIntDict;
diff --git a/csharp/test/Ice/optional/TestAMD.ice b/csharp/test/Ice/optional/TestAMD.ice
index 7a2eae43cb3..4913e2c9f2f 100644
--- a/csharp/test/Ice/optional/TestAMD.ice
+++ b/csharp/test/Ice/optional/TestAMD.ice
@@ -62,9 +62,7 @@ sequence<VarStruct> VarStructSeq;
sequence<OneOptional> OneOptionalSeq;
sequence<OneOptional*> OneOptionalPrxSeq;
-#if !defined(COMPACT) && !defined(SILVERLIGHT)
["clr:serializable:Test.SerializableClass"]
-#endif
sequence<byte> Serializable;
dictionary<int, int> IntIntDict;