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