Geant4  10.00.p02
G4UIcommandTree.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4UIcommandTree.hh 77651 2013-11-27 08:47:55Z gcosmo $
28 //
29 
30 #ifndef G4UIcommandTree_h
31 #define G4UIcommandTree_h 1
32 
33 
34 #include "G4UIcommand.hh"
35 #include "globals.hh"
36 #include <vector>
37 
38 // class description:
39 //
40 // This class is exclusively used by G4UImanager for handling the
41 // tree structure of the commands. The user MUST NOT construct/use
42 // this class object.
43 
45 {
46  public:
48  G4UIcommandTree(const char * thePathName);
50  G4int operator==(const G4UIcommandTree &right) const;
51  G4int operator!=(const G4UIcommandTree &right) const;
52 
53  public:
54  void AddNewCommand(G4UIcommand * newCommand, G4bool workerThreadOnly=false);
55  void RemoveCommand(G4UIcommand * aCommand, G4bool workerThreadOnly=false);
56  G4UIcommand* FindPath(const char* commandPath) const;
57  G4UIcommandTree* FindCommandTree(const char* commandPath);
58  G4String CompleteCommandPath(const G4String& commandPath);
59  // Complete most available caracters in common into command path in the command line
60  // given
61 
62  void List() const;
63  void ListCurrent() const;
64  void ListCurrentWithNum() const;
65  void CreateHTML();
66 
67  private:
68  G4String CreateFileName(const char* pName);
69  G4String ModStr(const char* strS);
70  G4String GetFirstMatchedString(const G4String&,const G4String&) const;
71 
72  std::vector<G4UIcommand*> command;
73  std::vector<G4UIcommandTree*> tree;
77 
78  public:
79  inline const G4UIcommand * GetGuidance() const
80  { return guidance; };
81  inline const G4String GetPathName() const
82  { return pathName; };
83  inline G4int GetTreeEntry() const
84  { return tree.size(); };
85  inline G4int GetCommandEntry() const
86  { return command.size(); };
88  { return tree[i-1]; };
89  inline G4UIcommandTree * GetTree(const char* comNameC)
90  {
91  G4String comName = comNameC;
92  for( size_t i=0; i < tree.size(); i++)
93  {
94  if( comName == tree[i]->GetPathName() )
95  { return tree[i]; }
96  }
97  return NULL;
98  };
100  { return command[i-1]; };
101  inline const G4String GetTitle() const
102  {
103  if(guidance==NULL)
104  { return G4String("...Title not available..."); }
105  else
106  { return guidance->GetTitle(); }
107  };
108 
109 };
110 
111 #endif
112 
G4UIcommandTree * FindCommandTree(const char *commandPath)
Try to match a command or a path with the one given.
G4UIcommand * FindPath(const char *commandPath) const
G4int GetCommandEntry() const
G4int operator==(const G4UIcommandTree &right) const
G4UIcommand * guidance
G4UIcommand * GetCommand(G4int i)
G4int GetTreeEntry() const
const G4String GetTitle() const
Definition: G4UIcommand.hh:170
G4int operator!=(const G4UIcommandTree &right) const
int G4int
Definition: G4Types.hh:78
std::vector< G4UIcommand * > command
std::vector< G4UIcommandTree * > tree
void ListCurrent() const
G4UIcommandTree * GetTree(G4int i)
bool G4bool
Definition: G4Types.hh:79
void ListCurrentWithNum() const
void RemoveCommand(G4UIcommand *aCommand, G4bool workerThreadOnly=false)
G4String GetFirstMatchedString(const G4String &, const G4String &) const
G4String ModStr(const char *strS)
const G4String GetPathName() const
G4UIcommandTree * GetTree(const char *comNameC)
const G4String GetTitle() const
void AddNewCommand(G4UIcommand *newCommand, G4bool workerThreadOnly=false)
const G4UIcommand * GetGuidance() const
G4String CreateFileName(const char *pName)
G4String CompleteCommandPath(const G4String &commandPath)
void List() const