config.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef CONFIG_H
  2. #define CONFIG_H
  3. #include <fstream>
  4. #include <map>
  5. #include <sstream>
  6. #include <vector>
  7. /**
  8. * Namespace which handles the GUI configuration and it's config file
  9. */
  10. namespace Config {
  11. /**
  12. * Set up the configuration map with the default values and declare the configuration valid
  13. */
  14. void setupDefaultConfig();
  15. /**
  16. * Check the loaded config if the values are valid and if it's size is valid
  17. * @return Is the config valid?
  18. */
  19. bool checkConfig();
  20. /**
  21. * Load the configuration file - if values are missing, they are added with their default values
  22. * @return Has the config file been successfully loaded?
  23. */
  24. bool loadFile();
  25. /**
  26. * Save the configuration map to the config file
  27. */
  28. void saveFile();
  29. /**
  30. * Get a value from the configuration map
  31. * @param key The configuration key to get
  32. * @return The value
  33. */
  34. std::string getValue(const std::string &key);
  35. /**
  36. * Set a value in the configuration map to the given one
  37. * @param key The configuration key
  38. * @param value The new value
  39. */
  40. void setValue(const std::string &key, const std::string &value);
  41. } // namespace Config
  42. #endif // CONFIG_H