| 346 | } |
| 347 | |
| 348 | mitk::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 | |
| 394 | void mitk::Preferences::RemoveNode() |
| 395 | { |