Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 114 lines (85 sloc) 5.612 kb
6a04a24 @tomaz Implemented methods and properties parsing.
authored
1 //
2 // GBMethodArgument.h
3 // appledoc
4 //
5 // Created by Tomaz Kragelj on 26.7.10.
6 // Copyright (C) 2010, Gentle Bytes. All rights reserved.
7 //
8
9 #import <Foundation/Foundation.h>
10
11 /** Defines a single method argument. */
12 @interface GBMethodArgument : NSObject {
13 @private
14 NSString *_argumentName;
15 NSArray *_argumentTypes;
16 NSString *_argumentVar;
85ff32d @tomaz Implemented variable arguments parsing.
authored
17 NSArray *_terminationMacros;
6a04a24 @tomaz Implemented methods and properties parsing.
authored
18 }
19
20 ///---------------------------------------------------------------------------------------
21 /// @name Initialization & disposal
22 ///---------------------------------------------------------------------------------------
23
24 /** Returns autoreleased method argument with the given parameters.
25
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
26 Internally this sends allocated instance `initWithName:types:var:variableArg:terminationMacros:` message, so check it's documentation for details.
85ff32d @tomaz Implemented variable arguments parsing.
authored
27
a050b89 @tomaz Fixed code documentation thanks to warnings from the appledoc...
authored
28 @param name The name of the method argument, part of method selector.
85ff32d @tomaz Implemented variable arguments parsing.
authored
29 @param types Array of argument types in the form of `NSString` instances or `nil` if not used.
30 @param var Array of arguments in the form of `GBMethodArgument` instances or `nil` if not used.
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
31 @param variableArg whether the last named parameter accepts indefinite number of arguments
32 @param macros Array of termination macros
85ff32d @tomaz Implemented variable arguments parsing.
authored
33 @return Returns initialized object or `nil` if initialization fails.
34 @exception NSException Thrown if either of the given parameters is invalid.
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
35 @see initWithName:types:var:variableArg:terminationMacros:
85ff32d @tomaz Implemented variable arguments parsing.
authored
36 */
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
37 + (id)methodArgumentWithName:(NSString *)name types:(NSArray *)types var:(NSString *)var variableArg:(BOOL)variableArg terminationMacros:(NSArray *)macros;
85ff32d @tomaz Implemented variable arguments parsing.
authored
38
39 /** Returns autoreleased method argument with the given parameters.
40
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
41 Internally this sends allocated instance `initWithName:types:var:variableArg:terminationMacros:` message, so check it's documentation for details.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
42
a050b89 @tomaz Fixed code documentation thanks to warnings from the appledoc...
authored
43 @param name The name of the method argument, part of method selector.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
44 @param types Array of argument types in the form of `NSString` instances or `nil` if not used.
45 @param var Array of arguments in the form of `GBMethodArgument` instances or `nil` if not used.
46 @return Returns initialized object or `nil` if initialization fails.
47 @exception NSException Thrown if either of the given parameters is invalid.
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
48 @see initWithName:types:var:variableArg:terminationMacros:
6a04a24 @tomaz Implemented methods and properties parsing.
authored
49 */
50 + (id)methodArgumentWithName:(NSString *)name types:(NSArray *)types var:(NSString *)var;
51
52 /** Returns autoreleased type-less method argument.
53
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
54 Internally this sends allocated instance `initWithName:types:var:variableArg:terminationMacros:` message, so check it's documentation for details.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
55
a050b89 @tomaz Fixed code documentation thanks to warnings from the appledoc...
authored
56 @param name The name of the method argument, part of method selector.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
57 @return Returns initialized object or `nil` if initialization fails.
58 @exception NSException Thrown if the argument is `nil` or empty string.
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
59 @see initWithName:types:var:variableArg:terminationMacros:
6a04a24 @tomaz Implemented methods and properties parsing.
authored
60 */
61 + (id)methodArgumentWithName:(NSString *)name;
62
63 /** Initializes method argument with the given parameters.
64
0bb1c7d @tomaz Enabled line wrapping and updated comments to fit better.
authored
65 This is the designated initializer. You can either use it to specify method argument with all parameters, in such case you must supply all parameters, or you can use it to specify method argument without type. In such case you should set types and var to `nil`. If the argument is variable arg type, you should pass in optional termination macros or empty array if no termination macro is used. To specify standard argument, pass `nil` for termination macros instead!
6a04a24 @tomaz Implemented methods and properties parsing.
authored
66
0bb1c7d @tomaz Enabled line wrapping and updated comments to fit better.
authored
67 @warning *Note:* If you use the selector for type-less argument, both initializer parameters - types and var must be `nil`. If only one of these is `nil`, exception is thrown.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
68
69 @param argument The name of the method argument, part of method selector.
70 @param types Array of argument types in the form of `NSString` instances or `nil` if not used.
71 @param var Array of arguments in the form of `GBMethodArgument` instances or `nil` if not used.
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
72 @param variableArg whether the last named parameter accepts indefinite number of arguments
73 @param macros Array of termination macros
6a04a24 @tomaz Implemented methods and properties parsing.
authored
74 @return Returns initialized object or `nil` if initialization fails.
75 @exception NSException Thrown if either of the given parameters is invalid.
76 */
c463617 @groue [GBMethodArgument isVariableArg] is no longer inferred from termination ...
groue authored
77 - (id)initWithName:(NSString *)argument types:(NSArray *)types var:(NSString *)var variableArg:(BOOL)variableArg terminationMacros:(NSArray *)macros;
6a04a24 @tomaz Implemented methods and properties parsing.
authored
78
79 ///---------------------------------------------------------------------------------------
80 /// @name Argument data
81 ///---------------------------------------------------------------------------------------
82
83 /** The name of the argument.
84
85 Argument is part of method selector and defines -(result)*arg*:(type)var part of method.
86 */
87 @property (readonly) NSString *argumentName;
88
89 /** Array of argument types.
90
7d6a323 @tomaz Copied all the changes from the old generating branch.
authored
91 Types array define -(result)arg:(*type*)var part of method. If argument doesn't use types, this is empty array.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
92 */
93 @property (readonly) NSArray *argumentTypes;
94
95 /** The name of the argument variable.
96
85ff32d @tomaz Implemented variable arguments parsing.
authored
97 Argument variable defines -(result)arg:(type)*var* part of method. If argument doesn't use variable, this is `nil`.
6a04a24 @tomaz Implemented methods and properties parsing.
authored
98 */
e156292 @tomaz Fixed merging method arguments with different var names.
authored
99 @property (copy) NSString *argumentVar;
6a04a24 @tomaz Implemented methods and properties parsing.
authored
100
85ff32d @tomaz Implemented variable arguments parsing.
authored
101 /** Array of variable arguments termination macros.
102
0bb1c7d @tomaz Enabled line wrapping and updated comments to fit better.
authored
103 Termination macros array define -(result)arg:(type)var,...*macros* part of method. If argument isn't variable or doesn't have termination macros, this is `nil`.
85ff32d @tomaz Implemented variable arguments parsing.
authored
104 */
105 @property (readonly) NSArray *terminationMacros;
106
6a04a24 @tomaz Implemented methods and properties parsing.
authored
107 /** Specifies whether the argument is typed or not. The argument is typed if it uses type and var. */
108 @property (readonly) BOOL isTyped;
109
85ff32d @tomaz Implemented variable arguments parsing.
authored
110 /** Specifies whether the argument is variable arg or not. */
111 @property (assign) BOOL isVariableArg;
112
6a04a24 @tomaz Implemented methods and properties parsing.
authored
113 @end
Something went wrong with that request. Please try again.