crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Data::Compression::Zip Namespace Reference

Namespace for compressing and decompressing zip. More...

Classes

class  Exception
 Class for zip exceptions. More...
 

Typedefs

using StringString = std::pair< std::string, std::string >
 A pair of strings. More...
 

Compression and Decompression

std::string compress (const std::vector< StringString > &fileContents)
 Compresses files using zip. More...
 
std::vector< StringStringdecompress (const std::string &compressed)
 Decompresses zip-compressed content. More...
 

Detailed Description

Namespace for compressing and decompressing zip.

Typedef Documentation

◆ StringString

using crawlservpp::Data::Compression::Zip::StringString = typedef std::pair<std::string, std::string>

A pair of strings.

Function Documentation

◆ compress()

std::string crawlservpp::Data::Compression::Zip::compress ( const std::vector< StringString > &  fileContents)
inline

Compresses files using zip.

Parameters
fileContentsA const reference to a vector containing pairs of strings containing the file names and contents of all the files to be compressed.
Returns
The zip-compressed content as string.
Exceptions
Zip::Exceptionif the libzip library generates an error.

References crawlservpp::Wrapper::ZipArchive::addFile(), crawlservpp::Wrapper::ZipArchive::close(), crawlservpp::Wrapper::ZipArchive::getError(), and crawlservpp::Wrapper::ZipArchive::valid().

Referenced by crawlservpp::Data::ImportExport::OpenDocument::exportSpreadsheet(), and crawlservpp::Main::Server::tick().

◆ decompress()

std::vector< StringString > crawlservpp::Data::Compression::Zip::decompress ( const std::string &  compressed)
inline

Decompresses zip-compressed content.

Parameters
compressedA const reference to the zip-compressed content to be decompressed.
Returns
The decompressed files as pairs of strings containing their names and their contents, or an empty pair if the given content is empty.
Exceptions
Zip::Exceptionif the libzip library generates an error.
Todo:
Not implemented yet.