Commit 3e95fe26 authored by j4cbo's avatar j4cbo

Merge pull request #42 from mknejp/fix/objcpp-proxy-ns

Properly handle namespaces in +o proxy code generation
parents 814ea357 3a58d924
...@@ -319,7 +319,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -319,7 +319,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
refs.privHeader.add("#import " + q("DJIObjcWrapperCache+Private.h")) refs.privHeader.add("#import " + q("DJIObjcWrapperCache+Private.h"))
refs.body.add("!#import " + q(privateHeaderName(objcExtName))) refs.body.add("!#import " + q(privateHeaderName(objcExtName)))
writeObjcFile(privateHeaderName(objcExtName), origin, refs.privHeader, w => { writeObjcFile(privateHeaderName(objcExtName), origin, refs.privHeader, w => {
w.wl(s"namespace ${spec.objcppNamespace}").braced { wrapNamespace(w, Some(spec.objcppNamespace), (w: IndentWriter) => {
w.wl(s"class $objcExtSelf final : public ${withNs(spec.cppNamespace, idCpp.ty(ident))}").bracedSemi { w.wl(s"class $objcExtSelf final : public ${withNs(spec.cppNamespace, idCpp.ty(ident))}").bracedSemi {
w.wl("public:") w.wl("public:")
w.wl(s"id <$self> objcRef;") w.wl(s"id <$self> objcRef;")
...@@ -335,11 +335,11 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -335,11 +335,11 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
w.wl("private:") w.wl("private:")
w.wl(s"$objcExtSelf () {};") w.wl(s"$objcExtSelf () {};")
} }
} })
}) })
writeObjcFile(bodyName(objcExtName), origin, refs.body, w => { writeObjcFile(bodyName(objcExtName), origin, refs.body, w => {
w.wl(s"namespace ${spec.objcppNamespace}").braced { wrapNamespace(w, Some(spec.objcppNamespace), (w: IndentWriter) => {
w.wl(s"$objcExtSelf::$objcExtSelf (id objcRef)").braced { w.wl(s"$objcExtSelf::$objcExtSelf (id objcRef)").braced {
w.wl(s"assert([[objcRef class] conformsToProtocol:@protocol($self)]);") w.wl(s"assert([[objcRef class] conformsToProtocol:@protocol($self)]);")
w.wl("this->objcRef = objcRef;") w.wl("this->objcRef = objcRef;")
...@@ -377,7 +377,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) { ...@@ -377,7 +377,7 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
} }
} }
} }
} })
}) })
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment