Index: src/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -19,15 +19,15 @@ @class OFMapTable; OF_ASSUME_NONNULL_BEGIN /** - * @struct of_options_parser_option_t OFOptionsParser.h ObjFW/OFOptionsParser.h + * @struct OFOptionsParserOption OFOptionsParser.h ObjFW/OFOptionsParser.h * * @brief An option which can be parsed by an @ref OFOptionsParser. */ -struct of_options_parser_option_t { +struct OFOptionsParserOption { /** The short version (e.g. `-v`) of the option or `\0` for none. */ OFUnichar shortOption; /** * The long version (e.g. `--verbose`) of the option or `nil` for none. @@ -56,21 +56,21 @@ * An optional pointer to an `OFString *` that is set to the * argument specified for the option or `nil` for no argument. */ OFString *__autoreleasing _Nullable *_Nullable argumentPtr; }; -typedef struct of_options_parser_option_t of_options_parser_option_t; +typedef struct OFOptionsParserOption OFOptionsParserOption; /** * @class OFOptionsParser OFOptionsParser.h ObjFW/OFOptionsParser.h * * @brief A class for parsing the program options specified on the command line. */ OF_SUBCLASSING_RESTRICTED @interface OFOptionsParser: OFObject { - of_options_parser_option_t *_options; + OFOptionsParserOption *_options; OFMapTable *_longOptions; OFArray OF_GENERIC(OFString *) *_arguments; size_t _index, _subIndex; OFUnichar _lastOption; OFString *_Nullable _lastLongOption, *_Nullable _argument; @@ -117,31 +117,31 @@ OFArray OF_GENERIC(OFString *) *remainingArguments; /** * @brief Creates a new OFOptionsParser which accepts the specified options. * - * @param options An array of @ref of_options_parser_option_t specifying all + * @param options An array of @ref OFOptionsParserOption specifying all * accepted options, terminated with an option whose short * option is `\0` and long option is `nil`. * * @return A new, autoreleased OFOptionsParser */ -+ (instancetype)parserWithOptions: (const of_options_parser_option_t *)options; ++ (instancetype)parserWithOptions: (const OFOptionsParserOption *)options; - (instancetype)init OF_UNAVAILABLE; /** * @brief Initializes an already allocated OFOptionsParser so that it accepts * the specified options. * - * @param options An array of @ref of_options_parser_option_t specifying all + * @param options An array of @ref OFOptionsParserOption specifying all * accepted options, terminated with an option whose short * option is `\0` and long option is `nil`. * * @return An initialized OFOptionsParser */ -- (instancetype)initWithOptions: (const of_options_parser_option_t *)options +- (instancetype)initWithOptions: (const OFOptionsParserOption *)options OF_DESIGNATED_INITIALIZER; /** * @brief Returns the next option. * Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -36,28 +36,28 @@ @implementation OFOptionsParser @synthesize lastOption = _lastOption, lastLongOption = _lastLongOption; @synthesize argument = _argument; -+ (instancetype)parserWithOptions: (const of_options_parser_option_t *)options ++ (instancetype)parserWithOptions: (const OFOptionsParserOption *)options { return [[[self alloc] initWithOptions: options] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithOptions: (const of_options_parser_option_t *)options +- (instancetype)initWithOptions: (const OFOptionsParserOption *)options { self = [super init]; @try { size_t count = 0; - const of_options_parser_option_t *iter; - of_options_parser_option_t *iter2; + const OFOptionsParserOption *iter; + OFOptionsParserOption *iter2; const of_map_table_functions_t keyFunctions = { .hash = stringHash, .equal = stringEqual }; const of_map_table_functions_t objectFunctions = { NULL }; @@ -139,11 +139,11 @@ } - (void)dealloc { if (_options != NULL) - for (of_options_parser_option_t *iter = _options; + for (OFOptionsParserOption *iter = _options; iter->shortOption != '\0' || iter->longOption != nil; iter++) [iter->longOption release]; free(_options); @@ -155,11 +155,11 @@ [super dealloc]; } - (OFUnichar)nextOption { - of_options_parser_option_t *iter; + OFOptionsParserOption *iter; OFString *argument; if (_done || _index >= _arguments.count) return '\0'; @@ -184,11 +184,11 @@ } if ([argument hasPrefix: @"--"]) { void *pool = objc_autoreleasePoolPush(); size_t pos; - of_options_parser_option_t *option; + OFOptionsParserOption *option; _lastOption = '-'; _index++; if ((pos = [argument rangeOfString: @"="].location) != Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -147,11 +147,11 @@ @implementation OFArc - (void)applicationDidFinishLaunching { OFString *outputDir, *encodingString, *type; - const of_options_parser_option_t options[] = { + const OFOptionsParserOption options[] = { { 'a', @"append", 0, NULL, NULL }, { 'c', @"create", 0, NULL, NULL }, { 'C', @"directory", 1, NULL, &outputDir }, { 'E', @"encoding", 1, NULL, &encodingString }, { 'f', @"force", 0, NULL, NULL }, Index: utils/ofdns/OFDNS.m ================================================================== --- utils/ofdns/OFDNS.m +++ utils/ofdns/OFDNS.m @@ -81,11 +81,11 @@ } - (void)applicationDidFinishLaunching { OFString *DNSClassString, *server; - const of_options_parser_option_t options[] = { + const OFOptionsParserOption options[] = { { 'c', @"class", 1, NULL, &DNSClassString }, { 'h', @"help", 0, NULL, NULL }, { 's', @"server", 1, NULL, &server }, { 't', @"type", 1, NULL, NULL }, { '\0', nil, 0, NULL, NULL } Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -68,11 +68,11 @@ - (void)applicationDidFinishLaunching { int exitStatus = 0; bool calculateMD5, calculateRIPEMD160, calculateSHA1, calculateSHA224; bool calculateSHA256, calculateSHA384, calculateSHA512; - const of_options_parser_option_t options[] = { + const OFOptionsParserOption options[] = { { '\0', @"md5", 0, &calculateMD5, NULL }, { '\0', @"ripemd160", 0, &calculateRIPEMD160, NULL }, { '\0', @"sha1", 0, &calculateSHA1, NULL }, { '\0', @"sha224", 0, &calculateSHA224, NULL }, { '\0', @"sha256", 0, &calculateSHA256, NULL }, Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -412,11 +412,11 @@ } - (void)applicationDidFinishLaunching { OFString *outputPath; - const of_options_parser_option_t options[] = { + const OFOptionsParserOption options[] = { { 'b', @"body", 1, NULL, NULL }, { 'c', @"continue", 0, &_continue, NULL }, { 'f', @"force", 0, &_force, NULL }, { 'h', @"help", 0, NULL, NULL }, { 'H', @"header", 1, NULL, NULL },