contrib/objcwrapper: add some doc and license
[nit.git] / contrib / objcwrapper / src / objc_model.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Model of the parsed Objective-C files
16 module objc_model
17
18 # Model of all the analyzed Objective-C classes
19 class ObjcModel
20 # All analyzed classes
21 var classes = new Array[ObjcClass]
22 end
23
24 # Objective-C class
25 class ObjcClass
26 # Name of the super classes
27 var super_names = new Array[String]
28
29 # Name of this Objective-C class
30 var name: String
31
32 # Attributes of this Objective-C class
33 var attributes = new Array[ObjcAttribute]
34
35 # Methods of this Objective-C class
36 var methods = new Array[ObjcMethod]
37 end
38
39 # Method of an `ObjcClass`
40 class ObjcMethod
41 super Property
42
43 # Scope: '+' for a static class method, and '-' for an instance method
44 var scope: Char is noinit, writable
45
46 # Parameters of the method
47 var params = new Array[Param]
48
49 # Return type as a `String`
50 var return_type: String is noinit, writable
51 end
52
53 # Attribute of an `ObjcClass`
54 class ObjcAttribute
55 super Property
56
57 # Name of this attribute
58 var name: String is noinit, writable
59
60 # Type of this attribute
61 var return_type: String is noinit, writable
62 end
63
64 # Property of an `ObjcClass`
65 class Property
66 # Is this property to be commented out?
67 var is_commented = false is writable
68 end
69
70 # Parameter of an `ObjcMethod`
71 class Param
72 # Parameter name, used by the caller (e.g. `withObject` in `withObject: (NSObject*) obj`)
73 var name: String is noinit, writable
74
75 # Type of the parameter name
76 var return_type: String is noinit, writable
77
78 # Argument name, used within the body (e.g. `obj` in `withObject: (NSObject*) obj`)
79 var variable_name: String is noinit, writable
80
81 # Is this a primitive array? with at least one `[]`.
82 var is_table = false is writable
83
84 # Is this a pointer type?
85 var is_pointer = false is writable
86
87 # Is this a parameter with only a `name`?
88 var is_single = false is writable
89 end