libxcks  0.1.0.1
libxcks::XCKSFileReader Class Referencefinal

XCKS file parser. More...

#include <xcksfilereader.hpp>

Inheritance diagram for libxcks::XCKSFileReader:
Collaboration diagram for libxcks::XCKSFileReader:

Public Member Functions

 XCKSFileReader ()=delete
 Deleted default constructor. More...
 
 XCKSFileReader (XCKSReaderHandler &handler, const std::filesystem::path &baseDir)
 Constructor. More...
 
void startElement (const std::string &name, const XMLParserAttributes &atts) noexcept(false) override
 Receives notification of the beginning of an element. More...
 
void endElement (const std::string &name) noexcept(false) override
 Receives notification of the end of an element. More...
 
void characters (const std::string &chars) noexcept(false) override
 Receives notification of character data. More...
 
void fatalError (XML_Error errorCode, const std::string &errorMessage, int line, int column) noexcept override
 Receive notification of a non-recoverable error. More...
 
- Public Member Functions inherited from libxcks::XMLParser
bool parse (const std::string &filename)
 Parses the given file. More...
 
bool parse (std::istream &is)
 Parses the given input stream. More...
 

Protected Member Functions

XMLParserDefaultHandlergetVersionHandler () const
 Gets the handler to parse the sums' file. More...
 
void setVersionHandler (XMLParserDefaultHandler *handler)
 Sets the handler to parse the sums' file. More...
 
- Protected Member Functions inherited from libxcks::XMLParser
 XMLParser ()
 Default constructor. More...
 
virtual ~XMLParser ()
 Destructor. More...
 
bool initParser ()
 Initializes the parser for parsing a new document. More...
 
int getDepth () const
 Returns the current depth in XML tree structure. More...
 

Protected Attributes

XCKSReaderHandlerreaderHandler
 The XCKS file reader handler. More...
 
const std::filesystem::path baseDirectory
 The base directory of the checksums' file. More...
 
std::shared_ptr< XMLParserDefaultHandlerversionHandler
 The handler for the version of the file. More...
 

Detailed Description

XCKS file parser.

Definition at line 41 of file xcksfilereader.hpp.

Constructor & Destructor Documentation

◆ XCKSFileReader() [1/2]

libxcks::XCKSFileReader::XCKSFileReader ( )
delete

Deleted default constructor.

◆ XCKSFileReader() [2/2]

libxcks::XCKSFileReader::XCKSFileReader ( XCKSReaderHandler xcksReaderHandler,
const std::filesystem::path &  baseDir 
)

Constructor.

Parameters
xcksReaderHandlerThe XCKS file reader handler.
baseDirThe base directory of the (Z)XCKS file to read. Must be an absolute path name.

Definition at line 52 of file xcksfilereader.cpp.

Member Function Documentation

◆ characters()

void libxcks::XCKSFileReader::characters ( const std::string &  chars)
overridevirtualnoexcept

Receives notification of character data.

Parameters
charsThe characters from the XML document.

Reimplemented from libxcks::XMLParser.

Definition at line 123 of file xcksfilereader.cpp.

◆ endElement()

void libxcks::XCKSFileReader::endElement ( const std::string &  name)
overridevirtualnoexcept

Receives notification of the end of an element.

Parameters
nameThe name of the element.

Reimplemented from libxcks::XMLParser.

Definition at line 103 of file xcksfilereader.cpp.

◆ fatalError()

void libxcks::XCKSFileReader::fatalError ( XML_Error  errorCode,
const std::string &  errorMessage,
int  line,
int  column 
)
overridevirtualnoexcept

Receive notification of a non-recoverable error.

Parameters
errorCodeThe error code.
errorMessageThe error message.
lineThe line number the text where the error has occurred.
columnThe column number where the error has occurred.

Reimplemented from libxcks::XMLParser.

Definition at line 145 of file xcksfilereader.cpp.

◆ getVersionHandler()

XMLParserDefaultHandler * libxcks::XCKSFileReader::getVersionHandler ( ) const
protected

Gets the handler to parse the sums' file.

Attention
The returned pointer is managed by std::shared_ptr.
Note
This method must be only used as a comfort method to access to the pointed instance.
Returns
The handler to parse the sums' file.

Definition at line 164 of file xcksfilereader.cpp.

◆ setVersionHandler()

void libxcks::XCKSFileReader::setVersionHandler ( XMLParserDefaultHandler handler)
protected

Sets the handler to parse the sums' file.

Parameters
[in]handlerThe handler to parse the sums' file.

Definition at line 176 of file xcksfilereader.cpp.

◆ startElement()

void libxcks::XCKSFileReader::startElement ( const std::string &  name,
const XMLParserAttributes atts 
)
overridevirtualnoexcept

Receives notification of the beginning of an element.

Parameters
nameThe name of the element.
attsThe attributes attached to the element.

Reimplemented from libxcks::XMLParser.

Definition at line 68 of file xcksfilereader.cpp.

Member Data Documentation

◆ baseDirectory

const std::filesystem::path libxcks::XCKSFileReader::baseDirectory
protected

The base directory of the checksums' file.

Definition at line 45 of file xcksfilereader.hpp.

◆ readerHandler

XCKSReaderHandler& libxcks::XCKSFileReader::readerHandler
protected

The XCKS file reader handler.

Definition at line 44 of file xcksfilereader.hpp.

◆ versionHandler

std::shared_ptr<XMLParserDefaultHandler> libxcks::XCKSFileReader::versionHandler
protected

The handler for the version of the file.

Definition at line 46 of file xcksfilereader.hpp.


The documentation for this class was generated from the following files: