contrib/objcwrapper: generate minimal doc above generated properties
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 1 Sep 2015 15:37:09 +0000 (11:37 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 3 Sep 2015 14:32:31 +0000 (10:32 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/objcwrapper/src/objc_generator.nit
contrib/objcwrapper/src/objc_model.nit

index d50795b..408d731 100644 (file)
@@ -195,6 +195,7 @@ end
 
                file.write """
 
+{{{attribute.doc}}}
 {{{c}}}        fun {{{nit_attr_name}}}: {{{nit_attr_type}}} in "ObjC" `{
 {{{c}}}                return [self {{{attribute.name}}}];
 {{{c}}}        `}
@@ -210,6 +211,7 @@ end
 
                file.write """
 
+{{{attribute.doc}}}
 {{{c}}}        fun {{{nit_attr_name}}}=(value: {{{nit_attr_type}}}) in "ObjC" `{
 {{{c}}}                return self.{{{attribute.name}}} = value;
 {{{c}}}        `}
@@ -256,6 +258,7 @@ end
 
                file.write """
 
+{{{method.doc}}}
 {{{c}}}{{{fun_keyword}}} {{{name}}}{{{params_with_par}}}{{{ret}}} in "ObjC" `{
 """
        end
@@ -324,10 +327,23 @@ redef class ObjcProperty
        private fun comment_str: String do if is_commented then
                return "#"
        else return ""
+
+       # Full documentation to be generated for the Nit code
+       private fun doc: String is abstract
 end
 
 redef class ObjcMethod
        private fun indent: String do return if is_class_property then "" else "\t"
 
        redef fun comment_str do return indent + super
+
+       redef fun doc
+       do
+               var recv = if is_class_property then objc_class.name else "self"
+               return "{indent}# Wraps: `[{recv} {params.join(" ")}]`"
+       end
+end
+
+redef class ObjcAttribute
+       redef fun doc do return "\t# Wraps: `{objc_class.name}.{name}`"
 end
index 21a34fa..3777f07 100644 (file)
@@ -119,4 +119,10 @@ class ObjcParam
 
        # Is this a parameter with only a `name`?
        var is_single = false is writable
+
+       redef fun to_s
+       do
+               if is_single then return name
+               return "{name}:({return_type}){variable_name}"
+       end
 end