60 , std::string
const & name
65 for(
auto it = collections.begin(); it != collections.end(); ++it)
67 cep = (*it)->getEntry(name, matchpath);
70 file_collection = *it;
75 file_collection.reset();
168 return std::make_shared<CollectionCollection>(*
this);
208 if(
this == &collection || !collection.
isValid())
243 if(collection ==
nullptr)
246 throw InvalidException(
"CollectionCollection::addCollection(): called with a null collection pointer");
305 all_entries += (*it)->entries();
354 matchEntry(
m_collections, name, cep, file_collection, matchpath);
396 matchEntry(
m_collections, entry_name, cep, file_collection, matchpath);
398 return cep ? file_collection->getInputStream(entry_name) :
nullptr;
446 (*it)->mustBeValid();
A collection of collections.
bool addCollection(FileCollection const &collection)
Add a FileCollection to this CollectionCollection.
CollectionCollection & operator=(CollectionCollection const &rhs)
Copy assignment operator.
virtual ~CollectionCollection() override
Clean up this CollectionCollection object.
virtual void close() override
Close the CollectionCollection object.
virtual void mustBeValid() const
Check whether the collection is valid.
virtual pointer_t clone() const override
Create a clone of this object.
virtual size_t size() const override
Return the size of the of this collection.
virtual stream_pointer_t getInputStream(std::string const &entry_name, MatchPath matchpath=MatchPath::MATCH) override
Retrieve pointer to an istream.
virtual FileEntry::vector_t entries() const override
Retrieve a vector to all the collection entries.
CollectionCollection()
Initialize a CollectionCollection object.
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const override
Get an entry from the collection.
Base class for various file collections.
bool isValid() const
Check whether the current collection is valid.
std::shared_ptr< FileCollection > pointer_t
virtual void mustBeValid() const
Check whether the collection is valid.
std::shared_ptr< std::istream > stream_pointer_t
A shared pointer to an input stream.
std::vector< pointer_t > vector_t
virtual void close()
Close the current FileEntry of this FileCollection.
virtual pointer_t clone() const =0
Create a clone of this object.
FileCollection & operator=(FileCollection const &rhs)
Replace the content of a collection with a copy of another collection.
std::shared_ptr< FileEntry > pointer_t
std::vector< pointer_t > vector_t
An InvalidException is used when invalid data is provided.
Define the zipios::CollectionCollection class.
void matchEntry(CollectionCollection::vector_t collections, std::string const &name, FileEntry::pointer_t &cep, FileCollection::pointer_t &file_collection, CollectionCollection::MatchPath matchpath)
Search for an entry.
The zipios namespace includes the Zipios library definitions.
Various functions used throughout the library.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.