Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/parser/preferences/cmd_line_prefs_reader.h @ 8599

Last change on this file since 8599 was 7256, checked in by bensch, 19 years ago

orxonox/trunk: merged the preferences back to the trunk
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/preferences . -r7233:HEAD
no conflicts… nice work

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