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 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084