90 size_t write(
const void *ptr,
size_t size,
size_t nmemb);
99 size_t read(
void *ptr,
size_t size,
size_t count);
108 size_t read(std::string &str,
size_t size,
size_t count);
128 [[nodiscard]]
inline const std::vector<std::byte> &
data()
const
140 [[nodiscard]]
inline std::string
content()
const
142 return std::string(
reinterpret_cast<const char *
>(
_content.data()),
154 [[nodiscard]]
inline const std::string &
path()
const
168 [[nodiscard]]
inline size_t size()
const
191 size_t remove(
size_t count);
The File class represents a I/O file asset.
std::string content() const
Returns the content of the file as a string view.
size_t _pos
Current read/write cursor position in the content buffer.
const std::string & path() const
Returns the path of the file.
size_t read(void *ptr, size_t size, size_t count)
Reads data from the file.
const std::vector< std::byte > & data() const
Returns the binary content of the file.
~File()
Destructs the File object.
size_t remove(size_t count)
Removes a number of elements from the current position.
Seek
The Seek enum represents the different seek modes for file operations.
@ END
Seek from the current position in the file
@ CUR
Seek from the beginning of the file
std::string _path
Path to the file.
std::vector< std::byte > _content
In-memory content of the asset.
size_t size() const
Returns the size of the file content.
int seek(long offset, Seek whence)
Seeks to a specific position in the file.
void clear()
Clears the content of the file.
size_t write(const void *ptr, size_t size, size_t nmemb)
Writes data to the file.
size_t tell() const
Returns the current position in the file.
The utility namespace contains classes and functions for the utility project.