dircoll.h

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

Generated on Wed Nov 23 19:00:05 2011 for FreeCAD by  doxygen 1.6.1