ObjFW  Check-in [03227c8a54]

Overview
Comment:objfw-new: Add short options
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 03227c8a544bee09706585a456ad78e12a8b3ed28d15d94adda3e270a4ead6c9
User & Date: js on 2022-08-10 21:38:56
Other Links: manifest | tags
Context
2022-08-11
20:46
OFURLHandler: Make +[handlerForURL:] nonnull check-in: 9e7f4f34b9 user: js tags: trunk
2022-08-10
21:38
objfw-new: Add short options check-in: 03227c8a54 user: js tags: trunk
2022-08-08
19:00
objfw-new: Automatically generate dealloc check-in: 8465dcaa25 user: js tags: trunk
Changes

Modified utils/objfw-new/NewClass.m from [c4e1442a79] to [13b11d77d3].

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
				[headerFile writeString: attribute];
				first = false;
			}

			[headerFile writeString: @") "];
		}

		[headerFile writeFormat: @"%@_%@;\n",
					 property.type, property.name];
	}

	[headerFile writeString: @"@end\n"
				 @"\n"
				 @"OF_ASSUME_NONNULL_END\n"];








|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
				[headerFile writeString: attribute];
				first = false;
			}

			[headerFile writeString: @") "];
		}

		[headerFile writeFormat: @"%@%@;\n",
					 property.type, property.name];
	}

	[headerFile writeString: @"@end\n"
				 @"\n"
				 @"OF_ASSUME_NONNULL_END\n"];

Modified utils/objfw-new/ObjFWNew.m from [620606a28a] to [6054a43bff].

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;
		}