MLBookProc 2.1
Loading...
Searching...
No Matches
MLBookProc Class Reference

The MLBookProc class. More...

#include <MLBookProc.h>

Public Member Functions

 MLBookProc (const MLBookProc &)=delete
 MLBookProc (MLBookProc &&)=delete
MLBookProc & operator= (const MLBookProc &)=delete
MLBookProc & operator= (MLBookProc &&)=delete
std::string stringToLower (const std::string &str)
std::string getExtension (const std::filesystem::path &p)
std::string getExtension (const std::string &file_name)
std::vector< std::string > getSupportedFileTypes ()
std::vector< std::string > getSupportedArchivesTypesUnpacking ()
std::vector< std::string > getSupportedArchivesTypesPacking ()
bool ifSupportedFile (const std::string &filename)
bool ifSupportedFile (const std::filesystem::path &p)
void libgcryptErrorHandling (const gcry_error_t &err)
template<typename T>
T randomNumber ()
std::filesystem::path tempDirPath ()
std::filesystem::path randomFileName ()
std::string timeToDate (const time_t &tt)
std::shared_ptr< DJVUContext > getDJVUContext ()

Static Public Member Functions

static std::shared_ptr< MLBookProc > create ()

Detailed Description

The MLBookProc class.

This class contains various auxiliary methods. It should be created before any other MLBookProc library objects.

Warning
Only one MLBookProc object per application is allowed, otherwise behavior is undefined.

Member Function Documentation

◆ create()

std::shared_ptr< MLBookProc > MLBookProc::create ( )
static

Creates MLBookProc object and retunrs smart pointer to it.

Returns
Smart pointer to MLBookProc object.

◆ getDJVUContext()

std::shared_ptr< DJVUContext > MLBookProc::getDJVUContext ( )

Creates DJVUContext object.

Returns
Smart pointer to DJVUContext object.

◆ getExtension() [1/2]

std::string MLBookProc::getExtension ( const std::filesystem::path & p)

Returns string, containing file extensinon (looks like .ext).

Parameters
pPath to file, extension of which should be obtained.
Returns
UTF-8 string, containing extension.

◆ getExtension() [2/2]

std::string MLBookProc::getExtension ( const std::string & file_name)

Returns string, containing file extensinon (looks like .ext).

Parameters
file_namePath to file, extension of which should be obtained.
Returns
UTF-8 string, containing extension.

◆ getSupportedArchivesTypesPacking()

std::vector< std::string > MLBookProc::getSupportedArchivesTypesPacking ( )

Returns vector, containing archive formats (UTF-8 strings, looks like zip or tar.gz) for which unpacking is supported.

Returns
Vector of UTF-8 strings.

◆ getSupportedArchivesTypesUnpacking()

std::vector< std::string > MLBookProc::getSupportedArchivesTypesUnpacking ( )

Returns vector, containing archive formats (UTF-8 strings, looks like zip or tar.gz) for which packing is supported.

Returns
Vector of UTF-8 strings.

◆ getSupportedFileTypes()

std::vector< std::string > MLBookProc::getSupportedFileTypes ( )

Returns vector, containing supported file formats (UTF-8 strings, looks like fbd or zip).

Returns
Vector of UTF-8 strings.

◆ ifSupportedFile() [1/2]

bool MLBookProc::ifSupportedFile ( const std::filesystem::path & p)

Checks if given file is supported.

Parameters
pPath to file or file name.
Returns
true if file is supported, false otherwise.

◆ ifSupportedFile() [2/2]

bool MLBookProc::ifSupportedFile ( const std::string & filename)

Checks if given file is supported.

Parameters
filenamePath to file or file name.
Returns
true if file is supported, false otherwise.

◆ libgcryptErrorHandling()

void MLBookProc::libgcryptErrorHandling ( const gcry_error_t & err)

Auxiliary method for libgcrypt error handling. It throws std::exception in all cases.

Parameters
errlibgcrypt error type.

◆ randomFileName()

std::filesystem::path MLBookProc::randomFileName ( )

Returns random file name.

Returns
Random file name.

◆ randomNumber()

template<typename T>
T MLBookProc::randomNumber ( )

Returns random number. Supported types: int64_t, int32_t, int16_t, int8_t, uint64_t, uint32_t, uint16_t, uint8_t.

Returns

◆ stringToLower()

std::string MLBookProc::stringToLower ( const std::string & str)

Converts all letters in the string to lowercase letters.

Parameters
strUTF-8 string to be converted.
Returns
UTF-8 lowercase string.

◆ tempDirPath()

std::filesystem::path MLBookProc::tempDirPath ( )

Returns absolute path to system temporary directory.

Returns
Absolute path to system temporary directory.

◆ timeToDate()

std::string MLBookProc::timeToDate ( const time_t & tt)

Converts time_t object to date string representation (looks like 01.01.2026).

Parameters
tttime_t object to be converted.
Returns
UTF-8 string, containing date.