tclap 1.2.2
OptionalUnlabeledTracker.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4 *
5 * file: OptionalUnlabeledTracker.h
6 *
7 * Copyright (c) 2005, Michael E. Smoot .
8 * All rights reserved.
9 *
10 * See the file COPYING in the top directory of this distribution for
11 * more information.
12 *
13 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
20 *
21 *****************************************************************************/
22
23
24#ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
25#define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
26
27#include <string>
28
29namespace TCLAP {
30
32{
33
34 public:
35
36 static void check( bool req, const std::string& argName );
37
38 static void gotOptional() { alreadyOptionalRef() = true; }
39
40 static bool& alreadyOptional() { return alreadyOptionalRef(); }
41
42 private:
43
44 static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
45};
46
47
48inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
49{
52 "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
53 argName ) );
54
55 if ( !req )
57}
58
59
60} // namespace TCLAP
61
62#endif
static void check(bool req, const std::string &argName)
Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
Definition: ArgException.h:168
Definition: Arg.h:58