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

The ODTParser class. More...

#include <ODTParser.h>

Inheritance diagram for ODTParser:
XMLParser LibArchive

Public Member Functions

 ODTParser (const std::shared_ptr< AuxFunc > &af)
 ODTParser constructor.
 
virtual ~ODTParser ()
 ODTParser destructor.
 
BookParseEntry odtParser (const std::filesystem::path &odt_path)
 Parses odt files.
 
std::shared_ptr< BookInfoEntryodtBookInfo (const std::filesystem::path &odt_path)
 Gets some extra info from odt files.
 
- Public Member Functions inherited from XMLParser
 XMLParser (const std::shared_ptr< AuxFunc > &af)
 XMLParser constructor.
 
std::vector< XMLTagget_tag (const std::string &book, const std::string &tag_id)
 Returns all tags with particular name.
 
std::string get_book_encoding (const std::string &book)
 Returns XML document encoding.
 
std::string get_element_attribute (const std::string &element, const std::string &attr_name)
 Returns XML tag attribute if it was found.
 
std::vector< XMLTaglistAllTags (const std::string &book)
 Parses XML document.
 
void searchTag (const std::vector< XMLTag > &list, const std::string &tag_id, std::vector< XMLTag > &result)
 Searches tag in tag list.
 
void htmlSymbolsReplacement (std::string &book)
 Replaces symbols encoded by "&..." sequences.
 
void removeAllTags (std::string &book)
 Removes all tag elements from XML document.
 
- Public Member Functions inherited from LibArchive
 LibArchive (const std::shared_ptr< AuxFunc > &af)
 LibArchive constructor.
 
std::filesystem::path unpackByPosition (const std::filesystem::path &archaddress, const std::filesystem::path &outfolder, const ArchEntry &entry)
 Unpacks single entry content from zip archive.
 
std::string unpackByPositionStr (const std::filesystem::path &archaddress, const ArchEntry &entry)
 Unpacks single entry content from zip archive.
 
std::filesystem::path unpackByFileNameStream (const std::filesystem::path &archaddress, const std::filesystem::path &outfolder, const std::string &filename)
 Unpacks entry content from archive.
 
std::string unpackByFileNameStreamStr (const std::filesystem::path &archaddress, const std::string &filename)
 Unpacks entry content from archive.
 
int fileNames (const std::filesystem::path &filepath, std::vector< ArchEntry > &filenames)
 Lists all entries in archive file.
 
int fileNamesStream (const std::filesystem::path &address, std::vector< ArchEntry > &filenames)
 Lists all entries in archive file.
 
ArchEntry fileinfo (const std::filesystem::path &address, const std::string &filename)
 Returns ArchEntry for particular file or directory in archive.
 
int libarchive_packing (const std::filesystem::path &sourcepath, const std::filesystem::path &outpath)
 Packs file or directory into archive.
 
int libarchive_packing (const std::shared_ptr< archive > &a, const std::filesystem::path &sourcepath, const bool &rename_source, const std::string &new_source_name)
 Packs file or directory into archive.
 
ArchiveRemoveEntry libarchive_remove_init (const std::filesystem::path &sourcepath, const std::filesystem::path &outpath)
 Initializes archive objects for removing entries from archive.
 
int libarchive_remove_entry (ArchiveRemoveEntry rm_e, const std::vector< ArchEntry > &to_remove)
 Removes entry from archive.
 
void libarchive_error (const std::shared_ptr< archive > &a, const std::string &message, const int &error_number)
 Prints libarchive error messages.
 
std::string libarchive_read_entry_str (archive *a, archive_entry *entry)
 Reads archived file to stirng.
 
int libarchive_write_data (archive *a, const std::string &data)
 Writes data to archive.
 
std::shared_ptr< ArchiveFileEntrycreateArchFile (const std::filesystem::path &archaddress, const la_int64_t &position=la_int64_t(0))
 Creates ArchiveFileEntry object.
 
std::shared_ptr< archive > libarchive_read_init (std::shared_ptr< ArchiveFileEntry > fl)
 Initializes archive reading.
 
std::shared_ptr< archive > libarchive_read_init_fallback (std::shared_ptr< ArchiveFileEntry > fl)
 Initializes archive reading.
 
std::filesystem::path libarchive_read_entry (archive *a, archive_entry *entry, const std::filesystem::path &outfolder)
 Unpacks libarchive entry content.
 
std::shared_ptr< archive > libarchive_write_init (const std::filesystem::path &outpath)
 Initializes writing to archive.
 
int writeToArchive (std::shared_ptr< archive > a, const std::filesystem::path &source, const std::filesystem::path &path_in_arch)
 Writes file or directory to archive.
 
int libarchive_write_directory (archive *a, archive_entry *entry, const std::filesystem::path &path_in_arch, const std::filesystem::path &source)
 Writes directory to archive.
 
int libarchive_write_file (archive *a, archive_entry *entry, const std::filesystem::path &path_in_arch, const std::filesystem::path &source)
 Writes file to archive.
 
int libarchive_write_data_from_file (archive *a, const std::filesystem::path &source)
 Writes raw data from file to archive.
 

Detailed Description

The ODTParser class.

This class contains methods for odt files processing. In most cases you do not need to use this class directly. Use CreateCollection, RefreshCollection and BookInfo instead.

Constructor & Destructor Documentation

◆ ODTParser()

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

ODTParser constructor.

Parameters
afsmart pointer to AuxFunc object.

Member Function Documentation

◆ odtBookInfo()

std::shared_ptr< BookInfoEntry > ODTParser::odtBookInfo ( const std::filesystem::path & odt_path)

Gets some extra info from odt files.

This method can be used to obtain odt file cover and some other info (see BookInfoEntry) if such info is avaliable.

Note
This method can throw MLException in case of some errors.
Parameters
odt_pathabsolute path to odt file.
Returns
Smart pointer to BookInfoEntry object.

◆ odtParser()

BookParseEntry ODTParser::odtParser ( const std::filesystem::path & odt_path)

Parses odt files.

This method can be used to obtain information from odt files.

Note
This method can throw MLException in case of some errors.
Parameters
odt_pathabsolute path to odt file.
Returns
BookParseEntry object.