mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-23 10:17:44 +00:00

- Refactored datReader and several other files for code cleanliness - Enhanced runtime performance by optimizing select functions, utilizing std::string_view in place of std::string where appropriate - Removed deprecated filesystem implementation - Introduced Link Time Optimization (LTO) support for Linux builds - Enabled parallel builds for GCC/Clang compilers - Expanded and improved comments for various functions - Replaced version check failure with warning, allowing for continued use with a cautionary message Tested on MSVC/Windows and Clang/Ubuntu
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <mutex>
|
|
|
|
#include <filesystem>
|
|
|
|
namespace xiv
|
|
{
|
|
namespace dat
|
|
{
|
|
class GameData;
|
|
}
|
|
namespace exd
|
|
{
|
|
|
|
class Cat;
|
|
|
|
// Interface for retrieval of exd data - Main entry point
|
|
// the game_data object should outlive the exd_data object
|
|
class ExdData
|
|
{
|
|
public:
|
|
// Need an initialized dat::GameData to retrieve the files from the dat
|
|
ExdData( dat::GameData& i_game_data );
|
|
~ExdData() = default;
|
|
|
|
// Get the list of thenames of the categories
|
|
const std::vector< std::string >& get_cat_names() const;
|
|
|
|
// Get a category by its name
|
|
const Cat& get_category( const std::string& i_cat_name );
|
|
|
|
// Export in csv in base flder i_ouput_path
|
|
void export_as_csvs( const std::filesystem::path& i_output_path );
|
|
|
|
protected:
|
|
// Lazy instantiation of category
|
|
void create_category( const std::string& i_cat_name );
|
|
|
|
// Reference to the game_data object
|
|
dat::GameData& _game_data;
|
|
|
|
// Categories, indexed by their name
|
|
std::unordered_map< std::string, std::unique_ptr< Cat > > _cats;
|
|
// List of category names = m_cats.keys()
|
|
std::vector< std::string > _cat_names;
|
|
// Mutexes used to avoid race condition when lazy instantiating a category
|
|
std::unordered_map< std::string, std::unique_ptr< std::mutex > > _cat_creation_mutexes;
|
|
};
|
|
|
|
}// namespace exd
|
|
}// namespace xiv
|