Mir
forward.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2022 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 
20 namespace mir
21 {
22 /// Basic geometry types. Types for dimensions, displacements, etc.
23 /// and the operations that they support.
24 namespace 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 /// @{
30 struct WidthTag{};
31 struct HeightTag{};
32 struct XTag{};
33 struct YTag{};
34 struct DeltaXTag{};
35 struct DeltaYTag{};
36 struct StrideTag{};
37 /// @}
38 
39 namespace generic
40 {
41 template<typename T, typename Tag>
42 struct Value;
43 
44 template<typename T>
45 struct Point;
46 
47 template<typename T>
48 struct Size;
49 
50 template<typename T>
51 struct Displacement;
52 
53 template<typename T>
54 struct Rectangle;
55 
56 template<typename T> using Width = Value<T, WidthTag>;
57 template<typename T> using Height = Value<T, HeightTag>;
58 template<typename T> using X = Value<T, XTag>;
59 template<typename T> using Y = Value<T, YTag>;
60 template<typename T> using DeltaX = Value<T, DeltaXTag>;
61 template<typename T> using DeltaY = Value<T, DeltaYTag>;
62 }
63 
64 using Width = generic::Width<int>;
65 using Height = generic::Height<int>;
66 using X = generic::X<int>;
67 using Y = generic::Y<int>;
68 using DeltaX = generic::DeltaX<int>;
69 using DeltaY = generic::DeltaY<int>;
70 
71 using WidthF = generic::Width<float>;
72 using HeightF = generic::Height<float>;
73 using XF = generic::X<float>;
74 using YF = generic::Y<float>;
75 using DeltaXF = generic::DeltaX<float>;
76 using DeltaYF = generic::DeltaY<float>;
77 
78 // Just to be clear, mir::geometry::Stride is the stride of the buffer in bytes
79 using Stride = generic::Value<int, StrideTag>;
80 
81 using Point = generic::Point<int>;
82 using Size = generic::Size<int>;
83 using Displacement = generic::Displacement<int>;
84 using Rectangle = generic::Rectangle<int>;
85 
86 using PointF = generic::Point<float>;
87 using SizeF = generic::Size<float>;
88 using DisplacementF = generic::Displacement<float>;
89 using RectangleF = generic::Rectangle<int>;
90 }
91 }
92 
93 #endif // MIR_GEOMETRY_FORWARD_H_

Copyright © 2012-2022 Canonical Ltd.
Generated on Tue Sep 13 03:20:30 UTC 2022
This documentation is licensed under the GPL version 2 or 3.