MCPcopy Create free account
hub / github.com/Geant4/geant4 / FindCommandTree

Method FindCommandTree

source/intercoms/src/G4UIcommandTree.cc:246–276  ·  view source on GitHub ↗

--------------------------------------------------------------------

Source from the content-addressed store, hash-verified

244
245// --------------------------------------------------------------------
246G4UIcommandTree* G4UIcommandTree::FindCommandTree(const char* commandPath)
247{
248 // Try to match a command or a path with the one given.
249 // @commandPath : command or path to match
250 // @return the commandTree found or nullptr if not
251
252 G4String remainingPath = commandPath;
253 if (remainingPath.find(pathName) == std::string::npos) {
254 return nullptr;
255 }
256 remainingPath.erase(0, pathName.length());
257 std::size_t i = remainingPath.find('/');
258 if (i != std::string::npos) {
259 // Find path
260 G4String nextPath = pathName;
261 nextPath.append(remainingPath.substr(0, i + 1));
262 std::size_t n_treeEntry = tree.size();
263 for (std::size_t i_thTree = 0; i_thTree < n_treeEntry; ++i_thTree) {
264 if (tree[i_thTree]->GetPathName() == commandPath) {
265 return tree[i_thTree];
266 }
267 if (nextPath == tree[i_thTree]->GetPathName()) {
268 return tree[i_thTree]->FindCommandTree(commandPath);
269 }
270 }
271 }
272 else {
273 return this;
274 }
275 return nullptr;
276}
277
278// --------------------------------------------------------------------
279G4String G4UIcommandTree::CompleteCommandPath(const G4String& aCommandPath)

Callers 7

CreateCompleterModelMethod · 0.80
HelpTreeClicCallbackMethod · 0.80
GetHelpTreeToolTipsMethod · 0.80
CreateDirectoryMethod · 0.80

Calls 5

substrMethod · 0.80
findMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected