MyGUI
3.2.2
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
() throw()
32
{
33
}
34
35
Exception
&
Exception::operator =
(
const
Exception
& _rhs)
36
{
37
mDescription
= _rhs.
mDescription
;
38
mSource
= _rhs.
mSource
;
39
mFile
= _rhs.
mFile
;
40
mLine
= _rhs.
mLine
;
41
mFullDesc
= _rhs.
mFullDesc
;
42
return
*
this
;
43
}
44
45
const
std::string&
Exception::getFullDescription
()
const
46
{
47
if
(
mFullDesc
.empty())
48
{
49
if
(
mLine
> 0 )
50
{
51
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
,
" at "
,
mFile
,
" (line "
,
mLine
,
")"
);
52
}
53
else
54
{
55
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
);
56
}
57
}
58
59
return
mFullDesc
;
60
}
61
62
const
std::string&
Exception::getSource
()
const
63
{
64
return
mSource
;
65
}
66
67
const
std::string&
Exception::getFile
()
const
68
{
69
return
mFile
;
70
}
71
72
long
Exception::getLine
()
const
73
{
74
return
mLine
;
75
}
76
77
const
std::string&
Exception::getDescription
()
const
78
{
79
return
mDescription
;
80
}
81
82
// Override std::exception::what
83
const
char
*
Exception::what
()
const
throw()
84
{
85
return
getFullDescription
().c_str();
86
}
87
88
}
// namespace MyGUI
MyGUI::utility::toString
std::string toString(T p)
Definition:
MyGUI_StringUtility.h:27
MyGUI::Exception::mLine
long mLine
Definition:
MyGUI_Exception.h:47
MyGUI::Exception::getDescription
virtual const std::string & getDescription() const
Definition:
MyGUI_Exception.cpp:77
MyGUI::Exception::~Exception
~Exception()
Definition:
MyGUI_Exception.cpp:31
MyGUI::Exception::mDescription
std::string mDescription
Definition:
MyGUI_Exception.h:44
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:35
MyGUI::Exception::getSource
virtual const std::string & getSource() const
Definition:
MyGUI_Exception.cpp:62
MyGUI_Exception.h
MyGUI::Exception
Definition:
MyGUI_Exception.h:17
MyGUI_Precompiled.h
MyGUI::Exception::getFile
virtual const std::string & getFile() const
Definition:
MyGUI_Exception.cpp:67
MyGUI::Exception::mSource
std::string mSource
Definition:
MyGUI_Exception.h:45
MyGUI::Exception::getLine
virtual long getLine() const
Definition:
MyGUI_Exception.cpp:72
MyGUI::Exception::mFile
std::string mFile
Definition:
MyGUI_Exception.h:46
MyGUI::Exception::mFullDesc
std::string mFullDesc
Definition:
MyGUI_Exception.h:48
MyGUI::Exception::getFullDescription
virtual const std::string & getFullDescription() const
Definition:
MyGUI_Exception.cpp:45
MyGUI_StringUtility.h
MyGUI
Definition:
MyGUI_ActionController.h:14
MyGUI::Exception::what
const char * what() const
Definition:
MyGUI_Exception.cpp:83
Generated by
1.8.16