Debian Codegraph @

samples/qtvidcap/parsecl.h

raw
1 /*
2 kwintv, Video4Linux based TV application
3
4 Copyright (C) 1998,1999 Moritz Wenk ([email protected])
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef PARSECL_H
22 #define PARSECL_H
23
24 #include <default.h>
25 #include <avm_stl.h>
26
27
28
29
30
31
32
33
34
35
36
37
38 struct parse_option {
39 int oshort;
40 const char* olong;
41 const char* help;
42
43 void* val;
44 enum { BOOL, INT, STRING, ANYSTRING, CODECINFO } type;
45 int maxval;
46 int minval;
47 const char* arr[];
48 };
49
50 class parsecl
51 {
52 public:
53 parsecl(int _argc = 0, char *_argv[] = 0,
54 const struct parse_option* opt = 0,
55 const char* help = 0);
56 ~parsecl();
57
58 int getInt(int oid, int odefault, int min, int max) const;
59 const char * getString(int oid, const char* odefault, const char* opt[] = 0) const;
60 bool getSwitch(int oid, bool odefault) const;
61
62 protected:
63 const char* find(int oid) const;
64 int argc;
65 char** argv;
66 const struct parse_option* opt;
67 };
68
69 #endif /* PARSECL_H */