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

Method FindPath

source/intercoms/src/G4UIcommandTree.cc:212–243  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

210
211// --------------------------------------------------------------------
212G4UIcommand* G4UIcommandTree::FindPath(const char* commandPath) const
213{
214 // This function tries to match a command name
215
216 G4String remainingPath = commandPath;
217 if (remainingPath.find(pathName) == std::string::npos) {
218 return nullptr;
219 }
220 remainingPath.erase(0, pathName.length());
221 std::size_t i = remainingPath.find('/');
222 if (i == std::string::npos) {
223 // Find command
224 std::size_t n_commandEntry = command.size();
225 for (std::size_t i_thCommand = 0; i_thCommand < n_commandEntry; ++i_thCommand) {
226 if (remainingPath == command[i_thCommand]->GetCommandName()) {
227 return command[i_thCommand];
228 }
229 }
230 }
231 else {
232 // Find path
233 G4String nextPath = pathName;
234 nextPath.append(remainingPath.substr(0, i + 1));
235 std::size_t n_treeEntry = tree.size();
236 for (std::size_t i_thTree = 0; i_thTree < n_treeEntry; ++i_thTree) {
237 if (nextPath == tree[i_thTree]->GetPathName()) {
238 return tree[i_thTree]->FindPath(commandPath);
239 }
240 }
241 }
242 return nullptr;
243}
244
245// --------------------------------------------------------------------
246G4UIcommandTree* G4UIcommandTree::FindCommandTree(const char* commandPath)

Callers 14

G4VisCommandOpenMethod · 0.80
FindCommandMethod · 0.80
TerminalHelpMethod · 0.80
AddButtonMethod · 0.80
AddIconMethod · 0.80
ButtonCallbackMethod · 0.80
HelpTreeClicCallbackMethod · 0.80
GetHelpTreeToolTipsMethod · 0.80
GetCurrentValuesMethod · 0.80

Calls 5

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

Tested by

no test coverage detected