MLBookProc 1.1
 
Loading...
Searching...
No Matches
OpenBook Class Reference

The OpenBook class. More...

#include <OpenBook.h>

Public Member Functions

 OpenBook (const std::shared_ptr< AuxFunc > &af)
 OpenBook constructor.
 
std::filesystem::path open_book (const BookBaseEntry &bbe, const bool &copy, const std::filesystem::path &copy_path, const bool &find_fbd, std::function< void(const std::filesystem::path &path)> open_callback)
 Opens book.
 

Detailed Description

The OpenBook class.

This class contains methods for books "opening".

Constructor & Destructor Documentation

◆ OpenBook()

OpenBook::OpenBook ( const std::shared_ptr< AuxFunc > & af)

OpenBook constructor.

Parameters
afsmart pointer to AuxFunc object.

Member Function Documentation

◆ open_book()

std::filesystem::path OpenBook::open_book ( const BookBaseEntry & bbe,
const bool & copy,
const std::filesystem::path & copy_path,
const bool & find_fbd,
std::function< void(const std::filesystem::path &path)> open_callback )

Opens book.

If book is in archive, unpacks book and returns absolute path to unpacked file. Otherwise returns absolute path to book file.

If copy is set to true and copy_path is not empty, creates directory on copy_path and copies book to it.

If find_fbd is set to true, will try to find and open fbd file instead of book.

If open_callback is not nullptr, calls it.

Note
This method can throw MLException in case of errors.
Parameters
bbeBookBaseEntry object.
copyif set to true, copy of book file will be created.
copy_pathabsolute path to directory book to be copied to.
find_fbdif set to true, this method will try to find and open fbd file instead of book.
open_callbackmethod to be called at the end of all operations. path argument is an absolute path to method work result.
Returns
Absolute path to book to be opened.