Mercurial > minori
diff include/core/ini.h @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | 53211cb1e7f5 |
children | 3ec7804abf17 |
line wrap: on
line diff
--- a/include/core/ini.h Sun Feb 18 16:02:14 2024 -0500 +++ b/include/core/ini.h Mon Apr 01 02:43:44 2024 -0400 @@ -2,34 +2,32 @@ #define __core__ini_h #define MINI_CASE_SENSITIVE -#include "mini/ini.h" #include "core/strings.h" #include "gui/translate/anime.h" #include "gui/translate/config.h" +#include "mini/ini.h" +#include <string> #include <type_traits> -#include <string> namespace INI { /* very simple tutorial on how to give anyone who reads your code an aneurysm */ -template <typename T, typename = void> +template<typename T, typename = void> struct is_toutf8string_available : std::false_type {}; template<typename T> -struct is_toutf8string_available<T, - std::void_t<decltype(Strings::ToUtf8String(std::declval<T>()))>> : std::true_type {}; +struct is_toutf8string_available<T, std::void_t<decltype(Strings::ToUtf8String(std::declval<T>()))>> : std::true_type { +}; -template <typename T, typename = void> +template<typename T, typename = void> struct is_translation_available : std::false_type {}; template<typename T> -struct is_translation_available<T, - std::void_t<decltype(Translate::ToString(std::declval<T>()))>> : std::true_type {}; +struct is_translation_available<T, std::void_t<decltype(Translate::ToString(std::declval<T>()))>> : std::true_type {}; template<typename T> -T GetIniValue(const mINI::INIStructure& ini, const std::string& section, - const std::string& value, const T& def) { +T GetIniValue(const mINI::INIStructure& ini, const std::string& section, const std::string& value, const T& def) { if (!ini.has(section) || !ini.get(section).has(value)) return def; @@ -51,8 +49,7 @@ /* this should be able to handle most of our custom types */ template<typename T> -void SetIniValue(mINI::INIStructure& ini, const std::string& section, - const std::string& key, const T& value) { +void SetIniValue(mINI::INIStructure& ini, const std::string& section, const std::string& key, const T& value) { auto& ini_key = ini[section][key]; if constexpr (is_translation_available<T>::value) { @@ -66,6 +63,6 @@ } } -} +} // namespace INI #endif