|
dEngine
Simple 2D C++ game engine
|
Takes care of packing files into a .dat file. More...
#include <Packer.h>
Public Member Functions | |
| Packer (std::string filePath) | |
| Create a new packer. More... | |
| void | ReadFileToBuffer (const std::filesystem::path filePath) |
| Read a new file into the buffer and write to the packed file. More... | |
| void | WriteTable () |
| Writes a table of contents to the top of the file. More... | |
Private Member Functions | |
| std::vector< char > | MapToVector () |
| bool | fileExists (const std::string &filename) |
| Checks if file exists. More... | |
| void | deleteFileIfExists (const std::string &filename) |
| Deletes a file if it exists. More... | |
| std::vector< char > | compressBuffer (const std::vector< char > &buffer) |
| Perform lossless compression on a buffer using zlib. More... | |
| std::string | getFileType (const std::string &extension) |
| Get a file's type based on file extension. More... | |
Private Attributes | |
| std::map< std::string, std::string > | fileLocMap |
| A map containing every file in the package and it's starting location. More... | |
| std::string | outFilePath |
| std::vector< char > | buffer |
Takes care of packing files into a .dat file.
| Packer::Packer | ( | std::string | filePath | ) |
Create a new packer.
| filePath | Filepath to the output packed file |
|
private |
Perform lossless compression on a buffer using zlib.
| buffer | The buffer to compress |
Referenced by ReadFileToBuffer().
|
private |
|
private |
Checks if file exists.
| filename | File to check |
Referenced by deleteFileIfExists().
|
private |
Get a file's type based on file extension.
| extension | The file's extension |
Referenced by ReadFileToBuffer().
|
private |
| void Packer::ReadFileToBuffer | ( | const std::filesystem::path | filePath | ) |
Read a new file into the buffer and write to the packed file.
| filePath | Filepath of the file to pack |
Referenced by main().
| void Packer::WriteTable | ( | ) |
Writes a table of contents to the top of the file.
Referenced by main().
|
private |
Referenced by ReadFileToBuffer().
|
private |
A map containing every file in the package and it's starting location.
Referenced by MapToVector(), ReadFileToBuffer(), and WriteTable().
|
private |
Referenced by Packer(), ReadFileToBuffer(), and WriteTable().
1.8.13