WiiUPluginSystem/include/wups/config/WUPSConfigCategory.h
2024-03-29 13:20:39 +01:00

52 lines
1.2 KiB
C++

#pragma once
#ifdef __cplusplus
#include "WUPSConfigItem.h"
#include <optional>
#include <stdexcept>
#include <string>
class WUPSConfigCategory {
public:
explicit WUPSConfigCategory(WUPSConfigCategoryHandle handle) noexcept;
virtual ~WUPSConfigCategory();
WUPSConfigCategory(const WUPSConfigCategory &) = delete;
WUPSConfigCategory(WUPSConfigCategory &&src) noexcept : mHandle(src.mHandle) {
src.mHandle = {};
}
WUPSConfigCategory &operator=(WUPSConfigCategory &&src) noexcept {
if (this != &src) {
this->mHandle = src.mHandle;
src.mHandle = {};
}
return *this;
}
static std::optional<WUPSConfigCategory> Create(std::string_view name, WUPSConfigAPIStatus &error) noexcept;
static WUPSConfigCategory Create(std::string_view name);
bool add(WUPSConfigCategory &&cat, WUPSConfigAPIStatus &error) noexcept;
void add(WUPSConfigCategory &&cat);
bool add(WUPSConfigItem &&item, WUPSConfigAPIStatus &error) noexcept;
void add(WUPSConfigItem &&item);
[[nodiscard]] const WUPSConfigCategoryHandle &getHandle() const {
return mHandle;
}
void release() {
mHandle = {};
}
private:
WUPSConfigCategoryHandle mHandle = {};
};
#endif