csutil/cmdhelp.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2001 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_CMDHELP_H__ 00020 #define __CS_CMDHELP_H__ 00021 00026 #include "csextern.h" 00027 00028 #include "csutil/stringarray.h" 00029 #include "iutil/pluginconfig.h" 00030 00031 struct iObjectRegistry; 00032 struct iCommandLineParser; 00033 00077 class CS_CRYSTALSPACE_EXPORT csCommandLineHelper 00078 { 00079 public: 00080 csCommandLineHelper (); 00081 00088 static void PrintTitle (const char* title, unsigned int level = 0); 00089 00095 static void PrintOption (const csOptionDescription& option, const csVariant& value); 00096 00103 static void PrintOption (const char* name, const char* description, const csVariant& value); 00104 00113 static void Help (iObjectRegistry* object_reg, 00114 iCommandLineParser* cmdline = 0); 00115 00122 static bool CheckHelp (iObjectRegistry* object_reg, 00123 iCommandLineParser* cmdline = 0); 00124 00130 size_t AddCommandLineSection (const char* name); 00131 00138 void AddCommandLineOption (csOptionDescription& description, csVariant& value, 00139 size_t section = 0); 00140 00149 void AddCommandLineOption (const char* name, const char* description, csVariant value, size_t section = 0); 00150 00155 void AddCommandLineExample (const char* example); 00156 00165 void PrintApplicationHelp (iObjectRegistry* registry, 00166 const char* command, 00167 const char* usage, 00168 const char* description) const; 00169 00170 private: 00171 00172 struct Option 00173 { 00174 csOptionDescription description; 00175 csVariant value; 00176 }; 00177 00178 struct CommandSection 00179 { 00180 // Constructor 00181 CommandSection (const char* name) 00182 : name (name) {} 00183 00184 // Name of the section 00185 csString name; 00186 00187 // Array of options 00188 csArray<Option> commandOptions; 00189 }; 00190 00191 // Array of command line sections 00192 csArray<CommandSection> commandSections; 00193 00194 // Array of usage examples 00195 csStringArray examples; 00196 }; 00197 00198 #endif // __CS_CMDHELP_H__ 00199
Generated for Crystal Space 2.0 by doxygen 1.6.1