dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / library / perforce / include / options.h
blobfadad2a78697668b668104667a5604fed393941f
1 /*
2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
5 */
8 const int N_OPTS = 20;
10 enum OptFlag {
11 // Bitwise selectors
13 OPT_ONE = 0x01, // exactly one
14 OPT_TWO = 0x02, // exactly two
15 OPT_THREE = 0x04, // exactly three
16 OPT_MORE = 0x08, // more than two
17 OPT_NONE = 0x10, // require none
18 OPT_MAKEONE = 0x20, // if none, make one that points to null
20 // combos of the above
22 OPT_OPT = 0x11, // NONE, or ONE
23 OPT_ANY = 0x1F, // ONE, TWO, THREE, MORE, or NONE
24 OPT_DEFAULT = 0x2F, // ONE, TWO, THREE, MORE, or MAKEONE
25 OPT_SOME = 0x0F // ONE, TWO, THREE, or MORE
26 } ;
28 class Options
30 public:
31 Options() { optc = 0; }
33 void Parse( int &argc, char **&argv, const char *opts,
34 int flag, const ErrorId &usage, Error *e );
36 void Parse( int &argc, StrPtr *&argv, const char *opts,
37 int flag, const ErrorId &usage, Error *e );
39 StrPtr * GetValue( char opt, int subopt );
41 StrPtr * operator [](char opt) { return GetValue( opt, 0 ); }
43 private:
44 int optc;
46 char flags[ N_OPTS ];
47 StrRef vals[ N_OPTS ];
48 } ;