54 std::pair<targetIterator, bool> res =
m_targets.insert({tgt.
name, tgt});
55 res.first->second.orderAdded =
nAdded;
63 const std::string &so,
64 const std::string &lo,
66 const std::string & s,
67 const std::string & kw,
69 const std::string & ht,
70 const std::string & he )
77 const std::string & oneTarget
88 if(it->second.shortOpt ==
"" && it->second.longOpt ==
"")
continue;
90 clOpts.
add(it->second.name,it->second.shortOpt.c_str(),it->second.longOpt.c_str(), it->second.clType);
97 if(cloit->shortOpt ==
"" && cloit->longOpt ==
"")
continue;
99 clOpts.
add(cloit->name,cloit->shortOpt.c_str(),cloit->longOpt.c_str(), cloit->clType);
107 std::vector<std::string> unk;
110 for (
size_t n=0;n<unk.size();++n)
120 if(clOpts.
nOpts == 0)
127 if(oneTarget !=
"" && it->second.name != oneTarget)
continue;
129 if(clOpts.
optSet(it->second.name))
131 std::vector<std::string> args;
133 clOpts.
getAll(args, it->second.name);
135 it->second.values.insert( it->second.values.end(), args.begin(), args.end());
138 for(
size_t n=0; n < args.size(); ++n) it->second.sources.push_back(
"command line");
141 it->second.verbosity = clOpts.
count(it->second.name);
142 it->second.set =
true;
150 bool reportFileNotFound
154 if(fname ==
"")
return 0;
159 int prv = iF.
parse(fname);
163 if(!reportFileNotFound)
return -1;
165 mxError(
"appConfigurator: ", MXE_FILENOTFOUND,
"The file " + fname +
" was not found");
171 mxError(
"appConfigurator: ", MXE_ALLOCERR,
"Memory allocation error in config file parser");
177 mxError(
"appConfigurator: ", MXE_PARSEERR,
"Parsing error in " + fname +
" at line " + std::to_string(prv));
185 if(iF.
count(it->second.section, it->second.keyword) > 0)
187 it->second.values.push_back(iF(it->second.section, it->second.keyword));
190 it->second.sources.push_back(fname);
192 it->second.set =
true;
194 iF.
erase(it->second.section, it->second.keyword);
199 for(
auto iFit = iF.
names.begin(); iFit != iF.
names.end(); ++iFit)
204 std::string sect, nam;
220 std::unordered_map<std::string, configTarget> & targets
223 if(targets.count(name) == 0)
return false;
225 targets[name].used =
true;
227 return targets[name].set;
236 std::unordered_map<std::string, configTarget> & targets
239 targets[name].used =
true;
240 return targets[name].values.size();
249 std::unordered_map<std::string, configTarget> & targets
252 targets[name].used =
true;
253 return targets[name].verbosity;
266 int appConfigurator::get<char>(
char & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
269 int appConfigurator::get<char16_t>( char16_t & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
272 int appConfigurator::get<char32_t>( char32_t & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
275 int appConfigurator::get<wchar_t>(
wchar_t & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
278 int appConfigurator::get<signed char>(
signed char & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
281 int appConfigurator::get<short>(
short & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
284 int appConfigurator::get<int>(
int & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
287 int appConfigurator::get<long>(
long & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
290 int appConfigurator::get<long long>(
long long & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
293 int appConfigurator::get<unsigned char>(
unsigned char & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
296 int appConfigurator::get<unsigned short>(
unsigned short & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
299 int appConfigurator::get<unsigned int>(
unsigned int & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
302 int appConfigurator::get<unsigned long>(
unsigned long & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
305 int appConfigurator::get<unsigned long long>(
unsigned long long & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
308 int appConfigurator::get<float>(
float & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
311 int appConfigurator::get<double>(
double & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
314 int appConfigurator::get<long double>(
long double & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
318 int appConfigurator::get<__float128>( __float128 & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
322 int appConfigurator::get<bool>(
bool & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
325 int appConfigurator::get<std::string>( std::string & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
330 int appConfigurator::get<char>(
char & v,
const std::string & name,
size_t i);
333 int appConfigurator::get<char16_t>( char16_t & v,
const std::string & name,
size_t i);
336 int appConfigurator::get<char32_t>( char32_t & v,
const std::string & name,
size_t i);
339 int appConfigurator::get<wchar_t>(
wchar_t & v,
const std::string & name,
size_t i);
342 int appConfigurator::get<signed char>(
signed char & v,
const std::string & name,
size_t i);
345 int appConfigurator::get<short>(
short & v,
const std::string & name,
size_t i);
348 int appConfigurator::get<int>(
int & v,
const std::string & name,
size_t i);
351 int appConfigurator::get<long>(
long & v,
const std::string & name,
size_t i);
354 int appConfigurator::get<long long>(
long long & v,
const std::string & name,
size_t i);
357 int appConfigurator::get<unsigned char>(
unsigned char & v,
const std::string & name,
size_t i);
360 int appConfigurator::get<unsigned short>(
unsigned short & v,
const std::string & name,
size_t i);
363 int appConfigurator::get<unsigned int>(
unsigned int & v,
const std::string & name,
size_t i);
366 int appConfigurator::get<unsigned long>(
unsigned long & v,
const std::string & name,
size_t i);
369 int appConfigurator::get<unsigned long long>(
unsigned long long & v,
const std::string & name,
size_t i);
372 int appConfigurator::get<float>(
float & v,
const std::string & name,
size_t i);
375 int appConfigurator::get<double>(
double & v,
const std::string & name,
size_t i);
378 int appConfigurator::get<long double>(
long double & v,
const std::string & name,
size_t i);
382 int appConfigurator::get<__float128>( __float128 & v,
const std::string & name,
size_t i);
386 int appConfigurator::get<bool>(
bool & v,
const std::string & name,
size_t i);
389 int appConfigurator::get<std::string>( std::string & v,
const std::string & name,
size_t i);
394 int appConfigurator::get<char>(
char & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
397 int appConfigurator::get<char16_t>( char16_t & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
400 int appConfigurator::get<char32_t>( char32_t & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
403 int appConfigurator::get<wchar_t>(
wchar_t & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
406 int appConfigurator::get<signed char>(
signed char & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
409 int appConfigurator::get<short>(
short & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
412 int appConfigurator::get<int>(
int & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
415 int appConfigurator::get<long>(
long & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
418 int appConfigurator::get<long long>(
long long & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
421 int appConfigurator::get<unsigned char>(
unsigned char & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
424 int appConfigurator::get<unsigned short>(
unsigned short & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
427 int appConfigurator::get<unsigned int>(
unsigned int & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
430 int appConfigurator::get<unsigned long>(
unsigned long & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
433 int appConfigurator::get<unsigned long long>(
unsigned long long & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
436 int appConfigurator::get<float>(
float & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
439 int appConfigurator::get<double>(
double & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
442 int appConfigurator::get<long double>(
long double & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
446 int appConfigurator::get<__float128>( __float128 & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
450 int appConfigurator::get<bool>(
bool & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
453 int appConfigurator::get<std::string>( std::string & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
458 int appConfigurator::get<char>(
char & v,
const std::string & name);
461 int appConfigurator::get<char16_t>( char16_t & v,
const std::string & name);
464 int appConfigurator::get<char32_t>( char32_t & v,
const std::string & name);
467 int appConfigurator::get<wchar_t>(
wchar_t & v,
const std::string & name);
470 int appConfigurator::get<signed char>(
signed char & v,
const std::string & name);
473 int appConfigurator::get<short>(
short & v,
const std::string & name);
476 int appConfigurator::get<int>(
int & v,
const std::string & name);
479 int appConfigurator::get<long>(
long & v,
const std::string & name);
482 int appConfigurator::get<long long>(
long long & v,
const std::string & name);
485 int appConfigurator::get<unsigned char>(
unsigned char & v,
const std::string & name);
488 int appConfigurator::get<unsigned short>(
unsigned short & v,
const std::string & name);
491 int appConfigurator::get<unsigned int>(
unsigned int & v,
const std::string & name);
494 int appConfigurator::get<unsigned long>(
unsigned long & v,
const std::string & name);
497 int appConfigurator::get<unsigned long long>(
unsigned long long & v,
const std::string & name);
500 int appConfigurator::get<float>(
float & v,
const std::string & name);
503 int appConfigurator::get<double>(
double & v,
const std::string & name);
506 int appConfigurator::get<long double>(
long double & v,
const std::string & name);
510 int appConfigurator::get<__float128>( __float128 & v,
const std::string & name);
514 int appConfigurator::get<bool>(
bool & v,
const std::string & name);
517 int appConfigurator::get<std::string>( std::string & v,
const std::string & name);
522 int appConfigurator::get<char>( std::vector<char> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
525 int appConfigurator::get<char16_t>( std::vector<char16_t> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
528 int appConfigurator::get<char32_t>( std::vector<char32_t> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
531 int appConfigurator::get<wchar_t>( std::vector<wchar_t> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
534 int appConfigurator::get<signed char>( std::vector<signed char> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
537 int appConfigurator::get<short>( std::vector<short> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
540 int appConfigurator::get<int>( std::vector<int> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
543 int appConfigurator::get<long>( std::vector<long> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
546 int appConfigurator::get<long long>( std::vector<long long> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
549 int appConfigurator::get<unsigned char>( std::vector<unsigned char> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
552 int appConfigurator::get<unsigned short>( std::vector<unsigned short> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
555 int appConfigurator::get<unsigned int>( std::vector<unsigned int> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
558 int appConfigurator::get<unsigned long>( std::vector<unsigned long> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
561 int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
564 int appConfigurator::get<float>( std::vector<float> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
567 int appConfigurator::get<double>( std::vector<double> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
570 int appConfigurator::get<long double>( std::vector<long double> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
574 int appConfigurator::get<__float128>( std::vector<__float128> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
578 int appConfigurator::get<bool>( std::vector<bool> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
581 int appConfigurator::get<std::string>( std::vector<std::string> & v,
const std::string & name,
size_t i, std::unordered_map<std::string, configTarget> & targets);
586 int appConfigurator::get<char>( std::vector<char> & v,
const std::string & name,
size_t i);
589 int appConfigurator::get<char16_t>( std::vector<char16_t> & v,
const std::string & name,
size_t i);
592 int appConfigurator::get<char32_t>( std::vector<char32_t> & v,
const std::string & name,
size_t i);
595 int appConfigurator::get<wchar_t>( std::vector<wchar_t> & v,
const std::string & name,
size_t i);
598 int appConfigurator::get<signed char>( std::vector<signed char> & v,
const std::string & name,
size_t i);
601 int appConfigurator::get<short>( std::vector<short> & v,
const std::string & name,
size_t i);
604 int appConfigurator::get<int>( std::vector<int> & v,
const std::string & name,
size_t i);
607 int appConfigurator::get<long>( std::vector<long> & v,
const std::string & name,
size_t i);
610 int appConfigurator::get<long long>( std::vector<long long> & v,
const std::string & name,
size_t i);
613 int appConfigurator::get<unsigned char>( std::vector<unsigned char> & v,
const std::string & name,
size_t i);
616 int appConfigurator::get<unsigned short>( std::vector<unsigned short> & v,
const std::string & name,
size_t i);
619 int appConfigurator::get<unsigned int>( std::vector<unsigned int> & v,
const std::string & name,
size_t i);
622 int appConfigurator::get<unsigned long>( std::vector<unsigned long> & v,
const std::string & name,
size_t i);
625 int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> & v,
const std::string & name,
size_t i);
628 int appConfigurator::get<float>( std::vector<float> & v,
const std::string & name,
size_t i);
631 int appConfigurator::get<double>( std::vector<double> & v,
const std::string & name,
size_t i);
634 int appConfigurator::get<long double>( std::vector<long double> & v,
const std::string & name,
size_t i);
638 int appConfigurator::get<__float128>( std::vector<__float128> & v,
const std::string & name,
size_t i);
642 int appConfigurator::get<bool>( std::vector<bool> & v,
const std::string & name,
size_t i);
645 int appConfigurator::get<std::string>( std::vector<std::string> & v,
const std::string & name,
size_t i);
649 int appConfigurator::get<char>( std::vector<char> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
652 int appConfigurator::get<char16_t>( std::vector<char16_t> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
655 int appConfigurator::get<char32_t>( std::vector<char32_t> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
658 int appConfigurator::get<wchar_t>( std::vector<wchar_t> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
661 int appConfigurator::get<signed char>( std::vector<signed char> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
664 int appConfigurator::get<short>( std::vector<short> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
667 int appConfigurator::get<int>( std::vector<int> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
670 int appConfigurator::get<long>( std::vector<long> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
673 int appConfigurator::get<long long>( std::vector<long long> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
676 int appConfigurator::get<unsigned char>( std::vector<unsigned char> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
679 int appConfigurator::get<unsigned short>( std::vector<unsigned short> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
682 int appConfigurator::get<unsigned int>( std::vector<unsigned int> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
685 int appConfigurator::get<unsigned long>( std::vector<unsigned long> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
688 int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
691 int appConfigurator::get<float>( std::vector<float> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
694 int appConfigurator::get<double>( std::vector<double> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
697 int appConfigurator::get<long double>( std::vector<long double> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
701 int appConfigurator::get<__float128>( std::vector<__float128> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
705 int appConfigurator::get<bool>( std::vector<bool> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
708 int appConfigurator::get<std::string>( std::vector<std::string> & v,
const std::string & name, std::unordered_map<std::string, configTarget> & targets);
712 int appConfigurator::get<char>( std::vector<char> & v,
const std::string & name);
715 int appConfigurator::get<char16_t>( std::vector<char16_t> & v,
const std::string & name);
718 int appConfigurator::get<char32_t>( std::vector<char32_t> & v,
const std::string & name);
721 int appConfigurator::get<wchar_t>( std::vector<wchar_t> & v,
const std::string & name);
724 int appConfigurator::get<signed char>( std::vector<signed char> & v,
const std::string & name);
727 int appConfigurator::get<short>( std::vector<short> & v,
const std::string & name);
730 int appConfigurator::get<int>( std::vector<int> & v,
const std::string & name);
733 int appConfigurator::get<long>( std::vector<long> & v,
const std::string & name);
736 int appConfigurator::get<long long>( std::vector<long long> & v,
const std::string & name);
739 int appConfigurator::get<unsigned char>( std::vector<unsigned char> & v,
const std::string & name);
742 int appConfigurator::get<unsigned short>( std::vector<unsigned short> & v,
const std::string & name);
745 int appConfigurator::get<unsigned int>( std::vector<unsigned int> & v,
const std::string & name);
748 int appConfigurator::get<unsigned long>( std::vector<unsigned long> & v,
const std::string & name);
751 int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> & v,
const std::string & name);
754 int appConfigurator::get<float>( std::vector<float> & v,
const std::string & name);
757 int appConfigurator::get<double>( std::vector<double> & v,
const std::string & name);
760 int appConfigurator::get<long double>( std::vector<long double> & v,
const std::string & name);
764 int appConfigurator::get<__float128>( std::vector<__float128> & v,
const std::string & name);
768 int appConfigurator::get<bool>( std::vector<bool> & v,
const std::string & name);
771 int appConfigurator::get<std::string>( std::vector<std::string> & v,
const std::string & name);
776 int appConfigurator::operator()<
char>(
char & v,
const std::string & name);
779 int appConfigurator::operator()<char16_t>( char16_t & v,
const std::string & name);
782 int appConfigurator::operator()<char32_t>( char32_t & v,
const std::string & name);
785 int appConfigurator::operator()<
wchar_t>(
wchar_t & v,
const std::string & name);
788 int appConfigurator::operator()<
signed char>(
signed char & v,
const std::string & name);
791 int appConfigurator::operator()<
short>(
short & v,
const std::string & name);
794 int appConfigurator::operator()<
int>(
int & v,
const std::string & name);
797 int appConfigurator::operator()<
long>(
long & v,
const std::string & name);
800 int appConfigurator::operator()<
long long>(
long long & v,
const std::string & name);
803 int appConfigurator::operator()<
unsigned char>(
unsigned char & v,
const std::string & name);
806 int appConfigurator::operator()<
unsigned short>(
unsigned short & v,
const std::string & name);
809 int appConfigurator::operator()<
unsigned int>(
unsigned int & v,
const std::string & name);
812 int appConfigurator::operator()<
unsigned long>(
unsigned long & v,
const std::string & name);
815 int appConfigurator::operator()<
unsigned long long>(
unsigned long long & v,
const std::string & name);
818 int appConfigurator::operator()<
float>(
float & v,
const std::string & name);
821 int appConfigurator::operator()<
double>(
double & v,
const std::string & name);
824 int appConfigurator::operator()<
long double>(
long double & v,
const std::string & name);
828 int appConfigurator::operator()<__float128>( __float128 & v,
const std::string & name);
832 int appConfigurator::operator()<
bool>(
bool & v,
const std::string & name);
835 int appConfigurator::operator()<std::string>( std::string & v,
const std::string & name);
840 int appConfigurator::configUnused<char>(
char & v,
const std::string & key);
843 int appConfigurator::configUnused<char16_t>( char16_t & v,
const std::string & key);
846 int appConfigurator::configUnused<char32_t>( char32_t & v,
const std::string & key);
849 int appConfigurator::configUnused<wchar_t>(
wchar_t & v,
const std::string & key);
852 int appConfigurator::configUnused<signed char>(
signed char & v,
const std::string & key);
855 int appConfigurator::configUnused<short>(
short & v,
const std::string & key);
858 int appConfigurator::configUnused<int>(
int & v,
const std::string & key);
861 int appConfigurator::configUnused<long>(
long & v,
const std::string & key);
864 int appConfigurator::configUnused<long long>(
long long & v,
const std::string & key);
867 int appConfigurator::configUnused<unsigned char>(
unsigned char & v,
const std::string & key);
870 int appConfigurator::configUnused<unsigned short>(
unsigned short & v,
const std::string & key);
873 int appConfigurator::configUnused<unsigned int>(
unsigned int & v,
const std::string & key);
876 int appConfigurator::configUnused<unsigned long>(
unsigned long & v,
const std::string & key);
879 int appConfigurator::configUnused<unsigned long long>(
unsigned long long & v,
const std::string & key);
882 int appConfigurator::configUnused<float>(
float & v,
const std::string & key);
885 int appConfigurator::configUnused<double>(
double & v,
const std::string & key);
888 int appConfigurator::configUnused<long double>(
long double & v,
const std::string & key);
892 int appConfigurator::configUnused<__float128>( __float128 & v,
const std::string & key);
896 int appConfigurator::configUnused<bool>(
bool & v,
const std::string & key);
899 int appConfigurator::configUnused<std::string>( std::string & v,
const std::string & key);
904 int appConfigurator::configUnused<char>(
char & v,
const std::string & section,
const std::string & keyword);
907 int appConfigurator::configUnused<char16_t>( char16_t & v,
const std::string & section,
const std::string & keyword);
910 int appConfigurator::configUnused<char32_t>( char32_t & v,
const std::string & section,
const std::string & keyword);
913 int appConfigurator::configUnused<wchar_t>(
wchar_t & v,
const std::string & section,
const std::string & keyword);
916 int appConfigurator::configUnused<signed char>(
signed char & v,
const std::string & section,
const std::string & keyword);
919 int appConfigurator::configUnused<short>(
short & v,
const std::string & section,
const std::string & keyword);
922 int appConfigurator::configUnused<int>(
int & v,
const std::string & section,
const std::string & keyword);
925 int appConfigurator::configUnused<long>(
long & v,
const std::string & section,
const std::string & keyword);
928 int appConfigurator::configUnused<long long>(
long long & v,
const std::string & section,
const std::string & keyword);
931 int appConfigurator::configUnused<unsigned char>(
unsigned char & v,
const std::string & section,
const std::string & keyword);
934 int appConfigurator::configUnused<unsigned short>(
unsigned short & v,
const std::string & section,
const std::string & keyword);
937 int appConfigurator::configUnused<unsigned int>(
unsigned int & v,
const std::string & section,
const std::string & keyword);
940 int appConfigurator::configUnused<unsigned long>(
unsigned long & v,
const std::string & section,
const std::string & keyword);
943 int appConfigurator::configUnused<unsigned long long>(
unsigned long long & v,
const std::string & section,
const std::string & keyword);
946 int appConfigurator::configUnused<float>(
float & v,
const std::string & section,
const std::string & keyword);
949 int appConfigurator::configUnused<double>(
double & v,
const std::string & section,
const std::string & keyword);
952 int appConfigurator::configUnused<long double>(
long double & v,
const std::string & section,
const std::string & keyword);
956 int appConfigurator::configUnused<__float128>( __float128 & v,
const std::string & section,
const std::string & keyword);
960 int appConfigurator::configUnused<bool>(
bool & v,
const std::string & section,
const std::string & keyword);
963 int appConfigurator::configUnused<std::string>( std::string & v,
const std::string & section,
const std::string & keyword);
974 std::string sect = it->second.section;
979 for(
size_t i=0;i < sections.size(); ++i)
981 if(sections[i] == sect)
989 if(
add) sections.push_back(sect);
1001 const std::vector<std::string> & sections,
1002 const std::vector<std::string> & keywords,
1003 const std::vector<std::string> & values
1010 std::string lastSection;
1011 for(
size_t i=0; i< sections.size(); ++i)
1013 std::string currSection = sections[i];
1015 if( currSection != lastSection && currSection !=
"")
1017 fout <<
"\n[" << currSection <<
"]\n";
1020 fout << keywords[i] <<
"=" << values[i] <<
"\n";
1022 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.
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.
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.
std::unordered_map< std::string, configTarget >::iterator targetIterator
Iterator for the targets unordered_map.
int nAdded
Running count of options added, used to track order.
std::unordered_map< std::string, configTarget > m_unusedConfigs
Config file entries present in the file(s), but not corresponding to a target when parsed....
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.