Zipios++
tests
example_zip.cpp
Go to the documentation of this file.
1
2
#include "zipios++/zipios-config.h"
3
4
#include "zipios++/meta-iostreams.h"
5
#include <memory>
6
7
#include "
zipios++/zipfile.h
"
8
9
using namespace
zipios
;
10
11
using
std::cerr ;
12
using
std::cout ;
13
using
std::endl ;
14
using
std::auto_ptr ;
15
16
int
main() {
17
try
{
18
19
cout <<
"Instantiating a ZipFile"
<< endl ;
20
ZipFile
zf(
"test.zip"
) ;
21
22
cout <<
"list length : "
<< zf.size() << endl ;
23
24
ConstEntries
entries ;
25
entries = zf.entries() ;
26
27
28
ConstEntries::iterator it ;
29
for
( it = entries.begin() ; it != entries.end() ; it++)
30
cout << *(*it) << endl ;
31
32
ConstEntryPointer
ent = zf.getEntry(
"file2.txt"
, FileCollection::IGNORE ) ;
33
if
( ent != 0 ) {
34
auto_ptr< istream > is( zf.getInputStream( ent ) ) ;
35
36
cout <<
"Contents of entry, "
<< ent->getName() <<
" :"
<< endl ;
37
38
cout << is->rdbuf() ;
39
}
40
cout <<
"end of main()"
<< endl ;
41
42
return
0 ;
43
}
44
catch
( exception &excp ) {
45
cerr <<
"Exception caught in main() :"
<< endl ;
46
cerr << excp.what() << endl ;
47
}
48
return
-1;
49
}
50
57
/*
58
Zipios++ - a small C++ library that provides easy access to .zip files.
59
Copyright (C) 2000 Thomas Søndergaard
60
61
This library is free software; you can redistribute it and/or
62
modify it under the terms of the GNU Lesser General Public
63
License as published by the Free Software Foundation; either
64
version 2 of the License, or (at your option) any later version.
65
66
This library is distributed in the hope that it will be useful,
67
but WITHOUT ANY WARRANTY; without even the implied warranty of
68
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69
Lesser General Public License for more details.
70
71
You should have received a copy of the GNU Lesser General Public
72
License along with this library; if not, write to the Free Software
73
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
74
*/
zipios
Definition:
basicentry.h:14
zipfile.h
Header file that defines ZipFile.
zipios::ZipFile
Definition:
zipfile.h:20
zipios::SimpleSmartPointer
SimpleSmartPointer is a simple reference counting smart pointer template.
Definition:
simplesmartptr.h:15
zipios::ConstEntries
vector< EntryPointer > ConstEntries
ConstEntries is a vector of ConstEntryPointer's.
Definition:
fileentry.h:43
Generated by
1.8.13