Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/parser/cmdline_parser/cmdline_parser.h @ 8089

Last change on this file since 8089 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.1 KB
Line 
1/*!
2 * @file cmdline_parser.h
3 * @brief Definition of ...
4 */
5
6#ifndef _CMD_LINE_PARSER_H
7#define _CMD_LINE_PARSER_H
8
9#include <list>
10#include <string>
11#include <vector>
12
13#include "src/defs/debug.h"
14#include "src/lib/util/multi_type.h"
15
16
17struct ArgTableEntry
18{
19  int         id;
20  std::string longOption;
21  char        shortOption;
22  int         numArgs;
23  std::string argNames;
24  std::string help;
25};
26
27typedef std::list<ArgTableEntry> ArgTable;
28
29typedef bool (*ArgParserCallback)( ArgTableEntry, void*, const std::string &, const std::vector<MultiType> & );
30
31
32//! A class for parsing command line arguments
33class CmdLineParser {
34
35  public:
36    CmdLineParser();
37    virtual ~CmdLineParser();
38   
39    bool add( int id, const std::string& longOption, char shortOption, int numArgs, const std::string & argNames, const std::string& help, bool back=false );
40
41    bool parse( ArgParserCallback cb, void* data, int argc, char** argv );
42   
43    void showHelp();
44   
45  private:
46    ArgTable argTable;
47    std::string exeName;
48   
49    inline bool matches( ArgTableEntry entry, std::string arg, bool & finish );
50
51};
52
53#endif /* _CMD_LINE_PARSER_H */
Note: See TracBrowser for help on using the repository browser.