args-parser 6.3.3
Loading...
Searching...
No Matches
api.hpp
Go to the documentation of this file.
1
31#ifndef ARGS__API_HPP__INCLUDED
32#define ARGS__API_HPP__INCLUDED
33
34// Args include.
35#include "types.hpp"
36#include "arg.hpp"
37#include "multi_arg.hpp"
38#include "groups.hpp"
39#include "command.hpp"
40
41
42namespace Args {
43
44namespace details {
45
46//
47// API
48//
49
51template< typename PARENT, typename SELF, typename ARGPTR,
52 bool RETPARENT >
53class API {
54};
55
56//
57// Specialization for Command.
58//
59
61template< typename PARENT, typename ARGPTR >
62class API< PARENT, Command, ARGPTR, false > {
63public:
64 API( PARENT & parent, Command & self )
65 : m_parent( parent )
66 , m_self( self )
67 {
68 }
69
70 virtual ~API()
71 {
72 }
73
75 template< typename NAME >
78 NAME && name,
80 bool required = false )
81 {
82 auto group = std::unique_ptr< OnlyOneGroup, details::Deleter< ArgIface > > (
83 new OnlyOneGroup( std::forward< NAME > ( name ), required ),
85
86 OnlyOneGroup & g = *group;
87
88 ARGPTR a = std::move( group );
89
90 m_self.addArg( std::move( a ) );
91
93 ( *this, g );
94 }
95
97 template< typename NAME >
100 NAME && name,
102 bool required = false )
103 {
104 auto group = std::unique_ptr< AllOfGroup, details::Deleter< ArgIface > > (
105 new AllOfGroup( std::forward< NAME > ( name ), required ),
107
108 AllOfGroup & g = *group;
109
110 ARGPTR a = std::move( group );
111
112 m_self.addArg( std::move( a ) );
113
115 ( *this, g );
116 }
117
119 template< typename NAME >
122 NAME && name,
124 bool required = false )
125 {
126 auto group = std::unique_ptr< AtLeastOneGroup, details::Deleter< ArgIface > > (
127 new AtLeastOneGroup( std::forward< NAME > ( name ), required ),
129
131
132 ARGPTR a = std::move( group );
133
134 m_self.addArg( std::move( a ) );
135
137 ( *this, g );
138 }
139
141 template< typename NAME >
144 Char flag,
146 NAME && name,
148 bool isWithValue = false,
150 bool isRequired = false,
152 const String & desc = String(),
154 const String & longDesc = String(),
156 const String & defaultValue = String(),
158 const String & valueSpecifier = String() )
159 {
160
161 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
162 new Arg( flag, std::forward< NAME > ( name ), isWithValue,
163 isRequired ),
165
166 if( !desc.empty() )
167 arg->setDescription( desc );
168
169 if( !longDesc.empty() )
170 arg->setLongDescription( longDesc );
171
172 if( !defaultValue.empty() )
173 arg->setDefaultValue( defaultValue );
174
175 if( !valueSpecifier.empty() )
176 arg->setValueSpecifier( valueSpecifier );
177
178 ARGPTR a = std::move( arg );
179
180 m_self.addArg( std::move( a ) );
181
182 return *this;
183 }
184
188 Char flag,
190 bool isWithValue = false,
192 bool isRequired = false,
194 const String & desc = String(),
196 const String & longDesc = String(),
198 const String & defaultValue = String(),
200 const String & valueSpecifier = String() )
201 {
202
203 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
204 new Arg( flag, isWithValue, isRequired ),
206
207 if( !desc.empty() )
208 arg->setDescription( desc );
209
210 if( !longDesc.empty() )
211 arg->setLongDescription( longDesc );
212
213 if( !defaultValue.empty() )
214 arg->setDefaultValue( defaultValue );
215
216 if( !valueSpecifier.empty() )
217 arg->setValueSpecifier( valueSpecifier );
218
219 ARGPTR a = std::move( arg );
220
221 m_self.addArg( std::move( a ) );
222
223 return *this;
224 }
225
227 template< typename NAME >
230 NAME && name,
232 bool isWithValue = false,
234 bool isRequired = false,
236 const String & desc = String(),
238 const String & longDesc = String(),
240 const String & defaultValue = String(),
242 const String & valueSpecifier = String() )
243 {
244
245 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
246 new Arg( std::forward< NAME > ( name ), isWithValue,
247 isRequired ),
249
250 if( !desc.empty() )
251 arg->setDescription( desc );
252
253 if( !longDesc.empty() )
254 arg->setLongDescription( longDesc );
255
256 if( !defaultValue.empty() )
257 arg->setDefaultValue( defaultValue );
258
259 if( !valueSpecifier.empty() )
260 arg->setValueSpecifier( valueSpecifier );
261
262 ARGPTR a = std::move( arg );
263
264 m_self.addArg( std::move( a ) );
265
266 return *this;
267 }
268
270 template< typename NAME >
273 Char flag,
275 NAME && name,
277 bool isWithValue = false,
279 bool isRequired = false,
281 const String & desc = String(),
283 const String & longDesc = String(),
285 const String & defaultValue = String(),
287 const String & valueSpecifier = String() )
288 {
289
290 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
291 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
292 isRequired ),
294
295 if( !desc.empty() )
296 arg->setDescription( desc );
297
298 if( !longDesc.empty() )
299 arg->setLongDescription( longDesc );
300
301 if( !defaultValue.empty() )
302 arg->setDefaultValue( defaultValue );
303
304 if( !valueSpecifier.empty() )
305 arg->setValueSpecifier( valueSpecifier );
306
307 ARGPTR a = std::move( arg );
308
309 m_self.addArg( std::move( a ) );
310
311 return *this;
312 }
313
317 Char flag,
319 bool isWithValue = false,
321 bool isRequired = false,
323 const String & desc = String(),
325 const String & longDesc = String(),
327 const String & defaultValue = String(),
329 const String & valueSpecifier = String() )
330 {
331
332 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
333 new MultiArg( flag, isWithValue, isRequired ),
335
336 if( !desc.empty() )
337 arg->setDescription( desc );
338
339 if( !longDesc.empty() )
340 arg->setLongDescription( longDesc );
341
342 if( !defaultValue.empty() )
343 arg->setDefaultValue( defaultValue );
344
345 if( !valueSpecifier.empty() )
346 arg->setValueSpecifier( valueSpecifier );
347
348 ARGPTR a = std::move( arg );
349
350 m_self.addArg( std::move( a ) );
351
352 return *this;
353 }
354
356 template< typename NAME >
359 NAME && name,
361 bool isWithValue = false,
363 bool isRequired = false,
365 const String & desc = String(),
367 const String & longDesc = String(),
369 const String & defaultValue = String(),
371 const String & valueSpecifier = String() )
372 {
373
374 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
375 new MultiArg( std::forward< NAME > ( name ), isWithValue,
376 isRequired ),
378
379 if( !desc.empty() )
380 arg->setDescription( desc );
381
382 if( !longDesc.empty() )
383 arg->setLongDescription( longDesc );
384
385 if( !defaultValue.empty() )
386 arg->setDefaultValue( defaultValue );
387
388 if( !valueSpecifier.empty() )
389 arg->setValueSpecifier( valueSpecifier );
390
391 ARGPTR a = std::move( arg );
392
393 m_self.addArg( std::move( a ) );
394
395 return *this;
396 }
397
399 template< typename NAME >
402 Char flag,
404 NAME && name,
406 bool isWithValue = false,
408 bool isRequired = false,
410 const String & desc = String(),
412 const String & longDesc = String(),
414 const StringList & defaultValues = StringList(),
416 const String & valueSpecifier = String() )
417 {
418
419 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
420 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
421 isRequired ),
423
424 if( !desc.empty() )
425 arg->setDescription( desc );
426
427 if( !longDesc.empty() )
428 arg->setLongDescription( longDesc );
429
430 if( !defaultValues.empty() )
431 arg->setDefaultValues( defaultValues );
432
433 if( !valueSpecifier.empty() )
434 arg->setValueSpecifier( valueSpecifier );
435
436 ARGPTR a = std::move( arg );
437
438 m_self.addArg( std::move( a ) );
439
440 return *this;
441 }
442
446 Char flag,
448 bool isWithValue = false,
450 bool isRequired = false,
452 const String & desc = String(),
454 const String & longDesc = String(),
456 const StringList & defaultValues = StringList(),
458 const String & valueSpecifier = String() )
459 {
460
461 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
462 new MultiArg( flag, isWithValue, isRequired ),
464
465 if( !desc.empty() )
466 arg->setDescription( desc );
467
468 if( !longDesc.empty() )
469 arg->setLongDescription( longDesc );
470
471 if( !defaultValues.empty() )
472 arg->setDefaultValues( defaultValues );
473
474 if( !valueSpecifier.empty() )
475 arg->setValueSpecifier( valueSpecifier );
476
477 ARGPTR a = std::move( arg );
478
479 m_self.addArg( std::move( a ) );
480
481 return *this;
482 }
483
485 template< typename NAME >
488 NAME && name,
490 bool isWithValue = false,
492 bool isRequired = false,
494 const String & desc = String(),
496 const String & longDesc = String(),
498 const StringList & defaultValues = StringList(),
500 const String & valueSpecifier = String() )
501 {
502
503 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
504 new MultiArg( std::forward< NAME > ( name ), isWithValue,
505 isRequired ),
507
508 if( !desc.empty() )
509 arg->setDescription( desc );
510
511 if( !longDesc.empty() )
512 arg->setLongDescription( longDesc );
513
514 if( !defaultValues.empty() )
515 arg->setDefaultValues( defaultValues );
516
517 if( !valueSpecifier.empty() )
518 arg->setValueSpecifier( valueSpecifier );
519
520 ARGPTR a = std::move( arg );
521
522 m_self.addArg( std::move( a ) );
523
524 return *this;
525 }
526
530 {
531 m_self.addArg( arg );
532
533 return *this;
534 }
535
539 {
540 m_self.addArg( arg );
541
542 return *this;
543 }
544
548 {
549 m_self.addArg( std::move( arg ) );
550
551 return *this;
552 }
553
555 template< typename NAME >
558 NAME && name,
562 bool isSubCommandRequired = false,
564 const String & desc = String(),
566 const String & longDesc = String(),
568 const String & defaultValue = String(),
570 const String & valueSpecifier = String() )
571 {
572 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
573 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
575
576 if( !desc.empty() )
577 cmd->setDescription( desc );
578
579 if( !longDesc.empty() )
580 cmd->setLongDescription( longDesc );
581
582 if( !defaultValue.empty() )
583 cmd->setDefaultValue( defaultValue );
584
585 if( !valueSpecifier.empty() )
586 cmd->setValueSpecifier( valueSpecifier );
587
588 Command & c = *cmd;
589
590 ARGPTR arg = std::move( cmd );
591
592 m_self.addArg( std::move( arg ) );
593
594 return API< API< PARENT, Command, ARGPTR, false >, Command, ARGPTR, false > ( *this, c );
595 }
596
598 template< typename NAME >
601 NAME && name,
605 bool isSubCommandRequired = false,
607 const String & desc = String(),
609 const String & longDesc = String(),
611 const StringList & defaultValues = StringList(),
613 const String & valueSpecifier = String() )
614 {
615 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
616 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
618
619 if( !desc.empty() )
620 cmd->setDescription( desc );
621
622 if( !longDesc.empty() )
623 cmd->setLongDescription( longDesc );
624
625 if( !defaultValues.empty() )
626 cmd->setDefaultValues( defaultValues );
627
628 if( !valueSpecifier.empty() )
629 cmd->setValueSpecifier( valueSpecifier );
630
631 Command & c = *cmd;
632
633 ARGPTR arg = std::move( cmd );
634
635 m_self.addArg( std::move( arg ) );
636
637 return API< API< PARENT, Command, ARGPTR, false >, Command, ARGPTR, false > ( *this, c );
638 }
639
641 PARENT & end() const
642 {
643 return m_parent;
644 }
645
646private:
648 PARENT & m_parent;
650 Command & m_self;
651}; // class API
652
653
654//
655// Common specialization.
656//
657
659template< typename PARENT, typename SELF, typename ARGPTR >
661{
662public:
664 : m_parent( parent )
665 , m_self( self )
666 {
667 }
668
669 virtual ~API()
670 {
671 }
672
674 template< typename NAME >
677 NAME && name,
679 bool required = false )
680 {
681 auto group = std::unique_ptr< OnlyOneGroup, details::Deleter< ArgIface > > (
682 new OnlyOneGroup( std::forward< NAME > ( name ), required ),
684
685 OnlyOneGroup & g = *group;
686
687 ARGPTR a = std::move( group );
688
689 m_self.addArg( std::move( a ) );
690
692 ( *this, g );
693 }
694
696 template< typename NAME >
699 NAME && name,
701 bool required = false )
702 {
703 auto group = std::unique_ptr< AllOfGroup, details::Deleter< ArgIface > > (
704 new AllOfGroup( std::forward< NAME > ( name ), required ),
706
707 AllOfGroup & g = *group;
708
709 ARGPTR a = std::move( group );
710
711 m_self.addArg( std::move( a ) );
712
714 ( *this, g );
715 }
716
718 template< typename NAME >
721 NAME && name,
723 bool required = false )
724 {
725 auto group = std::unique_ptr< AtLeastOneGroup, details::Deleter< ArgIface > > (
726 new AtLeastOneGroup( std::forward< NAME > ( name ), required ),
728
730
731 ARGPTR a = std::move( group );
732
733 m_self.addArg( std::move( a ) );
734
736 ( *this, g );
737 }
738
740 template< typename NAME >
743 Char flag,
745 NAME && name,
747 bool isWithValue = false,
749 bool isRequired = false,
751 const String & desc = String(),
753 const String & longDesc = String(),
755 const String & defaultValue = String(),
757 const String & valueSpecifier = String() )
758 {
759
760 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
761 new Arg( flag, std::forward< NAME > ( name ), isWithValue,
762 isRequired ),
764
765 if( !desc.empty() )
766 arg->setDescription( desc );
767
768 if( !longDesc.empty() )
769 arg->setLongDescription( longDesc );
770
771 if( !defaultValue.empty() )
772 arg->setDefaultValue( defaultValue );
773
774 if( !valueSpecifier.empty() )
775 arg->setValueSpecifier( valueSpecifier );
776
777 ARGPTR a = std::move( arg );
778
779 m_self.addArg( std::move( a ) );
780
781 return *this;
782 }
783
787 Char flag,
789 bool isWithValue = false,
791 bool isRequired = false,
793 const String & desc = String(),
795 const String & longDesc = String(),
797 const String & defaultValue = String(),
799 const String & valueSpecifier = String() )
800 {
801
802 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
803 new Arg( flag, isWithValue, isRequired ),
805
806 if( !desc.empty() )
807 arg->setDescription( desc );
808
809 if( !longDesc.empty() )
810 arg->setLongDescription( longDesc );
811
812 if( !defaultValue.empty() )
813 arg->setDefaultValue( defaultValue );
814
815 if( !valueSpecifier.empty() )
816 arg->setValueSpecifier( valueSpecifier );
817
818 ARGPTR a = std::move( arg );
819
820 m_self.addArg( std::move( a ) );
821
822 return *this;
823 }
824
826 template< typename NAME >
829 NAME && name,
831 bool isWithValue = false,
833 bool isRequired = false,
835 const String & desc = String(),
837 const String & longDesc = String(),
839 const String & defaultValue = String(),
841 const String & valueSpecifier = String() )
842 {
843
844 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
845 new Arg( std::forward< NAME > ( name ), isWithValue,
846 isRequired ),
848
849 if( !desc.empty() )
850 arg->setDescription( desc );
851
852 if( !longDesc.empty() )
853 arg->setLongDescription( longDesc );
854
855 if( !defaultValue.empty() )
856 arg->setDefaultValue( defaultValue );
857
858 if( !valueSpecifier.empty() )
859 arg->setValueSpecifier( valueSpecifier );
860
861 ARGPTR a = std::move( arg );
862
863 m_self.addArg( std::move( a ) );
864
865 return *this;
866 }
867
869 template< typename NAME >
872 Char flag,
874 NAME && name,
876 bool isWithValue = false,
878 bool isRequired = false,
880 const String & desc = String(),
882 const String & longDesc = String(),
884 const String & defaultValue = String(),
886 const String & valueSpecifier = String() )
887 {
888
889 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
890 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
891 isRequired ),
893
894 if( !desc.empty() )
895 arg->setDescription( desc );
896
897 if( !longDesc.empty() )
898 arg->setLongDescription( longDesc );
899
900 if( !defaultValue.empty() )
901 arg->setDefaultValue( defaultValue );
902
903 if( !valueSpecifier.empty() )
904 arg->setValueSpecifier( valueSpecifier );
905
906 ARGPTR a = std::move( arg );
907
908 m_self.addArg( std::move( a ) );
909
910 return *this;
911 }
912
916 Char flag,
918 bool isWithValue = false,
920 bool isRequired = false,
922 const String & desc = String(),
924 const String & longDesc = String(),
926 const String & defaultValue = String(),
928 const String & valueSpecifier = String() )
929 {
930
931 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
932 new MultiArg( flag, isWithValue, isRequired ),
934
935 if( !desc.empty() )
936 arg->setDescription( desc );
937
938 if( !longDesc.empty() )
939 arg->setLongDescription( longDesc );
940
941 if( !defaultValue.empty() )
942 arg->setDefaultValue( defaultValue );
943
944 if( !valueSpecifier.empty() )
945 arg->setValueSpecifier( valueSpecifier );
946
947 ARGPTR a = std::move( arg );
948
949 m_self.addArg( std::move( a ) );
950
951 return *this;
952 }
953
955 template< typename NAME >
958 NAME && name,
960 bool isWithValue = false,
962 bool isRequired = false,
964 const String & desc = String(),
966 const String & longDesc = String(),
968 const String & defaultValue = String(),
970 const String & valueSpecifier = String() )
971 {
972
973 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
974 new MultiArg( std::forward< NAME > ( name ), isWithValue,
975 isRequired ),
977
978 if( !desc.empty() )
979 arg->setDescription( desc );
980
981 if( !longDesc.empty() )
982 arg->setLongDescription( longDesc );
983
984 if( !defaultValue.empty() )
985 arg->setDefaultValue( defaultValue );
986
987 if( !valueSpecifier.empty() )
988 arg->setValueSpecifier( valueSpecifier );
989
990 ARGPTR a = std::move( arg );
991
992 m_self.addArg( std::move( a ) );
993
994 return *this;
995 }
996
998 template< typename NAME >
1001 Char flag,
1003 NAME && name,
1005 bool isWithValue = false,
1007 bool isRequired = false,
1009 const String & desc = String(),
1011 const String & longDesc = String(),
1013 const StringList & defaultValues = StringList(),
1015 const String & valueSpecifier = String() )
1016 {
1017
1018 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1019 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
1020 isRequired ),
1022
1023 if( !desc.empty() )
1024 arg->setDescription( desc );
1025
1026 if( !longDesc.empty() )
1027 arg->setLongDescription( longDesc );
1028
1029 if( !defaultValues.empty() )
1030 arg->setDefaultValues( defaultValues );
1031
1032 if( !valueSpecifier.empty() )
1033 arg->setValueSpecifier( valueSpecifier );
1034
1035 ARGPTR a = std::move( arg );
1036
1037 m_self.addArg( std::move( a ) );
1038
1039 return *this;
1040 }
1041
1045 Char flag,
1047 bool isWithValue = false,
1049 bool isRequired = false,
1051 const String & desc = String(),
1053 const String & longDesc = String(),
1055 const StringList & defaultValues = StringList(),
1057 const String & valueSpecifier = String() )
1058 {
1059
1060 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1061 new MultiArg( flag, isWithValue, isRequired ),
1063
1064 if( !desc.empty() )
1065 arg->setDescription( desc );
1066
1067 if( !longDesc.empty() )
1068 arg->setLongDescription( longDesc );
1069
1070 if( !defaultValues.empty() )
1071 arg->setDefaultValues( defaultValues );
1072
1073 if( !valueSpecifier.empty() )
1074 arg->setValueSpecifier( valueSpecifier );
1075
1076 ARGPTR a = std::move( arg );
1077
1078 m_self.addArg( std::move( a ) );
1079
1080 return *this;
1081 }
1082
1084 template< typename NAME >
1087 NAME && name,
1089 bool isWithValue = false,
1091 bool isRequired = false,
1093 const String & desc = String(),
1095 const String & longDesc = String(),
1097 const StringList & defaultValues = StringList(),
1099 const String & valueSpecifier = String() )
1100 {
1101
1102 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1103 new MultiArg( std::forward< NAME > ( name ), isWithValue,
1104 isRequired ),
1106
1107 if( !desc.empty() )
1108 arg->setDescription( desc );
1109
1110 if( !longDesc.empty() )
1111 arg->setLongDescription( longDesc );
1112
1113 if( !defaultValues.empty() )
1114 arg->setDefaultValues( defaultValues );
1115
1116 if( !valueSpecifier.empty() )
1117 arg->setValueSpecifier( valueSpecifier );
1118
1119 ARGPTR a = std::move( arg );
1120
1121 m_self.addArg( std::move( a ) );
1122
1123 return *this;
1124 }
1125
1129 {
1130 m_self.addArg( arg );
1131
1132 return *this;
1133 }
1134
1138 {
1139 m_self.addArg( arg );
1140
1141 return *this;
1142 }
1143
1147 {
1148 m_self.addArg( std::move( arg ) );
1149
1150 return *this;
1151 }
1152
1154 template< typename NAME >
1157 NAME && name,
1161 bool isSubCommandRequired = false,
1163 const String & desc = String(),
1165 const String & longDesc = String(),
1167 const String & defaultValue = String(),
1169 const String & valueSpecifier = String() )
1170 {
1171 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
1172 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
1174
1175 if( !desc.empty() )
1176 cmd->setDescription( desc );
1177
1178 if( !longDesc.empty() )
1179 cmd->setLongDescription( longDesc );
1180
1181 if( !defaultValue.empty() )
1182 cmd->setDefaultValue( defaultValue );
1183
1184 if( !valueSpecifier.empty() )
1185 cmd->setValueSpecifier( valueSpecifier );
1186
1187 Command & c = *cmd;
1188
1189 ARGPTR arg = std::move( cmd );
1190
1191 m_self.addArg( std::move( arg ) );
1192
1193 return API< API< PARENT, SELF, ARGPTR, false >, Command, ARGPTR, false > ( *this, c );
1194 }
1195
1197 template< typename NAME >
1200 NAME && name,
1204 bool isSubCommandRequired = false,
1206 const String & desc = String(),
1208 const String & longDesc = String(),
1210 const StringList & defaultValues = StringList(),
1212 const String & valueSpecifier = String() )
1213 {
1214 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
1215 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
1217
1218 if( !desc.empty() )
1219 cmd->setDescription( desc );
1220
1221 if( !longDesc.empty() )
1222 cmd->setLongDescription( longDesc );
1223
1224 if( !defaultValues.empty() )
1225 cmd->setDefaultValues( defaultValues );
1226
1227 if( !valueSpecifier.empty() )
1228 cmd->setValueSpecifier( valueSpecifier );
1229
1230 Command & c = *cmd;
1231
1232 ARGPTR arg = std::move( cmd );
1233
1234 m_self.addArg( std::move( arg ) );
1235
1236 return API< API< PARENT, SELF, ARGPTR, false >, Command, ARGPTR, false > ( *this, c );
1237 }
1238
1240 PARENT & end() const
1241 {
1242 return m_parent;
1243 }
1244
1245private:
1247 PARENT & m_parent;
1249 SELF & m_self;
1250}; // class API
1251
1252
1253//
1254// Specialization for CmdLine.
1255//
1256
1258template< typename PARENT, typename SELF, typename ARGPTR >
1260public:
1262 : m_parent( parent )
1263 , m_self( self )
1264 {
1265 }
1266
1267 virtual ~API()
1268 {
1269 }
1270
1272 template< typename NAME >
1275 NAME && name,
1277 bool required = false )
1278 {
1279 auto group = std::unique_ptr< OnlyOneGroup, details::Deleter< ArgIface > > (
1280 new OnlyOneGroup( std::forward< NAME > ( name ), required ),
1282
1283 OnlyOneGroup & g = *group;
1284
1285 ARGPTR a = std::move( group );
1286
1287 m_self.addArg( std::move( a ) );
1288
1290 ( *( static_cast< PARENT* > ( this ) ), g );
1291 }
1292
1294 template< typename NAME >
1297 NAME && name,
1299 bool required = false )
1300 {
1301 auto group = std::unique_ptr< AllOfGroup, details::Deleter< ArgIface > > (
1302 new AllOfGroup( std::forward< NAME > ( name ), required ),
1304
1305 AllOfGroup & g = *group;
1306
1307 ARGPTR a = std::move( group );
1308
1309 m_self.addArg( std::move( a ) );
1310
1312 ( *( static_cast< PARENT* > ( this ) ), g );
1313 }
1314
1316 template< typename NAME >
1319 NAME && name,
1321 bool required = false )
1322 {
1323 auto group = std::unique_ptr< AtLeastOneGroup, details::Deleter< ArgIface > > (
1324 new AtLeastOneGroup( std::forward< NAME > ( name ), required ),
1326
1327 AtLeastOneGroup & g = *group;
1328
1329 ARGPTR a = std::move( group );
1330
1331 m_self.addArg( std::move( a ) );
1332
1334 ( *( static_cast< PARENT* > ( this ) ), g );
1335 }
1336
1338 template< typename NAME >
1341 Char flag,
1343 NAME && name,
1345 bool isWithValue = false,
1347 bool isRequired = false,
1349 const String & desc = String(),
1351 const String & longDesc = String(),
1353 const String & defaultValue = String(),
1355 const String & valueSpecifier = String() )
1356 {
1357
1358 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
1359 new Arg( flag, std::forward< NAME > ( name ), isWithValue,
1360 isRequired ),
1362
1363 if( !desc.empty() )
1364 arg->setDescription( desc );
1365
1366 if( !longDesc.empty() )
1367 arg->setLongDescription( longDesc );
1368
1369 if( !defaultValue.empty() )
1370 arg->setDefaultValue( defaultValue );
1371
1372 if( !valueSpecifier.empty() )
1373 arg->setValueSpecifier( valueSpecifier );
1374
1375 ARGPTR a = std::move( arg );
1376
1377 m_self.addArg( std::move( a ) );
1378
1379 return m_parent;
1380 }
1381
1385 Char flag,
1387 bool isWithValue = false,
1389 bool isRequired = false,
1391 const String & desc = String(),
1393 const String & longDesc = String(),
1395 const String & defaultValue = String(),
1397 const String & valueSpecifier = String() )
1398 {
1399
1400 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
1401 new Arg( flag, isWithValue, isRequired ),
1403
1404 if( !desc.empty() )
1405 arg->setDescription( desc );
1406
1407 if( !longDesc.empty() )
1408 arg->setLongDescription( longDesc );
1409
1410 if( !defaultValue.empty() )
1411 arg->setDefaultValue( defaultValue );
1412
1413 if( !valueSpecifier.empty() )
1414 arg->setValueSpecifier( valueSpecifier );
1415
1416 ARGPTR a = std::move( arg );
1417
1418 m_self.addArg( std::move( a ) );
1419
1420 return m_parent;
1421 }
1422
1424 template< typename NAME >
1427 NAME && name,
1429 bool isWithValue = false,
1431 bool isRequired = false,
1433 const String & desc = String(),
1435 const String & longDesc = String(),
1437 const String & defaultValue = String(),
1439 const String & valueSpecifier = String() )
1440 {
1441
1442 auto arg = std::unique_ptr< Arg, details::Deleter< ArgIface > > (
1443 new Arg( std::forward< NAME > ( name ), isWithValue,
1444 isRequired ),
1446
1447 if( !desc.empty() )
1448 arg->setDescription( desc );
1449
1450 if( !longDesc.empty() )
1451 arg->setLongDescription( longDesc );
1452
1453 if( !defaultValue.empty() )
1454 arg->setDefaultValue( defaultValue );
1455
1456 if( !valueSpecifier.empty() )
1457 arg->setValueSpecifier( valueSpecifier );
1458
1459 ARGPTR a = std::move( arg );
1460
1461 m_self.addArg( std::move( a ) );
1462
1463 return m_parent;
1464 }
1465
1467 template< typename NAME >
1470 Char flag,
1472 NAME && name,
1474 bool isWithValue = false,
1476 bool isRequired = false,
1478 const String & desc = String(),
1480 const String & longDesc = String(),
1482 const String & defaultValue = String(),
1484 const String & valueSpecifier = String() )
1485 {
1486
1487 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1488 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
1489 isRequired ),
1491
1492 if( !desc.empty() )
1493 arg->setDescription( desc );
1494
1495 if( !longDesc.empty() )
1496 arg->setLongDescription( longDesc );
1497
1498 if( !defaultValue.empty() )
1499 arg->setDefaultValue( defaultValue );
1500
1501 if( !valueSpecifier.empty() )
1502 arg->setValueSpecifier( valueSpecifier );
1503
1504 ARGPTR a = std::move( arg );
1505
1506 m_self.addArg( std::move( a ) );
1507
1508 return m_parent;
1509 }
1510
1514 Char flag,
1516 bool isWithValue = false,
1518 bool isRequired = false,
1520 const String & desc = String(),
1522 const String & longDesc = String(),
1524 const String & defaultValue = String(),
1526 const String & valueSpecifier = String() )
1527 {
1528
1529 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1530 new MultiArg( flag, isWithValue, isRequired ),
1532
1533 if( !desc.empty() )
1534 arg->setDescription( desc );
1535
1536 if( !longDesc.empty() )
1537 arg->setLongDescription( longDesc );
1538
1539 if( !defaultValue.empty() )
1540 arg->setDefaultValue( defaultValue );
1541
1542 if( !valueSpecifier.empty() )
1543 arg->setValueSpecifier( valueSpecifier );
1544
1545 ARGPTR a = std::move( arg );
1546
1547 m_self.addArg( std::move( a ) );
1548
1549 return m_parent;
1550 }
1551
1553 template< typename NAME >
1556 NAME && name,
1558 bool isWithValue = false,
1560 bool isRequired = false,
1562 const String & desc = String(),
1564 const String & longDesc = String(),
1566 const String & defaultValue = String(),
1568 const String & valueSpecifier = String() )
1569 {
1570
1571 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1572 new MultiArg( std::forward< NAME > ( name ), isWithValue,
1573 isRequired ),
1575
1576 if( !desc.empty() )
1577 arg->setDescription( desc );
1578
1579 if( !longDesc.empty() )
1580 arg->setLongDescription( longDesc );
1581
1582 if( !defaultValue.empty() )
1583 arg->setDefaultValue( defaultValue );
1584
1585 if( !valueSpecifier.empty() )
1586 arg->setValueSpecifier( valueSpecifier );
1587
1588 ARGPTR a = std::move( arg );
1589
1590 m_self.addArg( std::move( a ) );
1591
1592 return m_parent;
1593 }
1594
1596 template< typename NAME >
1599 Char flag,
1601 NAME && name,
1603 bool isWithValue = false,
1605 bool isRequired = false,
1607 const String & desc = String(),
1609 const String & longDesc = String(),
1611 const StringList & defaultValues = StringList(),
1613 const String & valueSpecifier = String() )
1614 {
1615
1616 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1617 new MultiArg( flag, std::forward< NAME > ( name ), isWithValue,
1618 isRequired ),
1620
1621 if( !desc.empty() )
1622 arg->setDescription( desc );
1623
1624 if( !longDesc.empty() )
1625 arg->setLongDescription( longDesc );
1626
1627 if( !defaultValues.empty() )
1628 arg->setDefaultValues( defaultValues );
1629
1630 if( !valueSpecifier.empty() )
1631 arg->setValueSpecifier( valueSpecifier );
1632
1633 ARGPTR a = std::move( arg );
1634
1635 m_self.addArg( std::move( a ) );
1636
1637 return m_parent;
1638 }
1639
1643 Char flag,
1645 bool isWithValue = false,
1647 bool isRequired = false,
1649 const String & desc = String(),
1651 const String & longDesc = String(),
1653 const StringList & defaultValues = StringList(),
1655 const String & valueSpecifier = String() )
1656 {
1657
1658 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1659 new MultiArg( flag, isWithValue, isRequired ),
1661
1662 if( !desc.empty() )
1663 arg->setDescription( desc );
1664
1665 if( !longDesc.empty() )
1666 arg->setLongDescription( longDesc );
1667
1668 if( !defaultValues.empty() )
1669 arg->setDefaultValues( defaultValues );
1670
1671 if( !valueSpecifier.empty() )
1672 arg->setValueSpecifier( valueSpecifier );
1673
1674 ARGPTR a = std::move( arg );
1675
1676 m_self.addArg( std::move( a ) );
1677
1678 return m_parent;
1679 }
1680
1682 template< typename NAME >
1685 NAME && name,
1687 bool isWithValue = false,
1689 bool isRequired = false,
1691 const String & desc = String(),
1693 const String & longDesc = String(),
1695 const StringList & defaultValues = StringList(),
1697 const String & valueSpecifier = String() )
1698 {
1699
1700 auto arg = std::unique_ptr< MultiArg, details::Deleter< ArgIface > > (
1701 new MultiArg( std::forward< NAME > ( name ), isWithValue,
1702 isRequired ),
1704
1705 if( !desc.empty() )
1706 arg->setDescription( desc );
1707
1708 if( !longDesc.empty() )
1709 arg->setLongDescription( longDesc );
1710
1711 if( !defaultValues.empty() )
1712 arg->setDefaultValues( defaultValues );
1713
1714 if( !valueSpecifier.empty() )
1715 arg->setValueSpecifier( valueSpecifier );
1716
1717 ARGPTR a = std::move( arg );
1718
1719 m_self.addArg( std::move( a ) );
1720
1721 return m_parent;
1722 }
1723
1725 template< typename NAME >
1728 NAME && name,
1732 bool isSubCommandRequired = false,
1734 const String & desc = String(),
1736 const String & longDesc = String(),
1738 const String & defaultValue = String(),
1740 const String & valueSpecifier = String() )
1741 {
1742 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
1743 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
1745
1746 if( !desc.empty() )
1747 cmd->setDescription( desc );
1748
1749 if( !longDesc.empty() )
1750 cmd->setLongDescription( longDesc );
1751
1752 if( !defaultValue.empty() )
1753 cmd->setDefaultValue( defaultValue );
1754
1755 if( !valueSpecifier.empty() )
1756 cmd->setValueSpecifier( valueSpecifier );
1757
1758 Command & c = *cmd;
1759
1760 ARGPTR arg = std::move( cmd );
1761
1762 m_self.addArg( std::move( arg ) );
1763
1764 return API< PARENT, Command, ARGPTR, false > ( m_self, c );
1765 }
1766
1768 template< typename NAME >
1771 NAME && name,
1775 bool isSubCommandRequired = false,
1777 const String & desc = String(),
1779 const String & longDesc = String(),
1781 const StringList & defaultValues = StringList(),
1783 const String & valueSpecifier = String() )
1784 {
1785 auto cmd = std::unique_ptr< Command, details::Deleter< ArgIface > > (
1786 new Command( std::forward< NAME > ( name ), opt, isSubCommandRequired ),
1788
1789 if( !desc.empty() )
1790 cmd->setDescription( desc );
1791
1792 if( !longDesc.empty() )
1793 cmd->setLongDescription( longDesc );
1794
1795 if( !defaultValues.empty() )
1796 cmd->setDefaultValues( defaultValues );
1797
1798 if( !valueSpecifier.empty() )
1799 cmd->setValueSpecifier( valueSpecifier );
1800
1801 Command & c = *cmd;
1802
1803 ARGPTR arg = std::move( cmd );
1804
1805 m_self.addArg( std::move( arg ) );
1806
1807 return API< PARENT, Command, ARGPTR, false > ( m_self, c );
1808 }
1809
1810private:
1812 PARENT & m_parent;
1814 SELF & m_self;
1815}; // class API
1816
1817} /* namespace details */
1818
1819} /* namespace Args */
1820
1821#endif // ARGS__API_HPP__INCLUDED
Group of args where all arguments should be defined.
Definition groups.hpp:139
Argument with one value that can be present only once in the command line.
Definition arg.hpp:58
Interface for arguments.
Definition arg_iface.hpp:51
Group of args where at least one argument should be defined.
Definition groups.hpp:215
Command in the command line interface.
Definition command.hpp:53
std::unique_ptr< ArgIface, details::Deleter< ArgIface > > ArgPtr
Smart pointer to the argument.
MultiArg is a class that presents argument in the command line taht can be presented more than once o...
Definition multi_arg.hpp:59
Group of args where only one argument can be defined.
Definition groups.hpp:57
API< PARENT, Command, ARGPTR, false > addArg(ArgIface *arg)
Add argument.
Definition api.hpp:538
API< API< PARENT, Command, ARGPTR, false >, AllOfGroup, ARGPTR, false > addAllOfGroup(NAME &&name, bool required=false)
Add AllOfGroup.
Definition api.hpp:98
API< PARENT, Command, ARGPTR, false > & addMultiArgWithFlagOnlyAndDefaultValues(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:444
API< PARENT, Command, ARGPTR, false > addArg(GroupIface::ArgPtr arg)
Add argument.
Definition api.hpp:547
PARENT & end() const
End this group.
Definition api.hpp:641
API< PARENT, Command, ARGPTR, false > & addMultiArg(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:271
API< PARENT, Command, ARGPTR, false > & addArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with name only.
Definition api.hpp:228
API< API< PARENT, Command, ARGPTR, false >, OnlyOneGroup, ARGPTR, false > addOnlyOneGroup(NAME &&name, bool required=false)
Add OnlyOneGroup.
Definition api.hpp:76
API< PARENT, Command, ARGPTR, false > & addMultiArgWithNameOnlyAndDefaultValues(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:486
API(PARENT &parent, Command &self)
Definition api.hpp:64
API< PARENT, Command, ARGPTR, false > & addMultiArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:315
API< PARENT, Command, ARGPTR, false > & addArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with flag only.
Definition api.hpp:186
API< PARENT, Command, ARGPTR, false > & addMultiArgWithDefaulValues(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:400
API< PARENT, Command, ARGPTR, false > addArg(ArgIface &arg)
Add argument.
Definition api.hpp:529
API< API< PARENT, Command, ARGPTR, false >, AtLeastOneGroup, ARGPTR, false > addAtLeastOneGroup(NAME &&name, bool required=false)
Add AtLeastOneGroup.
Definition api.hpp:120
API< PARENT, Command, ARGPTR, false > & addMultiArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:357
API< API< PARENT, Command, ARGPTR, false >, Command, ARGPTR, false > addCommandWithDefaultValues(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:599
API< PARENT, Command, ARGPTR, false > & addArgWithFlagAndName(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument.
Definition api.hpp:142
API< API< PARENT, Command, ARGPTR, false >, Command, ARGPTR, false > addCommand(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:556
API< PARENT, SELF, ARGPTR, false > & addMultiArgWithNameOnlyAndDefaultValues(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:1085
API< API< PARENT, SELF, ARGPTR, false >, Command, ARGPTR, false > addCommandWithDefaultValues(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:1198
API< PARENT, SELF, ARGPTR, false > addArg(ArgIface *arg)
Add argument.
Definition api.hpp:1137
API< PARENT, SELF, ARGPTR, false > addArg(ArgIface &arg)
Add argument.
Definition api.hpp:1128
API< API< PARENT, SELF, ARGPTR, false >, Command, ARGPTR, false > addCommand(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:1155
API< PARENT, SELF, ARGPTR, false > & addMultiArgWithDefaulValues(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:999
API< API< PARENT, SELF, ARGPTR, false >, AtLeastOneGroup, ARGPTR, false > addAtLeastOneGroup(NAME &&name, bool required=false)
Add AtLeastOneGroup.
Definition api.hpp:719
API< API< PARENT, SELF, ARGPTR, false >, OnlyOneGroup, ARGPTR, false > addOnlyOneGroup(NAME &&name, bool required=false)
Add OnlyOneGroup.
Definition api.hpp:675
API< PARENT, SELF, ARGPTR, false > & addMultiArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:914
API< PARENT, SELF, ARGPTR, false > & addArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with flag only.
Definition api.hpp:785
API< PARENT, SELF, ARGPTR, false > & addMultiArgWithFlagOnlyAndDefaultValues(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:1043
API< PARENT, SELF, ARGPTR, false > & addArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with name only.
Definition api.hpp:827
API< PARENT, SELF, ARGPTR, false > addArg(GroupIface::ArgPtr arg)
Add argument.
Definition api.hpp:1146
API< PARENT, SELF, ARGPTR, false > & addArgWithFlagAndName(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument.
Definition api.hpp:741
API< API< PARENT, SELF, ARGPTR, false >, AllOfGroup, ARGPTR, false > addAllOfGroup(NAME &&name, bool required=false)
Add AllOfGroup.
Definition api.hpp:697
API< PARENT, SELF, ARGPTR, false > & addMultiArg(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:870
API< PARENT, SELF, ARGPTR, false > & addMultiArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:956
PARENT & end() const
End this group.
Definition api.hpp:1240
PARENT & addMultiArgWithNameOnlyAndDefaultValues(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:1683
PARENT & addArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with flag only.
Definition api.hpp:1383
PARENT & addMultiArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with name only.
Definition api.hpp:1554
API< PARENT, AtLeastOneGroup, ARGPTR, false > addAtLeastOneGroup(NAME &&name, bool required=false)
Add AtLeastOneGroup.
Definition api.hpp:1317
PARENT & addArgWithFlagAndName(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument.
Definition api.hpp:1339
API< PARENT, AllOfGroup, ARGPTR, false > addAllOfGroup(NAME &&name, bool required=false)
Add AllOfGroup.
Definition api.hpp:1295
API< PARENT, Command, ARGPTR, false > addCommandWithDefaultValues(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:1769
API< PARENT, OnlyOneGroup, ARGPTR, false > addOnlyOneGroup(NAME &&name, bool required=false)
Add OnlyOneGroup.
Definition api.hpp:1273
PARENT & addMultiArgWithFlagOnlyAndDefaultValues(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:1641
PARENT & addArgWithNameOnly(NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add argument with name only.
Definition api.hpp:1425
API< PARENT, Command, ARGPTR, false > addCommand(NAME &&name, ValueOptions opt=ValueOptions::NoValue, bool isSubCommandRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add Command.
Definition api.hpp:1726
PARENT & addMultiArg(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:1468
PARENT & addMultiArgWithFlagOnly(Char flag, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const String &defaultValue=String(), const String &valueSpecifier=String())
Add multi argument with flag only.
Definition api.hpp:1512
PARENT & addMultiArgWithDefaulValues(Char flag, NAME &&name, bool isWithValue=false, bool isRequired=false, const String &desc=String(), const String &longDesc=String(), const StringList &defaultValues=StringList(), const String &valueSpecifier=String())
Add multi argument.
Definition api.hpp:1597
Auxiliary API.
Definition api.hpp:53
Definition api.hpp:42
std::string String
String type.
Definition types.hpp:324
std::vector< String > StringList
List of strings.
Definition types.hpp:346
ValueOptions
Options for value property.
Definition enums.hpp:41
@ NoValue
No values.
String::value_type Char
Char type.
Definition types.hpp:327