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_LIMIT_READ_FILE_H_INCLUDED__
\r
6 #define __C_LIMIT_READ_FILE_H_INCLUDED__
\r
8 #include "IReadFile.h"
\r
9 #include "irrString.h"
\r
13 class CUnicodeConverter;
\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
24 class CLimitReadFile : public IReadFile
\r
28 CLimitReadFile(IReadFile* alreadyOpenedFile, long pos, long areaSize, const io::path& name);
\r
30 virtual ~CLimitReadFile();
\r
32 //! returns how much was read
\r
33 size_t read(void* buffer, size_t sizeToRead) override;
\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
40 //! returns size of file
\r
41 long getSize() const override;
\r
43 //! returns where in the file we are.
\r
44 long getPos() const override;
\r
46 //! returns name of file
\r
47 const io::path& getFileName() const override;
\r
49 //! Get the type of the class implementing this interface
\r
50 EREAD_FILE_TYPE getType() const override
\r
52 return ERFT_LIMIT_READ_FILE;
\r
64 } // end namespace io
\r
65 } // end namespace irr
\r