~ubuntu-branches/ubuntu/wily/mir/wily-proposed

« back to all changes in this revision

Viewing changes to include/shared/mir/geometry/rectangles.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-10-10 14:01:26 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20141010140126-n1czko8na1kuz4ll
Tags: upstream-0.8.0+14.10.20141010
Import upstream version 0.8.0+14.10.20141010

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
33
 
class Rectangles
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();
42
 
    Rectangle bounding_rectangle() const;
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_ */