Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::PropertyKeyPath Class Referencefinal

Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of the property persistence service or the property relation service.
Following assumptions are made /preconditions are defined: More...

#include <mitkPropertyKeyPath.h>

Collaboration diagram for mitk::PropertyKeyPath:

Classes

struct  NodeInfo
 Information about a single node in a PropertyKeyPath. More...
 

Public Types

using ItemSelectionIndex = std::size_t
 
using ElementNameType = std::string
 
using NodeInfoVectorType = std::vector< NodeInfo >
 
using PathIndexType = NodeInfoVectorType::size_type
 

Public Member Functions

bool IsEmpty () const
 
bool IsExplicit () const
 
bool HasItemSelectionWildcardsOnly () const
 
PathIndexType GetSize () const
 
PathIndexType AddNode (const NodeInfo &newNode)
 
const NodeInfo & GetNode (const PathIndexType &index) const
 
NodeInfo & GetNode (const PathIndexType &index)
 
NodeInfo & GetFirstNode ()
 
const NodeInfo & GetFirstNode () const
 
NodeInfo & GetLastNode ()
 
const NodeInfo & GetLastNode () const
 
const NodeInfoVectorType & GetNodes () const
 Get a const reference to all node info entries. More...
 
bool operator== (const PropertyKeyPath &path) const
 Compare two PropertyKeyPaths for exact structural equality. More...
 
bool operator< (const PropertyKeyPath &right) const
 Lexicographic less-than comparison. More...
 
bool operator<= (const PropertyKeyPath &right) const
 Lexicographic less-than-or-equal comparison. More...
 
bool operator>= (const PropertyKeyPath &right) const
 Lexicographic greater-than-or-equal comparison. More...
 
bool operator> (const PropertyKeyPath &right) const
 Lexicographic greater-than comparison. More...
 
bool Equals (const PropertyKeyPath &path) const
 Check if two PropertyKeyPaths match, processing wildcards. More...
 
PropertyKeyPath & operator= (const PropertyKeyPath &path)
 Assignment operator. More...
 
PropertyKeyPath & AddAnyElement ()
 Append a wildcard "any element" node to the path. More...
 
PropertyKeyPath & AddElement (const ElementNameType &name)
 Append a named element node to the path. More...
 
PropertyKeyPath & AddAnySelection (const ElementNameType &name)
 Append a named element with wildcard selection to the path. More...
 
PropertyKeyPath & AddSelection (const ElementNameType &name, ItemSelectionIndex index)
 Append a named element with a specific selection index to the path. More...
 
 PropertyKeyPath ()
 Default constructor. Creates an empty path. More...
 
 PropertyKeyPath (const PropertyKeyPath &path)
 Copy constructor. More...
 
 PropertyKeyPath (const std::initializer_list< ElementNameType > &list)
 Construct a path from a list of element names. More...
 
 ~PropertyKeyPath ()
 
void Reset ()
 Clear the path, removing all nodes. More...
 

Static Protected Member Functions

static bool PropertyKeyPathsMatch (const PropertyKeyPath &left, const PropertyKeyPath &right)
 

Protected Attributes

NodeInfoVectorType m_NodeInfos
 

Detailed Description

Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of the property persistence service or the property relation service.
Following assumptions are made /preconditions are defined:

  • A property key is partitioned by "." into nodes (c.f. visualization of property keys in the PropertyView).
  • A node can either be an element or a selection.
  • An element has a name (alphanumric, - and space; "A-Za-z0-9- ") or is wildcarded ("*")
  • A selection is either an index (e.g. "[1]") or a wildcard ("[*]").

Selections are used to indicate that the preceding element has multiple occurrences and which occurrence is meant. Example property keys would be:

  • prop : A simple property key
  • prop.subprop1 : A property key consisting of two nodes
  • prop.* : Any property key that starts with a node "prop"
  • prop.sub.[2] : A property key that starts with a node "prop" and a has a second node that is selection and has the index 2.
  • prop.sub.[*] : Any property key that starts with a node "prop" and a has a second node that is selection (with any index).

To build a path one may use the Add* method to build up the PropertyKeyPath element by element.
"first.*.third.[3]" would be equivalent to propKeyPath.AddElement("first"); propKeyPath.AddAnyElement(); propKeyPath.AddSelection("third",3);
or the inline version propKeyPath.AddElement("first").AddAnyElement().AddSelection("third",3);

Definition at line 54 of file mitkPropertyKeyPath.h.

Member Typedef Documentation

◆ ElementNameType

Definition at line 58 of file mitkPropertyKeyPath.h.

◆ ItemSelectionIndex

Definition at line 57 of file mitkPropertyKeyPath.h.

◆ NodeInfoVectorType

Definition at line 118 of file mitkPropertyKeyPath.h.

◆ PathIndexType

using mitk::PropertyKeyPath::PathIndexType = NodeInfoVectorType::size_type

Definition at line 119 of file mitkPropertyKeyPath.h.

Constructor & Destructor Documentation

◆ PropertyKeyPath() [1/3]

mitk::PropertyKeyPath::PropertyKeyPath ( )

Default constructor. Creates an empty path.

◆ PropertyKeyPath() [2/3]

mitk::PropertyKeyPath::PropertyKeyPath ( const PropertyKeyPath &  path)

Copy constructor.

Parameters
[in]pathThe path to copy.

◆ PropertyKeyPath() [3/3]

mitk::PropertyKeyPath::PropertyKeyPath ( const std::initializer_list< ElementNameType > &  list)

Construct a path from a list of element names.

Creates a simple key path consisting only of Element nodes.

Parameters
[in]listAn initializer list of element name strings.

◆ ~PropertyKeyPath()

mitk::PropertyKeyPath::~PropertyKeyPath ( )

Member Function Documentation

◆ AddAnyElement()

PropertyKeyPath& mitk::PropertyKeyPath::AddAnyElement ( )

Append a wildcard "any element" node to the path.

The resulting node matches any element name and selection.

Returns
A reference to this path (for chaining).

◆ AddAnySelection()

PropertyKeyPath& mitk::PropertyKeyPath::AddAnySelection ( const ElementNameType &  name)

Append a named element with wildcard selection to the path.

The resulting node matches any selection index for the given element name.

Parameters
[in]nameThe element name.
Returns
A reference to this path (for chaining).

◆ AddElement()

PropertyKeyPath& mitk::PropertyKeyPath::AddElement ( const ElementNameType &  name)

Append a named element node to the path.

Parameters
[in]nameThe element name.
Returns
A reference to this path (for chaining).

◆ AddNode()

PathIndexType mitk::PropertyKeyPath::AddNode ( const NodeInfo &  newNode)

Adds a new node to the end of the path.

Parameters
[in]newNodeReference to the node that should be added.
Returns
Returns the index of the newly added node.

◆ AddSelection()

PropertyKeyPath& mitk::PropertyKeyPath::AddSelection ( const ElementNameType &  name,
ItemSelectionIndex  index 
)

Append a named element with a specific selection index to the path.

Parameters
[in]nameThe element name.
[in]indexThe selection index.
Returns
A reference to this path (for chaining).

◆ Equals()

bool mitk::PropertyKeyPath::Equals ( const PropertyKeyPath &  path) const

Check if two PropertyKeyPaths match, processing wildcards.

Unlike operator==(), this method treats wildcards as matching any corresponding node. For example, "item1.child1.grandChild2" matches "item1.*.grandChild2".

Parameters
[in]pathThe path to compare against.
Returns
true if the paths match (considering wildcards).
Note
Use operator==() to check for exact structural equality.

◆ GetFirstNode() [1/2]

NodeInfo& mitk::PropertyKeyPath::GetFirstNode ( )

Function returns the node info of the first path node within the PropertyKeyPath.

Precondition
PropertyKeyPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetFirstNode() [2/2]

const NodeInfo& mitk::PropertyKeyPath::GetFirstNode ( ) const

Function returns the node info of the first path node within the PropertyKeyPath.

Precondition
PropertyKeyPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetLastNode() [1/2]

NodeInfo& mitk::PropertyKeyPath::GetLastNode ( )

Function returns the node info of the last path node within the PropertyKeyPath.

Precondition
PropertyKeyPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetLastNode() [2/2]

const NodeInfo& mitk::PropertyKeyPath::GetLastNode ( ) const

Function returns the node info of the last path node within the PropertyKeyPath.

Precondition
PropertyKeyPath must not be empty.
Returns
Info of the first path node. If the path is empty, an InvalidPathNode exception will be thrown.

◆ GetNode() [1/2]

NodeInfo& mitk::PropertyKeyPath::GetNode ( const PathIndexType &  index)

Function returns the node info of a path node specified by the index within the PropertyKeyPath.

Precondition
Passed index must not be out of bounds.
Parameters
[in]indexIndex of the node whose info should be retrieved.
Returns
Info of the specified path node. If the index is out of bound an InvalidPathNode exception will be thrown.

◆ GetNode() [2/2]

const NodeInfo& mitk::PropertyKeyPath::GetNode ( const PathIndexType &  index) const

Function returns the node info of a path node specified by the index within the PropertyKeyPath.

Precondition
Passed index must not be out of bounds.
Parameters
[in]indexIndex of the node whose info should be retrieved.
Returns
Info of the specified path node. If the index is out of bound an InvalidPathNode exception will be thrown.

◆ GetNodes()

const NodeInfoVectorType& mitk::PropertyKeyPath::GetNodes ( ) const

Get a const reference to all node info entries.

Returns
The vector of NodeInfo entries.

◆ GetSize()

PathIndexType mitk::PropertyKeyPath::GetSize ( ) const

Number of path nodes the PropertyKeyPath contains.

◆ HasItemSelectionWildcardsOnly()

bool mitk::PropertyKeyPath::HasItemSelectionWildcardsOnly ( ) const

Returns if the path has any nodes with item selection wild cards ([*]).

◆ IsEmpty()

bool mitk::PropertyKeyPath::IsEmpty ( ) const

Returns if the PropertyKeyPath is empty.

◆ IsExplicit()

bool mitk::PropertyKeyPath::IsExplicit ( ) const

Returns if the path is explicit (has no wildcards).

◆ operator<()

bool mitk::PropertyKeyPath::operator< ( const PropertyKeyPath &  right) const

Lexicographic less-than comparison.

Compares node names, types, and selections element by element.

Parameters
[in]rightThe path to compare against.
Returns
true if this path is lexicographically less than right.

◆ operator<=()

bool mitk::PropertyKeyPath::operator<= ( const PropertyKeyPath &  right) const

Lexicographic less-than-or-equal comparison.

Parameters
[in]rightThe path to compare against.
Returns
true if this path is lexicographically less than or equal to right.

◆ operator=()

PropertyKeyPath& mitk::PropertyKeyPath::operator= ( const PropertyKeyPath &  path)

Assignment operator.

Parameters
[in]pathThe path to copy from.
Returns
A reference to this path.

◆ operator==()

bool mitk::PropertyKeyPath::operator== ( const PropertyKeyPath &  path) const

Compare two PropertyKeyPaths for exact structural equality.

Two paths are equal if and only if all their nodes are identical (same type, name, and selection index).

Parameters
[in]pathThe path to compare against.
Returns
true if both paths are structurally identical.
See also
Equals

◆ operator>()

bool mitk::PropertyKeyPath::operator> ( const PropertyKeyPath &  right) const

Lexicographic greater-than comparison.

Parameters
[in]rightThe path to compare against.
Returns
true if this path is lexicographically greater than right.

◆ operator>=()

bool mitk::PropertyKeyPath::operator>= ( const PropertyKeyPath &  right) const

Lexicographic greater-than-or-equal comparison.

Parameters
[in]rightThe path to compare against.
Returns
true if this path is lexicographically greater than or equal to right.

◆ PropertyKeyPathsMatch()

static bool mitk::PropertyKeyPath::PropertyKeyPathsMatch ( const PropertyKeyPath &  left,
const PropertyKeyPath &  right 
)
staticprotected

◆ Reset()

void mitk::PropertyKeyPath::Reset ( )

Clear the path, removing all nodes.

Member Data Documentation

◆ m_NodeInfos

NodeInfoVectorType mitk::PropertyKeyPath::m_NodeInfos
protected

Definition at line 311 of file mitkPropertyKeyPath.h.


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