VR-Link API Documentation for DIS
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
cmdLine
cmdArgException.h
Go to the documentation of this file.
1
2
/******************************************************************************
3
*
4
* file: ArgException.h
5
*
6
* Copyright (c) 2003, Michael E. Smoot .
7
* All rights reverved.
8
*
9
* See the file COPYING in the top directory of this distribution for
10
* more information.
11
*
12
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
13
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18
* DEALINGS IN THE SOFTWARE.
19
*
20
*****************************************************************************/
24
25
26
#ifndef DtCmdLine_ARG_EXCEPTION_H
27
#define DtCmdLine_ARG_EXCEPTION_H
28
29
30
#include <string>
31
#include <exception>
32
33
#ifdef DtUSE_UTILITIES_NAMESPACE
34
namespace
DtUSE_UTILITIES_NAMESPACE
35
{
36
#endif
37
38
namespace
DtCmdLine {
39
43
class
ArgException
:
public
std::exception
44
{
45
public
:
46
52
ArgException
(
const
std::string& text =
"undefined exception"
,
53
const
std::string&
id
=
"undefined"
,
54
const
std::string& td =
"Generic ArgException"
)
55
: std::exception(),
56
_errorText(text),
57
_argId( id ),
58
_typeDescription(td)
59
{ }
60
64
virtual
~
ArgException
() throw()
65
{ }
66
70
std::string error()
const
71
{
return
( _errorText ); }
72
76
std::string argId()
const
77
{
78
if
( _argId ==
"undefined"
)
79
return
" "
;
80
else
81
return
(
"Argument: "
+ _argId );
82
}
83
87
const
char
* what()
const
throw()
88
{
89
_ex = _argId +
" -- "
+ _errorText;
90
return
_ex.c_str();
91
}
92
97
std::string typeDescription()
const
98
{
99
return
_typeDescription;
100
}
101
102
103
private
:
104
108
std::string
_errorText
;
109
113
std::string
_argId
;
114
119
std::string
_typeDescription
;
120
124
mutable
std::string
_ex
;
125
};
126
131
class
ArgParseException
:
public
ArgException
132
{
133
public
:
140
ArgParseException
(
const
std::string& text =
"undefined exception"
,
141
const
std::string&
id
=
"undefined"
)
142
:
ArgException
( text,
143
id,
144
std::string(
"Exception found while parsing "
) +
145
std::string(
"the value the Arg has been passed."
))
146
{ }
147
};
148
153
class
CmdLineParseException
:
public
ArgException
154
{
155
public
:
162
CmdLineParseException
(
const
std::string& text =
"undefined exception"
,
163
const
std::string&
id
=
"undefined"
)
164
:
ArgException
( text,
165
id,
166
std::string(
"Exception found when the values "
) +
167
std::string(
"on the command line do not meet "
) +
168
std::string(
"the requirements of the defined "
) +
169
std::string(
"Args."
))
170
{ }
171
};
172
177
class
SpecificationException
:
public
ArgException
178
{
179
public
:
186
SpecificationException
(
const
std::string& text =
"undefined exception"
,
187
const
std::string&
id
=
"undefined"
)
188
:
ArgException
( text,
189
id,
190
std::string(
"Exception found when an Arg object "
)+
191
std::string(
"is improperly defined by the "
) +
192
std::string(
"developer."
))
193
{ }
194
195
};
196
197
}
198
199
#ifdef DtUSE_UTILITIES_NAMESPACE
200
}
201
#endif
202
203
#endif
204
Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (
www.mak.com
)