ObjC Declaration Filter
The ObjC Declaration filter converts ObjC instance variable declarations in the input text into ObjC instance method declarations. This filter parses out different components of the variable declaration and passes them into templates depending on the type of variable.
The tab for this filter's settings controls the various templates that are chosen depending on the type of instance variable in the input text.
| variable type | description |
|---|---|
| Object */Pointer | This template is chosen for Object or Pointer style variables, like the following.
|
| id | This template is chosen for variables declared as type id, like the following.
|
| Value | This template is chosen for variables declared as C basic types, like the following.
|
The instance variables are then broken up into different parts to be substituted into appropriate template.
| substitution name | description |
|---|---|
| $TYPE | The ObjC type of the declaration, NSString in the following example.
|
| $POINTER | The pointer section of the declaration, "*" in the following example.
|
| $NAME | The lowercase method name derived from the instance variable, name in the following example.
|
| $UNAME | The uppercase method name derived from the instance variable, Name in the following example.
|
Assuming the default templates are used the following substitutions occur.
| input | output |
|---|---|
| NSString *_name; | - (NSString *)name;
- (void)setName:(NSString *)newName; |
| NSString *name; | - (NSString *)name;
- (void)setName:(NSString *)newName; |
| unsigned int _count; | - (unsigned int)count;
- (void)setCount:(unsigned int)newCount; |
| char *title; | - (char *)title;
- (void)setTitle:(char *)newTitle; |
| NSString *_firstName;
unsigned int age; char *title; |
- (NSString *)firstName;
- (void)setFirstName:(NSString *)newFirstName; - (unsigned int)age; - (void)setAge:(unsigned int)newAge; - (char *)title; - (void)setTitle:(char *)newTitle; |