]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CLimitReadFile.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / CLimitReadFile.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_LIMIT_READ_FILE_H_INCLUDED__\r
6 #define __C_LIMIT_READ_FILE_H_INCLUDED__\r
7 \r
8 #include "IReadFile.h"\r
9 #include "irrString.h"\r
10 \r
11 namespace irr\r
12 {\r
13         class CUnicodeConverter;\r
14 \r
15 namespace io\r
16 {\r
17 \r
18         /*! this is a read file, which is limited to some boundaries,\r
19                 so that it may only start from a certain file position\r
20                 and may only read until a certain file position.\r
21                 This can be useful, for example for reading uncompressed files\r
22                 in an archive (zip, tar).\r
23         !*/\r
24         class CLimitReadFile : public IReadFile\r
25         {\r
26         public:\r
27 \r
28                 CLimitReadFile(IReadFile* alreadyOpenedFile, long pos, long areaSize, const io::path& name);\r
29 \r
30                 virtual ~CLimitReadFile();\r
31 \r
32                 //! returns how much was read\r
33                 size_t read(void* buffer, size_t sizeToRead) override;\r
34 \r
35                 //! changes position in file, returns true if successful\r
36                 //! if relativeMovement==true, the pos is changed relative to current pos,\r
37                 //! otherwise from begin of file\r
38                 bool seek(long finalPos, bool relativeMovement = false) override;\r
39 \r
40                 //! returns size of file\r
41                 long getSize() const override;\r
42 \r
43                 //! returns where in the file we are.\r
44                 long getPos() const override;\r
45 \r
46                 //! returns name of file\r
47                 const io::path& getFileName() const override;\r
48 \r
49                 //! Get the type of the class implementing this interface\r
50                 EREAD_FILE_TYPE getType() const override\r
51                 {\r
52                         return ERFT_LIMIT_READ_FILE;\r
53                 }\r
54 \r
55         private:\r
56 \r
57                 io::path Filename;\r
58                 long AreaStart;\r
59                 long AreaEnd;\r
60                 long Pos;\r
61                 IReadFile* File;\r
62         };\r
63 \r
64 } // end namespace io\r
65 } // end namespace irr\r
66 \r
67 #endif\r
68 \r