|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
RAII wrapper for ZIP archives used by libzip. More...
#include <ZipArchive.hpp>
Construction and Destruction | |
| ZipArchive () | |
| Constructor creating an archive from an empty source. More... | |
| virtual | ~ZipArchive () |
| Destructor clearing the archive if necessary. More... | |
Getters | |
| struct zip * | get () noexcept |
| Gets a pointer to the underlying archive. More... | |
| const struct zip * | getc () const noexcept |
| Gets a const pointer to the underlying archive. More... | |
| bool | valid () const noexcept |
| Checks whether the underlying archive is valid. More... | |
| std::string | getError () |
| Get the last occurred error as string. More... | |
Archive Functionality | |
| bool | addEmptyDirectory (const std::string &name) |
| Adds an empty directory to the archive. More... | |
| bool | addFile (const std::string &fileName, const std::string &content, bool overwrite) |
| Adds a file to the archive. More... | |
Cleanup | |
| void | close () noexcept |
| Closes the underlying archive if necessary. More... | |
| void | close (std::string &dumpTo) |
| Closes the underlying archive and dumps its contents. More... | |
Copy and Move | |
| ZipArchive (ZipArchive &)=delete | |
| Deleted copy constructor. More... | |
| ZipArchive & | operator= (ZipArchive &)=delete |
| Deleted copy assignment operator. More... | |
| ZipArchive (ZipArchive &&other) noexcept | |
| Move constructor. More... | |
| ZipArchive & | operator= (ZipArchive &&other) noexcept |
| Move assignment operator. More... | |
RAII wrapper for ZIP archives used by libzip.
Creates the archive on construction and closes it on destruction, avoiding memory leaks.
This class is used exclusively by functions in the Data::Compression::Zip namespace.
For more information about the libzip library used, visit its website.
|
inline |
Constructor creating an archive from an empty source.
References crawlservpp::Wrapper::ZipSource::get(), crawlservpp::Wrapper::ZipSource::getError(), and crawlservpp::Wrapper::ZipSource::valid().
|
inlinevirtual |
Destructor clearing the archive if necessary.
References close().
|
delete |
Deleted copy constructor.
|
inlinenoexcept |
Move constructor.
Moves the archive from the specified location into this instance of the class.
| other | The archive to move from. |
|
inline |
Adds an empty directory to the archive.
| name | The name of the directory to add to the archive. |
|
inline |
Adds a file to the archive.
| name | The name of the file to add to the archive. |
| content | The content of the file to add to the archive. |
| overwrite | Specifies whether to overwrite an already existing file with the same name. |
Referenced by crawlservpp::Data::Compression::Zip::compress().
|
inlinenoexcept |
Closes the underlying archive if necessary.
The archive will be invalid and valid() will return false afterwards.
Referenced by close(), crawlservpp::Data::Compression::Zip::compress(), operator=(), and ~ZipArchive().
|
inline |
Closes the underlying archive and dumps its contents.
| dumpTo | Reference to a string into which the contents of the archive will be written. |
References close(), crawlservpp::Wrapper::ZipSource::get(), and crawlservpp::Wrapper::ZipSource::valid().
|
noexcept |
Gets a pointer to the underlying archive.
nullptr if none is set.
|
noexcept |
Gets a const pointer to the underlying archive.
nullptr if none is set.
|
inline |
Get the last occurred error as string.
Referenced by crawlservpp::Data::Compression::Zip::compress().
|
delete |
Deleted copy assignment operator.
|
inlinenoexcept |
Move assignment operator.
Moves the archive from the specified location into this instance of the class.
| other | The archive to move from. |
*this).References close().
|
inlinenoexcept |
Checks whether the underlying archive is valid.
Referenced by crawlservpp::Data::Compression::Zip::compress().