Zipios++
|
00001 00002 00003 #include "zipios++/zipios-config.h" 00004 00005 #include "zipios++/meta-iostreams.h" 00006 #include <memory> 00007 00008 #include "zipios++/dircoll.h" 00009 00010 using namespace zipios ; 00011 00012 using std::cerr ; 00013 using std::cout ; 00014 using std::endl ; 00015 using std::auto_ptr ; 00016 00017 int main() { 00018 try { 00019 00020 cout << "Instantiating a DirectoryCollection" << endl ; 00021 DirectoryCollection collection( "../zipios++" ) ; 00022 00023 ConstEntryPointer ent = collection.getEntry( "zipios-config.h" ) ; 00024 if ( ent != 0 ) { 00025 auto_ptr< istream > is( collection.getInputStream( ent ) ) ; 00026 00027 cout << "Contents of entry, " << ent->getName() << " :" << endl ; 00028 00029 cout << is->rdbuf() ; 00030 } 00031 00032 00033 cout << "list length : " << collection.size() << endl ; 00034 00035 ConstEntries entries ; 00036 entries = collection.entries() ; 00037 00038 00039 ConstEntries::iterator it ; 00040 for( it = entries.begin() ; it != entries.end() ; it++) 00041 cout << *(*it) << endl ; 00042 00043 ent = collection.getEntry( "zipios-config.h" ) ; 00044 if ( ent != 0 ) { 00045 auto_ptr< istream > is( collection.getInputStream( ent ) ) ; 00046 00047 cout << "Contents of entry, " << ent->getName() << " :" << endl ; 00048 00049 cout << is->rdbuf() ; 00050 } 00051 cout << "end of main()" << endl ; 00052 00053 return 0 ; 00054 } 00055 catch( exception &excp ) { 00056 cerr << "Exception caught in main() :" << endl ; 00057 cerr << excp.what() << endl ; 00058 } 00059 return -1; 00060 } 00061 00068 /* 00069 Zipios++ - a small C++ library that provides easy access to .zip files. 00070 Copyright (C) 2000 Thomas Søndergaard 00071 00072 This library is free software; you can redistribute it and/or 00073 modify it under the terms of the GNU Lesser General Public 00074 License as published by the Free Software Foundation; either 00075 version 2 of the License, or (at your option) any later version. 00076 00077 This library is distributed in the hope that it will be useful, 00078 but WITHOUT ANY WARRANTY; without even the implied warranty of 00079 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00080 Lesser General Public License for more details. 00081 00082 You should have received a copy of the GNU Lesser General Public 00083 License along with this library; if not, write to the Free Software 00084 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00085 */