Plasma Engine  2.0
Loading...
Searching...
No Matches
FileWriter.h
1#pragma once
2
3#include <Foundation/Containers/DynamicArray.h>
4#include <Foundation/IO/FileSystem/Implementation/FileReaderWriterBase.h>
5#include <Foundation/IO/Stream.h>
6
11class PL_FOUNDATION_DLL plFileWriter : public plFileWriterBase
12{
13 PL_DISALLOW_COPY_AND_ASSIGN(plFileWriter);
14
15public:
17 plFileWriter() = default;
18
20 ~plFileWriter() { Close(); }
21
26 plResult Open(plStringView sFile, plUInt32 uiCacheSize = 1024 * 1024, plFileShareMode::Enum fileShareMode = plFileShareMode::Default,
27 bool bAllowFileEvents = true);
28
30 void Close();
31
35 virtual plResult WriteBytes(const void* pWriteBuffer, plUInt64 uiBytesToWrite) override;
36
42 virtual plResult Flush() override;
43
44private:
45 plUInt64 m_uiCacheWritePosition;
47};
Definition DynamicArray.h:81
Definition FileReaderWriterBase.h:55
The default class to use to write data to a file, implements the plStreamWriter interface.
Definition FileWriter.h:12
plFileWriter()=default
Constructor, does nothing.
~plFileWriter()
Destructor, closes the file, if it is still open (RAII).
Definition FileWriter.h:20
virtual plResult WriteBytes(const void *pWriteBuffer, plUInt64 uiBytesToWrite)=0
Writes a raw number of bytes from the buffer, this is the only method which has to be implemented to ...
virtual plResult Flush()
Flushes the stream, may be implemented (not necessary to implement the interface correctly) so that u...
Definition Stream.h:123
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Enum
Definition FileEnums.h:7
@ Default
Results in 'Exclusive' when requesting write access and 'SharedReads' when requesting read access....
Definition FileEnums.h:8
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54