[821] | 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 | // |
---|
[842] | 27 | // $Id: G4UIcommandTree.hh,v 1.16 2008/01/30 11:20:03 lgarnier Exp $ |
---|
| 28 | // GEANT4 tag $Name: HEAD $ |
---|
[821] | 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); |
---|
[842] | 58 | G4UIcommandTree * FindCommandTree(const char* commandPath); |
---|
[821] | 59 | void List(); |
---|
| 60 | void ListCurrent(); |
---|
| 61 | void ListCurrentWithNum(); |
---|
| 62 | void CreateHTML(); |
---|
| 63 | |
---|
| 64 | private: |
---|
| 65 | G4String CreateFileName(const char* pName); |
---|
| 66 | G4String ModStr(const char* strS); |
---|
| 67 | |
---|
| 68 | std::vector<G4UIcommand*> command; |
---|
| 69 | std::vector<G4UIcommandTree*> tree; |
---|
| 70 | G4UIcommand *guidance; |
---|
| 71 | G4String pathName; |
---|
| 72 | |
---|
| 73 | public: |
---|
| 74 | inline const G4UIcommand * GetGuidance() const |
---|
| 75 | { return guidance; }; |
---|
| 76 | inline const G4String GetPathName() const |
---|
| 77 | { return pathName; }; |
---|
| 78 | inline G4int GetTreeEntry() const |
---|
| 79 | { return tree.size(); }; |
---|
| 80 | inline G4int GetCommandEntry() const |
---|
| 81 | { return command.size(); }; |
---|
| 82 | inline G4UIcommandTree * GetTree(G4int i) |
---|
| 83 | { return tree[i-1]; }; |
---|
| 84 | inline G4UIcommandTree * GetTree(const char* comNameC) |
---|
| 85 | { |
---|
| 86 | G4String comName = comNameC; |
---|
| 87 | for( size_t i=0; i < tree.size(); i++) |
---|
| 88 | { |
---|
| 89 | if( comName == tree[i]->GetPathName() ) |
---|
| 90 | { return tree[i]; } |
---|
| 91 | } |
---|
| 92 | return NULL; |
---|
| 93 | }; |
---|
| 94 | inline G4UIcommand * GetCommand(G4int i) |
---|
| 95 | { return command[i-1]; }; |
---|
| 96 | inline const G4String GetTitle() const |
---|
| 97 | { |
---|
| 98 | if(guidance==NULL) |
---|
| 99 | { return G4String("...Title not available..."); } |
---|
| 100 | else |
---|
| 101 | { return guidance->GetTitle(); } |
---|
| 102 | }; |
---|
| 103 | |
---|
| 104 | }; |
---|
| 105 | |
---|
| 106 | #endif |
---|
| 107 | |
---|