Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00181 CommandSection (const char* name)
00182 : name (name) {}
00183
00184
00185 csString name;
00186
00187
00188 csArray<Option> commandOptions;
00189 };
00190
00191
00192 csArray<CommandSection> commandSections;
00193
00194
00195 csStringArray examples;
00196 };
00197
00198 #endif // __CS_CMDHELP_H__
00199