Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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$
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);
55  void RemoveCommand(G4UIcommand * aCommand);
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;
74  G4UIcommand *guidance;
75  G4String pathName;
76 
77  public:
78  inline const G4UIcommand * GetGuidance() const
79  { return guidance; };
80  inline const G4String GetPathName() const
81  { return pathName; };
82  inline G4int GetTreeEntry() const
83  { return tree.size(); };
84  inline G4int GetCommandEntry() const
85  { return command.size(); };
87  { return tree[i-1]; };
88  inline G4UIcommandTree * GetTree(const char* comNameC)
89  {
90  G4String comName = comNameC;
91  for( size_t i=0; i < tree.size(); i++)
92  {
93  if( comName == tree[i]->GetPathName() )
94  { return tree[i]; }
95  }
96  return NULL;
97  };
99  { return command[i-1]; };
100  inline const G4String GetTitle() const
101  {
102  if(guidance==NULL)
103  { return G4String("...Title not available..."); }
104  else
105  { return guidance->GetTitle(); }
106  };
107 
108 };
109 
110 #endif
111