]> git.donarmstrong.com Git - flightcrew.git/blob - src/zipios/zipios++/zipinputstream.h
update changelog, target experimental
[flightcrew.git] / src / zipios / zipios++ / zipinputstream.h
1 #ifndef ZIPINPUTSTREAM_H
2 #define ZIPINPUTSTREAM_H
3
4 #include "zipios++/zipios-config.h"
5
6 #include "zipios++/meta-iostreams.h"
7 #include <string>
8
9 #include "zipios++/ziphead.h"
10 #include "zipios++/zipinputstreambuf.h"
11
12 namespace zipios {
13
14 using std::ifstream ;
15
16 /** \anchor ZipInputStream_anchor
17     ZipInputStream is an istream that gets it's input from a zip file. The
18     interface approximates the interface of the Java
19     ZipInputStream. */
20 class ZipInputStream : public istream {
21 public:
22
23   /** ZipInputStream constructor.
24       @param is istream from which the compressed zip archive can be read.
25       @param pos position to reposition the istream to before reading.  */
26   explicit ZipInputStream( istream &is, streampos pos = 0 ) ;
27
28   /** ZipInputStream constructor.
29       @filename filename of a valid zip file.
30       @param pos position to reposition the istream to before reading.   */
31   explicit ZipInputStream( const string &filename, streampos pos = 0 ) ;
32   
33   int available() ;
34   /** Closes the current entry, and positions the stream read pointer at 
35       the beginning of the next entry (if there is one). */
36   void closeEntry() ;
37
38   /** Closes the istream. */
39   void close() ;
40
41 //    ZipLocalEntry *createZipCDirEntry( const string &name ) ;
42
43   /** \anchor ZipInputStream_getnextentry_anchor
44       Opens the next entry in the zip archive and returns a const pointer to a 
45       FileEntry object for the entry. For new instances this method has to be
46       called once before you can read from the first entry.
47       @return a const FileEntry * containing information about the (now) current 
48       entry.
49   */
50   ConstEntryPointer getNextEntry() ;
51
52   /** Destructor. */
53   virtual ~ZipInputStream() ;
54
55 private:
56   ifstream *ifs ;
57   ZipInputStreambuf *izf ;
58
59   /** Copy-constructor is private to prevent copying. */
60   ZipInputStream( const ZipInputStream &src ) ;
61
62   /** Copy-assignment operator is private to prevent copying.  */
63   const ZipInputStream &operator= ( const ZipInputStream &src ) ;
64
65 };
66  
67 } // namespace.
68
69 #endif
70
71 /** \file 
72     Header file that defines ZipInputStream.
73 */
74
75 /*
76   Zipios++ - a small C++ library that provides easy access to .zip files.
77   Copyright (C) 2000  Thomas Søndergaard
78   
79   This library is free software; you can redistribute it and/or
80   modify it under the terms of the GNU Lesser General Public
81   License as published by the Free Software Foundation; either
82   version 2 of the License, or (at your option) any later version.
83   
84   This library is distributed in the hope that it will be useful,
85   but WITHOUT ANY WARRANTY; without even the implied warranty of
86   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
87   Lesser General Public License for more details.
88   
89   You should have received a copy of the GNU Lesser General Public
90   License along with this library; if not, write to the Free Software
91   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
92 */