2#include "zipios++/zipios-config.h"
4#include "zipios++/meta-iostreams.h"
13CollectionCollection *CollectionCollection::_inst = 0 ;
24 if (
this == &collection || ! collection.
isValid() )
26 _collections.push_back( collection.
clone() ) ;
34 if ( collection == 0 ||
this == collection || ! collection->
isValid() )
36 _collections.push_back( collection ) ;
51 std::vector< FileCollection * >::const_iterator it ;
52 for ( it = _collections.begin() ; it != _collections.end() ; it++ )
53 all_entries += (*it)->entries() ;
59 MatchPath matchpath )
const {
63 std::vector< FileCollection * >::const_iterator it ;
66 getEntry( name, cep, it, matchpath ) ;
74 throw InvalidStateException(
"Attempt to get an input stream from an invalid CollectionCollection" ) ;
81 MatchPath matchpath ) {
83 throw InvalidStateException(
"Attempt to get an input stream from an invalid CollectionCollection" ) ;
85 std::vector< FileCollection * >::const_iterator it ;
88 getEntry( entry_name, cep, it, matchpath ) ;
93 return (*it)->getInputStream( entry_name ) ;
102 std::vector< FileCollection * >::const_iterator it ;
103 for ( it = _collections.begin() ; it != _collections.end() ; it++ )
104 sz += (*it)->size() ;
112CollectionCollection::~CollectionCollection() {
113 std::vector< FileCollection * >::iterator it ;
114 for ( it = _collections.begin() ; it != _collections.end() ; ++it )
125 std::vector< FileCollection * >::const_iterator &it,
126 MatchPath matchpath )
const {
130 for ( it = _collections.begin() ; it != _collections.end() ; it++ ) {
131 cep = (*it)->getEntry( name, matchpath ) ;
virtual ConstEntries entries() const
Returns a vector of const pointers to the entries in the FileCollection.
virtual ConstEntryPointer getEntry(const string &name, MatchPath matchpath=MATCH) const
Returns a ConstEntryPointer to a FileEntry object for the entry with the specified name.
bool addCollection(const FileCollection &collection)
Adds a collection.
virtual FileCollection * clone() const
Create a heap allocated clone of the object this method is called for.
virtual istream * getInputStream(const ConstEntryPointer &entry)
Returns a pointer to an opened istream for the specified FileEntry.
CollectionCollection()
Constructor.
virtual int size() const
Returns the number in entries in all collections kept by the CollectionCollection object.
virtual void close()
Closes the FileCollection.
FileCollection is an abstract baseclass that represents a collection of files.
bool isValid() const
The member function returns true if the collection is valid.
virtual FileCollection * clone() const =0
Create a heap allocated clone of the object this method is called for.
An object member function may throw this exception, if the operation it normally performs is inapprop...
SimpleSmartPointer is a simple reference counting smart pointer template.
Header file that defines CollectionCollection.
vector< EntryPointer > ConstEntries
ConstEntries is a vector of ConstEntryPointer's.
Header file containing miscellaneous small functions.