1816
|
1 // prog-args.h -*- C++ -*- |
|
2 /* |
|
3 |
|
4 Copyright (C) 1996 John W. Eaton |
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_prog_args_h) |
|
25 #define octave_prog_args_h 1 |
|
26 |
|
27 struct |
|
28 long_options |
|
29 { |
|
30 const char *name; |
|
31 int has_arg; |
|
32 int *flag; |
|
33 int val; |
|
34 }; |
|
35 |
|
36 class |
|
37 prog_args |
|
38 { |
|
39 public: |
|
40 |
|
41 prog_args (int argc, char *const *argv, const char *s_opts, const |
|
42 long_options* l_opts = 0) |
|
43 : xargc (argc), xargv (argv), short_opts (s_opts), long_opts (l_opts) |
|
44 { |
|
45 init (); |
|
46 } |
|
47 |
|
48 ~prog_args (void) { } |
|
49 |
|
50 int getopt (void); |
|
51 |
|
52 const char *optarg (void); |
|
53 |
|
54 int optind (void); |
|
55 |
|
56 private: |
|
57 |
|
58 // Number of args. |
|
59 int xargc; |
|
60 |
|
61 // Program args. |
|
62 char *const *xargv; |
|
63 |
|
64 // Single character options. |
|
65 const char *short_opts; |
|
66 |
|
67 // Long options. |
|
68 const long_options *long_opts; |
|
69 |
|
70 void init (void); |
|
71 |
|
72 prog_args (const prog_args&); |
|
73 |
|
74 prog_args& operator = (const prog_args&); |
|
75 }; |
|
76 |
|
77 #endif |
|
78 |
|
79 /* |
|
80 ;;; Local Variables: *** |
|
81 ;;; mode: C++ *** |
|
82 ;;; page-delimiter: "^/\\*" *** |
|
83 ;;; End: *** |
|
84 */ |