mirror of https://github.com/stella-emu/stella.git
Move function to bspf.hxx. It's not used yet, but it might be in the future.
This commit is contained in:
parent
d1f9ee730b
commit
2e0c0549e7
|
@ -470,18 +470,6 @@ Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD, bool zero
|
|||
return val;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void replaceAll(std::string& str, const std::string& from, const std::string& to) {
|
||||
if(from.empty())
|
||||
return;
|
||||
size_t start_pos = 0;
|
||||
while((start_pos = str.find(from, start_pos)) != std::string::npos) {
|
||||
str.replace(start_pos, from.length(), to);
|
||||
start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool HighScoresManager::getPropBool(const json& jprops, const string& key,
|
||||
bool defVal) const
|
||||
|
|
|
@ -290,6 +290,19 @@ namespace BSPF
|
|||
return false;
|
||||
}
|
||||
|
||||
// Modify 'str', replacing all occurrences of 'from' with 'to'
|
||||
inline void replaceAll(string& str, const string& from, const string& to)
|
||||
{
|
||||
if(from.empty()) return;
|
||||
size_t start_pos = 0;
|
||||
while((start_pos = str.find(from, start_pos)) != string::npos)
|
||||
{
|
||||
str.replace(start_pos, from.length(), to);
|
||||
start_pos += to.length(); // In case 'to' contains 'from',
|
||||
// like replacing 'x' with 'yx'
|
||||
}
|
||||
}
|
||||
|
||||
// C++11 way to get local time
|
||||
// Equivalent to the C-style localtime() function, but is thread-safe
|
||||
inline std::tm localTime()
|
||||
|
|
Loading…
Reference in New Issue