tclap
1.2.5
include
tclap
Constraint.h
Go to the documentation of this file.
1
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2
3
4
/******************************************************************************
5
*
6
* file: Constraint.h
7
*
8
* Copyright (c) 2005, Michael E. Smoot
9
* Copyright (c) 2017, Google LLC
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
#ifndef TCLAP_CONSTRAINT_H
26
#define TCLAP_CONSTRAINT_H
27
28
#include <string>
29
#include <vector>
30
#include <list>
31
#include <iostream>
32
#include <iomanip>
33
#include <algorithm>
34
#include <stdexcept>
35
36
namespace
TCLAP
{
37
41
template
<
class
T>
42
class
Constraint
43
{
44
45
public
:
49
virtual
std::string
description
()
const
=0;
50
54
virtual
std::string
shortID
()
const
=0;
55
61
virtual
bool
check
(
const
T& value)
const
=0;
62
68
virtual
~Constraint
() { ; }
69
70
static
std::string
shortID
(
Constraint<T>
*constraint) {
71
if
(!constraint)
72
throw
std::logic_error(
"Cannot create a ValueArg with a NULL constraint"
);
73
return
constraint->shortID();
74
}
75
};
76
77
}
//namespace TCLAP
78
#endif
TCLAP::Constraint::~Constraint
virtual ~Constraint()
Destructor.
Definition:
Constraint.h:106
TCLAP::Constraint::description
virtual std::string description() const =0
Returns a description of the Constraint.
TCLAP::Constraint::shortID
virtual std::string shortID() const =0
Returns the short ID for the Constraint.
TCLAP::Constraint
The interface that defines the interaction between the Arg and Constraint.
Definition:
Constraint.h:61
TCLAP::Constraint::check
virtual bool check(const T &value) const =0
The method used to verify that the value parsed from the command line meets the constraint.
TCLAP
Definition:
Arg.h:48
Generated by
1.8.17