]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CWriteFile.h
Merging r5975 through r6036 from trunk to ogl-es branch.
[irrlicht.git] / source / Irrlicht / CWriteFile.h
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
4 \r
5 #ifndef __C_WRITE_FILE_H_INCLUDED__\r
6 #define __C_WRITE_FILE_H_INCLUDED__\r
7 \r
8 #include <stdio.h>\r
9 #include "IWriteFile.h"\r
10 #include "irrString.h"\r
11 \r
12 namespace irr\r
13 {\r
14 \r
15 namespace io\r
16 {\r
17 \r
18         /*!\r
19                 Class for writing a real file to disk.\r
20         */\r
21         class CWriteFile : public IWriteFile\r
22         {\r
23         public:\r
24 \r
25                 CWriteFile(const io::path& fileName, bool append);\r
26 \r
27                 virtual ~CWriteFile();\r
28 \r
29                 //! Reads an amount of bytes from the file.\r
30                 virtual size_t write(const void* buffer, size_t sizeToWrite) _IRR_OVERRIDE_;\r
31 \r
32                 //! Changes position in file, returns true if successful.\r
33                 virtual bool seek(long finalPos, bool relativeMovement = false) _IRR_OVERRIDE_;\r
34 \r
35                 //! Returns the current position in the file.\r
36                 virtual long getPos() const _IRR_OVERRIDE_;\r
37 \r
38                 //! Returns name of file.\r
39                 virtual const io::path& getFileName() const _IRR_OVERRIDE_;\r
40 \r
41                 //! Flush the content of the buffer in the file\r
42                 virtual bool flush() _IRR_OVERRIDE_;\r
43 \r
44                 //! returns if file is open\r
45                 bool isOpen() const;\r
46 \r
47                 //! creator method\r
48                 static IWriteFile* createWriteFile(const io::path& fileName, bool append);\r
49 \r
50         private:\r
51 \r
52                 //! opens the file\r
53                 void openFile(bool append);\r
54 \r
55                 io::path Filename;\r
56                 FILE* File;\r
57                 long FileSize;\r
58         };\r
59 \r
60 } // end namespace io\r
61 } // end namespace irr\r
62 \r
63 #endif\r
64 \r