/* Copyright (c) 2025 Poul Sander Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef CONFIG_HPP #define CONFIG_HPP #include #include #include #include "SDL.h" /** * @brief Loads configuration from file into a map * @return Map of configuration key-value pairs */ std::map LoadConfigMap(); /** * @brief Saves configuration map to file * @param config Map of configuration key-value pairs */ void SaveConfigMap(const std::map& config); /** * @brief Gets a boolean value from config map * @param config The configuration map * @param key The configuration key * @param defaultValue Default value if key not found * @return The boolean value */ bool GetConfigBool(const std::map& config, const std::string& key, bool defaultValue); /** * @brief Sets a boolean value in config map * @param config The configuration map * @param key The configuration key * @param value The boolean value */ void SetConfigBool(std::map& config, const std::string& key, bool value); /** * @brief Gets an integer value from config map * @param config The configuration map * @param key The configuration key * @param defaultValue Default value if key not found * @return The integer value */ int GetConfigInt(const std::map& config, const std::string& key, int defaultValue); /** * @brief Sets an integer value in config map * @param config The configuration map * @param key The configuration key * @param value The integer value */ void SetConfigInt(std::map& config, const std::string& key, int value); /** * @brief Gets a string value from config map * @param config The configuration map * @param key The configuration key * @param defaultValue Default value if key not found * @return The string value */ std::string GetConfigString(const std::map& config, const std::string& key, const std::string& defaultValue); /** * @brief Sets a string value in config map * @param config The configuration map * @param key The configuration key * @param value The string value */ void SetConfigString(std::map& config, const std::string& key, const std::string& value); /** * @brief Loads the list of favorite image paths * @return Vector of absolute paths to favorite images */ std::vector LoadFavorites(); /** * @brief Saves the list of favorite image paths * @param favorites Vector of absolute paths to favorite images */ void SaveFavorites(const std::vector& favorites); /** * @brief Adds an image path to favorites * @param imagePath Absolute path to the image */ void AddFavorite(const std::string& imagePath); /** * @brief Removes an image path from favorites * @param imagePath Absolute path to the image */ void RemoveFavorite(const std::string& imagePath); /** * @brief Checks if an image path is in favorites * @param imagePath Absolute path to the image * @return true if the image is a favorite, false otherwise */ bool IsFavorite(const std::string& imagePath); /** * @brief Loads custom piece layout for an image * @param pictureId Unique identifier for the image (hash) * @param pieces Vector to fill with piece rectangles * @return true if custom layout was loaded, false otherwise */ bool LoadCustomPieceLayout(const std::string& pictureId, std::vector& pieces); /** * @brief Saves custom piece layout for an image * @param pictureId Unique identifier for the image (hash) * @param pieces Vector of piece rectangles to save * @return true if layout was saved successfully, false otherwise */ bool SaveCustomPieceLayout(const std::string& pictureId, const std::vector& pieces); /** * @brief Checks if a custom piece layout exists for an image * @param pictureId Unique identifier for the image (hash) * @return true if custom layout exists, false otherwise */ bool HasCustomPieceLayout(const std::string& pictureId); #endif // CONFIG_HPP