summaryrefslogtreecommitdiff
path: root/Source/Core/Common/SettingsHandler.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2024-05-05 22:35:23 +0200
committerGitHub <noreply@github.com>2024-05-05 22:35:23 +0200
commit2c913674295e08bca0e2cb1726b778fb61bf6bd1 (patch)
tree059c4b482124ea20f5eaadfc7df39a529dcb2b72 /Source/Core/Common/SettingsHandler.cpp
parent485bdba98ec215efe184f9f74f73f43984d2660e (diff)
parent36cdb4a544341e45155ff750c5f67ece71348a52 (diff)
Merge pull request #12737 from nlebeck/settingshandler-split
Eliminate SettingsHandler's `SetBytes` and `Reset` methods
Diffstat (limited to 'Source/Core/Common/SettingsHandler.cpp')
-rw-r--r--Source/Core/Common/SettingsHandler.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp
index e737a97620..b5c32a2099 100644
--- a/Source/Core/Common/SettingsHandler.cpp
+++ b/Source/Core/Common/SettingsHandler.cpp
@@ -17,14 +17,14 @@
namespace Common
{
-SettingsHandler::SettingsHandler()
+SettingsHandler::SettingsHandler() : m_buffer{}, m_position{0}, m_key{INITIAL_SEED}, decoded{""}
{
- Reset();
}
-SettingsHandler::SettingsHandler(const Buffer& buffer)
+SettingsHandler::SettingsHandler(const Buffer& buffer) : SettingsHandler()
{
- SetBytes(buffer);
+ m_buffer = buffer;
+ Decrypt();
}
const SettingsHandler::Buffer& SettingsHandler::GetBytes() const
@@ -32,13 +32,6 @@ const SettingsHandler::Buffer& SettingsHandler::GetBytes() const
return m_buffer;
}
-void SettingsHandler::SetBytes(const Buffer& buffer)
-{
- Reset();
- m_buffer = buffer;
- Decrypt();
-}
-
std::string SettingsHandler::GetValue(std::string_view key) const
{
constexpr char delim[] = "\n";
@@ -84,14 +77,6 @@ void SettingsHandler::Decrypt()
std::erase(decoded, '\x0d');
}
-void SettingsHandler::Reset()
-{
- decoded = "";
- m_position = 0;
- m_key = INITIAL_SEED;
- m_buffer = {};
-}
-
void SettingsHandler::AddSetting(std::string_view key, std::string_view value)
{
WriteLine(fmt::format("{}={}\r\n", key, value));