Main Page   Class Hierarchy   Compound List   File List   Compound Members  

dircoll.h

Go to the documentation of this file.
00001 #ifndef DIRCOLL_H
00002 #define DIRCOLL_H
00003 
00004 #include "zipios++/zipios-config.h"
00005 
00006 
00007 #include "zipios++/fcoll.h"
00008 #include "zipios++/basicentry.h"
00009 #include "zipios++/filepath.h"
00010 
00011 namespace zipios {
00012 
00014 typedef BasicEntry DirEntry ;
00015 
00019 class DirectoryCollection : public FileCollection {
00020 public:
00021 
00023   explicit DirectoryCollection() 
00024     : _entries_loaded( false ), _recursive( true ) {}
00025 
00026 
00033   explicit DirectoryCollection( const string &path, 
00034                                 bool recursive = true,
00035                                 bool load_now = false ) ;
00036 
00037   /* Default Copy constructor and copy assignment operator are sufficient. */
00038 
00039   virtual void close() ;
00040 
00041   virtual ConstEntries entries() const ;
00042 
00043   virtual ConstEntryPointer getEntry( const string &name, 
00044                                      MatchPath matchpath = MATCH ) const ;
00045 
00046   virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
00047 
00048   virtual istream *getInputStream( const string &entry_name, 
00049                                      MatchPath matchpath = MATCH ) ;
00050 
00051   virtual int size() const ;
00052 
00053   virtual FileCollection *clone() const ;
00054 
00056   virtual ~DirectoryCollection() ;
00057 
00058 protected:
00059   mutable bool _entries_loaded ;
00060   bool _recursive ; // recurse into subdirs.
00061   FilePath _filepath ;
00062 
00063   void loadEntries() const ;
00064   void load( bool recursive, const FilePath &subdir = FilePath() ) ;
00065  
00066 };
00067  
00068 } // namespace
00069 
00070 #endif
00071 
00076 /*
00077   Zipios++ - a small C++ library that provides easy access to .zip files.
00078   Copyright (C) 2000  Thomas Søndergaard
00079   
00080   This library is free software; you can redistribute it and/or
00081   modify it under the terms of the GNU Lesser General Public
00082   License as published by the Free Software Foundation; either
00083   version 2 of the License, or (at your option) any later version.
00084   
00085   This library is distributed in the hope that it will be useful,
00086   but WITHOUT ANY WARRANTY; without even the implied warranty of
00087   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00088   Lesser General Public License for more details.
00089   
00090   You should have received a copy of the GNU Lesser General Public
00091   License along with this library; if not, write to the Free Software
00092   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00093 */

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