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