-
Notifications
You must be signed in to change notification settings - Fork 0
/
aghException.cpp
142 lines (120 loc) · 3.76 KB
/
aghException.cpp
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#include <iostream>
#include <string.h>
// --------------------------------------------------------------
using namespace std;
// --------------------------------------------------------------
#include "aghException.h"
// --------------------------------------------------------------
aghException::aghException(void)
{
reset();
}
// --------------------------------------------------------------
aghException::aghException(aghException const& __other)
{
reset();
setErrorCode(__other.errorCode());
setErrorLine(__other.errorLine());
setErrorMessage(__other.errorMessage());
setErrorFile(__other.errorFile());
}
// --------------------------------------------------------------
aghException::aghException(int __errorCode, int __errorLine)
{
reset();
setErrorCode(__errorCode);
setErrorLine(__errorLine);
}
// --------------------------------------------------------------
aghException::aghException(int __errorCode, string __errorMessage)
{
reset();
setErrorCode(__errorCode);
setErrorMessage(__errorMessage);
}
// --------------------------------------------------------------
aghException::aghException(string __errorFile, int __errorLine)
{
reset();
setErrorLine(__errorLine);
setErrorFile(__errorFile);
}
// --------------------------------------------------------------
aghException::aghException(int __errorCode, string __errorMessage, string __errorFile, int __errorLine)
{
reset();
setErrorCode(__errorCode);
setErrorLine(__errorLine);
setErrorMessage(__errorMessage);
setErrorFile(__errorFile);
}
// --------------------------------------------------------------
aghException::~aghException(void)
{
reset();
}
// --------------------------------------------------------------
void aghException::reset(void)
{
_errorMessage = "";
_errorFile = "";
_errorLine = -1;
_errorCode = -1;
}
// --------------------------------------------------------------
int aghException::errorCode(void) const
{
return _errorCode;
}
// --------------------------------------------------------------
int aghException::errorLine(void) const
{
return _errorLine;
}
// --------------------------------------------------------------
string aghException::errorMessage(void) const
{
return _errorMessage;
}
// --------------------------------------------------------------
string aghException::errorFile(void) const
{
return _errorFile;
}
// --------------------------------------------------------------
void aghException::setErrorLine(int __errorLine)
{
_errorLine = __errorLine;
}
// --------------------------------------------------------------
void aghException::setErrorCode(int __errorCode)
{
_errorCode = __errorCode;
}
// --------------------------------------------------------------
void aghException::setErrorMessage(string __errorMessage)
{
_errorMessage = __errorMessage;
}
// --------------------------------------------------------------
void aghException::setErrorFile(string __errorFile)
{
_errorFile = __errorFile;
}
// --------------------------------------------------------------
aghException& aghException::operator=(aghException const& __other)
{
reset();
setErrorCode(__other.errorCode());
setErrorLine(__other.errorLine());
setErrorMessage(__other.errorMessage());
setErrorFile(__other.errorFile());
return *this;
}
// --------------------------------------------------------------
ostream& operator<<(ostream& __out, aghException& __exception)
{
__out << "Error in " << __exception.errorFile() << " file at " << __exception.errorLine() << " line.\nError code: " << __exception.errorCode() << " (" << __exception.errorMessage() << ").";
return __out;
}
//--------------------------------------------------------------