-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlError.cpp
More file actions
96 lines (74 loc) · 1.45 KB
/
ControlError.cpp
File metadata and controls
96 lines (74 loc) · 1.45 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
89
90
91
92
93
94
95
96
// ControlError.cpp: implementation of the ControlError class.
//
//////////////////////////////////////////////////////////////////////
#include "ControlError.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ControlError::ControlError()
{
this->first = 0;
}
ControlError::~ControlError()
{
while (this->first != 0)
{
control_error* tmp = this->first;
this->first = this->first->pNext;
delete tmp;
}
}
bool ControlError::AddError(char* err, int id)
{
if (err)
{
control_error* newerr = new control_error;
newerr->strErr = err;
newerr->iErrID = id;
newerr->pNext = this->first;
this->first = newerr;
return false;
}
return true;
}
bool ControlError::AddErrors(control_error* first)
{
if (first != 0)
{
if (this->first != 0)
{
control_error* tmp = this->first;
while (tmp->pNext != 0)
tmp = tmp->pNext;
tmp->pNext = first;
}
else
{
this->first = first;
}
return false;
}
return true;
}
bool ControlError::GetLastError(control_error &err)
{
if (this->first != 0)
{
err = *this->first;
control_error* tmp = this->first;
this->first = this->first->pNext;
delete tmp;
return true;
}
return false;
}
control_error* ControlError::GetErrors()
{
control_error* tmp = this->first;
this->first = 0;
return tmp;
}
bool ControlError::HasErrors()
{
return this->first != 0;
}