dircoll.h
Go to the documentation of this file.
#ifndef DIRCOLL_H
#define DIRCOLL_H
#include "zipios++/zipios-config.h"
#include "zipios++/fcoll.h"
#include "zipios++/basicentry.h"
#include "zipios++/filepath.h"
namespace zipios {
typedef BasicEntry DirEntry ;
class DirectoryCollection : public FileCollection {
public:
explicit DirectoryCollection()
: _entries_loaded( false ), _recursive( true ) {}
explicit DirectoryCollection( const string &path,
bool recursive = true,
bool load_now = false ) ;
/* Default Copy constructor and copy assignment operator are sufficient. */
virtual void close() ;
virtual ConstEntries entries() const ;
virtual ConstEntryPointer getEntry( const string &name,
MatchPath matchpath = MATCH ) const ;
virtual istream *getInputStream( const ConstEntryPointer &entry ) ;
virtual istream *getInputStream( const string &entry_name,
MatchPath matchpath = MATCH ) ;
virtual int size() const ;
virtual FileCollection *clone() const ;
virtual ~DirectoryCollection() ;
protected:
mutable bool _entries_loaded ;
bool _recursive ; // recurse into subdirs.
FilePath _filepath ;
void loadEntries() const ;
void load( bool recursive, const FilePath &subdir = FilePath() ) ;
};
} // namespace
#endif
/*
Zipios++ - a small C++ library that provides easy access to .zip files.
Copyright (C) 2000 Thomas Søndergaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
basicentry.h
Header file that defines BasicEntry.
zipios::BasicEntry
BasicEntry is a FileEntry that is suitable as a base class for basic entries, that e....
Definition basicentry.h:18
zipios::DirectoryCollection::getEntry
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:50
zipios::DirectoryCollection::getInputStream
virtual istream * getInputStream(const ConstEntryPointer &entry)
Returns a pointer to an opened istream for the specified FileEntry.
Definition dircoll.cpp:69
zipios::DirectoryCollection::clone
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
Definition dircoll.cpp:115
zipios::DirectoryCollection::close
virtual void close()
Closes the FileCollection.
Definition dircoll.cpp:34
zipios::DirectoryCollection::DirectoryCollection
DirectoryCollection()
Default Constructor.
Definition dircoll.h:23
zipios::DirectoryCollection::~DirectoryCollection
virtual ~DirectoryCollection()
Destructor.
Definition dircoll.cpp:119
zipios::DirectoryCollection::size
virtual int size() const
Returns the number of entries in the FileCollection.
Definition dircoll.cpp:107
zipios::DirectoryCollection::entries
virtual ConstEntries entries() const
Returns a vector of const pointers to the entries in the FileCollection.
Definition dircoll.cpp:39
zipios::FileCollection
FileCollection is an abstract baseclass that represents a collection of files.
Definition fcoll.h:21
zipios::FileCollection::FileCollection
FileCollection()
FileCollection constructor.
Definition fcoll.h:24
zipios::FilePath
FilePath represents a path to a file or directory name.
Definition filepath.h:18
zipios::DirEntry
BasicEntry DirEntry
DirEntry is a BasicEntry.
Definition dircoll.h:14
fcoll.h
Header file that defines FileCollection.
zipios::ConstEntryPointer
SimpleSmartPointer< const FileEntry > ConstEntryPointer
ConstEntryPointer is a SimpleSmartPointer for const FileEntry's.
Definition fileentry.h:37
zipios::ConstEntries
vector< EntryPointer > ConstEntries
ConstEntries is a vector of ConstEntryPointer's.
Definition fileentry.h:43
filepath.h
Header file that defines FilePath.