#ifndef CONFIGFILEPARSER_H #define CONFIGFILEPARSER_H #include #include #include #include #include struct mosquitto_auth_opt { char *key = nullptr; char *value = nullptr; mosquitto_auth_opt(const std::string &key, const std::string &value); mosquitto_auth_opt(mosquitto_auth_opt &&other); mosquitto_auth_opt(const mosquitto_auth_opt &other) = delete; ~mosquitto_auth_opt(); }; struct AuthOptCompatWrap { std::vector optArray; AuthOptCompatWrap(const std::unordered_map &authOpts); AuthOptCompatWrap(const AuthOptCompatWrap &other) = delete; AuthOptCompatWrap(AuthOptCompatWrap &&other) = delete; struct mosquitto_auth_opt *head() { return &optArray[0]; } int size() { return optArray.size(); } }; class ConfigFileParser { const std::string path; std::set validKeys; std::unordered_map authOpts; std::unique_ptr authOptCompatWrap; std::string authPluginPath; public: ConfigFileParser(const std::string &path); void loadFile(); AuthOptCompatWrap &getAuthOptsCompat(); std::string getAuthPluginPath() { return authPluginPath; } }; #endif // CONFIGFILEPARSER_H