1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_MEMORY_READ_FILE_H_INCLUDED__
\r
6 #define __C_MEMORY_READ_FILE_H_INCLUDED__
\r
8 #include "IMemoryReadFile.h"
\r
9 #include "IWriteFile.h"
\r
10 #include "irrString.h"
\r
19 Class for reading from memory.
\r
21 class CMemoryReadFile : public IMemoryReadFile
\r
26 CMemoryReadFile(const void* memory, long len, const io::path& fileName, bool deleteMemoryWhenDropped);
\r
29 virtual ~CMemoryReadFile();
\r
31 //! returns how much was read
\r
32 size_t read(void* buffer, size_t sizeToRead) override;
\r
34 //! changes position in file, returns true if successful
\r
35 bool seek(long finalPos, bool relativeMovement = false) override;
\r
37 //! returns size of file
\r
38 long getSize() const override;
\r
40 //! returns where in the file we are.
\r
41 long getPos() const override;
\r
43 //! returns name of file
\r
44 const io::path& getFileName() const override;
\r
46 //! Get the type of the class implementing this interface
\r
47 EREAD_FILE_TYPE getType() const override
\r
49 return ERFT_MEMORY_READ_FILE;
\r
52 //! Get direct access to internal buffer
\r
53 const void *getBuffer() const override
\r
64 bool deleteMemoryWhenDropped;
\r
68 Class for writing to memory.
\r
70 class CMemoryWriteFile : public IWriteFile
\r
75 CMemoryWriteFile(void* memory, long len, const io::path& fileName, bool deleteMemoryWhenDropped);
\r
78 virtual ~CMemoryWriteFile();
\r
80 //! returns how much was written
\r
81 size_t write(const void* buffer, size_t sizeToWrite) override;
\r
83 //! changes position in file, returns true if successful
\r
84 bool seek(long finalPos, bool relativeMovement = false) override;
\r
86 //! returns where in the file we are.
\r
87 long getPos() const override;
\r
89 //! returns name of file
\r
90 const io::path& getFileName() const override;
\r
92 bool flush() override;
\r
100 bool deleteMemoryWhenDropped;
\r
103 } // end namespace io
\r
104 } // end namespace irr
\r