commit no. 7

This commit is contained in:
2026-03-25 19:48:24 +01:00
parent cf397eaa2d
commit 7b9a87fbc0
8 changed files with 628 additions and 274 deletions

32
src/core/Config.h Normal file
View File

@@ -0,0 +1,32 @@
#pragma once
#include <string>
#include <unordered_map>
namespace baudline {
// Simple INI-style config: key = value, one per line. Lines starting with # are
// comments. No sections. Stored at ~/.config/baudline/settings.ini.
class Config {
public:
static std::string defaultPath();
bool load(const std::string& path = "");
bool save(const std::string& path = "") const;
void setString(const std::string& key, const std::string& value);
void setInt(const std::string& key, int value);
void setFloat(const std::string& key, float value);
void setBool(const std::string& key, bool value);
std::string getString(const std::string& key, const std::string& def = "") const;
int getInt(const std::string& key, int def = 0) const;
float getFloat(const std::string& key, float def = 0.0f) const;
bool getBool(const std::string& key, bool def = false) const;
private:
std::unordered_map<std::string, std::string> data_;
std::string resolvedPath(const std::string& path) const;
};
} // namespace baudline