diff options
Diffstat (limited to 'cpp/src/slice2objc/Gen.cpp')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 283efc935e3..dbab21cbb66 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 << " <"; @@ -1109,6 +1149,7 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) TypePtr returnType = p->returnType(); string retString; string params; + if(cl->isLocal()) { retString = outTypeToString(returnType, p->returnIsOptional()); @@ -1134,9 +1175,9 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) _H << ";"; } - if(cl->isLocal() && (cl->hasMetaData("async") || p->hasMetaData("async"))) + if(cl->isLocal() && (cl->hasMetaData("async-oneway") || p->hasMetaData("async-oneway"))) { - // TODO: add supports for parameters when needed. + // TODO: add support for parameters when needed. _H << nl << "-(id<ICEAsyncResult>) begin_" << name << ";"; _H << nl << "-(id<ICEAsyncResult>) begin_" << name << ":(void(^)(ICEException*))exception;"; _H << nl << "-(id<ICEAsyncResult>) begin_" << name @@ -1242,12 +1283,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) } // - // ice_name + // ice_id // - _H << nl << "-(NSString *) ice_name;"; - _M << sp << nl << "-(NSString *) ice_name"; + _H << nl << "-(NSString *) ice_id;"; + _M << sp << nl << "-(NSString *) ice_id"; _M << sb; - _M << nl << "return @\"" << p->scoped().substr(2) << "\";"; + _M << nl << "return @\"" << p->scoped() << "\";"; _M << eb; ContainerType ct = p->isLocal() ? LocalException : Other; @@ -3048,7 +3089,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) _M << sb; _M << nl << "[is_ endEncapsulation];"; _M << nl << "@throw [ICEUnknownUserException unknownUserException:__FILE__ line:__LINE__ " - << "unknown:[ex_ ice_name]];"; + << "unknown:[ex_ ice_id]];"; _M << eb; _M << eb; |