ADTF  3.14.3
DDFile

Convenience class to load and validate a Data Definition form a xml file string. More...

Static Public Member Functions

static dd::DataDefinition fromXMLFile (const std::string &xml_filepath, bool strict=false)
 Read a file containing a data definiton in XML. More...
 
static void toXMLFile (const dd::DataDefinition &ddl_to_write, const std::string &xml_filepath)
 Writes DataDefinition to a file containing a data definiton in XML. More...
 

Detailed Description

Convenience class to load and validate a Data Definition form a xml file string.


This implementation can be used as follows:

//read the whole file and provide the contained DDL
//if there are validation errors, see @ref ddl::dd::Error::problems
auto my_dd_1 = DDFile::fromXMLFile("<struct name=\"mystruct\" version=\"1\"></struct>");
static dd::DataDefinition fromXMLFile(const std::string &xml_filepath, bool strict=false)
Read a file containing a data definiton in XML.
See also
DDString::fromXMLString, DDString::toXMLString

Definition at line 43 of file ddfile.h.

Member Function Documentation

◆ fromXMLFile()

static dd::DataDefinition fromXMLFile ( const std::string &  xml_filepath,
bool  strict = false 
)
static

Read a file containing a data definiton in XML.

Parameters
xml_filepatha valid filesystem path for loading a DataDefinition xmlfile.
strictset to true to load the datamodel exactly like defined (no mixture of DDL tag definitions allowed).
Exceptions
ddl::dd::Errorif the xml file is not valid against the xsd definition (depending on the DDL Version).
ddl::dd::Errorif the validation level of the created DataDefinition is not at least good_enough!
Returns
dd::DataDefinition the valid Data Definiton of the file.

◆ toXMLFile()

static void toXMLFile ( const dd::DataDefinition ddl_to_write,
const std::string &  xml_filepath 
)
static

Writes DataDefinition to a file containing a data definiton in XML.

Parameters
xml_filepatha valid filesystem path for loading a DataDefinition xmlfile.
ddl_to_writea valid DataDefinition for writing a xmlfile.
Exceptions
ddl::dd::ErrorFile could not be written.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)