MCPcopy Create free account
hub / github.com/MITK/MITK / Node

Method Node

Modules/Core/src/IO/mitkPreferences.cpp:348–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348mitk::IPreferences* mitk::Preferences::Node(const std::string& path)
349{
350 if (path.empty())
351 return this;
352
353 if (path[0] == '/')
354 return m_Root->Node(path.substr(1));
355
356 std::string name;
357 std::string remainingPath;
358
359 auto pos = path.find('/');
360
361 if (pos != std::string::npos)
362 {
363 name = path.substr(0, pos);
364 remainingPath = path.substr(pos + 1);
365 }
366 else
367 {
368 name = path;
369 }
370
371 IPreferences* node = nullptr;
372
373 for (const auto& child : m_Children)
374 {
375 if (child->m_Name == name)
376 {
377 node = child.get();
378 break;
379 }
380 }
381
382 if (node == nullptr)
383 {
384 node = new Preferences(Properties(), name, this, m_Storage);
385 this->OnChanged(this);
386 }
387
388 if (pos != std::string::npos)
389 node = node->Node(remainingPath);
390
391 return node;
392}
393
394void mitk::Preferences::RemoveNode()
395{

Calls 3

OnChangedMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45

Tested by 1