Mir
rectangles.h
Go to the documentation of this file.
1/*
2 * Copyright © Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 2 or 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef MIR_GEOMETRY_RECTANGLES_H_
18#define MIR_GEOMETRY_RECTANGLES_H_
19
20#include "mir/geometry/point.h"
21#include "mir/geometry/rectangle.h"
22
23#include <vector>
24#include <initializer_list>
25
26namespace mir
27{
28namespace geometry
29{
30
31/// A collection of rectangles (with possible duplicates).
33{
34public:
36 Rectangles(std::initializer_list<Rectangle> const& rects);
37 /* We want to keep implicit copy and move methods */
38
39 void add(Rectangle const& rect);
40 /// removes at most one matching rectangle
41 void remove(Rectangle const& rect);
42 void clear();
43 Rectangle bounding_rectangle() const;
44 void confine(Point& point) const;
45
46 typedef std::vector<Rectangle>::const_iterator const_iterator;
47 typedef std::vector<Rectangle>::size_type size_type;
48 const_iterator begin() const;
49 const_iterator end() const;
50 size_type size() const;
51
52 bool operator==(Rectangles const& rect) const;
53 bool operator!=(Rectangles const& rect) const;
54
55private:
56 std::vector<Rectangle> rectangles;
57};
58
59
60std::ostream& operator<<(std::ostream& out, Rectangles const& value);
61
62}
63}
64
65#endif /* MIR_GEOMETRY_RECTANGLES_H_ */
A collection of rectangles (with possible duplicates).
Definition: rectangles.h:33
void confine(Point &point) const
void remove(Rectangle const &rect)
removes at most one matching rectangle
bool operator==(Rectangles const &rect) const
Rectangles(std::initializer_list< Rectangle > const &rects)
size_type size() const
void add(Rectangle const &rect)
bool operator!=(Rectangles const &rect) const
const_iterator begin() const
Rectangle bounding_rectangle() const
const_iterator end() const
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: size.h:27
Definition: runner.h:27

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue 2 May 10:01:24 UTC 2023
This documentation is licensed under the GPL version 2 or 3.