mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Move Config ValueToString to StringUtil
An identical implementation is used by IniFile, so move those functions to StringUtil. A future commit will modify IniFile to use them.
This commit is contained in:
@ -19,19 +19,6 @@ namespace Config
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
std::string ValueToString(u16 value);
|
||||
std::string ValueToString(u32 value);
|
||||
std::string ValueToString(float value);
|
||||
std::string ValueToString(double value);
|
||||
std::string ValueToString(int value);
|
||||
std::string ValueToString(bool value);
|
||||
std::string ValueToString(const std::string& value);
|
||||
template <typename T, std::enable_if_t<std::is_enum<T>::value>* = nullptr>
|
||||
std::string ValueToString(T value)
|
||||
{
|
||||
return ValueToString(static_cast<std::underlying_type_t<T>>(value));
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<!std::is_enum<T>::value>* = nullptr>
|
||||
std::optional<T> TryParse(const std::string& str_value)
|
||||
{
|
||||
@ -139,7 +126,7 @@ public:
|
||||
template <typename T>
|
||||
void Set(const ConfigLocation& location, const T& value)
|
||||
{
|
||||
const std::string new_value = detail::ValueToString(value);
|
||||
const std::string new_value = ValueToString(value);
|
||||
std::optional<std::string>& current_value = m_map[location];
|
||||
if (current_value == new_value)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user