21#include <GenreGroup.h>
22#include <MLException.h>
26#include <libdjvu/ddjvuapi.h>
94 to_utf_8(
const std::string &input,
const char *conv_name);
114 utf_8_to(
const std::string &input,
const char *conv_name);
139 std::filesystem::path
146 std::filesystem::path
153 std::filesystem::path
164 std::filesystem::path
175 std::vector<GenreGroup>
290 const std::filesystem::path &out);
297 std::vector<std::string>
305 std::vector<std::string>
313 std::vector<std::string>
359 template <
class InputIt,
360 class T =
typename std::iterator_traits<InputIt>::value_type>
362 parallelFind(InputIt start, InputIt end,
const T &val)
365 const T *val_ptr = &val;
369 for(InputIt i = start; i != end; i++)
380#pragma omp cancel for
401 template <
class InputIt,
class UnaryPred>
403 parallelFindIf(InputIt start, InputIt end, UnaryPred predicate)
409 for(InputIt i = start; i != end; i++)
420#pragma omp cancel for
443 template <
class InputIt,
444 class T =
typename std::iterator_traits<InputIt>::value_type>
446 parallelRemove(InputIt start, InputIt end,
const T &val)
448 start = parallelFind(start, end, val);
454#pragma omp for ordered
455 for(T *i = s + 1; i != e; i++)
461 *s = std::move((*i));
486 template <
class InputIt,
class UnaryPred,
487 class T =
typename std::iterator_traits<InputIt>::value_type>
489 parallelRemoveIf(InputIt start, InputIt end, UnaryPred predicate)
491 start = parallelFindIf(start, end, predicate);
497#pragma omp for ordered
498 for(T *i = s + 1; i != e; i++)
523 static std::shared_ptr<AuxFunc>
560 std::tuple<std::shared_ptr<ddjvu_context_t>, std::shared_ptr<int>>
566 std::vector<std::tuple<std::string, Genre>>
567 read_genres(
const bool &wrong_loc,
const std::string &locname);
569 std::vector<GenreGroup>
570 read_genre_groups(
const bool &wrong_loc,
const std::string &locname);
573 djvuMessageCallback(ddjvu_context_t *context,
void *closure);
575 bool activated =
true;
577 std::mt19937_64 *rng;
578 std::uniform_int_distribution<uint64_t> *dist;
580 std::weak_ptr<ddjvu_context_t> djvu_context;
582 omp_lock_t djvu_context_mtx;
584 std::mutex djvu_context_mtx;
586 std::vector<std::weak_ptr<int>> djvu_pipes;
std::vector< std::string > get_supported_archive_types_unpacking()
Same as get_supported_types(), but returns only archives types, available for unpacking.
std::filesystem::path get_selfpath()
Returns absolute path to program executable file.
std::string time_t_to_date(const time_t &tt)
Converts time_t value to calendar date.
std::filesystem::path homePath()
Returns user home directory path.
std::vector< std::string > get_supported_archive_types_packing()
Same as get_supported_types(), but returns only archives types, available for packing.
std::string detect_encoding(const std::string &buf)
Tries to detect string encoding.
std::string utf8_to_system(const std::string &input)
Converts UTF-8 string to string in system default encoding.
bool get_activated()
Checks if depencies have been successfully activated.
std::string to_utf_8(const std::string &input, const char *conv_name)
Converts string to UTF-8 string.
std::string randomFileName()
Returns random string.
std::vector< std::string > get_supported_types()
Returns supported file types.
bool ifSupportedArchivePackingType(const std::filesystem::path &ch_p)
Checks if given archive is supported by MLBookProc for packing.
void open_book_callback(const std::filesystem::path &path)
Opens given file in default system application.
static std::shared_ptr< AuxFunc > create()
Creats AuxFunc object.
void html_to_utf8(std::string &input)
Converst 'html' symbols to UTF-8 characters.
std::string utf_8_to(const std::string &input, const char *conv_name)
Converts UTF-8 string to string in chosen encoding.
std::tuple< std::shared_ptr< ddjvu_context_t >, std::shared_ptr< int > > getDJVUContext()
Returns tuple with smart pointer to djvu context object and smart pointer to djvu context signal pipe...
virtual ~AuxFunc()
AuxFunc destructor.
const char * get_converter_by_number(const int32_t &num)
Returns converter name.
std::string get_extension(const std::filesystem::path &p)
Returns file extesion.
void copy_book_callback(const std::filesystem::path &source, const std::filesystem::path &out)
Replaces out file by source file.
std::string to_hex(const std::string &source)
Converts given string to hex format.
bool if_supported_type(const std::filesystem::path &ch_p)
Checks if given file is supported by MLBookProc.
std::filesystem::path temp_path()
Returns absolute path to system temporary directory.
std::vector< GenreGroup > get_genre_list()
Returns translated genre groups and genres names.
std::filesystem::path share_path()
Returns absolute path to share directory, used by MLBookProc.
std::string libgcrypt_error_handling(const gcry_error_t &err)
Auxiliary method to reinterpret libgcrypt errors as strings.
int32_t get_charset_conv_quantity()
Returns number of available converters.
std::string stringToLower(const std::string &line)
Converts all letters of the string to lowercase letters.
bool ifSupportedArchiveUnpackaingType(const std::filesystem::path &ch_p)
Checks if given archive is supported by MLBookProc.