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:
parent
d845cc6c39
commit
2f5ecd46c7
20
options.cpp
20
options.cpp
@ -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
|
||||
*/
|
||||
|
17
options.hpp
17
options.hpp
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user