libxcks  0.1.0.1
libxcks::XCKS1FileHandler Class Referencefinal

XCKS file version 1 handler. More...

#include <xcksfilereader_1.hpp>

Inheritance diagram for libxcks::XCKS1FileHandler:
Collaboration diagram for libxcks::XCKS1FileHandler:

Public Member Functions

 XCKS1FileHandler ()=delete
 Deleted default constructor. More...
 
 XCKS1FileHandler (const XCKS1FileHandler &)=delete
 Deleted copy constructor. More...
 
XCKS1FileHandleroperator= (const XCKS1FileHandler &)=delete
 Deleted copy assignment operator. More...
 
 XCKS1FileHandler (XCKSReaderHandler &handler, const std::filesystem::path &baseDir)
 Constructor. More...
 
virtual ~XCKS1FileHandler ()
 Destructor. 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::XMLParserDefaultHandler
 XMLParserDefaultHandler ()
 Default constructor. More...
 
 XMLParserDefaultHandler (const XMLParserDefaultHandler &)=delete
 Deleted copy constructor. More...
 
XMLParserDefaultHandleroperator= (const XMLParserDefaultHandler &)=delete
 Deleted copy assignment operator. More...
 
virtual ~XMLParserDefaultHandler ()
 Destructor. More...
 

Protected Types

enum class  XMLTags : int16_t {
  BAD_TAG = INT16_MIN , SEQ_BEGIN = INT16_MIN / 2 , CHECKSUMSFILE = 0x001 , GENERATED = 0x100 ,
  ALGORITHMS = 0x300 , ALGORITHM = 0x201 , LOCALFILES = 0x500 , PARENTDIRECTORY = 0x510 ,
  DIRECTORY = 0x520 , FILE = 0x530 , INFORMATION = 0x531 , CHECKSUM = 0x532
}
 Known XML tags. More...
 

Protected Member Functions

XMLTags stringToXMLTags (const std::string &str)
 Gets a XML tag identifier from a string. More...
 
void startGeneratedElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "generated" element. More...
 
void startAlgorithmsElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "algorithms" element. More...
 
void startAlgorithmElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "algorithm" element. More...
 
void startLocalFilesElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "localFiles" element. More...
 
void startParentDirectoryElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "parentDirectory" element. More...
 
void startDirectoryElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "directory" element. More...
 
void startFileElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "file" element. More...
 
void startInformationElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "information" element. More...
 
void startChecksumElement (const XMLParserAttributes &atts) noexcept(false)
 Receives notification of the beginning of a "checksum" element. More...
 
void endFileElement () noexcept(false)
 Receives notification of the end of a "file" element. More...
 

Protected Attributes

XCKSReaderHandlerreaderHandler
 The XCKS file reader handler. More...
 
const std::filesystem::path baseDirectory
 The base directory of the checksums' file. More...
 
const std::vector< std::filesystem::path > baseDirectoryDirs
 The base directory of the checksums' file directories. More...
 
ssize_t curBaseDirectoryDir
 Current directory in the base directory of the checksums' file name. More...
 
std::stack< XMLTagsreadTags
 Stack of read tags. More...
 
XMLTags tagInChecksumsFileTag
 Current tag in "checksumsFile" tag. More...
 
const StringSet possibleSumsAlgosName
 Possible algorithms names for a (Z)XCKS file. More...
 
ArrayChecksumAlgoId sumsAlgos
 Type of algorithms' checksums to read for each file. More...
 
ArrayString currentRelativeDirectory
 The current relative directory. More...
 
std::stack< StringSetnamesInDirectories
 Read filenames in directories. More...
 
std::string fileName
 Name of checksums' file. More...
 
XMLTags tagInFileTag
 Information tag seen inside a file tag. More...
 
uintmax_t fileLength
 The current file size. More...
 
time_t lastFileModicationTime
 The current last file modification time. More...
 
ArrayChecksumAlgoId algosToRead
 Remaining algorithms to read for a file. More...
 
ArrayChecksumValue readChecksumsValues
 Read checksums values. More...
 

Static Protected Attributes

static const std::string parentDir = ".."
 Parent directory on Unix and windows. More...
 

Detailed Description

XCKS file version 1 handler.

Definition at line 54 of file xcksfilereader_1.hpp.

Member Enumeration Documentation

◆ XMLTags

enum libxcks::XCKS1FileHandler::XMLTags : int16_t
strongprotected

Known XML tags.

Enumerator
BAD_TAG 

Bad or unknown tag.

SEQ_BEGIN 

Beginning of a sequence.

CHECKSUMSFILE 

checksumsFile element

GENERATED 

generated element

ALGORITHMS 

algorithms element

ALGORITHM 

algorithm element

LOCALFILES 

localFiles element

PARENTDIRECTORY 

parentDirectory element

DIRECTORY 

directory element

FILE 

file element

INFORMATION 

information element

CHECKSUM 

checksum element

Definition at line 58 of file xcksfilereader_1.hpp.

Constructor & Destructor Documentation

◆ XCKS1FileHandler() [1/3]

libxcks::XCKS1FileHandler::XCKS1FileHandler ( )
delete

Deleted default constructor.

◆ XCKS1FileHandler() [2/3]

libxcks::XCKS1FileHandler::XCKS1FileHandler ( const XCKS1FileHandler )
delete

Deleted copy constructor.

◆ XCKS1FileHandler() [3/3]

libxcks::XCKS1FileHandler::XCKS1FileHandler ( XCKSReaderHandler handler,
const std::filesystem::path &  baseDir 
)

Constructor.

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

Definition at line 93 of file xcksfilereader_1.cpp.

◆ ~XCKS1FileHandler()

libxcks::XCKS1FileHandler::~XCKS1FileHandler ( )
virtual

Destructor.

Definition at line 110 of file xcksfilereader_1.cpp.

Member Function Documentation

◆ characters()

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

Receives notification of character data.

Parameters
charsThe characters from the XML document.

Reimplemented from libxcks::XMLParserDefaultHandler.

Definition at line 821 of file xcksfilereader_1.cpp.

◆ endElement()

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

Receives notification of the end of an element.

Parameters
nameThe name of the element.

Reimplemented from libxcks::XMLParserDefaultHandler.

Definition at line 719 of file xcksfilereader_1.cpp.

◆ endFileElement()

void libxcks::XCKS1FileHandler::endFileElement ( )
inlineprotectednoexcept

Receives notification of the end of a "file" element.

Parameters
attsThe attributes attached to the element.

Definition at line 690 of file xcksfilereader_1.cpp.

◆ fatalError()

void libxcks::XCKS1FileHandler::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::XMLParserDefaultHandler.

Definition at line 838 of file xcksfilereader_1.cpp.

◆ operator=()

XCKS1FileHandler& libxcks::XCKS1FileHandler::operator= ( const XCKS1FileHandler )
delete

Deleted copy assignment operator.

◆ startAlgorithmElement()

void libxcks::XCKS1FileHandler::startAlgorithmElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "algorithm" element.

Parameters
attsThe attributes attached to the element.

Definition at line 236 of file xcksfilereader_1.cpp.

◆ startAlgorithmsElement()

void libxcks::XCKS1FileHandler::startAlgorithmsElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "algorithms" element.

Parameters
attsThe attributes attached to the element.

Definition at line 207 of file xcksfilereader_1.cpp.

◆ startChecksumElement()

void libxcks::XCKS1FileHandler::startChecksumElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "checksum" element.

Parameters
attsThe attributes attached to the element.

Definition at line 546 of file xcksfilereader_1.cpp.

◆ startDirectoryElement()

void libxcks::XCKS1FileHandler::startDirectoryElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "directory" element.

Parameters
attsThe attributes attached to the element.

Definition at line 371 of file xcksfilereader_1.cpp.

◆ startElement()

void libxcks::XCKS1FileHandler::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::XMLParserDefaultHandler.

Definition at line 637 of file xcksfilereader_1.cpp.

◆ startFileElement()

void libxcks::XCKS1FileHandler::startFileElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "file" element.

Parameters
attsThe attributes attached to the element.

Definition at line 427 of file xcksfilereader_1.cpp.

◆ startGeneratedElement()

void libxcks::XCKS1FileHandler::startGeneratedElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "generated" element.

Parameters
attsThe attributes attached to the element.
Todo:
Make a full ISO8601 parser

Definition at line 156 of file xcksfilereader_1.cpp.

◆ startInformationElement()

void libxcks::XCKS1FileHandler::startInformationElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "information" element.

Parameters
attsThe attributes attached to the element.
Todo:
Make a full ISO8601 parser

Definition at line 487 of file xcksfilereader_1.cpp.

◆ startLocalFilesElement()

void libxcks::XCKS1FileHandler::startLocalFilesElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "localFiles" element.

Parameters
attsThe attributes attached to the element.

Definition at line 294 of file xcksfilereader_1.cpp.

◆ startParentDirectoryElement()

void libxcks::XCKS1FileHandler::startParentDirectoryElement ( const XMLParserAttributes atts)
inlineprotectednoexcept

Receives notification of the beginning of a "parentDirectory" element.

Parameters
attsThe attributes attached to the element.

Definition at line 323 of file xcksfilereader_1.cpp.

◆ stringToXMLTags()

XCKS1FileHandler::XMLTags libxcks::XCKS1FileHandler::stringToXMLTags ( const std::string &  str)
protected

Gets a XML tag identifier from a string.

Parameters
strThe string.
Returns
The XML tag identifier corresponding to str content or BAD_TAG if str contains an unknown tag.

Definition at line 123 of file xcksfilereader_1.cpp.

Member Data Documentation

◆ algosToRead

ArrayChecksumAlgoId libxcks::XCKS1FileHandler::algosToRead
protected

Remaining algorithms to read for a file.

Definition at line 94 of file xcksfilereader_1.hpp.

◆ baseDirectory

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

The base directory of the checksums' file.

Definition at line 77 of file xcksfilereader_1.hpp.

◆ baseDirectoryDirs

const std::vector<std::filesystem::path> libxcks::XCKS1FileHandler::baseDirectoryDirs
protected

The base directory of the checksums' file directories.

Definition at line 78 of file xcksfilereader_1.hpp.

◆ curBaseDirectoryDir

ssize_t libxcks::XCKS1FileHandler::curBaseDirectoryDir
protected

Current directory in the base directory of the checksums' file name.

Definition at line 79 of file xcksfilereader_1.hpp.

◆ currentRelativeDirectory

ArrayString libxcks::XCKS1FileHandler::currentRelativeDirectory
protected

The current relative directory.

Definition at line 87 of file xcksfilereader_1.hpp.

◆ fileLength

uintmax_t libxcks::XCKS1FileHandler::fileLength
protected

The current file size.

Definition at line 92 of file xcksfilereader_1.hpp.

◆ fileName

std::string libxcks::XCKS1FileHandler::fileName
protected

Name of checksums' file.

Definition at line 90 of file xcksfilereader_1.hpp.

◆ lastFileModicationTime

time_t libxcks::XCKS1FileHandler::lastFileModicationTime
protected

The current last file modification time.

Definition at line 93 of file xcksfilereader_1.hpp.

◆ namesInDirectories

std::stack<StringSet> libxcks::XCKS1FileHandler::namesInDirectories
protected

Read filenames in directories.

Definition at line 88 of file xcksfilereader_1.hpp.

◆ parentDir

const string libxcks::XCKS1FileHandler::parentDir = ".."
staticprotected

Parent directory on Unix and windows.

Definition at line 74 of file xcksfilereader_1.hpp.

◆ possibleSumsAlgosName

const StringSet libxcks::XCKS1FileHandler::possibleSumsAlgosName
protected

Possible algorithms names for a (Z)XCKS file.

Definition at line 84 of file xcksfilereader_1.hpp.

◆ readChecksumsValues

ArrayChecksumValue libxcks::XCKS1FileHandler::readChecksumsValues
protected

Read checksums values.

Definition at line 95 of file xcksfilereader_1.hpp.

◆ readerHandler

XCKSReaderHandler& libxcks::XCKS1FileHandler::readerHandler
protected

The XCKS file reader handler.

Definition at line 76 of file xcksfilereader_1.hpp.

◆ readTags

std::stack<XMLTags> libxcks::XCKS1FileHandler::readTags
protected

Stack of read tags.

Definition at line 81 of file xcksfilereader_1.hpp.

◆ sumsAlgos

ArrayChecksumAlgoId libxcks::XCKS1FileHandler::sumsAlgos
protected

Type of algorithms' checksums to read for each file.

Definition at line 85 of file xcksfilereader_1.hpp.

◆ tagInChecksumsFileTag

XMLTags libxcks::XCKS1FileHandler::tagInChecksumsFileTag
protected

Current tag in "checksumsFile" tag.

Definition at line 82 of file xcksfilereader_1.hpp.

◆ tagInFileTag

XMLTags libxcks::XCKS1FileHandler::tagInFileTag
protected

Information tag seen inside a file tag.

Definition at line 91 of file xcksfilereader_1.hpp.


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