2 #include "zipios++/zipios-config.h"
4 #include "zipios++/meta-iostreams.h"
13 CollectionCollection *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 ) ;
50 ConstEntries all_entries ;
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() ;
112 CollectionCollection::~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 istream * getInputStream(const ConstEntryPointer &entry)
CollectionCollection()
Constructor.
virtual ConstEntryPointer getEntry(const string &name, MatchPath matchpath=MATCH) const
bool addCollection(const FileCollection &collection)
SimpleSmartPointer is a simple reference counting smart pointer template.
virtual FileCollection * clone() const =0
Create a heap allocated clone of the object this method is called for.
virtual int size() const
Returns the number in entries in all collections kept by the CollectionCollection object...
virtual ConstEntries entries() const
virtual FileCollection * clone() const
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...
bool isValid() const
The member function returns true if the collection is valid.
virtual void close()
Closes the FileCollection.
Header file that defines CollectionCollection.
Header file containing miscellaneous small functions.