]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/Android/CAndroidAssetReader.h
Reduce IrrCompileConfig usage to files that actually need it
[irrlicht.git] / source / Irrlicht / Android / CAndroidAssetReader.h
1 // Copyright (C) 2012 Joerg Henrichs\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_ANDROID_ASSET_READER_H_INCLUDED__\r
6 #define __C_ANDROID_ASSET_READER_H_INCLUDED__\r
7 \r
8 \r
9 \r
10 #ifdef  _IRR_COMPILE_ANDROID_ASSET_READER_\r
11 \r
12 \r
13 #include "IReadFile.h"\r
14 \r
15 struct AAssetManager;\r
16 struct AAsset;\r
17 struct ANativeActivity;\r
18 \r
19 namespace irr\r
20 {\r
21 namespace io\r
22 {\r
23 \r
24         class CAndroidAssetReader : public virtual IReadFile\r
25         {\r
26         public:\r
27                 CAndroidAssetReader(AAssetManager *assetManager, const io::path &filename);\r
28 \r
29                 virtual ~CAndroidAssetReader();\r
30 \r
31                 //! Reads an amount of bytes from the file.\r
32                 /** \param buffer Pointer to buffer where read bytes are written to.\r
33                 \param sizeToRead Amount of bytes to read from the file.\r
34                 \return How many bytes were read. */\r
35                 virtual size_t read(void* buffer, size_t sizeToRead);\r
36 \r
37                 //! Changes position in file\r
38                 /** \param finalPos Destination position in the file.\r
39                 \param relativeMovement If set to true, the position in the file is\r
40                 changed relative to current position. Otherwise the position is changed\r
41                 from beginning of file.\r
42                 \return True if successful, otherwise false. */\r
43                 virtual bool seek(long finalPos, bool relativeMovement = false);\r
44 \r
45                 //! Get size of file.\r
46                 /** \return Size of the file in bytes. */\r
47                 virtual long getSize() const;\r
48 \r
49                 //! Get the current position in the file.\r
50                 /** \return Current position in the file in bytes. */\r
51                 virtual long getPos() const;\r
52 \r
53                 //! Get name of file.\r
54                 /** \return File name as zero terminated character string. */\r
55                 virtual const io::path& getFileName() const;\r
56 \r
57                 /** Return true if the file could be opened. */\r
58                 bool isOpen() const { return Asset!=NULL; }\r
59 \r
60         private:\r
61         //! Android's asset manager\r
62                 AAssetManager *AssetManager;\r
63 \r
64                 // An asset, i.e. file\r
65                 AAsset *Asset;\r
66                 path Filename;\r
67     };\r
68 \r
69 } // end namespace io\r
70 } // end namespace irr\r
71 \r
72 #endif //   _IRR_COMPILE_ANDROID_ASSET_READER_\r
73 #endif //  __C_ANDROID_ASSET_READER_H_INCLUDED__\r
74 \r