/****************************************************************************** * File - assetIndex.h * Author - Joey Pollack * Date - 2021/10/25 (y/m/d) * Mod Date - 2021/10/25 (y/m/d) * Description - Loads and stores the index.dat file. Allows querying * the asset index by asset ID or name. ******************************************************************************/ #ifndef ASSET_INDEX_H_ #define ASSET_INDEX_H_ #include #include #include #include #include namespace lunarium { class AssetIndex { public: struct AssetInfo { int32_t ID; std::string Name; AssetType Type; std::string File; int32_t Offset; }; public: static AssetIndex& GetInstance(); static void FreeInstance(); OpRes LoadIndex(const char* filename); const AssetInfo* GetAssetInfo(int id) const; const AssetInfo* GetAssetInfo(const char* name) const; private: static AssetIndex* mpInstance; std::map mAssets; std::map mAssetsByName; AssetIndex(); AssetIndex(const AssetIndex&) = delete; AssetIndex& operator=(const AssetIndex&) = delete; }; } #endif // ASSET_INDEX_H_