NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
Archive Namespace Reference

Enumerations

enum  Type {
  ARCHIVE_AUTO , ARCHIVE_TAR , ARCHIVE_GZ , ARCHIVE_ZLIB ,
  ARCHIVE_ZIP , ARCHIVE_NONE
}
 

Functions

Type detectType (const std::string &sArchiveFileName)
 Detects the type of the archive based upon the magic numbers in their header sections or upon the file names extension, if the file does not yet exist. More...
 
static std::string getGZipFileName (const std::string &sArchiveFileName)
 Static helper function to read a possible available file name in the GZIP header section. More...
 
void pack (const std::vector< std::string > &vFileList, const std::string &sTargetFile, Type type)
 Pack a set of files or folders into an archive file type with the specified file name. If the type of the archive is not specified then its automatically detected based upon the file extension or from an already existing file at the specified location. More...
 
std::vector< std::string > unpack (const std::string &sArchiveName, const std::string &sTargetPath)
 Unpacks an archive file format into its folder structure at the specified location. The archive file type is detected automatically. If no target is specified then only the names of the contained files are returned. More...
 

Enumeration Type Documentation

◆ Type

Enumerator
ARCHIVE_AUTO 
ARCHIVE_TAR 
ARCHIVE_GZ 
ARCHIVE_ZLIB 
ARCHIVE_ZIP 
ARCHIVE_NONE 

Definition at line 27 of file archive.hpp.

Function Documentation

◆ detectType()

Type Archive::detectType ( const std::string &  sArchiveFileName)

Detects the type of the archive based upon the magic numbers in their header sections or upon the file names extension, if the file does not yet exist.

Parameters
sArchiveFileNameconst std::string&
Returns
Type

Definition at line 48 of file archive.cpp.

References ARCHIVE_GZ, ARCHIVE_NONE, ARCHIVE_TAR, ARCHIVE_ZIP, ARCHIVE_ZLIB, DetachedLogger::debug(), g_logger, and toLowerCase().

Referenced by pack(), and unpack().

Here is the call graph for this function:

◆ getGZipFileName()

static std::string Archive::getGZipFileName ( const std::string &  sArchiveFileName)
static

Static helper function to read a possible available file name in the GZIP header section.

Parameters
sArchiveFileNameconst std::string&
Returns
std::string

Definition at line 109 of file archive.cpp.

Referenced by unpack().

◆ pack()

void Archive::pack ( const std::vector< std::string > &  vFileList,
const std::string &  sTargetFile,
Type  type 
)

Pack a set of files or folders into an archive file type with the specified file name. If the type of the archive is not specified then its automatically detected based upon the file extension or from an already existing file at the specified location.

Parameters
vFileListconst std::vector<std::string>&
sTargetFileconst std::string&
typeType
Returns
void

Definition at line 168 of file archive.cpp.

References ARCHIVE_AUTO, ARCHIVE_GZ, ARCHIVE_NONE, ARCHIVE_TAR, ARCHIVE_ZIP, DetachedLogger::debug(), detectType(), fileExists(), g_logger, getFileList(), getFolderList(), NumeReKernel::getInstance(), NumeReKernel::getSettings(), SyntaxError::INVALID_FILETYPE, and pack().

Referenced by cmd_pack(), and pack().

Here is the call graph for this function:

◆ unpack()

std::vector< std::string > Archive::unpack ( const std::string &  sArchiveName,
const std::string &  sTargetPath 
)

Unpacks an archive file format into its folder structure at the specified location. The archive file type is detected automatically. If no target is specified then only the names of the contained files are returned.

Parameters
sArchiveNameconst std::string&
sTargetPathconst std::string&
Returns
std::vector<std::string>

Definition at line 307 of file archive.cpp.

References ARCHIVE_GZ, ARCHIVE_NONE, ARCHIVE_TAR, ARCHIVE_ZIP, ARCHIVE_ZLIB, DetachedLogger::debug(), detectType(), SyntaxError::FILE_NOT_EXIST, fileExists(), g_logger, NumeReKernel::getFileSystem(), getGZipFileName(), NumeReKernel::getInstance(), SyntaxError::INVALID_FILETYPE, replacePathSeparator(), and FileSystem::ValidizeAndPrepareName().

Referenced by cmd_unpack().

Here is the call graph for this function: