aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/bounds.hpp
blob: 7e920cfa3274ea55fc1bda86efb38dbc01b530d2 (plain)
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
#pragma once

#include "interfaces/vector2.hpp"

#include <functional>
#include <memory>

enum CoordsValidation
{
	VALID,
	X_HIGH,
	Y_HIGH
};

class IBounds
{
public:
	virtual ~IBounds() = default;

	[[nodiscard]] virtual unsigned int width() const = 0;

	virtual void width(unsigned int width) = 0;

	[[nodiscard]] virtual unsigned int height() const = 0;

	virtual void height(unsigned int height) = 0;

	[[nodiscard]] virtual CoordsValidation
	validate_coords(const IVector2 &coords) const = 0;

	virtual const IBounds &operator*=(const IBounds &bounds) = 0;
	virtual const IBounds &operator+=(const IBounds &bounds) = 0;
	virtual const IBounds &operator-=(const IBounds &bounds) = 0;
};

struct IBoundsOptions
{
	unsigned int width;
	unsigned int height;
};

using IBoundsFactory =
	std::function<std::shared_ptr<IBounds>(const IBoundsOptions &options)>;