Plasma Engine  2.0
Loading...
Searching...
No Matches
FileInterface.h
1#pragma once
2
3#include <Foundation/IO/MemoryStream.h>
4#include <Foundation/Types/UniquePtr.h>
5
6#include <Foundation/Containers/IdTable.h>
7#include <RmlUi/Core/FileInterface.h>
8
9namespace plRmlUiInternal
10{
11 struct FileId : public plGenericId<24, 8>
12 {
13 using plGenericId::plGenericId;
14
15 static FileId FromRml(Rml::FileHandle hFile) { return FileId(static_cast<plUInt32>(hFile)); }
16
17 Rml::FileHandle ToRml() const { return m_Data; }
18 };
19
21
22 class FileInterface final : public Rml::FileInterface
23 {
24 public:
26 virtual ~FileInterface();
27
28 virtual Rml::FileHandle Open(const Rml::String& sPath) override;
29 virtual void Close(Rml::FileHandle hFile) override;
30
31 virtual size_t Read(void* pBuffer, size_t uiSize, Rml::FileHandle hFile) override;
32
33 virtual bool Seek(Rml::FileHandle hFile, long iOffset, int iOrigin) override;
34 virtual size_t Tell(Rml::FileHandle hFile) override;
35
36 virtual size_t Length(Rml::FileHandle hFile) override;
37
38 private:
39 struct OpenFile
40 {
42 plMemoryStreamReader m_Reader;
43 };
44
46 };
47} // namespace plRmlUiInternal
The default implementation for memory stream storage.
Definition MemoryStream.h:161
Definition IdTable.h:171
A reader which can access a memory stream.
Definition MemoryStream.h:259
Definition FileInterface.h:23
A generic id class that holds an id combined of an instance index and a generation counter.
Definition Id.h:52
Definition FileInterface.h:12