Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.h @ 7253

Last change on this file since 7253 was 7253, checked in by rennerc, 18 years ago

added license to argparser

File size: 1.8 KB
Line 
1/*!
2 * @file proto_class.h
3 * @brief Definition of CmdLinePrefsReader
4*/
5
6#ifndef _CMD_LINE_PREFS_READER_H
7#define _CMD_LINE_PREFS_READER_H
8
9#include "stdincl.h"
10#include "debug.h"
11#include "globals.h"
12
13#include "src/lib/parser/cmdline_parser/cmdline_parser.h"
14
15struct IniEntry
16{
17  std::string section;
18  std::string key;
19  std::string value;
20};
21
22struct CallbackData
23{
24  std::list<IniEntry> iniEntries;
25  CmdLineParser * parser;
26};
27
28struct RegistredArgument
29{
30  char shortOption;
31  std::string longOption;
32  std::string value;
33  std::string help;
34  std::string argName;
35  std::string section;
36  std::string key;
37};
38
39typedef std::vector<RegistredArgument> RegistredArgs;
40
41enum
42{
43  ID_SET_INI = 1,
44  ID_HELP,
45  ID_LICENSE,
46  ID_LAST
47};
48
49#define REGISTER_ARG_FLAG(shortOption,longOption,section,key,description,value) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,"",value)
50
51#define REGISTER_ARG_ARG(shortOption,longOption,section,key,description,argname) bool _ARGVAR_##shortOption##_##longOption = CmdLinePrefsReader::registerArgument(#shortOption[0],#longOption,section,key,description,argname)
52
53//! A class for reading commandline arguments into Preferences
54class CmdLinePrefsReader
55{
56
57 public:
58   CmdLinePrefsReader();
59   virtual ~CmdLinePrefsReader();
60
61    bool parse(int argc, char** argv);
62   
63    static bool registerArgument( const char shortOption, const std::string & longOption, const std::string & section, const std::string & key, const std::string & help,  const std::string & argName = "", const std::string & value = "%arg%" );
64   
65    static bool asdf;
66   
67  private:
68    static bool callBack( ArgTableEntry entry, void* data, const std::string & arg, const std::vector<MultiType> & argArgs );
69   
70    static RegistredArgs regArgs;
71
72};
73
74#endif /* _PROTO_CLASS_H */
Note: See TracBrowser for help on using the repository browser.