summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp61
1 files changed, 37 insertions, 24 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index eab9a81b8cb..bab73d8a16e 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1880,20 +1880,11 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
ContainerPtr container = p->container();
string name = fixKwd(p->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());
- }
-
writeDocSummary(H, p);
+ //
+ // Use an empty scope to get full qualified names from calls to typeToString.
+ //
+ const string scope = "";
H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), _useWstring) << ' ' << name << ';';
}
@@ -3910,7 +3901,11 @@ Slice::Gen::ObjectVisitor::emitDataMember(const DataMemberPtr& p)
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
int typeContext = cl->isLocal() ? TypeContextLocal | _useWstring : _useWstring;
writeDocSummary(H, p);
- H << nl << typeToString(p->type(), p->optional(), fixKwd(cl->scope()), p->getMetaData(), typeContext) << ' '
+ //
+ // Use an empty scope to get full qualified names from calls to typeToString.
+ //
+ const string scope = "";
+ H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), typeContext) << ' '
<< name << ';';
}
@@ -4101,7 +4096,10 @@ void
Slice::Gen::ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
DataMemberList allDataMembers = p->allDataMembers();
- string scope = fixKwd(p->scope());
+ //
+ // Use an empty scope to get full qualified names from calls to typeToString.
+ //
+ const string scope = "";
if(!allDataMembers.empty())
{
@@ -6447,7 +6445,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << nl << " * Obtains a tuple containing all of the exception's data members.";
H << nl << " * @return The data members in a tuple.";
H << nl << " */";
- writeIceTuple(H, scope, p->allDataMembers(), _useWstring);
+ writeIceTuple(H, p->allDataMembers(), _useWstring);
H << sp;
H << nl << "/**";
@@ -6607,7 +6605,7 @@ Slice::Gen::Cpp11TypesVisitor::visitStructEnd(const StructPtr& p)
H << nl << " * Obtains a tuple containing all of the struct's data members.";
H << nl << " * @return The data members in a tuple.";
H << nl << " */";
- writeIceTuple(H, fixKwd(p->scope()), p->dataMembers(), _useWstring);
+ writeIceTuple(H, p->dataMembers(), _useWstring);
H << eb << ';';
_useWstring = resetUseWstring(_useWstringHist);
}
@@ -6615,7 +6613,10 @@ Slice::Gen::Cpp11TypesVisitor::visitStructEnd(const StructPtr& p)
void
Slice::Gen::Cpp11TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
- string scope = fixKwd(ContainedPtr::dynamicCast(p->container())->scope());
+ //
+ // Use an empty scope to get full qualified names from calls to typeToString.
+ //
+ const string scope = "";
string name = fixKwd(p->name());
writeDocSummary(H, p);
H << nl << typeToString(p->type(), p->optional(), scope, p->getMetaData(), _useWstring | TypeContextCpp11)
@@ -6877,7 +6878,10 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
if(ret)
{
- futureOutParams.push_back(typeToString(ret, retIsOpt, clScope, p->getMetaData(), _useWstring |
+ //
+ // Use empty scope to get full qualified names in types used with future declarations.
+ //
+ futureOutParams.push_back(typeToString(ret, retIsOpt, "", p->getMetaData(), _useWstring |
TypeContextCpp11));
lambdaOutParams.push_back(typeToString(ret, retIsOpt, clScope, p->getMetaData(), _useWstring |
@@ -6893,7 +6897,10 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
if((*q)->isOutParam())
{
- futureOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), clScope, metaData,
+ //
+ // Use empty scope to get full qualified names in types used with future declarations.
+ //
+ futureOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), "", metaData,
_useWstring | TypeContextCpp11));
lambdaOutParams.push_back(typeToString((*q)->type(), (*q)->optional(), clScope, metaData,
_useWstring | TypeContextInParam | TypeContextCpp11));
@@ -6980,7 +6987,7 @@ Slice::Gen::Cpp11ProxyVisitor::visitOperation(const OperationPtr& p)
H << "auto _result = ";
}
- H << "_makePromiseOutgoing<" << getUnqualified(futureT, cl->scoped()) << ">";
+ H << "_makePromiseOutgoing<" << futureT << ">";
H << spar << "true, this" << "&" + cl->name() + "Prx::_iceI_" + name;
for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q)
@@ -7391,7 +7398,10 @@ 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());
+ //
+ // Use empty scope to get full qualified names in types used with future declarations.
+ //
+ string scope = "";
if(cl->isLocal())
{
typeContext |= TypeContextLocal;
@@ -8512,7 +8522,7 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p)
H << nl << " * Obtains a tuple containing all of the value's data members.";
H << nl << " * @return The data members in a tuple.";
H << nl << " */";
- writeIceTuple(H, fixKwd(p->scope()), p->allDataMembers(), _useWstring);
+ writeIceTuple(H, p->allDataMembers(), _useWstring);
H << sp;
H << nl << "/**";
@@ -8751,7 +8761,10 @@ void
Slice::Gen::Cpp11ObjectVisitor::emitOneShotConstructor(const ClassDefPtr& p)
{
DataMemberList allDataMembers = p->allDataMembers();
- string scope = fixKwd(p->scope());
+ //
+ // Use empty scope to get full qualified names in types used with future declarations.
+ //
+ string scope = "";
if(!allDataMembers.empty())
{
vector<string> allParamDecls;