Mir
forward.h
Go to the documentation of this file.
1/*
2 * Copyright © 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
17#ifndef MIR_GEOMETRY_FORWARD_H_
18#define MIR_GEOMETRY_FORWARD_H_
19
20namespace mir
21{
22/// Basic geometry types. Types for dimensions, displacements, etc.
23/// and the operations that they support.
24namespace geometry
25{
26/// These tag types determine what type of dimension a value holds and what operations are possible with it. They are
27/// only used as template parameters, are never instantiated and should only require forward declarations, but some
28/// compiler versions seem to fail if they aren't given real declarations.
29/// @{
30struct WidthTag{};
31struct HeightTag{};
32struct XTag{};
33struct YTag{};
34struct DeltaXTag{};
35struct DeltaYTag{};
36struct StrideTag{};
37/// @}
38
39namespace generic
40{
41template<typename T, typename Tag>
42struct Value;
43
44template<typename T>
45struct Point;
46
47template<typename T>
48struct Size;
49
50template<typename T>
51struct Displacement;
52
53template<typename T>
54struct Rectangle;
55
56template<typename T> using Width = Value<T, WidthTag>;
57template<typename T> using Height = Value<T, HeightTag>;
58template<typename T> using X = Value<T, XTag>;
59template<typename T> using Y = Value<T, YTag>;
60template<typename T> using DeltaX = Value<T, DeltaXTag>;
61template<typename T> using DeltaY = Value<T, DeltaYTag>;
62}
63
64using Width = generic::Width<int>;
65using Height = generic::Height<int>;
66using X = generic::X<int>;
67using Y = generic::Y<int>;
68using DeltaX = generic::DeltaX<int>;
69using DeltaY = generic::DeltaY<int>;
70
71using WidthF = generic::Width<float>;
72using HeightF = generic::Height<float>;
73using XF = generic::X<float>;
74using YF = generic::Y<float>;
75using DeltaXF = generic::DeltaX<float>;
76using DeltaYF = generic::DeltaY<float>;
77
78// Just to be clear, mir::geometry::Stride is the stride of the buffer in bytes
79using Stride = generic::Value<int, StrideTag>;
80
81using Point = generic::Point<int>;
82using Size = generic::Size<int>;
83using Displacement = generic::Displacement<int>;
84using Rectangle = generic::Rectangle<int>;
85
86using PointF = generic::Point<float>;
87using SizeF = generic::Size<float>;
88using DisplacementF = generic::Displacement<float>;
89using RectangleF = generic::Rectangle<int>;
90}
91}
92
93#endif // MIR_GEOMETRY_FORWARD_H_
Definition: size.h:29
Basic geometry types. Types for dimensions, displacements, etc. and the operations that they support.
Definition: size.h:27
Definition: runner.h:27
Definition: forward.h:34
Definition: forward.h:35
Definition: forward.h:31
Definition: forward.h:36
These tag types determine what type of dimension a value holds and what operations are possible with ...
Definition: forward.h:30
Definition: forward.h:32
Definition: forward.h:33
Definition: size.h:37

Copyright © 2012-2023 Canonical Ltd.
Generated on Tue 2 May 10:01:24 UTC 2023
This documentation is licensed under the GPL version 2 or 3.