-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathostream.h++
153 lines (130 loc) · 5.8 KB
/
ostream.h++
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/**
* The MIT License (MIT)
*
* Copyright © 2019-2020 Ruben Van Boxem
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
**/
#ifndef SKUI_CSS_OSTREAM_H
#define SKUI_CSS_OSTREAM_H
#include "css/color_stop.h++"
#include "css/time.h++"
#include "css/timing_function.h++"
#include "css/property/background.h++"
#include <iosfwd>
namespace skui::css
{
class color;
struct animation;
struct background_size_width_height;
struct background_size_auto;
struct box_shadow;
struct cubic_bezier;
struct infinite_t;
struct initial_t;
struct inherit_t;
struct length;
struct length_with_offset;
struct steps;
struct position;
enum class align_content : std::uint8_t;
enum class align_items : std::uint8_t;
enum class align_self : std::uint8_t;
enum class animation_direction : std::uint8_t;
enum class fill_mode : std::uint8_t;
enum class play_state : std::uint8_t;
enum class unit : std::uint8_t;
enum class background_size_keyword : std::uint8_t;
enum class box_decoration_break : std::uint8_t;
enum class box_sizing : std::uint8_t;
enum class caption_side : std::uint8_t;
enum class clear : std::uint8_t;
template<typename... Types>
std::ostream& operator<<(std::ostream& os, const std::vector<Types...>& values)
{
for(std::size_t i = 0; i<values.size(); ++i)
{
os << values[i] << ", ";
}
return os << values.back();
}
template<typename... ValueTypes>
std::ostream& operator<<(std::ostream& os, const std::variant<ValueTypes...>& value)
{
std::visit([&os](auto&& v) { os << v; }, value);
return os;
}
template<typename ValueType>
std::ostream& operator<<(std::ostream& os, const std::optional<ValueType>& value)
{
if(value)
return os << *value;
else
return os << "none";
}
std::ostream& operator<<(std::ostream& os, const auto_t&);
std::ostream& operator<<(std::ostream& os, const inherit_t&);
std::ostream& operator<<(std::ostream& os, const initial_t&);
std::ostream& operator<<(std::ostream& os, align_content align_content);
std::ostream& operator<<(std::ostream& os, align_items align_items);
std::ostream& operator<<(std::ostream& os, align_self align_self);
std::ostream& operator<<(std::ostream& os, const color& color);
template<typename ColorStopType>
std::ostream& operator<<(std::ostream& os, const color_stop<ColorStopType>& color_stop);
std::ostream& operator<<(std::ostream& os, const unit unit);
std::ostream& operator<<(std::ostream& os, const length& length);
std::ostream& operator<<(std::ostream& os, const length_with_offset& length_with_offset);
std::ostream& operator<<(std::ostream& os, const position& position);
std::ostream& operator<<(std::ostream& os, const css::time& time);
std::ostream& operator<<(std::ostream& os, const steps& steps);
std::ostream& operator<<(std::ostream& os, const cubic_bezier& cubic_bezier);
std::ostream& operator<<(std::ostream& os, const timing_function& timing_function);
std::ostream& operator<<(std::ostream& os, const animation_direction&);
std::ostream& operator<<(std::ostream& os, const fill_mode&);
std::ostream& operator<<(std::ostream& os, const play_state&);
std::ostream& operator<<(std::ostream& os, const timing_function&);
std::ostream& operator<<(std::ostream& os, const infinite_t&);
std::ostream& operator<<(std::ostream& os, const animation& animation);
std::ostream& operator<<(std::ostream& os, const linear_gradient& linear_gradient);
std::ostream& operator<<(std::ostream& os, radial_gradient::extent extent);
std::ostream& operator<<(std::ostream& os, graphics::size2D<length>& size);
std::ostream& operator<<(std::ostream& os, const radial_gradient::circle& circle);
std::ostream& operator<<(std::ostream& os, const radial_gradient::ellipse& ellipse);
std::ostream& operator<<(std::ostream& os, const radial_gradient& radial_gradient);
std::ostream& operator<<(std::ostream& os, const conic_gradient& conic_gradient);
std::ostream& operator<<(std::ostream& os, const background_size_auto_t&);
std::ostream& operator<<(std::ostream& os, const background_size_keyword& background_size_keyword);
std::ostream& operator<<(std::ostream& os, const background_size_width_height& width_height);
std::ostream& operator<<(std::ostream& os, box_decoration_break box_decoration_break);
std::ostream& operator<<(std::ostream& os, const box_shadow& box_shadow);
std::ostream& operator<<(std::ostream& os, box_sizing box_sizing);
std::ostream& operator<<(std::ostream& os, caption_side caption_side);
std::ostream& operator<<(std::ostream& os, clear clear);
}
template<typename ColorStopType>
std::ostream& skui::css::operator<<(std::ostream& os, const color_stop<ColorStopType>& color_stop)
{
os << "color-stop(" << color_stop.color;
if(color_stop.stop)
{
os << ", " << *color_stop.stop;
}
return os << ")";
}
#endif