PLCnext API Documentation 25.0.2.69
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Arp::System::Commons::Xml::XmlConfigDocument Class Reference

Class handle xml configuration documents More...

#include <XmlConfigDocument.hpp>

Inheritance diagram for Arp::System::Commons::Xml::XmlConfigDocument:
Inheritance graph

Public Member Functions

 XmlConfigDocument (const String &documentXmlElementName, IXmlSerializable &content)
 Constructs an XmlConfigDocument instance. More...
 
 XmlConfigDocument (MultiXmlConfigDocument &rootDocument, IXmlSerializable &content)
 Constructs an XmlConfigDocument instance.
 
virtual ~XmlConfigDocument (void)=default
 Destructs this instance and frees all resouces.
 
const StringGetPath (void) const
 Returns the path to the current file loaded by this document
 
IXmlSerializableGetContent (void)
 Returns the current content of this document
 
MultiXmlConfigDocumentGetRootDocument (void)
 Returns a pointer to the root document for MultiXmlConfigDocument
 
Version GetRecentVersion (void) const
 Returns the recent implemented schema version, used by XmlSerializationContext
 
const DocumentTraitsGetTraits (void) const
 Returns current traits of document
 
void Load (const String &documentPath)
 Loads the document from specified <paramref="documentPath"/>
 
void Load (const String &documentPath, const DocumentTraits &documentTraits)
 Loads the document from specified <paramref="documentPath"/> and with given <paramref="documentTraits"/>
 
bool TryLoad (const String &documentPath)
 Tries to load document from specified <paramref="documentPath"/> More...
 
bool TryLoad (const String &documentPath, const DocumentTraits &documentTraits)
 Tries to load document from specified <paramref="documentPath"/> and with given <paramref="documentTraits"/> More...
 
void Save (const String &documentPath)
 saves the content xml encoded to documentPath with filesystem sync
 
void Save (const String &documentPath, bool syncFilesystem)
 saves the content xml encoded to documentPath More...
 
void Save (const String &documentPath, bool syncFilesystem, const Version &schemaVersion)
 saves the content xml encoded to documentPath More...
 
void Save (void)
 saves the content xml encoded to the file the document was loaded from with filesystem sync
 
void Save (bool syncFilesystem)
 saves the content xml encoded to the file the document was loaded from More...
 
void LoadString (const String &xmlContent, const String &contentTraits=String::Empty)
 Loads the document from a string
 

Protected Member Functions

virtual void ReadDocument (XmlReader &reader)
 

Protected Attributes

MultiXmlConfigDocumentpRootDoc
 
IXmlSerializablecontent
 
String documentXmlElementName
 
String path
 
DocumentTraits traits
 
Version recentVersion
 

Friends

class XmlSerializationContext
 

Detailed Description

Class handle xml configuration documents

Constructor & Destructor Documentation

◆ XmlConfigDocument()

Arp::System::Commons::Xml::XmlConfigDocument::XmlConfigDocument ( const String documentXmlElementNameArg,
IXmlSerializable contentArg 
)

Constructs an XmlConfigDocument instance.

Parameters
documentXmlElementNamename of the root element of the document
contentclass which implements IXmlSerializable and can parse documentXmlElementName

Member Function Documentation

◆ ReadDocument()

void Arp::System::Commons::Xml::XmlConfigDocument::ReadDocument ( XmlReader reader)
protectedvirtual

◆ Save() [1/3]

void Arp::System::Commons::Xml::XmlConfigDocument::Save ( bool  syncFilesystem)

saves the content xml encoded to the file the document was loaded from

Parameters
syncFilesystemtrue: synchronize filesystem

◆ Save() [2/3]

void Arp::System::Commons::Xml::XmlConfigDocument::Save ( const String documentPath,
bool  syncFilesystem 
)

saves the content xml encoded to documentPath

Parameters
syncFilesystemtrue: synchronize filesystem

◆ Save() [3/3]

void Arp::System::Commons::Xml::XmlConfigDocument::Save ( const String documentPath,
bool  syncFilesystem,
const Version schemaVersion 
)

saves the content xml encoded to documentPath

Parameters
syncFilesystemtrue: synchronize filesystem
schemaVersionversion of the XML schema as attribute schemaVersion at the document element, omitted if equal to Version()

◆ TryLoad() [1/2]

bool Arp::System::Commons::Xml::XmlConfigDocument::TryLoad ( const String documentPath)

Tries to load document from specified <paramref="documentPath"/>

Returns
true if the document was loaded successfully, otherwise false.

◆ TryLoad() [2/2]

bool Arp::System::Commons::Xml::XmlConfigDocument::TryLoad ( const String documentPath,
const DocumentTraits documentTraits 
)

Tries to load document from specified <paramref="documentPath"/> and with given <paramref="documentTraits"/>

Returns
true if the document was loaded successfully, otherwise false.

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