diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CLimitReadFile.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CLimitReadFile.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CLimitReadFile.h b/libraries/irrlicht-1.8/source/Irrlicht/CLimitReadFile.h new file mode 100644 index 0000000..00348b1 --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/CLimitReadFile.h | |||
@@ -0,0 +1,62 @@ | |||
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_LIMIT_READ_FILE_H_INCLUDED__ | ||
6 | #define __C_LIMIT_READ_FILE_H_INCLUDED__ | ||
7 | |||
8 | #include "IReadFile.h" | ||
9 | #include "irrString.h" | ||
10 | |||
11 | namespace irr | ||
12 | { | ||
13 | class CUnicodeConverter; | ||
14 | |||
15 | namespace io | ||
16 | { | ||
17 | |||
18 | /*! this is a read file, which is limited to some boundaries, | ||
19 | so that it may only start from a certain file position | ||
20 | and may only read until a certain file position. | ||
21 | This can be useful, for example for reading uncompressed files | ||
22 | in an archive (zip, tar). | ||
23 | !*/ | ||
24 | class CLimitReadFile : public IReadFile | ||
25 | { | ||
26 | public: | ||
27 | |||
28 | CLimitReadFile(IReadFile* alreadyOpenedFile, long pos, long areaSize, const io::path& name); | ||
29 | |||
30 | virtual ~CLimitReadFile(); | ||
31 | |||
32 | //! returns how much was read | ||
33 | virtual s32 read(void* buffer, u32 sizeToRead); | ||
34 | |||
35 | //! changes position in file, returns true if successful | ||
36 | //! if relativeMovement==true, the pos is changed relative to current pos, | ||
37 | //! otherwise from begin of file | ||
38 | virtual bool seek(long finalPos, bool relativeMovement = false); | ||
39 | |||
40 | //! returns size of file | ||
41 | virtual long getSize() const; | ||
42 | |||
43 | //! returns where in the file we are. | ||
44 | virtual long getPos() const; | ||
45 | |||
46 | //! returns name of file | ||
47 | virtual const io::path& getFileName() const; | ||
48 | |||
49 | private: | ||
50 | |||
51 | io::path Filename; | ||
52 | long AreaStart; | ||
53 | long AreaEnd; | ||
54 | long Pos; | ||
55 | IReadFile* File; | ||
56 | }; | ||
57 | |||
58 | } // end namespace io | ||
59 | } // end namespace irr | ||
60 | |||
61 | #endif | ||
62 | |||