26 #include <boost/locale.hpp>
39 using namespace boost::locale;
53 const std::filesystem::path& baseDir) :
XMLParser(),
54 readerHandler(xcksReaderHandler),
55 baseDirectory(baseDir)
57 assert(baseDir.is_absolute());
72 if (name ==
"checksumsFile")
75 if (atts.getValue(
"version", xcksVer))
77 if (xcksVer ==
"1.0.0")
80 setVersionHandler(handler);
81 readerHandler.onChecksumsFile(xcksVer);
92 getVersionHandler()->startElement(name, atts);
107 if (name !=
"checksumsFile")
112 getVersionHandler()->endElement(name);
132 getVersionHandler()->characters(chars);
147 if (getVersionHandler() !=
nullptr)
148 getVersionHandler()->fatalError(errorCode, errorMessage, line, column);
150 readerHandler.onFatalError(errorMessage, line, column);
178 this->
versionHandler = shared_ptr<XMLParserDefaultHandler>(handler);
XCKS file version 1 handler.
void characters(const std::string &chars) noexcept(false) override
Receives notification of character data.
void endElement(const std::string &name) noexcept(false) override
Receives notification of the end of an element.
void setVersionHandler(XMLParserDefaultHandler *handler)
Sets the handler to parse the sums' file.
XMLParserDefaultHandler * getVersionHandler() const
Gets the handler to parse the sums' file.
void startElement(const std::string &name, const XMLParserAttributes &atts) noexcept(false) override
Receives notification of the beginning of an element.
void fatalError(XML_Error errorCode, const std::string &errorMessage, int line, int column) noexcept override
Receive notification of a non-recoverable error.
std::shared_ptr< XMLParserDefaultHandler > versionHandler
The handler for the version of the file.
Handler for reading XCKS files.
Manages elements' attributes.
Default XML parser handler.
An exception class for the XML parser.
A very simple XML parser.
Common definitions for libxcks.
constexpr const char * libxcks_domain
Domain for translations (i18n).
std::string trim_copy(std::string s)
Trim from both ends (copying).
LIBXCKS_SO_EXPORT const std::string getLibraryName()
Gets the name of the library.
Classes that read a XCKS file.
Classes that read a XCKS file version 1.