summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CPlusPlusUtil.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-05-03 20:14:31 -0400
committerBernard Normier <bernard@zeroc.com>2017-05-03 20:14:31 -0400
commit34156adcd7d7a1cc458260aabbd6b1857dab84b7 (patch)
tree7379294e035ba71def6df3131ee7edc882258505 /cpp/src/Slice/CPlusPlusUtil.cpp
parentMore makefile fixes (diff)
downloadice-34156adcd7d7a1cc458260aabbd6b1857dab84b7.tar.bz2
ice-34156adcd7d7a1cc458260aabbd6b1857dab84b7.tar.xz
ice-34156adcd7d7a1cc458260aabbd6b1857dab84b7.zip
Generate alias for "delegate" in C++11 (ICE-7859)
Diffstat (limited to 'cpp/src/Slice/CPlusPlusUtil.cpp')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp40
1 files changed, 4 insertions, 36 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 30f184c17d4..a6e0408189f 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -697,11 +697,11 @@ Slice::typeToString(const TypePtr& type, const StringList& metaData, int typeCtx
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return classDefToDelegateString(cl->definition());
+ return fixKwd(cl->scoped());
}
else if(cl->isInterface() && !cl->isLocal())
{
- return "std::shared_ptr<::Ice::Value>";
+ return "::std::shared_ptr<::Ice::Value>";
}
else
{
@@ -886,7 +886,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const StringList& m
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return classDefToDelegateString(cl->definition(), typeCtx);
+ return fixKwd(cl->scoped());
}
else if(cl->isInterface() && !cl->isLocal())
{
@@ -1047,7 +1047,7 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const StringList&
{
if(cl->definition() && cl->definition()->isDelegate())
{
- return classDefToDelegateString(cl->definition(), typeCtx) + "&";
+ return fixKwd(cl->scoped()) + "&";
}
else if(cl->isInterface() && !cl->isLocal())
{
@@ -1800,35 +1800,3 @@ Slice::getDataMemberRef(const DataMemberPtr& p)
return "(*" + name + ")";
}
}
-
-string
-Slice::classDefToDelegateString(const ClassDefPtr& cl, int typeCtx)
-{
- assert(cl->isDelegate());
-
- // A delegate only has one operation
- OperationPtr op = cl->allOperations().front();
-
- TypePtr ret = op->returnType();
- string retS = returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), typeCtx);
-
- string t = "::std::function<" + retS + "(";
-
- ParamDeclList paramList = cl->allOperations().front()->parameters();
- for(ParamDeclList::iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if((*q)->isOutParam())
- {
- t += outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
- }
- else
- {
- t += inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
- }
-
- t += distance(q, paramList.end()) == 1 ? "" : ", ";
- }
-
- t += ")>";
- return t;
-}