Xteink-X4-crosspoint-reader/lib/ThemeEngine/include/IniParser.h
2026-01-29 13:06:44 +01:00

39 lines
863 B
C++

#pragma once
#include <map>
#include <string>
#include <vector>
// Forward declaration for FS file or stream if needed,
// but for now we'll take a string buffer or filename to keep it generic?
// Or better, depend on FS.h to read files directly.
#ifdef FILE_READ
#undef FILE_READ
#endif
#ifdef FILE_WRITE
#undef FILE_WRITE
#endif
#include <FS.h>
namespace ThemeEngine {
struct IniSection {
std::string name;
std::map<std::string, std::string> properties;
};
class IniParser {
public:
// Parse a stream (File, Serial, etc.)
static std::map<std::string, std::map<std::string, std::string>> parse(Stream& stream);
// Parse a string buffer (useful for testing)
static std::map<std::string, std::map<std::string, std::string>> parseString(const std::string& content);
private:
static void trim(std::string& s);
};
} // namespace ThemeEngine