MyGUI
3.2.0
Main Page
Related Pages
Namespaces
Data Structures
Files
Examples
File List
Globals
MyGUIEngine
src
MyGUI_Exception.cpp
Go to the documentation of this file.
1
6
/*
7
This file is part of MyGUI.
8
9
MyGUI is free software: you can redistribute it and/or modify
10
it under the terms of the GNU Lesser General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
(at your option) any later version.
13
14
MyGUI is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public License
20
along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
#include "
MyGUI_Precompiled.h
"
23
#include "
MyGUI_Exception.h
"
24
#include "
MyGUI_StringUtility.h
"
25
26
namespace
MyGUI
27
{
28
29
Exception::Exception
(
const
std::string& _description,
const
std::string& _source,
const
char
* _file,
long
_line ) :
30
mDescription(_description),
31
mSource(_source),
32
mFile(_file),
33
mLine(_line)
34
{
35
}
36
37
Exception::Exception
(
const
Exception
& _rhs) :
38
mDescription(_rhs.mDescription),
39
mSource(_rhs.mSource),
40
mFile(_rhs.mFile),
41
mLine(_rhs.mLine),
42
mFullDesc(_rhs.mFullDesc)
43
{
44
}
45
46
Exception::~Exception
() throw()
47
{
48
}
49
50
Exception
&
Exception::operator =
(
const
Exception
& _rhs)
51
{
52
mDescription
= _rhs.
mDescription
;
53
mSource
= _rhs.
mSource
;
54
mFile
= _rhs.
mFile
;
55
mLine
= _rhs.
mLine
;
56
mFullDesc
= _rhs.
mFullDesc
;
57
return
*
this
;
58
}
59
60
const
std::string&
Exception::getFullDescription
()
const
61
{
62
if
(
mFullDesc
.empty())
63
{
64
if
(
mLine
> 0 )
65
{
66
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
,
" at "
,
mFile
,
" (line "
,
mLine
,
")"
);
67
}
68
else
69
{
70
mFullDesc
=
utility::toString
(
"MyGUI EXCEPTION : "
,
mDescription
,
" in "
,
mSource
);
71
}
72
}
73
74
return
mFullDesc
;
75
}
76
77
const
std::string&
Exception::getSource
()
const
78
{
79
return
mSource
;
80
}
81
82
const
std::string&
Exception::getFile
()
const
83
{
84
return
mFile
;
85
}
86
87
long
Exception::getLine
()
const
88
{
89
return
mLine
;
90
}
91
92
const
std::string&
Exception::getDescription
()
const
93
{
94
return
mDescription
;
95
}
96
97
// Override std::exception::what
98
const
char
*
Exception::what
()
const
throw()
99
{
100
return
getFullDescription
().c_str();
101
}
102
103
}
// namespace MyGUI
Generated by
1.8.3.1