Reads and writes collections of named PropertyList objects to and from XML files.
More...
#include <mitkPropertyListsXmlFileReaderAndWriter.h>
Reads and writes collections of named PropertyList objects to and from XML files.
This class serializes PropertyList maps (keyed by string identifiers) into a simple XML format and deserializes them back. Each PropertyList is stored as a <PropertyList> element containing <Property> child elements. Supported property types are BoolProperty, StringProperty, IntProperty, DoubleProperty, and FloatProperty.
The XML structure is:
<PropertyLists>
<PropertyList name="listId">
<Property name="propName" value="..." type="IntProperty"/>
</PropertyList>
</PropertyLists>
- See also
- PersistenceService
-
PropertyList
Definition at line 45 of file mitkPropertyListsXmlFileReaderAndWriter.h.
◆ PropertyListsXmlFileReaderAndWriter()
| mitk::PropertyListsXmlFileReaderAndWriter::PropertyListsXmlFileReaderAndWriter |
( |
| ) |
|
|
protected |
◆ ~PropertyListsXmlFileReaderAndWriter()
| mitk::PropertyListsXmlFileReaderAndWriter::~PropertyListsXmlFileReaderAndWriter |
( |
| ) |
|
|
overrideprotected |
◆ Clone()
| Pointer mitk::PropertyListsXmlFileReaderAndWriter::Clone |
( |
| ) |
const |
◆ GetPropertyListIdElementName()
| static const char* mitk::PropertyListsXmlFileReaderAndWriter::GetPropertyListIdElementName |
( |
| ) |
|
|
static |
Get the XML attribute name used for PropertyList identifiers.
- Returns
- The string "name".
◆ mitkClassMacroItkParent()
◆ New()
| static Pointer mitk::PropertyListsXmlFileReaderAndWriter::New |
( |
| ) |
|
|
static |
◆ PropertyFromXmlElem()
| bool mitk::PropertyListsXmlFileReaderAndWriter::PropertyFromXmlElem |
( |
std::string & |
name, |
|
|
mitk::BaseProperty::Pointer & |
prop, |
|
|
const tinyxml2::XMLElement * |
elem |
|
) |
| const |
|
protected |
◆ PropertyToXmlElem()
| bool mitk::PropertyListsXmlFileReaderAndWriter::PropertyToXmlElem |
( |
const std::string & |
name, |
|
|
const mitk::BaseProperty * |
prop, |
|
|
tinyxml2::XMLElement * |
elem |
|
) |
| const |
|
protected |
◆ ReadLists()
| bool mitk::PropertyListsXmlFileReaderAndWriter::ReadLists |
( |
const std::string & |
fileName, |
|
|
std::map< std::string, mitk::PropertyList::Pointer > & |
_PropertyLists |
|
) |
| const |
Read a map of PropertyLists from an XML file.
Parses the XML file and populates the provided map with PropertyList objects keyed by their identifiers. Existing entries in the map may be overwritten.
- Parameters
-
| [in] | fileName | Path to the input XML file. |
| [in,out] | _PropertyLists | Map to populate with the deserialized PropertyLists. |
- Returns
- True if at least one PropertyList was read successfully, false on error.
◆ WriteLists()
| bool mitk::PropertyListsXmlFileReaderAndWriter::WriteLists |
( |
const std::string & |
fileName, |
|
|
const std::map< std::string, mitk::PropertyList::Pointer > & |
_PropertyLists |
|
) |
| const |
Write a map of PropertyLists to an XML file.
Each PropertyList is serialized with its string identifier. Only BoolProperty, StringProperty, IntProperty, DoubleProperty, and FloatProperty types are supported. Unsupported property types are skipped with a warning.
- Parameters
-
| [in] | fileName | Path to the output XML file. |
| [in] | _PropertyLists | Map of identifier-to-PropertyList pairs to serialize. |
- Returns
- True if all properties were converted and the file was written successfully, false otherwise.
The documentation for this class was generated from the following file: