MyGUI
3.4.0
MyGUIEngine
src
MyGUI_Exception.cpp
Go to the documentation of this file.
1
/*
2
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
3
* Distributed under the MIT License
4
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5
*/
6
7
#include "
MyGUI_Precompiled.h
"
8
#include "
MyGUI_Exception.h
"
9
#include "
MyGUI_StringUtility.h
"
10
11
namespace
MyGUI
12
{
13
14
Exception::Exception
(
const
std::string& _description,
const
std::string& _source,
const
char
* _file,
long
_line ) :
15
mDescription(_description),
16
mSource(_source),
17
mFile(_file),
18
mLine(_line)
19
{
20
}
21
22
Exception::Exception
(
const
Exception
& _rhs) :
23
mDescription(_rhs.mDescription),
24
mSource(_rhs.mSource),
25
mFile(_rhs.mFile),
26
mLine(_rhs.mLine),
27
mFullDesc(_rhs.mFullDesc)
28
{
29
}
30
31
Exception
&
Exception::operator =
(
const
Exception
& _rhs)
32
{
33
mDescription
= _rhs.
mDescription
;
34
mSource
= _rhs.
mSource
;
35
mFile
= _rhs.
mFile
;
36
mLine
= _rhs.
mLine
;
37
mFullDesc
= _rhs.
mFullDesc
;
38
return
*
this
;
39
}
40
41
const
std::string&
Exception::getFullDescription
()
const
42
{
43
if
(
mFullDesc
.empty())
44
{
45
if
(
mLine
> 0 )
46
{
47
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
,
" at "
,
mFile
,
" (line "
,
mLine
,
")"
);
48
}
49
else
50
{
51
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
);
52
}
53
}
54
55
return
mFullDesc
;
56
}
57
58
const
std::string&
Exception::getSource
()
const
59
{
60
return
mSource
;
61
}
62
63
const
std::string&
Exception::getFile
()
const
64
{
65
return
mFile
;
66
}
67
68
long
Exception::getLine
()
const
69
{
70
return
mLine
;
71
}
72
73
const
std::string&
Exception::getDescription
()
const
74
{
75
return
mDescription
;
76
}
77
78
// Override std::exception::what
79
const
char
*
Exception::what
() const noexcept
80
{
81
return
getFullDescription
().c_str();
82
}
83
84
}
// namespace MyGUI
MyGUI::utility::toString
std::string toString(T p)
Definition:
MyGUI_StringUtility.h:27
MyGUI::Exception::mLine
long mLine
Definition:
MyGUI_Exception.h:49
MyGUI::Exception::getDescription
virtual const std::string & getDescription() const
Definition:
MyGUI_Exception.cpp:73
MyGUI::Exception::mDescription
std::string mDescription
Definition:
MyGUI_Exception.h:46
MyGUI::Exception::Exception
Exception(const std::string &_description, const std::string &_source, const char *_file, long _line)
Definition:
MyGUI_Exception.cpp:14
MyGUI::Exception::operator=
Exception & operator=(const Exception &_rhs)
Definition:
MyGUI_Exception.cpp:31
MyGUI::Exception::getSource
virtual const std::string & getSource() const
Definition:
MyGUI_Exception.cpp:58
MyGUI_Exception.h
MyGUI::Exception
Definition:
MyGUI_Exception.h:25
MyGUI_Precompiled.h
MyGUI::Exception::getFile
virtual const std::string & getFile() const
Definition:
MyGUI_Exception.cpp:63
MyGUI::Exception::mSource
std::string mSource
Definition:
MyGUI_Exception.h:47
MyGUI::Exception::getLine
virtual long getLine() const
Definition:
MyGUI_Exception.cpp:68
MyGUI::Exception::mFile
std::string mFile
Definition:
MyGUI_Exception.h:48
MyGUI::Exception::mFullDesc
std::string mFullDesc
Definition:
MyGUI_Exception.h:50
MyGUI::Exception::getFullDescription
virtual const std::string & getFullDescription() const
Definition:
MyGUI_Exception.cpp:41
MyGUI_StringUtility.h
MyGUI
Definition:
MyGUI_ActionController.h:15
MyGUI::Exception::what
const char * what() const noexcept override
Definition:
MyGUI_Exception.cpp:79
Generated by
1.8.20