-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathRexception.cpp
More file actions
88 lines (68 loc) · 2.35 KB
/
Rexception.cpp
File metadata and controls
88 lines (68 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// $Id: Rexception.cpp 1186 2019-07-12 17:49:59Z mueller $
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
// Revision History:
// Date Rev Version Comment
// 2018-10-27 1060 1.3 drop throw() list; use noexcept
// 2017-04-29 888 1.2 BUGFIX: add fErrtxt for proper what() return
// 2014-12-30 625 1.1 add ctor(meth,text,emsg)
// 2013-01-12 474 1.0 Initial version
// ---------------------------------------------------------------------------
/*!
\brief Implemenation of Rexception.
*/
#include "Rexception.hpp"
using namespace std;
/*!
\class Retro::Rexception
\brief FIXME_docs
*/
// all method definitions in namespace Retro
namespace Retro {
//------------------------------------------+-----------------------------------
//! Default constructor
Rexception::Rexception()
: fErrmsg(),
fErrtxt()
{
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
Rexception::Rexception(const RerrMsg& errmsg)
: fErrmsg(errmsg),
fErrtxt(fErrmsg.Message())
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
Rexception::Rexception(const std::string& meth, const std::string& text)
: fErrmsg(meth,text),
fErrtxt(fErrmsg.Message())
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
Rexception::Rexception(const std::string& meth, const std::string& text,
int errnum)
: fErrmsg(meth,text,errnum),
fErrtxt(fErrmsg.Message())
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
Rexception::Rexception(const std::string& meth, const std::string& text,
const RerrMsg& errmsg)
: fErrmsg(meth,text+errmsg.Message()),
fErrtxt(fErrmsg.Message())
{}
//------------------------------------------+-----------------------------------
//! Destructor
Rexception::~Rexception()
{}
//------------------------------------------+-----------------------------------
//! FIXME_docs
const char* Rexception::what() const noexcept
{
// what() must return a pointer to a string which stays valid at least as long
// as the exception object lives. Use member variable fErrtxt for this.
return fErrtxt.c_str();
}
} // end namespace Retro