/src/serenity/Userland/Libraries/LibWeb/CSS/ColumnCount.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | namespace Web::CSS { |
10 | | |
11 | | class ColumnCount { |
12 | | public: |
13 | | enum class Type { |
14 | | Auto, |
15 | | Integer |
16 | | }; |
17 | | |
18 | | static ColumnCount make_auto() |
19 | 0 | { |
20 | 0 | return ColumnCount(); |
21 | 0 | } |
22 | | |
23 | | static ColumnCount make_integer(int value) |
24 | 0 | { |
25 | 0 | return ColumnCount(value); |
26 | 0 | } |
27 | | |
28 | 0 | bool is_auto() const { return m_type == Type::Auto; } |
29 | 0 | int value() const { return *m_value; } |
30 | | |
31 | | private: |
32 | | ColumnCount(int value) |
33 | 0 | : m_type(Type::Integer) |
34 | 0 | , m_value(value) |
35 | 0 | { |
36 | 0 | } |
37 | 0 | ColumnCount() { } |
38 | | |
39 | | Type m_type { Type::Auto }; |
40 | | Optional<int> m_value; |
41 | | }; |
42 | | |
43 | | } |