54 std::pair<targetIterator, bool> res =
m_targets.insert( { tgt.
name, tgt } );
55 res.first->second.orderAdded =
nAdded;
62 const std::string &so,
63 const std::string &lo,
66 const std::string &kw,
68 const std::string &ht,
69 const std::string &he )
85 if( it->second.shortOpt ==
"" && it->second.longOpt ==
"" )
88 clOpts.
add( it->second.name, it->second.shortOpt.c_str(), it->second.longOpt.c_str(), it->second.clType );
95 if( cloit->shortOpt ==
"" && cloit->longOpt ==
"" )
98 clOpts.
add( cloit->name, cloit->shortOpt.c_str(), cloit->longOpt.c_str(), cloit->clType );
106 std::vector<std::string> unk;
109 for(
size_t n = 0; n < unk.size(); ++n )
120 if( clOpts.
nOpts == 0 )
127 if( oneTarget !=
"" && it->second.name != oneTarget )
130 if( clOpts.
optSet( it->second.name ) )
132 std::vector<std::string> args;
134 clOpts.
getAll( args, it->second.name );
136 it->second.values.insert( it->second.values.end(), args.begin(), args.end() );
139 for(
size_t n = 0; n < args.size(); ++n )
140 it->second.sources.push_back(
"command line" );
143 it->second.verbosity = clOpts.
count( it->second.name );
144 it->second.set =
true;
158 int prv = iF.
parse( fname );
162 if( !reportFileNotFound )
178 "Parsing error in " + fname +
" at line " + std::to_string( prv ) );
186 if( iF.
count( it->second.section, it->second.keyword ) > 0 )
188 it->second.values.push_back( iF( it->second.section, it->second.keyword ) );
191 it->second.sources.push_back( fname );
193 it->second.set =
true;
195 iF.
erase( it->second.section, it->second.keyword );
200 for(
auto iFit = iF.
names.begin(); iFit != iF.
names.end(); ++iFit )
205 std::string sect, nam;
223 if( targets.count( name ) == 0 )
226 targets[name].used =
true;
228 return targets[name].set;
238 targets[name].used =
true;
239 return targets[name].values.size();
249 targets[name].used =
true;
250 return targets[name].verbosity;
262template int appConfigurator::get<char>(
char &v,
263 const std::string &name,
265 std::unordered_map<std::string, configTarget> &targets );
267template int appConfigurator::get<signed char>(
signed char &v,
268 const std::string &name,
270 std::unordered_map<std::string, configTarget> &targets );
272template int appConfigurator::get<short>(
short &v,
273 const std::string &name,
275 std::unordered_map<std::string, configTarget> &targets );
277template int appConfigurator::get<int>(
int &v,
278 const std::string &name,
280 std::unordered_map<std::string, configTarget> &targets );
282template int appConfigurator::get<long>(
long &v,
283 const std::string &name,
285 std::unordered_map<std::string, configTarget> &targets );
287template int appConfigurator::get<long long>(
long long &v,
288 const std::string &name,
290 std::unordered_map<std::string, configTarget> &targets );
292template int appConfigurator::get<unsigned char>(
unsigned char &v,
293 const std::string &name,
295 std::unordered_map<std::string, configTarget> &targets );
297template int appConfigurator::get<unsigned short>(
unsigned short &v,
298 const std::string &name,
300 std::unordered_map<std::string, configTarget> &targets );
302template int appConfigurator::get<unsigned int>(
unsigned int &v,
303 const std::string &name,
305 std::unordered_map<std::string, configTarget> &targets );
307template int appConfigurator::get<unsigned long>(
unsigned long &v,
308 const std::string &name,
310 std::unordered_map<std::string, configTarget> &targets );
312template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
313 const std::string &name,
315 std::unordered_map<std::string, configTarget> &targets );
317template int appConfigurator::get<float>(
float &v,
318 const std::string &name,
320 std::unordered_map<std::string, configTarget> &targets );
322template int appConfigurator::get<double>(
double &v,
323 const std::string &name,
325 std::unordered_map<std::string, configTarget> &targets );
327template int appConfigurator::get<long double>(
long double &v,
328 const std::string &name,
330 std::unordered_map<std::string, configTarget> &targets );
333template int appConfigurator::get<__float128>( __float128 &v,
334 const std::string &name,
336 std::unordered_map<std::string, configTarget> &targets );
339template int appConfigurator::get<bool>(
bool &v,
340 const std::string &name,
342 std::unordered_map<std::string, configTarget> &targets );
344template int appConfigurator::get<std::string>( std::string &v,
345 const std::string &name,
347 std::unordered_map<std::string, configTarget> &targets );
351template int appConfigurator::get<char>(
char &v,
const std::string &name,
size_t i );
353template int appConfigurator::get<signed char>(
signed char &v,
const std::string &name,
size_t i );
355template int appConfigurator::get<short>(
short &v,
const std::string &name,
size_t i );
357template int appConfigurator::get<int>(
int &v,
const std::string &name,
size_t i );
359template int appConfigurator::get<long>(
long &v,
const std::string &name,
size_t i );
361template int appConfigurator::get<long long>(
long long &v,
const std::string &name,
size_t i );
363template int appConfigurator::get<unsigned char>(
unsigned char &v,
const std::string &name,
size_t i );
365template int appConfigurator::get<unsigned short>(
unsigned short &v,
const std::string &name,
size_t i );
367template int appConfigurator::get<unsigned int>(
unsigned int &v,
const std::string &name,
size_t i );
369template int appConfigurator::get<unsigned long>(
unsigned long &v,
const std::string &name,
size_t i );
371template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
const std::string &name,
size_t i );
373template int appConfigurator::get<float>(
float &v,
const std::string &name,
size_t i );
375template int appConfigurator::get<double>(
double &v,
const std::string &name,
size_t i );
377template int appConfigurator::get<long double>(
long double &v,
const std::string &name,
size_t i );
380template int appConfigurator::get<__float128>( __float128 &v,
const std::string &name,
size_t i );
383template int appConfigurator::get<bool>(
bool &v,
const std::string &name,
size_t i );
385template int appConfigurator::get<std::string>( std::string &v,
const std::string &name,
size_t i );
390appConfigurator::get<char>(
char &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
392template int appConfigurator::get<signed char>(
signed char &v,
393 const std::string &name,
394 std::unordered_map<std::string, configTarget> &targets );
396template int appConfigurator::get<short>(
short &v,
397 const std::string &name,
398 std::unordered_map<std::string, configTarget> &targets );
401appConfigurator::get<int>(
int &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
404appConfigurator::get<long>(
long &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
406template int appConfigurator::get<long long>(
long long &v,
407 const std::string &name,
408 std::unordered_map<std::string, configTarget> &targets );
410template int appConfigurator::get<unsigned char>(
unsigned char &v,
411 const std::string &name,
412 std::unordered_map<std::string, configTarget> &targets );
414template int appConfigurator::get<unsigned short>(
unsigned short &v,
415 const std::string &name,
416 std::unordered_map<std::string, configTarget> &targets );
418template int appConfigurator::get<unsigned int>(
unsigned int &v,
419 const std::string &name,
420 std::unordered_map<std::string, configTarget> &targets );
422template int appConfigurator::get<unsigned long>(
unsigned long &v,
423 const std::string &name,
424 std::unordered_map<std::string, configTarget> &targets );
426template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
427 const std::string &name,
428 std::unordered_map<std::string, configTarget> &targets );
430template int appConfigurator::get<float>(
float &v,
431 const std::string &name,
432 std::unordered_map<std::string, configTarget> &targets );
434template int appConfigurator::get<double>(
double &v,
435 const std::string &name,
436 std::unordered_map<std::string, configTarget> &targets );
438template int appConfigurator::get<long double>(
long double &v,
439 const std::string &name,
440 std::unordered_map<std::string, configTarget> &targets );
443template int appConfigurator::get<__float128>( __float128 &v,
444 const std::string &name,
445 std::unordered_map<std::string, configTarget> &targets );
449appConfigurator::get<bool>(
bool &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
451template int appConfigurator::get<std::string>( std::string &v,
452 const std::string &name,
453 std::unordered_map<std::string, configTarget> &targets );
457template int appConfigurator::get<char>(
char &v,
const std::string &name );
459template int appConfigurator::get<signed char>(
signed char &v,
const std::string &name );
461template int appConfigurator::get<short>(
short &v,
const std::string &name );
463template int appConfigurator::get<int>(
int &v,
const std::string &name );
465template int appConfigurator::get<long>(
long &v,
const std::string &name );
467template int appConfigurator::get<long long>(
long long &v,
const std::string &name );
469template int appConfigurator::get<unsigned char>(
unsigned char &v,
const std::string &name );
471template int appConfigurator::get<unsigned short>(
unsigned short &v,
const std::string &name );
473template int appConfigurator::get<unsigned int>(
unsigned int &v,
const std::string &name );
475template int appConfigurator::get<unsigned long>(
unsigned long &v,
const std::string &name );
477template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
const std::string &name );
479template int appConfigurator::get<float>(
float &v,
const std::string &name );
481template int appConfigurator::get<double>(
double &v,
const std::string &name );
483template int appConfigurator::get<long double>(
long double &v,
const std::string &name );
486template int appConfigurator::get<__float128>( __float128 &v,
const std::string &name );
489template int appConfigurator::get<bool>(
bool &v,
const std::string &name );
491template int appConfigurator::get<std::string>( std::string &v,
const std::string &name );
495template int appConfigurator::get<char>( std::vector<char> &v,
496 const std::string &name,
498 std::unordered_map<std::string, configTarget> &targets );
500template int appConfigurator::get<signed char>( std::vector<signed char> &v,
501 const std::string &name,
503 std::unordered_map<std::string, configTarget> &targets );
505template int appConfigurator::get<short>( std::vector<short> &v,
506 const std::string &name,
508 std::unordered_map<std::string, configTarget> &targets );
510template int appConfigurator::get<int>( std::vector<int> &v,
511 const std::string &name,
513 std::unordered_map<std::string, configTarget> &targets );
515template int appConfigurator::get<long>( std::vector<long> &v,
516 const std::string &name,
518 std::unordered_map<std::string, configTarget> &targets );
520template int appConfigurator::get<long long>( std::vector<long long> &v,
521 const std::string &name,
523 std::unordered_map<std::string, configTarget> &targets );
525template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
526 const std::string &name,
528 std::unordered_map<std::string, configTarget> &targets );
530template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
531 const std::string &name,
533 std::unordered_map<std::string, configTarget> &targets );
535template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
536 const std::string &name,
538 std::unordered_map<std::string, configTarget> &targets );
540template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
541 const std::string &name,
543 std::unordered_map<std::string, configTarget> &targets );
545template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
546 const std::string &name,
548 std::unordered_map<std::string, configTarget> &targets );
550template int appConfigurator::get<float>( std::vector<float> &v,
551 const std::string &name,
553 std::unordered_map<std::string, configTarget> &targets );
555template int appConfigurator::get<double>( std::vector<double> &v,
556 const std::string &name,
558 std::unordered_map<std::string, configTarget> &targets );
560template int appConfigurator::get<long double>( std::vector<long double> &v,
561 const std::string &name,
563 std::unordered_map<std::string, configTarget> &targets );
566template int appConfigurator::get<__float128>( std::vector<__float128> &v,
567 const std::string &name,
569 std::unordered_map<std::string, configTarget> &targets );
572template int appConfigurator::get<bool>( std::vector<bool> &v,
573 const std::string &name,
575 std::unordered_map<std::string, configTarget> &targets );
577template int appConfigurator::get<std::string>( std::vector<std::string> &v,
578 const std::string &name,
580 std::unordered_map<std::string, configTarget> &targets );
584template int appConfigurator::get<char>( std::vector<char> &v,
const std::string &name,
size_t i );
586template int appConfigurator::get<signed char>( std::vector<signed char> &v,
const std::string &name,
size_t i );
588template int appConfigurator::get<short>( std::vector<short> &v,
const std::string &name,
size_t i );
590template int appConfigurator::get<int>( std::vector<int> &v,
const std::string &name,
size_t i );
592template int appConfigurator::get<long>( std::vector<long> &v,
const std::string &name,
size_t i );
594template int appConfigurator::get<long long>( std::vector<long long> &v,
const std::string &name,
size_t i );
596template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
const std::string &name,
size_t i );
598template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
const std::string &name,
size_t i );
600template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
const std::string &name,
size_t i );
602template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
const std::string &name,
size_t i );
605appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
const std::string &name,
size_t i );
607template int appConfigurator::get<float>( std::vector<float> &v,
const std::string &name,
size_t i );
609template int appConfigurator::get<double>( std::vector<double> &v,
const std::string &name,
size_t i );
611template int appConfigurator::get<long double>( std::vector<long double> &v,
const std::string &name,
size_t i );
614template int appConfigurator::get<__float128>( std::vector<__float128> &v,
const std::string &name,
size_t i );
617template int appConfigurator::get<bool>( std::vector<bool> &v,
const std::string &name,
size_t i );
619template int appConfigurator::get<std::string>( std::vector<std::string> &v,
const std::string &name,
size_t i );
622template int appConfigurator::get<char>( std::vector<char> &v,
623 const std::string &name,
624 std::unordered_map<std::string, configTarget> &targets );
626template int appConfigurator::get<signed char>( std::vector<signed char> &v,
627 const std::string &name,
628 std::unordered_map<std::string, configTarget> &targets );
630template int appConfigurator::get<short>( std::vector<short> &v,
631 const std::string &name,
632 std::unordered_map<std::string, configTarget> &targets );
634template int appConfigurator::get<int>( std::vector<int> &v,
635 const std::string &name,
636 std::unordered_map<std::string, configTarget> &targets );
638template int appConfigurator::get<long>( std::vector<long> &v,
639 const std::string &name,
640 std::unordered_map<std::string, configTarget> &targets );
642template int appConfigurator::get<long long>( std::vector<long long> &v,
643 const std::string &name,
644 std::unordered_map<std::string, configTarget> &targets );
646template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
647 const std::string &name,
648 std::unordered_map<std::string, configTarget> &targets );
650template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
651 const std::string &name,
652 std::unordered_map<std::string, configTarget> &targets );
654template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
655 const std::string &name,
656 std::unordered_map<std::string, configTarget> &targets );
658template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
659 const std::string &name,
660 std::unordered_map<std::string, configTarget> &targets );
662template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
663 const std::string &name,
664 std::unordered_map<std::string, configTarget> &targets );
666template int appConfigurator::get<float>( std::vector<float> &v,
667 const std::string &name,
668 std::unordered_map<std::string, configTarget> &targets );
670template int appConfigurator::get<double>( std::vector<double> &v,
671 const std::string &name,
672 std::unordered_map<std::string, configTarget> &targets );
674template int appConfigurator::get<long double>( std::vector<long double> &v,
675 const std::string &name,
676 std::unordered_map<std::string, configTarget> &targets );
679template int appConfigurator::get<__float128>( std::vector<__float128> &v,
680 const std::string &name,
681 std::unordered_map<std::string, configTarget> &targets );
684template int appConfigurator::get<bool>( std::vector<bool> &v,
685 const std::string &name,
686 std::unordered_map<std::string, configTarget> &targets );
688template int appConfigurator::get<std::string>( std::vector<std::string> &v,
689 const std::string &name,
690 std::unordered_map<std::string, configTarget> &targets );
693template int appConfigurator::get<char>( std::vector<char> &v,
const std::string &name );
695template int appConfigurator::get<signed char>( std::vector<signed char> &v,
const std::string &name );
697template int appConfigurator::get<short>( std::vector<short> &v,
const std::string &name );
699template int appConfigurator::get<int>( std::vector<int> &v,
const std::string &name );
701template int appConfigurator::get<long>( std::vector<long> &v,
const std::string &name );
703template int appConfigurator::get<long long>( std::vector<long long> &v,
const std::string &name );
705template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
const std::string &name );
707template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
const std::string &name );
709template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
const std::string &name );
711template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
const std::string &name );
713template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
const std::string &name );
715template int appConfigurator::get<float>( std::vector<float> &v,
const std::string &name );
717template int appConfigurator::get<double>( std::vector<double> &v,
const std::string &name );
719template int appConfigurator::get<long double>( std::vector<long double> &v,
const std::string &name );
722template int appConfigurator::get<__float128>( std::vector<__float128> &v,
const std::string &name );
725template int appConfigurator::get<bool>( std::vector<bool> &v,
const std::string &name );
727template int appConfigurator::get<std::string>( std::vector<std::string> &v,
const std::string &name );
731template int appConfigurator::operator()<
char>(
char &v,
const std::string &name );
733template int appConfigurator::operator()<
signed char>(
signed char &v,
const std::string &name );
735template int appConfigurator::operator()<
short>(
short &v,
const std::string &name );
737template int appConfigurator::operator()<
int>(
int &v,
const std::string &name );
739template int appConfigurator::operator()<
long>(
long &v,
const std::string &name );
741template int appConfigurator::operator()<
long long>(
long long &v,
const std::string &name );
743template int appConfigurator::operator()<
unsigned char>(
unsigned char &v,
const std::string &name );
745template int appConfigurator::operator()<
unsigned short>(
unsigned short &v,
const std::string &name );
747template int appConfigurator::operator()<
unsigned int>(
unsigned int &v,
const std::string &name );
749template int appConfigurator::operator()<
unsigned long>(
unsigned long &v,
const std::string &name );
751template int appConfigurator::operator()<
unsigned long long>(
unsigned long long &v,
const std::string &name );
753template int appConfigurator::operator()<
float>(
float &v,
const std::string &name );
755template int appConfigurator::operator()<
double>(
double &v,
const std::string &name );
757template int appConfigurator::operator()<
long double>(
long double &v,
const std::string &name );
760template int appConfigurator::operator()<__float128>( __float128 &v,
const std::string &name );
763template int appConfigurator::operator()<
bool>(
bool &v,
const std::string &name );
765template int appConfigurator::operator()<std::string>( std::string &v,
const std::string &name );
769template int appConfigurator::configUnused<char>(
char &v,
const std::string &key );
771template int appConfigurator::configUnused<signed char>(
signed char &v,
const std::string &key );
773template int appConfigurator::configUnused<short>(
short &v,
const std::string &key );
775template int appConfigurator::configUnused<int>(
int &v,
const std::string &key );
777template int appConfigurator::configUnused<long>(
long &v,
const std::string &key );
779template int appConfigurator::configUnused<long long>(
long long &v,
const std::string &key );
781template int appConfigurator::configUnused<unsigned char>(
unsigned char &v,
const std::string &key );
783template int appConfigurator::configUnused<unsigned short>(
unsigned short &v,
const std::string &key );
785template int appConfigurator::configUnused<unsigned int>(
unsigned int &v,
const std::string &key );
787template int appConfigurator::configUnused<unsigned long>(
unsigned long &v,
const std::string &key );
789template int appConfigurator::configUnused<unsigned long long>(
unsigned long long &v,
const std::string &key );
791template int appConfigurator::configUnused<float>(
float &v,
const std::string &key );
793template int appConfigurator::configUnused<double>(
double &v,
const std::string &key );
795template int appConfigurator::configUnused<long double>(
long double &v,
const std::string &key );
798template int appConfigurator::configUnused<__float128>( __float128 &v,
const std::string &key );
801template int appConfigurator::configUnused<bool>(
bool &v,
const std::string &key );
803template int appConfigurator::configUnused<std::string>( std::string &v,
const std::string &key );
807template int appConfigurator::configUnused<char>(
char &v,
const std::string §ion,
const std::string &keyword );
810appConfigurator::configUnused<signed char>(
signed char &v,
const std::string §ion,
const std::string &keyword );
812template int appConfigurator::configUnused<short>(
short &v,
const std::string §ion,
const std::string &keyword );
814template int appConfigurator::configUnused<int>(
int &v,
const std::string §ion,
const std::string &keyword );
816template int appConfigurator::configUnused<long>(
long &v,
const std::string §ion,
const std::string &keyword );
819appConfigurator::configUnused<long long>(
long long &v,
const std::string §ion,
const std::string &keyword );
821template int appConfigurator::configUnused<unsigned char>(
unsigned char &v,
822 const std::string §ion,
823 const std::string &keyword );
825template int appConfigurator::configUnused<unsigned short>(
unsigned short &v,
826 const std::string §ion,
827 const std::string &keyword );
830appConfigurator::configUnused<unsigned int>(
unsigned int &v,
const std::string §ion,
const std::string &keyword );
832template int appConfigurator::configUnused<unsigned long>(
unsigned long &v,
833 const std::string §ion,
834 const std::string &keyword );
836template int appConfigurator::configUnused<unsigned long long>(
unsigned long long &v,
837 const std::string §ion,
838 const std::string &keyword );
840template int appConfigurator::configUnused<float>(
float &v,
const std::string §ion,
const std::string &keyword );
842template int appConfigurator::configUnused<double>(
double &v,
const std::string §ion,
const std::string &keyword );
845appConfigurator::configUnused<long double>(
long double &v,
const std::string §ion,
const std::string &keyword );
849appConfigurator::configUnused<__float128>( __float128 &v,
const std::string §ion,
const std::string &keyword );
852template int appConfigurator::configUnused<bool>(
bool &v,
const std::string §ion,
const std::string &keyword );
855appConfigurator::configUnused<std::string>( std::string &v,
const std::string §ion,
const std::string &keyword );
866 std::string sect = it->second.section;
871 for(
size_t i = 0; i < sections.size(); ++i )
873 if( sections[i] == sect )
882 sections.push_back( sect );
894 const std::vector<std::string> §ions,
895 const std::vector<std::string> &keywords,
896 const std::vector<std::string> &values )
902 std::string lastSection;
903 for(
size_t i = 0; i < sections.size(); ++i )
905 std::string currSection = sections[i];
907 if( currSection != lastSection && currSection !=
"" )
909 fout <<
"\n[" << currSection <<
"]\n";
912 if( keywords.size() >= i && values.size() >= i )
914 if( keywords[i] !=
"" )
916 fout << keywords[i] <<
"=" << values[i] <<
"\n";
919 lastSection = currSection;
An application configuration manager.
void writeConfigFile(const std::string &fname, const std::vector< std::string > §ions, const std::vector< std::string > &keywords, const std::vector< std::string > &values)
A simple config file writing function, useful for testing.
@ filenotfound
The file was not found.
@ parseerr
A parsing error occurred.
@ allocerr
An error occurred during memory allocation.
error_t mxlib_error_report(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Print a report to stderr given an mxlib error_t code and explanation and return the code.
std::unordered_map< std::string, configTarget > m_targets
The targets are stored in an unordered_map for fast access by key.
int readConfig(const std::string &fname, bool reportFileNotFound=true)
Read and parse a config/ini file, updating the targets.
void add(const configTarget &tgt)
Add a configTarget.
bool m_sources
Flag controlling whether or not to record config sources.
std::vector< std::string > nonOptions
Non-option arguments from the command line.
int verbosity(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Get the command line verbosity count for this option.
std::unordered_map< std::string, configTarget >::iterator targetIterator
Iterator for the targets unordered_map.
int isSetUnused(const std::string &name)
Check if a target has been set in the unused configuration.
bool isSet(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Check if a target has been set by the configuration.
void clear()
Clear the containers and free up the associated memory.
int unusedSections(std::vector< std::string > §ions)
Get the unique sections in the unused config targets.
std::list< configTarget > clOnlyTargets
Targets which are only for the command line are stored separately in a list.
int count(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Get the number of different values set for the specified config target.
void parseCommandLine(int argc, char **argv, const std::string &oneTarget="")
Parse the command line, updating the targets.
int nAdded
Running count of options added, used to track order.
std::unordered_map< std::string, configTarget > m_unusedConfigs
std::list< configTarget >::iterator clOnlyTargetIterator
Iterator for the clOnlyTargets list.
Command line options parser.
void parse(int argc, char **argv, std::vector< std::string > *nonOptions=0)
Parse the command line.
int numUnknown()
Get the number of unknown options found by the parser.
void add(const std::string &optName, const char *const shortOpt, const char *const longOpt, int argT)
Add a command line option target.
int count(const std::string &key)
Get the number of times the option was set on the command line.
unsigned int nOpts
The number of options added.
void getAll(std::vector< std::string > &args, const std::string &key)
Fill a vector of strings with the arguments supplied for key, last to first.
int unknown(std::vector< std::string > &unk)
Get a vector of the unknown options found by the parser.
bool optSet(const std::string &key)
Test whether this option was set.
std::string keyword
The config file keyword, read in a "keyword=value" pair.
std::string section
The config file section name, can be empty "".
std::string name
The name of the target.
A wrapper for the ini functions.
size_t count(const std::string §ion, const std::string &name)
Get the number of entries for the given section and name.
int erase(const std::string §ion, const std::string &name)
Erase the entry for the given section and name.
nameMapT names
The map of section=name keys to values.
static int parseKey(std::string §ion, std::string &name, const std::string &key)
Parse a key into its section and name consituents.
int parse(const std::string &fname)
Calls the inih parse function with this->handler.