| 403 | } |
| 404 | |
| 405 | IDrawableModule* ModuleContainer::FindModule(std::string name, bool fail) |
| 406 | { |
| 407 | /*string ownerPath = ""; |
| 408 | if (mOwner) |
| 409 | ownerPath = mOwner->Path(); |
| 410 | if (strstr(name.c_str(), ownerPath.c_str()) != name.c_str()) //path doesn't start with ownerPath |
| 411 | return nullptr; |
| 412 | |
| 413 | name = name.substr(ownerPath.length());*/ |
| 414 | |
| 415 | if (name == "") |
| 416 | return nullptr; |
| 417 | |
| 418 | for (int i = 0; i < mModules.size(); ++i) |
| 419 | { |
| 420 | if (name == mModules[i]->Name()) |
| 421 | return mModules[i]; |
| 422 | std::vector<std::string> tokens = ofSplitString(name, "~"); |
| 423 | if (mModules[i]->GetContainer()) |
| 424 | { |
| 425 | if (tokens[0] == mModules[i]->Name()) |
| 426 | { |
| 427 | ofStringReplace(name, tokens[0] + "~", "", true); |
| 428 | return mModules[i]->GetContainer()->FindModule(name, fail); |
| 429 | } |
| 430 | } |
| 431 | if (tokens.size() == 2 && tokens[0] == mModules[i]->Name()) |
| 432 | { |
| 433 | IDrawableModule* child = nullptr; |
| 434 | try |
| 435 | { |
| 436 | child = mModules[i]->FindChild(tokens[1], fail); |
| 437 | } |
| 438 | catch (UnknownModuleException& e) |
| 439 | { |
| 440 | } |
| 441 | if (child) |
| 442 | return child; |
| 443 | } |
| 444 | } |
| 445 | |
| 446 | if (fail) |
| 447 | throw UnknownModuleException(name); |
| 448 | return nullptr; |
| 449 | } |
| 450 | |
| 451 | IUIControl* ModuleContainer::FindUIControl(std::string path) |
| 452 | { |
nothing calls this directly
no test coverage detected