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"
23 #include "mir/geometry/rectangle.h"
24 
25 #include <vector>
26 #include <initializer_list>
27 
28 namespace mir
29 {
30 namespace geometry
31 {
32 
35 {
36 public:
37  Rectangles();
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;
50  const_iterator begin() const;
51  const_iterator end() const;
52  size_type size() const;
53 
54  bool operator==(Rectangles const& rect) const;
55  bool operator!=(Rectangles const& rect) const;
56 
57 private:
58  std::vector<Rectangle> rectangles;
59  Rectangle bounding_rectangle_; // TODO unused: delete on next ABI break
60 };
61 
62 
63 std::ostream& operator<<(std::ostream& out, Rectangles const& value);
64 
65 }
66 }
67 
68 #endif /* MIR_GEOMETRY_RECTANGLES_H_ */
Definition: splash_session.h:24
const_iterator end() const
A collection of rectangles (with possible duplicates).
Definition: rectangles.h:34
Definition: point.h:30
void confine(Point &point) const
size_type size() const
Rectangle bounding_rectangle() const
bool operator!=(Rectangles const &rect) const
Definition: rectangle.h:33
std::ostream & operator<<(std::ostream &out, Displacement const &value)
const_iterator begin() const
bool operator==(Rectangles const &rect) const
void add(Rectangle const &rect)
std::vector< Rectangle >::size_type size_type
Definition: rectangles.h:49
std::vector< Rectangle >::const_iterator const_iterator
Definition: rectangles.h:48

Copyright © 2012-2022 Canonical Ltd.
Generated on Thu Jan 27 21:10:36 UTC 2022
This documentation is licensed under the GPL version 2 or 3.