aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h')
-rw-r--r--src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h b/src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h
new file mode 100644
index 0000000..de20ae7
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/tools/GUIEditor/CMemoryReadWriteFile.h
@@ -0,0 +1,73 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_MEMORY_READ_WRITE_FILE_H_INCLUDED__
6#define __C_MEMORY_READ_WRITE_FILE_H_INCLUDED__
7
8#include "IWriteFile.h"
9#include "IReadFile.h"
10#include "irrArray.h"
11#include "irrString.h"
12#include "memory.h"
13
14namespace irr
15{
16namespace io
17{
18
19 //! Provides write acess to an array as if it is a file.
20 class CMemoryReadWriteFile : public virtual IWriteFile, public virtual IReadFile
21 {
22 public:
23
24 CMemoryReadWriteFile(const c8* filename=0);
25
26 //! Reads an amount of bytes from the file.
27 //! \param buffer: Pointer to buffer of bytes to write.
28 //! \param sizeToWrite: Amount of bytes to wrtie to the file.
29 //! \return Returns how much bytes were written.
30 virtual s32 write(const void* buffer, u32 sizeToWrite);
31
32 //! Changes position in file, returns true if successful.
33 //! \param finalPos: Destination position in the file.
34 //! \param relativeMovement: If set to true, the position in the file is
35 //! changed relative to current position. Otherwise the position is changed
36 //! from begin of file.
37 //! \return Returns true if successful, otherwise false.
38 virtual bool seek(long finalPos, bool relativeMovement = false);
39
40 //! Returns size of file.
41 //! \return Returns the size of the file in bytes.
42 virtual long getSize() const;
43
44 //! Reads an amount of bytes from the file.
45 //! \param buffer: Pointer to buffer where to read bytes will be written to.
46 //! \param sizeToRead: Amount of bytes to read from the file.
47 //! \return Returns how much bytes were read.
48 virtual s32 read(void* buffer, u32 sizeToRead);
49
50 //! Returns the current position in the file.
51 //! \return Returns the current position in the file in bytes.
52 virtual long getPos() const;
53
54 //! Returns name of file.
55 //! \return Returns the file name as zero terminated character string.
56 virtual const io::path& getFileName() const;
57
58 //! Returns file data as an array
59 core::array<c8>& getData();
60
61 private:
62
63 core::array<c8> Data;
64 io::path FileName;
65 long Pos;
66 };
67
68
69
70} // end namespace io
71} // end namespace irr
72
73#endif // __C_MEMORY_READ_WRITE_FILE_H_INCLUDED__