Mir
rectangles.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013-2015 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 * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17 */
18
19#ifndef MIR_GEOMETRY_RECTANGLES_H_
20#define MIR_GEOMETRY_RECTANGLES_H_
21
22#include "mir/geometry/point.h"
24
25#include <vector>
26#include <initializer_list>
27
28namespace mir
29{
30namespace geometry
31{
32
35{
36public:
38 Rectangles(std::initializer_list<Rectangle> const& rects);
39 /* We want to keep implicit copy and move methods */
40
41 void add(Rectangle const& rect);
43 void remove(Rectangle const& rect);
44 void clear();
46 void confine(Point& point) const;
47
48 typedef std::vector<Rectangle>::const_iterator const_iterator;
49 typedef std::vector<Rectangle>::size_type size_type;
52 size_type size() const;
53
54 bool operator==(Rectangles const& rect) const;
55 bool operator!=(Rectangles const& rect) const;
56
57private:
58 std::vector<Rectangle> rectangles;
59 Rectangle bounding_rectangle_; // TODO unused: delete on next ABI break
60};
61
62
63std::ostream& operator<<(std::ostream& out, Rectangles const& value);
64
65}
66}
67
68#endif /* MIR_GEOMETRY_RECTANGLES_H_ */
A collection of rectangles (with possible duplicates).
Definition: rectangles.h:35
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)
std::vector< Rectangle >::size_type size_type
Definition: rectangles.h:49
size_type size() const
void add(Rectangle const &rect)
bool operator!=(Rectangles const &rect) const
std::vector< Rectangle >::const_iterator const_iterator
Definition: rectangles.h:48
const_iterator begin() const
Rectangle bounding_rectangle() const
const_iterator end() const
std::ostream & operator<<(std::ostream &out, Displacement const &value)
Definition: splash_session.h:24
Definition: point.h:31
Definition: rectangle.h:34

Copyright © 2012-2022 Canonical Ltd.
Generated on Sat 3 Dec 14:36:51 UTC 2022
This documentation is licensed under the GPL version 2 or 3.