seqcmdline.h
1 /***************************************************************************
2  seqcmdline.h - description
3  -------------------
4  begin : Tue Jan 18 2005
5  copyright : (C) 2000-2015 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SEQCMDLINE_H
19 #define SEQCMDLINE_H
20 
21 #include <odinseq/seqclass.h>
22 
23 #define USAGE_INDENTION_FACTOR 2
24 
25 
27 
28 
29 #ifdef NO_CMDLINE
30 struct SeqCmdlineActionList {}; // dummy class
31 #else
32 struct SeqCmdlineAction {
33  SeqCmdlineAction(const STD_string& act, const STD_string& descr) : action(act), description(descr) {}
34  void add_req_arg(const STD_string& opt, const STD_string& descr) {req_args[opt]=descr;}
35  void add_opt_arg(const STD_string& opt, const STD_string& descr) {opt_args[opt]=descr;}
36  STD_string action;
37  STD_string description;
38  STD_map<STD_string,STD_string> req_args;
39  STD_map<STD_string,STD_string> opt_args;
40 };
41 
42 typedef STD_list<SeqCmdlineAction> SeqCmdlineActionList;
43 #endif
44 
45 
47 
48 
53 class SeqCmdLine : public SeqClass {
54 
55  public:
56  static int process(int argc, char *argv[]);
57 
58  static STD_string format_actions(const SeqCmdlineActionList& actions);
59 
60  private:
61  static STD_string usage(const STD_string& meth, const STD_string& description);
62 
63 };
64 
65 
66 #endif