types["NSUInteger"] = "Int"
types["BOOL"] = "Bool"
types["id"] = "NSObject"
+ types["constid"] = "NSObject"
+ types["SEL"] = "NSObject"
+ types["void"] = "Pointer"
+
return types
end
end
+redef class ObjcModel
+ redef fun knows_type(objc_type) do return super or
+ nit_to_java_types.keys.has(objc_type)
+end
+
+# Wrapper generator
class CodeGenerator
+
+ # `ObjcModel` to wrap
+ var model: ObjcModel
+
# Generate Nit code to wrap `classes`
- fun generate(classes: Array[ObjcClass])
+ fun generate
do
+ var classes = model.classes
+
# Open specified path or stdin
var file
var path = opt_output.value
# Methods
for method in classe.methods do
+ if not model.knows_all_types(method) then method.is_commented = true
if not opt_init_as_methods.value and method.is_init then continue
for method in classe.methods do
if not method.is_init then continue
+ if not model.knows_all_types(method) then method.is_commented = true
+
write_method_signature(method, file)
write_objc_init_call(classe.name, method, file)
private fun write_attribute(attribute: ObjcAttribute, file: Writer)
do
+ if not model.knows_type(attribute.return_type) then attribute.is_commented = true
+
write_attribute_getter(attribute, file)
# TODO write_attribute_setter if there is no `readonly` annotation
end