feat: add helper macro and new Win32 function.

- add IsValidCodePage in WinFctHelper to check whether code page number is valid.
- add 6 macros to batchly (add / set default) (move / copy) (constructor / assign operator).
- add default or delete (copy / move) (constructor / assign operator) for some classes.
This commit is contained in:
2024-08-04 11:57:56 +08:00
parent 6da990876e
commit e6c24b8b61
12 changed files with 185 additions and 74 deletions

View File

@ -30,6 +30,7 @@ namespace YYCC::ConfigManager {
*/
AbstractSetting(const yycc_u8string_view& name);
virtual ~AbstractSetting();
YYCC_DEL_CLS_COPY_MOVE(AbstractSetting);
// Name interface
public:
@ -89,6 +90,7 @@ namespace YYCC::ConfigManager {
uint64_t version_identifier,
std::initializer_list<AbstractSetting*> settings);
~CoreManager() {}
YYCC_DEL_CLS_COPY_MOVE(CoreManager);
// Core functions
public:
@ -129,6 +131,7 @@ namespace YYCC::ConfigManager {
Constraints::Constraint<_Ty> constraint = Constraints::Constraint<_Ty> {}) :
AbstractSetting(name), m_Data(default_value), m_DefaultData(default_value), m_Constraint(constraint) {}
virtual ~NumberSetting() {}
YYCC_DEL_CLS_COPY_MOVE(NumberSetting);
/// @brief Get stored data in setting.
_Ty Get() const { return m_Data; }
@ -189,6 +192,7 @@ namespace YYCC::ConfigManager {
m_DefaultData = default_value;
}
virtual ~StringSetting() {}
YYCC_DEL_CLS_COPY_MOVE(StringSetting);
/// @brief Get reference to stored string.
const yycc_u8string& Get() const { return m_Data; }