00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 00030 #ifndef G4UIcommandTree_h 00031 #define G4UIcommandTree_h 1 00032 00033 00034 #include "G4UIcommand.hh" 00035 #include "globals.hh" 00036 #include <vector> 00037 00038 // class description: 00039 // 00040 // This class is exclusively used by G4UImanager for handling the 00041 // tree structure of the commands. The user MUST NOT construct/use 00042 // this class object. 00043 00044 class G4UIcommandTree 00045 { 00046 public: 00047 G4UIcommandTree(); 00048 G4UIcommandTree(const char * thePathName); 00049 ~G4UIcommandTree(); 00050 G4int operator==(const G4UIcommandTree &right) const; 00051 G4int operator!=(const G4UIcommandTree &right) const; 00052 00053 public: 00054 void AddNewCommand(G4UIcommand * newCommand); 00055 void RemoveCommand(G4UIcommand * aCommand); 00056 G4UIcommand* FindPath(const char* commandPath) const; 00057 G4UIcommandTree* FindCommandTree(const char* commandPath); 00058 G4String CompleteCommandPath(const G4String& commandPath); 00059 // Complete most available caracters in common into command path in the command line 00060 // given 00061 00062 void List() const; 00063 void ListCurrent() const; 00064 void ListCurrentWithNum() const; 00065 void CreateHTML(); 00066 00067 private: 00068 G4String CreateFileName(const char* pName); 00069 G4String ModStr(const char* strS); 00070 G4String GetFirstMatchedString(const G4String&,const G4String&) const; 00071 00072 std::vector<G4UIcommand*> command; 00073 std::vector<G4UIcommandTree*> tree; 00074 G4UIcommand *guidance; 00075 G4String pathName; 00076 00077 public: 00078 inline const G4UIcommand * GetGuidance() const 00079 { return guidance; }; 00080 inline const G4String GetPathName() const 00081 { return pathName; }; 00082 inline G4int GetTreeEntry() const 00083 { return tree.size(); }; 00084 inline G4int GetCommandEntry() const 00085 { return command.size(); }; 00086 inline G4UIcommandTree * GetTree(G4int i) 00087 { return tree[i-1]; }; 00088 inline G4UIcommandTree * GetTree(const char* comNameC) 00089 { 00090 G4String comName = comNameC; 00091 for( size_t i=0; i < tree.size(); i++) 00092 { 00093 if( comName == tree[i]->GetPathName() ) 00094 { return tree[i]; } 00095 } 00096 return NULL; 00097 }; 00098 inline G4UIcommand * GetCommand(G4int i) 00099 { return command[i-1]; }; 00100 inline const G4String GetTitle() const 00101 { 00102 if(guidance==NULL) 00103 { return G4String("...Title not available..."); } 00104 else 00105 { return guidance->GetTitle(); } 00106 }; 00107 00108 }; 00109 00110 #endif 00111