option to hide homebrew.
This commit is contained in:
@@ -8,28 +8,6 @@
|
||||
#include <cstdlib>
|
||||
|
||||
namespace sphaira::option {
|
||||
namespace {
|
||||
|
||||
// these are taken from minini in order to parse a value already loaded in memory.
|
||||
long getl(const char* LocalBuffer, long def) {
|
||||
const auto len = strlen(LocalBuffer);
|
||||
return (len == 0) ? def
|
||||
: ((len >= 2 && toupper((int)LocalBuffer[1]) == 'X') ? strtol(LocalBuffer, NULL, 16)
|
||||
: strtol(LocalBuffer, NULL, 10));
|
||||
}
|
||||
|
||||
bool getbool(const char* LocalBuffer, bool def) {
|
||||
const auto c = toupper(LocalBuffer[0]);
|
||||
|
||||
if (c == 'Y' || c == '1' || c == 'T')
|
||||
return true;
|
||||
else if (c == 'N' || c == '0' || c == 'F')
|
||||
return false;
|
||||
else
|
||||
return def;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
template<typename T>
|
||||
auto OptionBase<T>::GetInternal(const char* name) -> T {
|
||||
@@ -90,9 +68,9 @@ auto OptionBase<T>::LoadFrom(const char* name, const char* value) -> bool {
|
||||
if (m_name == name) {
|
||||
if (m_file) {
|
||||
if constexpr(std::is_same_v<T, bool>) {
|
||||
m_value = getbool(value, m_default_value);
|
||||
m_value = ini_parse_getbool(value, m_default_value);
|
||||
} else if constexpr(std::is_same_v<T, long>) {
|
||||
m_value = getl(value, m_default_value);
|
||||
m_value = ini_parse_getl(value, m_default_value);
|
||||
} else if constexpr(std::is_same_v<T, std::string>) {
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user