Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::PropertyListsXmlFileReaderAndWriter Class Reference

Reads and writes collections of named PropertyList objects to and from XML files. More...

#include <mitkPropertyListsXmlFileReaderAndWriter.h>

Inheritance diagram for mitk::PropertyListsXmlFileReaderAndWriter:
Collaboration diagram for mitk::PropertyListsXmlFileReaderAndWriter:

Public Member Functions

 mitkClassMacroItkParent (PropertyListsXmlFileReaderAndWriter, itk::Object)
 
Pointer Clone () const
 
bool WriteLists (const std::string &fileName, const std::map< std::string, mitk::PropertyList::Pointer > &_PropertyLists) const
 Write a map of PropertyLists to an XML file. More...
 
bool ReadLists (const std::string &fileName, std::map< std::string, mitk::PropertyList::Pointer > &_PropertyLists) const
 Read a map of PropertyLists from an XML file. More...
 

Static Public Member Functions

static const char * GetPropertyListIdElementName ()
 Get the XML attribute name used for PropertyList identifiers. More...
 
static Pointer New ()
 

Protected Member Functions

 PropertyListsXmlFileReaderAndWriter ()
 
 ~PropertyListsXmlFileReaderAndWriter () override
 
bool PropertyFromXmlElem (std::string &name, mitk::BaseProperty::Pointer &prop, const tinyxml2::XMLElement *elem) const
 
bool PropertyToXmlElem (const std::string &name, const mitk::BaseProperty *prop, tinyxml2::XMLElement *elem) const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PropertyListsXmlFileReaderAndWriter()

mitk::PropertyListsXmlFileReaderAndWriter::PropertyListsXmlFileReaderAndWriter ( )
protected

◆ ~PropertyListsXmlFileReaderAndWriter()

mitk::PropertyListsXmlFileReaderAndWriter::~PropertyListsXmlFileReaderAndWriter ( )
overrideprotected

Member Function Documentation

◆ 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()

mitk::PropertyListsXmlFileReaderAndWriter::mitkClassMacroItkParent ( PropertyListsXmlFileReaderAndWriter  ,
itk::Object   
)

◆ 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]fileNamePath to the input XML file.
[in,out]_PropertyListsMap 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]fileNamePath to the output XML file.
[in]_PropertyListsMap 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: