-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathExceptions.h
83 lines (63 loc) · 2.08 KB
/
Exceptions.h
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
//
// Created by Ivo Georgiev on 12/4/15.
//
#ifndef PA5GAME_EXCEPTIONS_H
#define PA5GAME_EXCEPTIONS_H
#include <iostream>
namespace Gaming {
class GamingException {
protected:
std::string __name;
virtual void __print_args(std::ostream &os) const = 0;
void setName(std::string name);
public:
std::string getName() const { return __name; };
friend std::ostream &operator<<(std::ostream &os, const GamingException &ex);
};
class DimensionEx : public GamingException {
protected:
unsigned __exp_width, __exp_height, __width, __height;
public:
DimensionEx(unsigned expWidth, unsigned expHeight, unsigned width, unsigned height);
unsigned getExpWidth() const;
unsigned getExpHeight() const;
unsigned getWidth() const;
unsigned getHeight() const;
};
class InsufficientDimensionsEx : public DimensionEx {
void __print_args(std::ostream &os) const override;
public:
InsufficientDimensionsEx(unsigned minWidth, unsigned minHeight, unsigned width, unsigned height);
};
class OutOfBoundsEx : public DimensionEx {
void __print_args(std::ostream &os) const override;
public:
OutOfBoundsEx(unsigned maxWidth, unsigned maxHeight, unsigned width, unsigned height);
};
class PositionEx : public GamingException {
private:
unsigned int __x, __y;
protected:
void __print_args(std::ostream &os) const override;
public:
PositionEx(unsigned x, unsigned y);
};
// to use in population methods
class PositionNonemptyEx : public PositionEx {
public:
PositionNonemptyEx(unsigned x, unsigned y);
};
// to use in Game Piece getter
class PositionEmptyEx : public PositionEx {
public:
PositionEmptyEx(unsigned x, unsigned y);
};
// to use with position randomizer
class PosVectorEmptyEx : public GamingException {
protected:
void __print_args(std::ostream &os) const override;
public:
PosVectorEmptyEx();
};
}
#endif //PA5GAME_EXCEPTIONS_H