iw4x-client/src/Utils/InfoString.hpp

28 lines
546 B
C++
Raw Normal View History

2017-01-20 08:36:52 -05:00
#pragma once
2017-01-19 16:23:59 -05:00
namespace Utils
{
class InfoString
{
public:
2022-06-04 04:56:14 -04:00
InfoString() = default;
explicit InfoString(const std::string& buffer);
2017-01-19 16:23:59 -05:00
2018-12-17 08:29:18 -05:00
void set(const std::string& key, const std::string& value);
2022-06-04 04:56:14 -04:00
void remove(const std::string& key);
2017-01-19 16:23:59 -05:00
2022-06-04 04:56:14 -04:00
[[nodiscard]] std::string get(const std::string& key) const;
[[nodiscard]] std::string build() const;
#ifdef _DEBUG
2017-01-19 16:23:59 -05:00
void dump();
2022-06-04 04:56:14 -04:00
#endif
2017-01-19 16:23:59 -05:00
[[nodiscard]] nlohmann::json to_json() const;
2017-01-19 16:23:59 -05:00
private:
2022-06-04 04:56:14 -04:00
std::unordered_map<std::string, std::string> keyValuePairs;
2017-01-19 16:23:59 -05:00
void parse(std::string buffer);
};
}