@@ -19,17 +19,17 @@ @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 { +typedef struct { /** The short version (e.g. `-v`) of the option or `\0` for none. */ - of_unichar_t shortOption; + OFUnichar shortOption; /** * The long version (e.g. `--verbose`) of the option or `nil` for none. */ OFString *__unsafe_unretained _Nullable longOption; @@ -55,26 +55,25 @@ /** * 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; +} 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; - of_unichar_t _lastOption; + OFUnichar _lastOption; OFString *_Nullable _lastLongOption, *_Nullable _argument; bool _done; } /** @@ -83,11 +82,11 @@ * If @ref nextOption returned `?` or `:`, this returns the option which was * unknown or for which the argument was missing.@n * If this returns `-`, the last option is only available as a long option (see * lastLongOption). */ -@property (readonly, nonatomic) of_unichar_t lastOption; +@property (readonly, nonatomic) OFUnichar lastOption; /** * @brief The long option for the last parsed option, or `nil` if the last * parsed option was not passed as a long option by the user. * @@ -117,31 +116,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. * @@ -158,9 +157,9 @@ * make sure all options have been parsed, even if you only rely on the * optional pointers specified and don't do any parsing yourself. * * @return The next option */ -- (of_unichar_t)nextOption; +- (OFUnichar)nextOption; @end OF_ASSUME_NONNULL_END