00001
00002 #include "zipios++/zipios-config.h"
00003
00004 #include "zipios++/meta-iostreams.h"
00005 #include <memory>
00006
00007 #include "zipios++/zipfile.h"
00008
00009 using namespace zipios ;
00010
00011 using std::cerr ;
00012 using std::cout ;
00013 using std::endl ;
00014 using std::auto_ptr ;
00015
00016 int main() {
00017 try {
00018
00019 cout << "Instantiating a ZipFile" << endl ;
00020 ZipFile zf( "test.zip" ) ;
00021
00022 cout << "list length : " << zf.size() << endl ;
00023
00024 ConstEntries entries ;
00025 entries = zf.entries() ;
00026
00027
00028 ConstEntries::iterator it ;
00029 for( it = entries.begin() ; it != entries.end() ; it++)
00030 cout << *(*it) << endl ;
00031
00032 ConstEntryPointer ent = zf.getEntry( "file2.txt", FileCollection::IGNORE ) ;
00033 if ( ent != 0 ) {
00034 auto_ptr< istream > is( zf.getInputStream( ent ) ) ;
00035
00036 cout << "Contents of entry, " << ent->getName() << " :" << endl ;
00037
00038 cout << is->rdbuf() ;
00039 }
00040 cout << "end of main()" << endl ;
00041
00042 return 0 ;
00043 }
00044 catch( exception &excp ) {
00045 cerr << "Exception caught in main() :" << endl ;
00046 cerr << excp.what() << endl ;
00047 }
00048 }
00049
00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073