92 return entry->getName() == m_name;
145 return entry->getFileName() == m_name;
289 : m_filename(src.m_filename)
291 , m_valid(src.m_valid)
431 FileEntry::vector_t::const_iterator iter;
541 if((*it)->getSize() > limit)
543 (*it)->setMethod(large_storage_method);
547 (*it)->setMethod(small_storage_method);
576 if((*it)->getSize() > limit)
578 (*it)->setLevel(large_compression_level);
582 (*it)->setLevel(small_compression_level);
600 os <<
"collection '" << collection.
getName() <<
"' {";
603 for(
auto it = entries.begin(); it != entries.end(); ++it)
607 os << (*it)->getName();
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const
Get an entry from this collection.
std::ostream & operator<<(std::ostream &os, FileCollection const &collection)
Write a FileCollection to the output stream.
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
virtual void addEntry(FileEntry const &entry)
Add an entry to this collection.
FileCollection(std::string const &filename="")
Initializes a FileCollection object.
Class object used with the std::find_if() function.
MatchName(std::string const &name)
Initialize a MatchName object.
virtual FileEntry::vector_t entries() const
Retrieve the array of entries.
virtual std::string getName() const
Returns the name of the FileCollection.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
Define the zipios::FileCollection class.
int CompressionLevel
The compression level to be used to save an entry.
char const * g_default_filename
A default filename for unnamed collections.
virtual size_t size() const
Returns the number of entries in the FileCollection.
FileEntry::vector_t m_entries
virtual ~FileCollection()
Make sure the resources are released.
Class object used with the std::find_if() function.
virtual void close()
Close the current FileEntry of this FileCollection.
virtual void mustBeValid() const
Check whether the collection is valid.
virtual pointer_t clone() const =0
Create a clone of a file entry.
FileCollection & operator=(FileCollection const &src)
Replace the content of a collection with a copy of another collection.
MatchFileName(std::string const &name)
Initialize a MatchFileName object.
A FileEntry represents an entry in a FileCollection.
Exception used when it is not possible to move forward.
Base class for various file collections.
void setLevel(size_t limit, FileEntry::CompressionLevel small_compression_level, FileEntry::CompressionLevel large_compression_level)
Change the compression level to the specified value.
bool isValid() const
Check whether the current collection is valid.
std::shared_ptr< FileEntry > pointer_t
void setMethod(size_t limit, StorageMethod small_storage_method, StorageMethod large_storage_method)
Change the storage method to the specified value.
std::vector< pointer_t > vector_t