You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.0 KiB

#include "Properties.h"
#include "../util/StringUtil.h"
static const string STRING_TRUE("true");
static const string STRING_FALSE("false");
namespace Feather::Config
{
template <>
string Properties::Get<string>(string_view key)
{
return properties.at(string(key));
}
template <>
bool Properties::Get<bool>(string_view key)
{
string value = Get<string>(key);
if (StringUtil::iequal(value, STRING_TRUE))
{
return true;
}
else
{
// Java's Boolean.valueOf does not care about anything other than "true"
return false;
}
}
template <>
int Properties::Get<int>(string_view key)
{
return std::stoi(Get<string>(key));
}
template <>
long Properties::Get<long>(string_view key)
{
return std::stol(Get<string>(key));
}
template <>
long long Properties::Get<long long>(string_view key)
{
return std::stoll(Get<string>(key));
}
}