26 : type(type), name(name),
selection(index){};
107 <<
"Error. Cannot return info of path node. Node index is out of bounds. Index: " << index
119 <<
"Error. Cannot return info of path node. Node index is out of bounds. Index: " << index
172 if (rightIter == rightEnd)
177 if (leftPos.name < rightIter->name)
181 if (rightIter->name < leftPos.name)
186 if (leftPos.type < rightIter->type)
190 if (rightIter->type < leftPos.type)
195 if (leftPos.selection < rightIter->selection)
199 if (rightIter->selection < leftPos.selection)
206 return rightIter != rightEnd;
215 if (rightIter == rightEnd)
218 if (leftPos.name > rightIter->name)
220 if (rightIter->name > leftPos.name)
223 if (leftPos.type > rightIter->type)
225 if (rightIter->type > leftPos.type)
228 if (leftPos.selection > rightIter->selection)
230 if (rightIter->selection > leftPos.selection)
234 return rightIter != rightEnd;
287 auto leftPos = left.
GetNodes().cbegin();
288 auto rightPos = right.
GetNodes().cbegin();
289 auto leftEnd = left.
GetNodes().cend();
290 auto rightEnd = right.
GetNodes().cend();
292 while (leftPos != leftEnd && rightPos != rightEnd)
294 if (!leftPos->Matches(*rightPos))
302 if (leftPos == leftEnd && rightPos == rightEnd)
320 std::ostringstream nameStream;
324 for (
const auto &node : tagPath.
GetNodes())
334 nameStream <<
"([a-zA-Z0-9- ]+)";
338 nameStream << node.name;
342 nameStream <<
"\\.\\[" << node.selection <<
"\\]";
346 nameStream <<
"\\.\\[(\\d*)\\]";
351 nameStream <<
"INVALIDNODE";
355 return nameStream.str();
360 std::ostringstream nameStream;
364 for (
const auto &node : tagPath.
GetNodes())
374 nameStream <<
"([a-zA-Z0-9- ]+)";
378 nameStream << node.name;
382 nameStream <<
"_\\[" << node.selection <<
"\\]";
386 nameStream <<
"_\\[(\\d*)\\]";
391 nameStream <<
"INVALIDNODE";
395 return nameStream.str();
400 std::ostringstream nameStream;
402 int captureGroup = 1;
406 for (
const auto &node : tagPath.
GetNodes())
416 nameStream <<
"$" << captureGroup++;
420 nameStream << node.name;
424 nameStream <<
"_[" << node.selection <<
"]";
428 nameStream <<
"_[$" << captureGroup++ <<
"]";
433 nameStream <<
"INVALID_NODE";
437 return nameStream.str();
442 std::ostringstream nameStream;
444 int captureGroup = 1;
448 for (
const auto &node : tagPath.
GetNodes())
458 nameStream <<
"$" << captureGroup++;
462 nameStream << node.name;
466 nameStream <<
".[" << node.selection <<
"]";
470 nameStream <<
".[$" << captureGroup++ <<
"]";
475 nameStream <<
"INVALID_NODE";
479 return nameStream.str();
486 std::regex reg_element(
"([a-zA-Z0-9- ]+)");
487 std::regex reg_anySelection(
"\\[\\*\\]");
488 std::regex reg_Selection(
"\\[(\\d+)\\]");
490 std::istringstream f(propertyName);
495 while (getline(f, subStr,
'.'))
510 if (std::regex_match(subStr, sm, reg_anySelection))
522 else if (std::regex_match(subStr, sm, reg_Selection))
534 else if (std::regex_match(subStr, sm, reg_element))
559 std::ostringstream nameStream;
563 for (
const auto &node : tagPath.
GetNodes())
577 nameStream << node.name;
581 nameStream <<
".[" << node.selection <<
"]";
585 nameStream <<
".[*]";
590 nameStream <<
"INVALID_NODE";
594 return nameStream.str();
std::string ElementNameType
MITKCORE_EXPORT std::string PropertyKeyPathToPropertyName(const PropertyKeyPath &tagPath)
ItemSelectionIndex selection
bool operator>(const PropertyKeyPath &right) const
bool operator<=(const PropertyKeyPath &right) const
bool operator>=(const PropertyKeyPath &right) const
PathIndexType GetSize() const
DataCollection - Class to facilitate loading/accessing structured data.
PropertyKeyPath & AddElement(const ElementNameType &name)
PathIndexType AddNode(const NodeInfo &newNode)
const NodeInfo & GetNode(const PathIndexType &index) const
static bool PropertyKeyPathsMatch(const PropertyKeyPath &left, const PropertyKeyPath &right)
PropertyKeyPath & AddSelection(const ElementNameType &name, ItemSelectionIndex index)
std::vector< NodeInfo > NodeInfoVectorType
NodeInfo & GetFirstNode()
PropertyKeyPath & operator=(const PropertyKeyPath &path)
MITKCORE_EXPORT PropertyKeyPath PropertyNameToPropertyKeyPath(const std::string &propertyName)
std::vcl_size_t ItemSelectionIndex
bool HasItemSelectionWildcardsOnly() const
bool operator==(const PropertyKeyPath &path) const
MITKCORE_EXPORT std::string PropertyKeyPathToPersistenceNameTemplate(const PropertyKeyPath &tagPath)
const NodeInfoVectorType & GetNodes() const
#define mitkThrowException(classname)
MITKCORE_EXPORT std::string PropertyKeyPathToPersistenceKeyTemplate(const PropertyKeyPath &tagPath)
NodeInfoVectorType m_NodeInfos
NodeInfoVectorType::size_type PathIndexType
PropertyKeyPath & AddAnyElement()
bool operator==(const NodeInfo &right) const
bool operator<(const PropertyKeyPath &right) const
bool Equals(const PropertyKeyPath &path) const
Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of...
bool Matches(const NodeInfo &right) const
MITKCORE_EXPORT std::string PropertyKeyPathToPropertyRegEx(const PropertyKeyPath &tagPath)
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
MITKCORE_EXPORT std::string PropertyKeyPathToPersistenceKeyRegEx(const PropertyKeyPath &tagPath)
PropertyKeyPath & AddAnySelection(const ElementNameType &name)