You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/src/internal_libs/assets/loaders/assetIndex.h

55 lines
1.3 KiB
C++

/******************************************************************************
* 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 <string>
#include <map>
#include <assets/types/asset.h>
#include <utils/opRes.h>
#include <utils/types.h>
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<int, AssetInfo*> mAssets;
std::map<std::string, AssetInfo*> mAssetsByName;
AssetIndex();
AssetIndex(const AssetIndex&) = delete;
AssetIndex& operator=(const AssetIndex&) = delete;
};
}
#endif // ASSET_INDEX_H_