Zipios++
dircoll.h
Go to the documentation of this file.
1 #ifndef DIRCOLL_H
2 #define DIRCOLL_H
3 
4 #include "zipios++/zipios-config.h"
5 
6 
7 #include "zipios++/fcoll.h"
8 #include "zipios++/basicentry.h"
9 #include "zipios++/filepath.h"
10 
11 namespace zipios {
12 
14 typedef BasicEntry DirEntry ;
15 
20 public:
21 
23  explicit DirectoryCollection()
24  : _entries_loaded( false ), _recursive( true ) {}
25 
26 
33  explicit DirectoryCollection( const string &path,
34  bool recursive = true,
35  bool load_now = false ) ;
36 
37  /* Default Copy constructor and copy assignment operator are sufficient. */
38 
39  virtual void close() ;
40 
41  virtual ConstEntries entries() const ;
42 
43  virtual ConstEntryPointer getEntry( const string &name,
44  MatchPath matchpath = MATCH ) const ;
45 
46  virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
47 
48  virtual istream *getInputStream( const string &entry_name,
49  MatchPath matchpath = MATCH ) ;
50 
51  virtual int size() const ;
52 
53  virtual FileCollection *clone() const ;
54 
56  virtual ~DirectoryCollection() ;
57 
58 protected:
59  mutable bool _entries_loaded ;
60  bool _recursive ; // recurse into subdirs.
61  FilePath _filepath ;
62 
63  void loadEntries() const ;
64  void load( bool recursive, const FilePath &subdir = FilePath() ) ;
65 
66 };
67 
68 } // namespace
69 
70 #endif
71 
76 /*
77  Zipios++ - a small C++ library that provides easy access to .zip files.
78  Copyright (C) 2000 Thomas Søndergaard
79 
80  This library is free software; you can redistribute it and/or
81  modify it under the terms of the GNU Lesser General Public
82  License as published by the Free Software Foundation; either
83  version 2 of the License, or (at your option) any later version.
84 
85  This library is distributed in the hope that it will be useful,
86  but WITHOUT ANY WARRANTY; without even the implied warranty of
87  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
88  Lesser General Public License for more details.
89 
90  You should have received a copy of the GNU Lesser General Public
91  License along with this library; if not, write to the Free Software
92  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
93 */
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
Definition: dircoll.cpp:114
Header file that defines FileCollection.
SimpleSmartPointer is a simple reference counting smart pointer template.
virtual ~DirectoryCollection()
Destructor.
Definition: dircoll.cpp:118
virtual int size() const
Returns the number of entries in the FileCollection.
Definition: dircoll.cpp:106
Header file that defines BasicEntry.
virtual ConstEntries entries() const
Definition: dircoll.cpp:38
virtual istream * getInputStream(const ConstEntryPointer &entry)
Definition: dircoll.cpp:68
virtual void close()
Closes the FileCollection.
Definition: dircoll.cpp:33
DirectoryCollection()
Default Constructor.
Definition: dircoll.h:23
virtual ConstEntryPointer getEntry(const string &name, MatchPath matchpath=MATCH) const
Definition: dircoll.cpp:49
FilePath represents a path to a file or directory name.
Definition: filepath.h:18
Header file that defines FilePath.