Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
rectangles.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 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 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  * XXX This header is only used externally in one location in QtMir. It could
19  * possibly be made private with only minor changes.
20  */
21 
22 #ifndef MIR_GEOMETRY_RECTANGLES_H_
23 #define MIR_GEOMETRY_RECTANGLES_H_
24 
25 #include "mir/geometry/point.h"
26 #include "mir/geometry/rectangle.h"
27 
28 #include <vector>
29 #include <initializer_list>
30 
31 namespace mir
32 {
33 namespace geometry
34 {
35 
37 {
38 public:
39  Rectangles();
40  Rectangles(std::initializer_list<Rectangle> const& rects);
41  /* We want to keep implicit copy and move methods */
42 
43  void add(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_;
60 };
61 
62 
63 std::ostream& operator<<(std::ostream& out, Rectangles const& value);
64 
65 }
66 }
67 
68 #endif /* MIR_GEOMETRY_RECTANGLES_H_ */
All things Mir.
Definition: aging_buffer.h:24
const_iterator end() const
Definition: rectangles.cpp:147
Rectangles()
Definition: rectangles.cpp:44
void clear()
Definition: rectangles.cpp:58
Definition: rectangles.h:36
Definition: point.h:30
void confine(Point &point) const
Definition: rectangles.cpp:63
size_type size() const
Definition: rectangles.cpp:152
const_iterator begin() const
Definition: rectangles.cpp:142
Rectangle bounding_rectangle() const
Definition: rectangles.cpp:110
std::ostream & operator<<(std::ostream &out, Displacement const &value)
Definition: ostream.cpp:29
bool operator!=(Rectangles const &rect) const
Definition: rectangles.cpp:186
Definition: rectangle.h:33
bool operator==(Rectangles const &rect) const
Definition: rectangles.cpp:157
void add(Rectangle const &rect)
Definition: rectangles.cpp:53
std::vector< Rectangle >::size_type size_type
Definition: rectangles.h:49
std::vector< Rectangle >::const_iterator const_iterator
Definition: rectangles.h:48

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Oct 10 14:07:14 UTC 2014