Zipios++
zipinputstream.cpp
Go to the documentation of this file.
1
2
#include "zipios++/zipios-config.h"
3
4
#include "zipios++/meta-iostreams.h"
5
6
#include "
zipios++/zipinputstreambuf.h
"
7
#include "
zipios++/zipinputstream.h
"
8
9
using
std::istream;
10
11
namespace
zipios {
12
13
ZipInputStream::ZipInputStream
( std::istream &is, std::streampos pos )
14
: istream( 0 ),
15
// SGIs basic_ifstream calls istream with 0, but calls basic_ios constructor first??
16
ifs( 0 )
17
{
18
izf =
new
ZipInputStreambuf( is.rdbuf(), pos ) ;
19
// this->rdbuf( izf ) ; is replaced by:
20
this->init( izf ) ;
21
}
22
23
ZipInputStream::ZipInputStream(
const
std::string &filename, std::streampos pos )
24
: istream( 0 ),
25
ifs( 0 )
26
{
27
ifs =
new
std::ifstream( filename.c_str(), std::ios::in |std:: ios::binary ) ;
28
izf =
new
ZipInputStreambuf( ifs->rdbuf(), pos ) ;
29
// this->rdbuf( izf ) ; is replaced by:
30
this->init( izf ) ;
31
}
32
33
int
ZipInputStream::available() {
34
return
1 ;
// FIXME: Dummy implementation
35
}
36
37
void
ZipInputStream::closeEntry
() {
38
izf->closeEntry() ;
39
}
40
41
void
ZipInputStream::close
() {
42
izf->close() ;
43
}
44
45
// ZipLocalEntry *ZipInputStream::createZipCDirEntry( const string
46
// &name ) {}
47
48
ConstEntryPointer
ZipInputStream::getNextEntry
() {
49
clear() ;
// clear eof and other flags.
50
return
izf->getNextEntry() ;
51
}
52
53
ZipInputStream::~ZipInputStream
() {
54
// It's ok to call delete with a Null pointer.
55
delete
izf ;
56
delete
ifs ;
57
}
58
59
}
// namespace
60
64
65
/*
66
Zipios++ - a small C++ library that provides easy access to .zip files.
67
Copyright (C) 2000 Thomas Søndergaard
68
69
This library is free software; you can redistribute it and/or
70
modify it under the terms of the GNU Lesser General Public
71
License as published by the Free Software Foundation; either
72
version 2 of the License, or (at your option) any later version.
73
74
This library is distributed in the hope that it will be useful,
75
but WITHOUT ANY WARRANTY; without even the implied warranty of
76
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
77
Lesser General Public License for more details.
78
79
You should have received a copy of the GNU Lesser General Public
80
License along with this library; if not, write to the Free Software
81
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
82
*/
zipios::ZipInputStream::~ZipInputStream
virtual ~ZipInputStream()
Destructor.
Definition
zipinputstream.cpp:53
zipios::ZipInputStream::close
void close()
Closes the istream.
Definition
zipinputstream.cpp:41
zipios::ZipInputStream::closeEntry
void closeEntry()
Closes the current entry, and positions the stream read pointer at the beginning of the next entry (i...
Definition
zipinputstream.cpp:37
zipios::ZipInputStream::getNextEntry
ConstEntryPointer getNextEntry()
Opens the next entry in the zip archive and returns a const pointer to a FileEntry object for the ent...
Definition
zipinputstream.cpp:48
zipios::ZipInputStream::ZipInputStream
ZipInputStream(istream &is, streampos pos=0)
ZipInputStream constructor.
zipios::ConstEntryPointer
SimpleSmartPointer< const FileEntry > ConstEntryPointer
ConstEntryPointer is a SimpleSmartPointer for const FileEntry's.
Definition
fileentry.h:37
zipinputstream.h
Header file that defines ZipInputStream.
zipinputstreambuf.h
Header file that defines ZipInputStreambuf.
src
zipinputstream.cpp
Generated by
1.14.0