1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-23 10:17:44 +00:00
sapphire/deps/datReader/File.h
AriAvery 8dd40b1378 Cleanup, Improvements
- 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
2023-04-26 13:58:41 +02:00

52 lines
1.1 KiB
C++

#pragma once
#include <vector>
#include <filesystem>
#include <stdint.h>
#include "bparse.h"
namespace xiv::dat
{
enum class FileType :
uint32_t
{
empty = 1,
standard = 2,
model = 3,
texture = 4,
};
class Dat;
// Basic file from the dats
class File
{
friend class Dat;
public:
File();
~File() = default;
// Returns the file type of the File object
FileType get_type() const;
// Returns a const reference to the data sections in the File object
const std::vector< std::vector< char > >& get_data_sections() const;
// Returns a reference to the data sections in the File object
std::vector< std::vector< char > >& access_data_sections();
// Exports the content of the File object to a file on disk at the given path
void exportToFile( const std::filesystem::path& i_path ) const;
protected:
// Stores the file type of the File object
FileType _type;
// Stores the data sections of the File object as a vector of vectors of chars
std::vector< std::vector< char > > _data_sections;
};
}// namespace xiv::dat