summaryrefslogtreecommitdiff
path: root/cpp/src/slice2objc/Gen.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2015-12-23 14:48:40 -0500
committerJoe George <joe@zeroc.com>2015-12-24 10:01:11 -0500
commite84da5f580821cae8dab292e19cc1296c07a8ed5 (patch)
tree1e8783c55c7dccd5adda2b87b47b8a7c118a1147 /cpp/src/slice2objc/Gen.cpp
parentFixes related to EnableSharedFromThis (diff)
downloadice-e84da5f580821cae8dab292e19cc1296c07a8ed5.tar.bz2
ice-e84da5f580821cae8dab292e19cc1296c07a8ed5.tar.xz
ice-e84da5f580821cae8dab292e19cc1296c07a8ed5.zip
ICE-6898 - "Delegate" functions for ACM callbacks
- Add delegate local interfaces CloseCallback and HeartbeatCallback and remove ConnectionCallback. - Replace setCallback by setCloseCallback and setHeartbeatCallback
Diffstat (limited to 'cpp/src/slice2objc/Gen.cpp')
-rw-r--r--cpp/src/slice2objc/Gen.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp
index eae190d4a5f..f31146e05ab 100644
--- a/cpp/src/slice2objc/Gen.cpp
+++ b/cpp/src/slice2objc/Gen.cpp
@@ -450,6 +450,32 @@ Slice::ObjCVisitor::getParams(const OperationPtr& op) const
}
string
+Slice::ObjCVisitor::getBlockParams(const OperationPtr& op) const
+{
+ string result;
+ ParamDeclList paramList = op->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ TypePtr type = (*q)->type();
+ string typeString;
+ if((*q)->isOutParam())
+ {
+ typeString = outTypeToString(type, (*q)->optional(), false, true);
+ }
+ else
+ {
+ typeString = inTypeToString(type, (*q)->optional());
+ }
+ if(q != paramList.begin())
+ {
+ result += " " + getParamId(*q);
+ }
+ result += "(" + typeString + ")";
+ }
+ return result;
+}
+
+string
Slice::ObjCVisitor::getMarshalParams(const OperationPtr& op) const
{
ParamDeclList paramList = op->parameters();
@@ -868,6 +894,11 @@ Slice::Gen::ObjectDeclVisitor::ObjectDeclVisitor(Output& H, Output& M, const str
void
Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p)
{
+ if(p->definition() && p->definition()->isDelegate())
+ {
+ return;
+ }
+
_H << sp;
if(!p->isLocal() || !p->isInterface())
{
@@ -925,7 +956,16 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
string name = fixName(p);
ClassList bases = p->bases();
+ if(p->isDelegate())
+ {
+ OperationPtr o = p->allOperations().front();
+ _H << sp << nl << "typedef " << typeToString(o->returnType());
+ _H << " (^" << name << ")" << getBlockParams(o) << ";";
+ return false;
+ }
+
_H << sp << nl << _dllExport << "@protocol " << name;
+
if(!bases.empty())
{
_H << " <";