mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02: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:
@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <cstdarg>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
@ -291,11 +292,51 @@ bool TryParse(const std::string& str, bool* const output)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string StringFromBool(bool value)
|
||||
std::string ValueToString(u16 value)
|
||||
{
|
||||
return StringFromFormat("0x%04x", value);
|
||||
}
|
||||
|
||||
std::string ValueToString(u32 value)
|
||||
{
|
||||
return StringFromFormat("0x%08x", value);
|
||||
}
|
||||
|
||||
std::string ValueToString(u64 value)
|
||||
{
|
||||
return StringFromFormat("0x%016" PRIx64, value);
|
||||
}
|
||||
|
||||
std::string ValueToString(float value)
|
||||
{
|
||||
return StringFromFormat("%#.9g", value);
|
||||
}
|
||||
|
||||
std::string ValueToString(double value)
|
||||
{
|
||||
return StringFromFormat("%#.17g", value);
|
||||
}
|
||||
|
||||
std::string ValueToString(int value)
|
||||
{
|
||||
return std::to_string(value);
|
||||
}
|
||||
|
||||
std::string ValueToString(s64 value)
|
||||
{
|
||||
return StringFromFormat("%" PRId64, value);
|
||||
}
|
||||
|
||||
std::string ValueToString(bool value)
|
||||
{
|
||||
return value ? "True" : "False";
|
||||
}
|
||||
|
||||
std::string ValueToString(const std::string& value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename,
|
||||
std::string* _pExtension)
|
||||
{
|
||||
|
Reference in New Issue
Block a user