2018-10-24 23:31:26 +11:00
|
|
|
#ifndef XIV_DAT_CAT_H
|
|
|
|
#define XIV_DAT_CAT_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2019-10-14 18:41:16 +11:00
|
|
|
#include <filesystem>
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
namespace xiv::dat
|
|
|
|
{
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
class Index;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
class Dat;
|
|
|
|
|
|
|
|
class File;
|
|
|
|
|
|
|
|
// A category represents an .index and its associated .datX
|
|
|
|
class Cat
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// basePath: Path to the folder containingthe datfiles
|
|
|
|
// catNum: The number of the category
|
|
|
|
// name: The name of the category, empty if not known
|
|
|
|
Cat( const std::filesystem::path& basePath, uint32_t catNum, const std::string& name );
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
// basePath: Path to the folder containingthe datfiles
|
|
|
|
// catNum: The number of the category
|
|
|
|
// name: The name of the category, empty if not known
|
|
|
|
// exNum: The number of the expansion to load from
|
|
|
|
// chunk: The chunk to load from
|
|
|
|
Cat( const std::filesystem::path& basePath, uint32_t catNum, const std::string& name, uint32_t exNum,
|
|
|
|
uint32_t chunk );
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
~Cat();
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
// Returns .index of the category
|
|
|
|
const Index& getIndex() const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
// Retrieve a file from the category given its hashes
|
|
|
|
std::unique_ptr< File > getFile( uint32_t dir_hash, uint32_t filename_hash ) const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
bool doesFileExist( uint32_t dir_hash, uint32_t filename_hash ) const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
bool doesDirExist( uint32_t dir_hash ) const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
// Returns thename of the category
|
|
|
|
const std::string& getName() const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
// Returns the number of the category
|
|
|
|
uint32_t getCatNum() const;
|
2018-10-24 23:31:26 +11:00
|
|
|
|
2020-02-10 14:05:04 +11:00
|
|
|
protected:
|
|
|
|
const std::string m_name;
|
|
|
|
const uint32_t m_catNum;
|
|
|
|
const uint32_t m_chunk;
|
|
|
|
|
|
|
|
// The .index
|
|
|
|
std::unique_ptr< Index > m_index;
|
|
|
|
|
|
|
|
// The .datXs such as dat nb X => m_dats[X]
|
|
|
|
std::vector< std::unique_ptr< Dat>> m_dats;
|
|
|
|
};
|
2018-10-24 23:31:26 +11:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // XIV_DAT_CAT_H
|