diff options
author | Joe George <joe@zeroc.com> | 2015-12-23 14:48:40 -0500 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2015-12-24 10:01:11 -0500 |
commit | e84da5f580821cae8dab292e19cc1296c07a8ed5 (patch) | |
tree | 1e8783c55c7dccd5adda2b87b47b8a7c118a1147 /cpp/src/slice2objc | |
parent | Fixes related to EnableSharedFromThis (diff) | |
download | ice-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')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 40 | ||||
-rw-r--r-- | cpp/src/slice2objc/Gen.h | 1 |
2 files changed, 41 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 << " <"; diff --git a/cpp/src/slice2objc/Gen.h b/cpp/src/slice2objc/Gen.h index 70a42ad37f7..ec9657d21c5 100644 --- a/cpp/src/slice2objc/Gen.h +++ b/cpp/src/slice2objc/Gen.h @@ -30,6 +30,7 @@ protected: virtual std::string getName(const OperationPtr&) const; virtual std::string getSelector(const OperationPtr&) const; virtual std::string getParams(const OperationPtr&) const; + virtual std::string getBlockParams(const OperationPtr&) const; virtual std::string getMarshalParams(const OperationPtr&) const; virtual std::string getUnmarshalParams(const OperationPtr&) const; virtual std::string getServerParams(const OperationPtr&) const; |