| 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,v 1.17 2009/05/07 09:33:51 lgarnier Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| 29 | //
|
|---|
| 30 |
|
|---|
| 31 | #ifndef G4UIcommandTree_h
|
|---|
| 32 | #define G4UIcommandTree_h 1
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | #include "G4UIcommand.hh"
|
|---|
| 36 | #include "globals.hh"
|
|---|
| 37 | #include <vector>
|
|---|
| 38 |
|
|---|
| 39 | // class description:
|
|---|
| 40 | //
|
|---|
| 41 | // This class is exclusively used by G4UImanager for handling the
|
|---|
| 42 | // tree structure of the commands. The user MUST NOT construct/use
|
|---|
| 43 | // this class object.
|
|---|
| 44 |
|
|---|
| 45 | class G4UIcommandTree
|
|---|
| 46 | {
|
|---|
| 47 | public:
|
|---|
| 48 | G4UIcommandTree();
|
|---|
| 49 | G4UIcommandTree(const char * thePathName);
|
|---|
| 50 | ~G4UIcommandTree();
|
|---|
| 51 | G4int operator==(const G4UIcommandTree &right) const;
|
|---|
| 52 | G4int operator!=(const G4UIcommandTree &right) const;
|
|---|
| 53 |
|
|---|
| 54 | public:
|
|---|
| 55 | void AddNewCommand(G4UIcommand * newCommand);
|
|---|
| 56 | void RemoveCommand(G4UIcommand * aCommand);
|
|---|
| 57 | G4UIcommand * FindPath(const char* commandPath);
|
|---|
| 58 | G4UIcommandTree * FindCommandTree(const char* commandPath);
|
|---|
| 59 | G4String CompleteCommandPath(const G4String commandPath);
|
|---|
| 60 | // Complete most available caracters in common into command path in the command line
|
|---|
| 61 | // given
|
|---|
| 62 |
|
|---|
| 63 | void List();
|
|---|
| 64 | void ListCurrent();
|
|---|
| 65 | void ListCurrentWithNum();
|
|---|
| 66 | void CreateHTML();
|
|---|
| 67 |
|
|---|
| 68 | private:
|
|---|
| 69 | G4String CreateFileName(const char* pName);
|
|---|
| 70 | G4String ModStr(const char* strS);
|
|---|
| 71 | G4String GetFirstMatchedString(const G4String&,const G4String&) const;
|
|---|
| 72 |
|
|---|
| 73 | std::vector<G4UIcommand*> command;
|
|---|
| 74 | std::vector<G4UIcommandTree*> tree;
|
|---|
| 75 | G4UIcommand *guidance;
|
|---|
| 76 | G4String pathName;
|
|---|
| 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(); };
|
|---|
| 87 | inline G4UIcommandTree * GetTree(G4int i)
|
|---|
| 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 | };
|
|---|
| 99 | inline G4UIcommand * GetCommand(G4int i)
|
|---|
| 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 |
|
|---|