Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::file::xml::File Class Referencefinal

#include <xmlFile.hpp>

Classes

struct  DefaultValues
 
struct  Files
 
struct  Keys
 
struct  Sections
 

Public Member Functions

 File ()=default
 
 File (std::string_view pathFile)
 
 File (const File &other)=delete
 
 File (File &&other)=default
 
 ~File ()=default
 
Fileoperator= (const File &other)=delete
 
Fileoperator= (File &&other)=delete
 
bool read (bool checkIntegrity=true)
 
bool save ()
 
bool hasChanges () const
 
iv::types::timestamp lastTimeEdited () const
 
iv::file::xml::node getChild (std::string_view name) const
 
iv::file::xml::node setChild (std::string_view name, std::string_view parentName="")
 
template<typename T >
getAttribute (const std::string_view node, std::string_view key, T defaultValue) const
 
template<typename T >
bool addAttribute (const std::string_view node, std::string_view key, T value)
 
std::string toString () const
 Converts current XML data into string format.
 

Static Public Member Functions

static File fromString (std::string_view xmlString)
 

Private Member Functions

uint16_t prvCalculateFileValidation () const
 
bool setMetadata (uint16_t crcValue) const
 
bool prvCheckFileValidation (uint16_t crcValue) const
 

Private Attributes

std::string m_pathFile
 
pugi::xml_document m_xml
 

Constructor & Destructor Documentation

◆ File() [1/4]

iv::file::xml::File::File ( )
default

◆ File() [2/4]

iv::file::xml::File::File ( std::string_view pathFile)
explicit

◆ File() [3/4]

iv::file::xml::File::File ( const File & other)
delete

◆ File() [4/4]

iv::file::xml::File::File ( File && other)
default

◆ ~File()

iv::file::xml::File::~File ( )
default

Member Function Documentation

◆ addAttribute()

template<typename T >
bool iv::file::xml::File::addAttribute ( const std::string_view node,
std::string_view key,
T value )
inline

◆ fromString()

File iv::file::xml::File::fromString ( std::string_view xmlString)
static
Parameters
xmlString
Exceptions
iv::exception::StreamIOErrorif there's an error opening file.
Returns

◆ getAttribute()

template<typename T >
T iv::file::xml::File::getAttribute ( const std::string_view node,
std::string_view key,
T defaultValue ) const
inline

◆ getChild()

iv::file::xml::node iv::file::xml::File::getChild ( std::string_view name) const
nodiscard

◆ hasChanges()

bool iv::file::xml::File::hasChanges ( ) const
nodiscard

◆ lastTimeEdited()

iv::types::timestamp iv::file::xml::File::lastTimeEdited ( ) const
nodiscard

◆ operator=() [1/2]

File & iv::file::xml::File::operator= ( const File & other)
delete

◆ operator=() [2/2]

File & iv::file::xml::File::operator= ( File && other)
delete

◆ prvCalculateFileValidation()

uint16_t iv::file::xml::File::prvCalculateFileValidation ( ) const
nodiscardprivate

◆ prvCheckFileValidation()

bool iv::file::xml::File::prvCheckFileValidation ( uint16_t crcValue) const
private

◆ read()

bool iv::file::xml::File::read ( bool checkIntegrity = true)
Exceptions
iv::exception::StreamIOErrorif there's a load fail.
iv::exception::InvalidFileIntegrityif file integrity is violated.
Returns

◆ save()

bool iv::file::xml::File::save ( )
nodiscard
Exceptions
iv::exception::StreamIOErrorif there's an error saving the XML file.
Returns

◆ setChild()

iv::file::xml::node iv::file::xml::File::setChild ( std::string_view name,
std::string_view parentName = "" )
Parameters
name
parentName
Exceptions
iv::exception::StreamIOErrorif there's an error adding a new child.
Returns

◆ setMetadata()

bool iv::file::xml::File::setMetadata ( uint16_t crcValue) const
nodiscardprivate

◆ toString()

std::string iv::file::xml::File::toString ( ) const
nodiscard

Converts current XML data into string format.

Exceptions
iv::exception::StreamIOErrorif there's an error saving, reading or removing a temporal file.
Returns
STRING format of the XML data.

Member Data Documentation

◆ m_pathFile

std::string iv::file::xml::File::m_pathFile
private

◆ m_xml

pugi::xml_document iv::file::xml::File::m_xml
private

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