tclap  1.4.0
OptionalUnlabeledTracker.h
Go to the documentation of this file.
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
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 #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
24 #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
25 
26 #include <string>
27 
28 namespace TCLAP {
29 
31 public:
32  static void check(bool req, const std::string &argName);
33 
34  static void gotOptional() { alreadyOptionalRef() = true; }
35 
36  static bool &alreadyOptional() { return alreadyOptionalRef(); }
37 
38 private:
39  static bool &alreadyOptionalRef() {
40  static bool ct = false;
41  return ct;
42  }
43 };
44 
45 inline void OptionalUnlabeledTracker::check(bool req,
46  const std::string &argName) {
49  "You can't specify ANY Unlabeled Arg following an optional "
50  "Unlabeled Arg",
51  argName));
52 
54 }
55 
56 } // namespace TCLAP
57 
58 #endif // TCLAP_OPTIONAL_UNLABELED_TRACKER_H
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:150
Definition: Arg.h:46