Mercurial > illumos > onarm
annotate usr/src/cmd/man/src/util/nsgmls.src/include/Options.h @ 4:1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
author | Koji Uno <koji.uno@sun.com> |
---|---|
date | Mon, 31 Aug 2009 14:38:03 +0900 |
parents | c9caec207d52 |
children |
rev | line source |
---|---|
0 | 1 // Copyright (c) 1996 James Clark |
2 // See the file COPYING for copying permission. | |
4
1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
Koji Uno <koji.uno@sun.com>
parents:
0
diff
changeset
|
3 #pragma ident "%Z%%M% %I% %E% SMI" |
0 | 4 |
5 #ifndef Options_INCLUDED | |
6 #define Options_INCLUDED 1 | |
7 | |
8 #include "Boolean.h" | |
9 | |
10 #ifdef SP_NAMESPACE | |
11 namespace SP_NAMESPACE { | |
12 #endif | |
13 | |
14 // This is a mildly C++ified version of getopt(). | |
15 // It never prints any message. | |
16 | |
17 template<class T> | |
18 class Options { | |
19 public: | |
20 Options(int argc, T *const *, const T *); | |
21 // Returns false if there are no more options. | |
22 bool get(T &); | |
23 T *arg() const { return arg_; } // optarg | |
24 T opt() const { return opt_; } // optopt | |
25 int ind() const { return ind_; } // optind | |
26 private: | |
27 const T *search(T) const; | |
28 const T *opts_; | |
29 T *const *argv_; | |
30 int argc_; | |
31 int ind_; | |
32 T opt_; | |
33 T *arg_; | |
34 int sp_; | |
35 }; | |
36 | |
37 #ifdef SP_NAMESPACE | |
38 } | |
39 #endif | |
40 | |
41 #endif /* not Options_INCLUDED */ | |
42 | |
43 #ifdef SP_DEFINE_TEMPLATES | |
44 #include "Options.cxx" | |
45 #endif |