RDI/include/FileHandler/Generic.hpp

63 lines
1.3 KiB
C++

/**
* @file GenericFile.h
* @date 01/02/2023
* @author JackCarterSmith
* @copyright GPL-v3.0
* @brief Generic file object class.
*
*/
#include <string>
#ifndef GENERICFILE_H_
#define GENERICFILE_H_
namespace RDI {
typedef char* MEMFILE;
namespace DatFile {
class DatFileEntryFile;
}
class GenericFile {
public:
// Default constructor
// Set the default class members and link against correct MEMFILE
GenericFile( DatFile::DatFileEntryFile* hDat );
virtual ~GenericFile();
GenericFile(const GenericFile&) = default;
GenericFile& operator=(const GenericFile&) = default;
GenericFile(GenericFile&&) = default;
GenericFile& operator=(GenericFile&&) = default;
// Primary datas parsing/loading function
// This function must be called to load datas in memory and access to others function
void Load();
bool isLoaded() const { return loaded; }
// Free memory of object datas
// Should be called after using it
void Dispose();
std::string getFileName() const { return fileName; }
std::string getFullPath() const { return fullFilePath; }
std::string getFileExtension() const { return fileExtension; }
MEMFILE get() { return pMemLoc; }
protected:
unsigned long size;
std::string fileName, fullFilePath, fileExtension;
MEMFILE pMemLoc = nullptr;
private:
bool loaded = false;
};
}
#endif /* GENERICFILE_H_ */