options: move bool value getter into cpp

Keeping the bool valueoption getter in the header was causing duplicate
definitions in the built static library.
This commit is contained in:
Danny Robson 2014-08-18 22:09:57 +10:00
parent d845cc6c39
commit 2f5ecd46c7
2 changed files with 20 additions and 17 deletions

View File

@ -127,6 +127,26 @@ presentoption::execute (void) {
} }
/*
* Value option
*/
namespace util {
template<>
bool&
valueoption<bool>::get_arg(const std::string& arg, bool *val) {
if (arg == "true" || arg == "yes" || arg == "1")
*val = true;
else if (arg == "false" || arg == "no" || arg == "0")
*val = false;
else
throw std::domain_error("Invalid form for boolean argument");
return *val;
}
}
/* /*
* bytesoption * bytesoption
*/ */

View File

@ -192,23 +192,6 @@ namespace util {
}; };
// God-damn Solaris strikes again with its antiquated everything. So you
// don't get these goodies on that system, with its ancient compiler.
#if __GNUC__ >= 4
template<>
bool& valueoption<bool>::get_arg(const std::string& arg, bool * val) {
if (arg == "true" || arg == "yes" || arg == "1")
*val = true;
else if (arg == "false" || arg == "no" || arg == "0")
*val = false;
else
throw std::domain_error("Invalid form for boolean argument");
return *val;
}
#endif
/** /**
* Interpret a (possibly) numeric value as a data size. * Interpret a (possibly) numeric value as a data size.
* *