1 #ifndef MEMORYWRITER_HPP 2 #define MEMORYWRITER_HPP 7 #include "athena/IStreamWriter.hpp" 40 void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
57 inline bool isOpen()
const {
return true;}
64 void setData(atUint8* data, atUint64 length,
bool takeOwnership =
false);
72 atUint8*
data()
const;
92 void save(
const std::string& filename =
"");
101 void writeUBytes(
const atUint8* data, atUint64 len);
134 void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current);
153 void writeUBytes(
const atUint8* data, atUint64 len);
156 std::unique_ptr<atUint8[]> m_dataCopy;
158 void resize(atUint64 newSize);
164 #ifndef MEMORYWRITER_BASE 165 #define MEMORYWRITER_BASE() \ 167 typedef athena::io::MemoryWriter base 168 #endif // BINARYWRITER_BASE 170 #ifndef MEMORYCOPYWRITER_BASE 171 #define MEMORYCOPYWRITER_BASE() \ 173 typedef athena::io::MemoryCopyWriter base 174 #endif // BINARYWRITER_BASE 176 #endif // MEMORYWRITER_HPP A Stream class for writing data to a memory position.
std::string filepath() const
Returns the target file.
atUint8 * data() const
Returns a copy of the current buffer. Changes to the copy do not affect the buffer so it's perfectly...
atUint64 position() const
Returns the current position in the stream.
void writeUBytes(const atUint8 *data, atUint64 len)
Writes the given buffer with the specified length, buffers can be bigger than the length however it's...
atUint64 length() const
Returns the length of the stream.
void seek(atInt64 pos, SeekOrigin origin=SeekOrigin::Current)
Sets the buffers position relative to the specified position. It seeks relative to the current posit...
void setFilepath(const std::string &filepath)
Sets the target file.
std::string m_filepath
Path to the target file.
void save(const std::string &filename="")
Saves the file to the specified file.
void setData(atUint8 *data, atUint64 length, bool takeOwnership=false)
Sets the buffer to the given one, deleting the current one if it owns it.