Main Page   Class Hierarchy   Compound List   File List   Compound Members  

test_dircoll.cpp

Go to the documentation of this file.
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 }
00060 
00067 /*
00068   Zipios++ - a small C++ library that provides easy access to .zip files.
00069   Copyright (C) 2000  Thomas Søndergaard
00070   
00071   This library is free software; you can redistribute it and/or
00072   modify it under the terms of the GNU Lesser General Public
00073   License as published by the Free Software Foundation; either
00074   version 2 of the License, or (at your option) any later version.
00075   
00076   This library is distributed in the hope that it will be useful,
00077   but WITHOUT ANY WARRANTY; without even the implied warranty of
00078   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00079   Lesser General Public License for more details.
00080   
00081   You should have received a copy of the GNU Lesser General Public
00082   License along with this library; if not, write to the Free Software
00083   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00084 */

Generated at Tue Aug 14 20:39:26 2001 for Zipios++ by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000