#pragma once #include "StorageItem.h" #include "utils/utils.h" #include #include #include #include #include #include class StorageSubItem : public StorageItem { public: enum StorageSubItemError { STORAGE_SUB_ITEM_ERROR_NONE = 0, STORAGE_SUB_ITEM_ERROR_MALLOC_FAILED = 1, STORAGE_SUB_ITEM_KEY_ALREADY_IN_USE = 2, }; explicit StorageSubItem(const std::string &key) : StorageItem(key) { } StorageSubItem *getSubItem(wups_storage_item item) const; const StorageSubItem *getSubItem(const char *key) const; bool deleteItem(const char *key); StorageItem *createItem(const char *key, StorageSubItem::StorageSubItemError &error); StorageSubItem *createSubItem(const char *key, StorageSubItem::StorageSubItemError &error); StorageItem *getItem(const char *name); [[nodiscard]] const std::forward_list> &getSubItems() const { return mSubCategories; } [[nodiscard]] const std::map> &getItems() const { return mItems; } private: std::forward_list> mSubCategories; std::map> mItems; };