42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
bool app, class;
OFString *superclass = nil;
OFMutableArray OF_GENERIC(OFString *) *properties = nil;
const OFOptionsParserOption options[] = {
{ '\0', @"app", 0, &app, NULL },
{ '\0', @"class", 0, &class, NULL },
{ '\0', @"superclass", 1, NULL, &superclass },
{ '\0', @"property", 1, NULL, NULL },
{ '\0', nil, 0, NULL, NULL }
};
OFOptionsParser *optionsParser;
OFUnichar option;
optionsParser = [OFOptionsParser parserWithOptions: options];
while ((option = [optionsParser nextOption]) != '\0') {
switch (option) {
case '-':;
if ([optionsParser.lastLongOption
isEqual: @"property"]) {
if (properties == nil)
properties = [OFMutableArray array];
[properties addObject: optionsParser.argument];
}
break;
case '?':
case ':':
case '=':
showUsage();
break;
}
|
|
|
|
|
|
<
<
|
|
|
<
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
bool app, class;
OFString *superclass = nil;
OFMutableArray OF_GENERIC(OFString *) *properties = nil;
const OFOptionsParserOption options[] = {
{ 'a', @"app", 0, &app, NULL },
{ 'c', @"class", 0, &class, NULL },
{ 's', @"superclass", 1, NULL, &superclass },
{ 'p', @"property", 1, NULL, NULL },
{ '\0', nil, 0, NULL, NULL }
};
OFOptionsParser *optionsParser;
OFUnichar option;
optionsParser = [OFOptionsParser parserWithOptions: options];
while ((option = [optionsParser nextOption]) != '\0') {
switch (option) {
case 'p':
if (properties == nil)
properties = [OFMutableArray array];
[properties addObject: optionsParser.argument];
break;
case '?':
case ':':
case '=':
showUsage();
break;
}
|