@@ -11,8 +11,6 @@ import :std_module;
11
11
12
12
namespace Argo {
13
13
14
- using namespace std ;
15
-
16
14
/* !
17
15
* ParserID which holds parser id
18
16
* You can set int or string as id
@@ -80,12 +78,12 @@ struct String {
80
78
}
81
79
};
82
80
83
- consteval explicit operator string () const {
84
- return string (str_, N);
81
+ consteval explicit operator std:: string () const {
82
+ return std:: string (str_, N);
85
83
}
86
84
87
- consteval explicit operator string_view () const {
88
- return string_view (str_, N);
85
+ consteval explicit operator std:: string_view () const {
86
+ return std:: string_view (str_, N);
89
87
}
90
88
91
89
[[nodiscard]] consteval auto operator [](size_t n) const {
@@ -125,15 +123,18 @@ String(const char (&)[N]) -> String<N - 1>;
125
123
*/
126
124
template <class T >
127
125
consteval auto get_type_name_base_type ([[maybe_unused]] size_t n = 0 ) {
128
- if constexpr (is_same_v<T, bool >) {
126
+ if constexpr (std:: is_same_v<T, bool >) {
129
127
return String (" BOOL" );
130
- } else if constexpr (is_integral_v<T>) {
128
+ } else if constexpr (std:: is_integral_v<T>) {
131
129
return String (" NUMBER" );
132
- } else if constexpr (is_floating_point_v<T>) {
130
+ } else if constexpr (std:: is_floating_point_v<T>) {
133
131
return String (" FLOAT" );
134
- } else if constexpr (is_same_v<T, const char *> or is_same_v<T, string> or
135
- is_same_v<T, string_view>) {
132
+ } else if constexpr (std::is_same_v<T, const char *> or
133
+ std::is_same_v<T, std::string> or
134
+ std::is_same_v<T, std::string_view>) {
136
135
return String (" STRING" );
136
+ } else if constexpr (std::is_same_v<T, std::filesystem::path>) {
137
+ return String (" PATH" );
137
138
} else {
138
139
return String (" UNKNOWN" );
139
140
}
@@ -142,17 +143,17 @@ consteval auto get_type_name_base_type([[maybe_unused]] size_t n = 0) {
142
143
template <class T , NArgs TNArgs>
143
144
consteval auto get_base_type_name_form_stl () {
144
145
if constexpr (is_array_v<T>) {
145
- return []<size_t ... Is>(index_sequence<Is...>) consteval {
146
+ return []<size_t ... Is>(std:: index_sequence<Is...>) consteval {
146
147
return ((get_type_name_base_type<array_base_t <T>>(Is) + String (" ," )) +
147
148
...);
148
- }(make_index_sequence<TNArgs.nargs >())
149
+ }(std:: make_index_sequence<TNArgs.nargs >())
149
150
.removeTrail ();
150
151
} else if constexpr (is_vector_v<T>) {
151
- return []<size_t ... Is>(index_sequence<Is...>) consteval {
152
+ return []<size_t ... Is>(std:: index_sequence<Is...>) consteval {
152
153
return ((get_type_name_base_type<vector_base_t <T>>(Is) + String (" ," )) +
153
154
...)
154
155
.removeTrail ();
155
- }(make_index_sequence<TNArgs.nargs >());
156
+ }(std:: make_index_sequence<TNArgs.nargs >());
156
157
} else if constexpr (is_tuple_v<T>) {
157
158
return []<class ... U>(type_sequence<U...>) consteval {
158
159
return (((get_type_name_base_type<vector_base_t <U>>()) + String (" ," )) +
@@ -196,41 +197,42 @@ struct ArgTag {};
196
197
*/
197
198
template <class Type , ArgName Name, NArgs TNArgs, bool Required, ParserID ID>
198
199
struct Arg : ArgTag {
199
- using type = //
200
- conditional_t < //
200
+ using type = //
201
+ std:: conditional_t < //
201
202
((TNArgs.nargs <= 1 ) && (TNArgs.nargs_char != ' +' ) &&
202
- (TNArgs.nargs_char != ' *' )) //
203
- || is_array_v<Type> //
204
- || is_tuple_v<Type> //
205
- || is_vector_v<Type>, //
206
- Type, //
207
- conditional_t < //
208
- (TNArgs.nargs > 1 ), //
209
- array<Type, static_cast <size_t >(TNArgs.nargs)>, //
210
- vector<Type> //
211
- > //
212
- >; //
213
- using baseType = conditional_t < //
214
- is_array_v<Type>, //
215
- array_base_t <Type>, //
216
- conditional_t < //
217
- is_vector_v<Type>, //
218
- vector_base_t <Type>, //
219
- Type //
220
- > //
203
+ (TNArgs.nargs_char != ' *' )) //
204
+ || is_array_v<Type> //
205
+ || is_tuple_v<Type> //
206
+ || is_vector_v<Type>, //
207
+ Type, //
208
+ std:: conditional_t < //
209
+ (TNArgs.nargs > 1 ), //
210
+ std:: array<Type, static_cast <size_t >(TNArgs.nargs)>, //
211
+ std:: vector<Type> //
212
+ > //
213
+ >; //
214
+ using baseType = std:: conditional_t < //
215
+ is_array_v<Type>, //
216
+ array_base_t <Type>, //
217
+ std:: conditional_t < //
218
+ is_vector_v<Type>, //
219
+ vector_base_t <Type>, //
220
+ Type //
221
+ > //
221
222
>;
222
223
static constexpr auto name = Name;
223
- inline static string_view description{};
224
+ inline static std:: string_view description{};
224
225
inline static bool assigned = false ;
225
226
inline static bool required = Required;
226
227
inline static type value = {};
227
228
inline static type defaultValue = {};
228
229
inline static constexpr NArgs nargs = TNArgs;
229
- inline static function<type(string_view)> caster = nullptr ;
230
- inline static function<void (const type& value, span<string_view>,
231
- string_view)>
230
+ inline static std:: function<type(std:: string_view)> caster = nullptr ;
231
+ inline static std:: function<void (
232
+ const type& value, std::span<std::string_view>, std:: string_view)>
232
233
validator = nullptr ;
233
- inline static function<void (type&, span<string_view>)> callback = nullptr ;
234
+ inline static std::function<void (type&, std::span<std::string_view>)>
235
+ callback = nullptr ;
234
236
inline static constexpr auto typeName = get_type_name<type, TNArgs>();
235
237
};
236
238
@@ -242,9 +244,9 @@ struct FlagArg : FlagArgTag {
242
244
using baseType = bool ;
243
245
static constexpr auto name = Name;
244
246
inline static bool assigned = false ;
245
- inline static string_view description{};
247
+ inline static std:: string_view description{};
246
248
inline static type value = false ;
247
- inline static function<void ()> callback = nullptr ;
249
+ inline static std:: function<void ()> callback = nullptr ;
248
250
inline static constexpr auto typeName = String(" " );
249
251
};
250
252
@@ -256,9 +258,9 @@ struct HelpArg : HelpArgTag, FlagArgTag {
256
258
using baseType = bool ;
257
259
static constexpr auto name = Name;
258
260
inline static bool assigned = false ;
259
- inline static string_view description = " Print help information" ;
261
+ inline static std:: string_view description = " Print help information" ;
260
262
inline static type value = false ;
261
- inline static function<void ()> callback = nullptr ;
263
+ inline static std:: function<void ()> callback = nullptr ;
262
264
inline static constexpr auto typeName = String(" " );
263
265
};
264
266
0 commit comments