File: forward.h

package info (click to toggle)
wlcs 1.8.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,528 kB
  • sloc: cpp: 14,211; xml: 7,744; ansic: 952; sh: 164; makefile: 33
file content (88 lines) | stat: -rw-r--r-- 2,649 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * Copyright © Canonical Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 2 or 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef WLCS_GEOMETRY_FORWARD_H_
#define WLCS_GEOMETRY_FORWARD_H_

namespace wlcs
{
/// These tag types determine what type of dimension a value holds and what operations are possible with it. They are
/// only used as template parameters, are never instantiated and should only require forward declarations, but some
/// compiler versions seem to fail if they aren't given real declarations.
/// @{
struct WidthTag{};
struct HeightTag{};
struct XTag{};
struct YTag{};
struct DeltaXTag{};
struct DeltaYTag{};
struct StrideTag{};
/// @}

namespace generic
{
template<typename T, typename Tag>
struct Value;

template<typename T>
struct Point;

template<typename T>
struct Size;

template<typename T>
struct Displacement;

template<typename T>
struct Rectangle;

template<typename T> using Width = Value<T, WidthTag>;
template<typename T> using Height = Value<T, HeightTag>;
template<typename T> using X = Value<T, XTag>;
template<typename T> using Y = Value<T, YTag>;
template<typename T> using DeltaX = Value<T, DeltaXTag>;
template<typename T> using DeltaY = Value<T, DeltaYTag>;
}

using Width = generic::Width<int>;
using Height = generic::Height<int>;
using X = generic::X<int>;
using Y = generic::Y<int>;
using DeltaX = generic::DeltaX<int>;
using DeltaY = generic::DeltaY<int>;

using WidthF = generic::Width<float>;
using HeightF = generic::Height<float>;
using XF = generic::X<float>;
using YF = generic::Y<float>;
using DeltaXF = generic::DeltaX<float>;
using DeltaYF = generic::DeltaY<float>;

// Just to be clear, mir::geometry::Stride is the stride of the buffer in bytes
using Stride = generic::Value<int, StrideTag>;

using Point = generic::Point<int>;
using Size = generic::Size<int>;
using Displacement = generic::Displacement<int>;
using Rectangle = generic::Rectangle<int>;

using PointF = generic::Point<float>;
using SizeF = generic::Size<float>;
using DisplacementF = generic::Displacement<float>;
using RectangleF = generic::Rectangle<int>;
}

#endif // WLCS_GEOMETRY_FORWARD_H_