mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Merge pull request #9703 from Filoppi/fix_expression_serialization
Fix serialization of control expressions with line breaks
This commit is contained in:
@ -219,7 +219,7 @@ std::string ArrayToString(const u8* data, u32 size, int line_len, bool spaces)
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
// Turns " hello " into "hello". Also handles tabs.
|
||||
// Turns "\n\r\t hello " into "hello" (trims at the start and end but not inside).
|
||||
std::string_view StripSpaces(std::string_view str)
|
||||
{
|
||||
const size_t s = str.find_first_not_of(" \t\r\n");
|
||||
@ -241,6 +241,13 @@ std::string_view StripQuotes(std::string_view s)
|
||||
return s;
|
||||
}
|
||||
|
||||
// Turns "\n\rhello" into " hello".
|
||||
void ReplaceBreaksWithSpaces(std::string& str)
|
||||
{
|
||||
std::replace(str.begin(), str.end(), '\r', ' ');
|
||||
std::replace(str.begin(), str.end(), '\n', ' ');
|
||||
}
|
||||
|
||||
bool TryParse(const std::string& str, bool* const output)
|
||||
{
|
||||
float value;
|
||||
|
@ -52,6 +52,8 @@ std::string_view StripQuotes(std::string_view s);
|
||||
|
||||
std::string ReplaceAll(std::string result, std::string_view src, std::string_view dest);
|
||||
|
||||
void ReplaceBreaksWithSpaces(std::string& str);
|
||||
|
||||
bool TryParse(const std::string& str, bool* output);
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_integral_v<T> || std::is_enum_v<T>>* = nullptr>
|
||||
|
Reference in New Issue
Block a user