1#ifndef CPP_UTILITIES_ARCHIVE_H
2#define CPP_UTILITIES_ARCHIVE_H
32 :
std::runtime_error("unable to convert")
40 : std::runtime_error(what.data())
57 , creationTime(creationTime)
58 , modificationTime(modificationTime)
70using FileMap = std::map<std::string, std::vector<ArchiveFile>>;
72using FilePredicate = std::function<bool(
const char *,
const char *, mode_t)>;
The ArchiveException class is thrown by the various archiving-related functions of this library when ...
ArchiveException() noexcept
Constructs a new ArchiveException.
Represents an instant in time, typically expressed as a date and time of day.
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
Contains all utilities provides by the c++utilities library.
CPP_UTILITIES_EXPORT void walkThroughArchiveFromBuffer(std::string_view archiveData, std::string_view archiveName, const FilePredicate &isFileRelevant=FilePredicate(), FileHandler &&fileHandler=FileHandler(), DirectoryHandler &&directoryHandler=DirectoryHandler())
Invokes callbacks for files and directories in the specified archive.
CPP_UTILITIES_EXPORT FileMap extractFilesFromBuffer(std::string_view archiveData, std::string_view archiveName, const FilePredicate &isFileRelevant=FilePredicate())
Extracts the specified archive.
CPP_UTILITIES_EXPORT void walkThroughArchive(std::string_view archivePath, const FilePredicate &isFileRelevant=FilePredicate(), FileHandler &&fileHandler=FileHandler(), DirectoryHandler &&directoryHandler=DirectoryHandler())
Invokes callbacks for files and directories in the specified archive.
ArchiveFileType
The ArchiveFileType enum specifies the type of a file within an archive.
std::function< bool(const char *, const char *, mode_t)> FilePredicate
A function that is invoked for each file within an archive. If it returns true, the file is considere...
CPP_UTILITIES_EXPORT FileMap extractFiles(std::string_view archivePath, const FilePredicate &isFileRelevant=FilePredicate())
Extracts the specified archive.
std::function< bool(std::string_view path)> DirectoryHandler
A function that is invoked by the walk-through-functions to return a directory.
std::map< std::string, std::vector< ArchiveFile > > FileMap
A map of files extracted from an archive. Keys represent directories and values files within those di...
std::function< bool(std::string_view path, ArchiveFile &&file)> FileHandler
A function that is invoked by the walk-through-functions to return a file.
The ArchiveFile class holds data about a file within an archive.
CppUtilities::DateTime modificationTime
CppUtilities::DateTime creationTime
ArchiveFile(std::string &&name, std::string &&content, ArchiveFileType type, CppUtilities::DateTime creationTime, CppUtilities::DateTime modificationTime)