filters
pole.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef POLE_H
00030 #define POLE_H
00031
00032 #include <string>
00033 #include <list>
00034
00035 namespace POLE
00036 {
00037
00038 class StorageIO;
00039 class Stream;
00040 class StreamIO;
00041
00042 class Storage
00043 {
00044 friend class Stream;
00045 friend class StreamOut;
00046
00047 public:
00048
00049
00050 enum { Ok, OpenFailed, NotOLE, BadOLE, UnknownError };
00051
00055 Storage( const char* filename );
00056
00060 ~Storage();
00061
00065 bool open();
00066
00070 void close();
00071
00075 int result();
00076
00080 std::list<std::string> entries( const std::string& path = "/" );
00081
00085 bool isDirectory( const std::string& name );
00086
00097 Stream* stream( const std::string& name, bool reuse = true );
00098
00099
00100 private:
00101 StorageIO* io;
00102
00103
00104 Storage( const Storage& );
00105 Storage& operator=( const Storage& );
00106
00107 };
00108
00109 class Stream
00110 {
00111 friend class Storage;
00112 friend class StorageIO;
00113
00114 public:
00115
00119
00120 Stream( Storage* storage, const std::string& name );
00121
00125 ~Stream();
00126
00130 std::string fullName();
00131
00135 unsigned long size();
00136
00140 unsigned long tell();
00141
00145 void seek( unsigned long pos );
00146
00150 int getch();
00151
00155 unsigned long read( unsigned char* data, unsigned long maxlen );
00156
00160 bool eof();
00161
00165 bool fail();
00166
00167 private:
00168 StreamIO* io;
00169
00170
00171 Stream( const Stream& );
00172 Stream& operator=( const Stream& );
00173 };
00174
00175 }
00176
00177 #endif // POLE_H
|