#include "public.hpp" #include #include #include struct SHandler { std::string name = ""; Hyprlang::SHandlerOptions options; Hyprlang::PCONFIGHANDLERFUNC func = nullptr; }; struct SVariable { std::string name = ""; std::string value = ""; std::vector linesContainingVar; // for dynamic updates }; // remember to also edit CConfigValue if editing enum eDataType { CONFIGDATATYPE_EMPTY, CONFIGDATATYPE_INT, CONFIGDATATYPE_FLOAT, CONFIGDATATYPE_STR, CONFIGDATATYPE_VEC2, CONFIGDATATYPE_CUSTOM, }; // CUSTOM is stored as STR!! struct SConfigDefaultValue { std::any data; eDataType type = CONFIGDATATYPE_EMPTY; // this sucks but I have no better idea Hyprlang::PCONFIGCUSTOMVALUEHANDLERFUNC handler = nullptr; Hyprlang::PCONFIGCUSTOMVALUEDESTRUCTOR dtor = nullptr; }; struct SSpecialCategoryDescriptor { std::string name = ""; std::string key = ""; std::unordered_map defaultValues; bool dontErrorOnMissing = false; }; struct SSpecialCategory { SSpecialCategoryDescriptor* descriptor = nullptr; std::string name = ""; std::string key = ""; // empty means no key std::unordered_map values; bool isStatic = false; void applyDefaults(); }; class CConfigImpl { public: std::string path = ""; std::unordered_map values; std::unordered_map defaultValues; std::vector handlers; std::vector variables; std::vector envVariables; std::vector> specialCategories; std::vector> specialCategoryDescriptors; std::vector categories; std::string currentSpecialKey = ""; std::string parseError = ""; Hyprlang::SConfigOptions configOptions; };