Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups 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 
19 #ifndef MIR_GEOMETRY_RECTANGLES_H_
20 #define MIR_GEOMETRY_RECTANGLES_H_
21 
22 #include "point.h"
23 #include "rectangle.h"
24 
25 #include <vector>
26 #include <initializer_list>
27 
28 namespace mir
29 {
30 namespace geometry
31 {
32 
34 {
35 public:
36  Rectangles();
37  Rectangles(std::initializer_list<Rectangle> const& rects);
38  /* We want to keep implicit copy and move methods */
39 
40  void add(Rectangle const& rect);
41  void clear();
43  void confine(Point& point) const;
44 
45  typedef std::vector<Rectangle>::const_iterator const_iterator;
46  typedef std::vector<Rectangle>::size_type size_type;
47  const_iterator begin() const;
48  const_iterator end() const;
49  size_type size() const;
50 
51  bool operator==(Rectangles const& rect) const;
52  bool operator!=(Rectangles const& rect) const;
53 
54 private:
55  std::vector<Rectangle> rectangles;
56  Rectangle bounding_rectangle_;
57 };
58 
59 
60 std::ostream& operator<<(std::ostream& out, Rectangles const& value);
61 
62 }
63 }
64 
65 #endif /* MIR_GEOMETRY_RECTANGLES_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013