-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBorder.h
More file actions
173 lines (122 loc) · 5.52 KB
/
Border.h
File metadata and controls
173 lines (122 loc) · 5.52 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
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
//****************************************************************************
//
// Border
//
//****************************************************************************
#ifndef __Border_H__
#define __Border_H__
// ===========================================================================
// Libraries
// ===========================================================================
#include <cstdio>
#include <cstdlib>
// ===========================================================================
// Project Files
// ===========================================================================
// ===========================================================================
// Class declarations
// ===========================================================================
class Border
{
public :
// =======================================================================
// Enums
// =======================================================================
// =======================================================================
// Constructors
// =======================================================================
// Create a border by giving its type, the coordinates of a 1st point and
// the needed coordinate of the second to define the segment, depending on
// whether it is a vertical or horizontal line
// The type can be 0 (upper), 1 (lower), 2 (right) or 3 (left)
Border(int type, int new_x1, int new_y1, int new_c2, unsigned int new_color);
Border(int type, int new_x1, int new_y1, int new_c2);
// =======================================================================
// Destructor
// =======================================================================
virtual ~Border(void);
// =======================================================================
// Accessors: getters
// =======================================================================
// Gives the two points defining the border segment, in a 4-ints array
inline int* get_points();
inline unsigned int get_color();
inline int get_orientation();
// =======================================================================
// Accessors: setters
// =======================================================================
// =======================================================================
// Operators
// =======================================================================
// =======================================================================
// Public Methods
// =======================================================================
// =======================================================================
// Public Attributes
// =======================================================================
protected :
// =======================================================================
// Forbidden Constructors
// =======================================================================
Border(void)
{
printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
exit(EXIT_FAILURE);
};
Border(const Border &model)
{
printf("%s:%d: error: call to forbidden constructor.\n", __FILE__, __LINE__);
exit(EXIT_FAILURE);
};
// =======================================================================
// Protected Methods
// =======================================================================
// =======================================================================
// Protected Attributes
// =======================================================================
int orientation, x1, y1, c2;
unsigned int color;
double strength;
};
// ===========================================================================
// Getters' definitions
// ===========================================================================
int* Border::get_points()
{
int* res = new int [4];
// First point
res[0] = x1;
res[1] = y1;
// Second point
// If we have an horizontal line
if (orientation <= 1)
{
res[2] = c2;
res[3] = y1;
}
// If we have a vertical line
else
{
res[2] = x1;
res[3] = c2;
}
return res;
}
unsigned int Border::get_color()
{
return color;
}
int Border::get_orientation()
{
return orientation;
}
// ===========================================================================
// Setters' definitions
// ===========================================================================
// ===========================================================================
// Operators' definitions
// ===========================================================================
// ===========================================================================
// Inline functions' definition
// ===========================================================================
#endif // __Border_H__