Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10768 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.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 "lib/util/debug.h"
14#include "lib/util/multi_type.h"
15
16
17struct ArgTableEntry
18{
19  unsigned int    id;
20  std::string     longOption;
21  char            shortOption;
22  unsigned 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.