Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/preferences/src/lib/parser/cmdline_parser/cmdline_parser.h @ 7245

Last change on this file since 7245 was 7243, checked in by rennerc, 19 years ago
File size: 993 bytes
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};
24
25typedef std::list<ArgTableEntry> ArgTable;
26
27typedef bool (*ArgParserCallback)( ArgTableEntry, void*, const std::string &, const std::vector<MultiType> & );
28
29
30//! A class for parsing command line arguments
31class CmdLineParser {
32
33  public:
34    CmdLineParser();
35    virtual ~CmdLineParser();
36   
37    bool add( int id, const std::string& longOption, char shortOption, int numArgs, bool back=false );
38
39    bool parse( ArgParserCallback cb, void* data, int argc, char** argv );
40   
41  private:
42    ArgTable argTable;
43   
44    inline bool matches( ArgTableEntry entry, std::string arg, bool & finish );
45
46};
47
48#endif /* _CMD_LINE_PARSER_H */
Note: See TracBrowser for help on using the repository browser.