Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CONFIGAPPLIER_H
- #define CONFIGAPPLIER_H
- /* C system icnludes */
- /* C++ system icnludes */
- #include <cstdint>
- /* Third-party icnludes */
- /* Own icnludes */
- #include "sdl_utils/config/tools/ConfigValidator.h"
- /* Forward Declaration */
- class ConfigApplier {
- private:
- static std::string applyConfig(const configData &data, displayConfig name, configType type) {
- const std::string configName = displayConfigStr[name];
- auto it = data.find(configName);
- if (it == data.end()) {
- std::cerr << "There is no " << configName << " in the configurations data." << std::endl;
- }
- const std::string configValue;
- if (EXIT_SUCCESS != ConfigValidator::checkConfig(configValue, type)) {
- std::cerr << "Validation of config data failed." << std::endl;
- }
- return configValue;
- }
- public:
- static void setConfigs(const configData &data, MonitorConfig &outConfig) {
- /* String configurations: */
- outConfig.windowName = applyConfig(data, WINDOW_NAME, STRING);
- /* Integer configurations: */
- outConfig.windowHeight = stoi(applyConfig(data, DISPLAY_HEIGHT, INT));
- outConfig.windowWidth = stoi(applyConfig(data, DISPLAY_WIDTH, INT));
- /* Boolean configurations: */
- outConfig.windowFlags = WINDOW_SHOWN;
- }
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement