SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
File.hpp
Go to the documentation of this file.
1
#ifndef _FILE_H_
2
#define _FILE_H_
3
4
#include <string>
5
#include <vector>
6
#include <fstream>
7
8
namespace
Sleak
{
9
10
/// Thin wrapper over std::fstream for text/binary file I/O.
11
/// @ingroup filesystem
12
class
File
{
13
public
:
14
// Constructor and Destructor
15
File
();
16
~File
();
17
18
// Opens a file with the specified mode
19
bool
Open
(
const
std::string& filename,
const
std::string& mode);
20
21
// Closes the currently open file
22
void
Close
();
23
24
// Reads all text from the file
25
std::string
ReadAllText
();
26
27
// Reads all bytes from the file
28
std::vector<unsigned char>
ReadAllBytes
();
29
30
// Writes all text to the file
31
bool
WriteAllText
(
const
std::string& content);
32
33
// Writes all bytes to the file
34
bool
WriteAllBytes
(
const
std::vector<unsigned char>& data);
35
36
// Checks if a file exists
37
static
bool
Exists
(
const
std::string& filename);
38
39
private
:
40
// File stream for reading and writing
41
std::fstream m_fileStream;
42
43
// Current file mode
44
std::string m_mode;
45
46
// Platform-specific implementation for file existence check
47
static
bool
ExistsImpl(
const
std::string& filename);
48
};
49
50
}
// namespace Sleak
51
52
#endif
// _FILE_H_
Sleak::File::File
File()
Definition
File.cpp:14
Sleak::File::Exists
static bool Exists(const std::string &filename)
Definition
File.cpp:97
Sleak::File::ReadAllBytes
std::vector< unsigned char > ReadAllBytes()
Definition
File.cpp:60
Sleak::File::WriteAllText
bool WriteAllText(const std::string &content)
Definition
File.cpp:77
Sleak::File::Open
bool Open(const std::string &filename, const std::string &mode)
Definition
File.cpp:20
Sleak::File::Close
void Close()
Definition
File.cpp:43
Sleak::File::ReadAllText
std::string ReadAllText()
Definition
File.cpp:49
Sleak::File::WriteAllBytes
bool WriteAllBytes(const std::vector< unsigned char > &data)
Definition
File.cpp:87
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
include
public
Core
File.hpp
Generated on
for SleakEngine by
1.18.0