ObjFW
OFOptionsParser.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
3  * Jonathan Schleifer <js@heap.zone>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 #import "OFString.h"
19 
20 @class OFMapTable;
21 
22 OF_ASSUME_NONNULL_BEGIN
23 
31  of_unichar_t shortOption;
32 
36  OFString *__unsafe_unretained _Nullable longOption;
37 
48  signed char hasArgument;
49 
54  bool *_Nullable isSpecifiedPtr;
55 
60  OFString *__autoreleasing _Nullable *_Nullable argumentPtr;
62 
69 {
71  OFMapTable *_longOptions;
72  OFArray OF_GENERIC(OFString *) *_arguments;
73  size_t _index, _subIndex;
74  of_unichar_t _lastOption;
75  OFString *_Nullable _lastLongOption, *_Nullable _argument;
76  bool _done;
77 }
78 
87 @property (readonly, nonatomic) of_unichar_t lastOption;
88 
104 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *lastLongOption;
105 
110 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *argument;
111 
121 + (instancetype)parserWithOptions: (const of_options_parser_option_t *)options;
122 
123 - init OF_UNAVAILABLE;
124 
135 - initWithOptions: (const of_options_parser_option_t *)options
136  OF_DESIGNATED_INITIALIZER;
137 
156 - (of_unichar_t)nextOption;
157 
163 - (OFArray OF_GENERIC(OFString *) *)remainingArguments;
164 @end
165 
166 OF_ASSUME_NONNULL_END
OFString *__autoreleasing _Nullable *_Nullable argumentPtr
Definition: OFOptionsParser.h:60
A class for handling strings.
Definition: OFString.h:114
signed char hasArgument
Definition: OFOptionsParser.h:48
OFString *__unsafe_unretained _Nullable longOption
Definition: OFOptionsParser.h:36
A class for parsing the program options specified on the command line.
Definition: OFOptionsParser.h:68
of_unichar_t shortOption
Definition: OFOptionsParser.h:31
The root class for all other classes inside ObjFW.
Definition: OFObject.h:379
bool *_Nullable isSpecifiedPtr
Definition: OFOptionsParser.h:54
An abstract class for storing objects in an array.
Definition: OFArray.h:89
A class similar to OFDictionary, but providing more options how keys and objects should be retained...
Definition: OFMapTable.h:71
An option which can be parsed by an OFOptionsParser.
Definition: OFOptionsParser.h:29