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"
9#include "zipios++/filepath.h"
10
11namespace zipios {
12
15
20public:
21
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
58protected:
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*/
Header file that defines BasicEntry.
BasicEntry is a FileEntry that is suitable as a base class for basic entries, that e....
Definition basicentry.h:18
DirectoryCollection is a FileCollection that obtains its entries from a directory.
Definition dircoll.h:19
virtual ConstEntryPointer getEntry(const string &name, MatchPath matchpath=MATCH) const
Returns a ConstEntryPointer to a FileEntry object for the entry with the specified name.
Definition dircoll.cpp:49
virtual istream * getInputStream(const ConstEntryPointer &entry)
Returns a pointer to an opened istream for the specified FileEntry.
Definition dircoll.cpp:68
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
Definition dircoll.cpp:114
virtual void close()
Closes the FileCollection.
Definition dircoll.cpp:33
DirectoryCollection()
Default Constructor.
Definition dircoll.h:23
virtual ~DirectoryCollection()
Destructor.
Definition dircoll.cpp:118
virtual int size() const
Returns the number of entries in the FileCollection.
Definition dircoll.cpp:106
virtual ConstEntries entries() const
Returns a vector of const pointers to the entries in the FileCollection.
Definition dircoll.cpp:38
FileCollection is an abstract baseclass that represents a collection of files.
Definition fcoll.h:21
FilePath represents a path to a file or directory name.
Definition filepath.h:18
SimpleSmartPointer is a simple reference counting smart pointer template.
Header file that defines FileCollection.
vector< EntryPointer > ConstEntries
ConstEntries is a vector of ConstEntryPointer's.
Definition fileentry.h:43
Header file that defines FilePath.