Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10657 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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