slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
GridLine.h
浏览该文件的文档.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <cstdint>
11
12namespace facebook::yoga {
13
14// https://www.w3.org/TR/css-grid-1/#typedef-grid-row-start-grid-line
15enum class GridLineType : uint8_t {
16 Auto,
17 Integer,
18 Span,
19};
20
21struct GridLine {
23 // Line position (1, 2, -1, -2, etc)
24 int32_t integer{};
25
26 constexpr static GridLine auto_() {
27 return GridLine{.type = GridLineType::Auto, .integer = 0};
28 }
29
30 constexpr static GridLine fromInteger(int32_t value) {
31 return GridLine{.type = GridLineType::Integer, .integer = value};
32 }
33
34 constexpr static GridLine span(int32_t value) {
35 return GridLine{.type = GridLineType::Span, .integer = value};
36 }
37
38 constexpr bool isAuto() const {
39 return type == GridLineType::Auto;
40 }
41
42 constexpr bool isInteger() const {
44 }
45
46 constexpr bool isSpan() const {
47 return type == GridLineType::Span;
48 }
49
50 bool operator==(const GridLine& other) const = default;
51};
52
53} // namespace facebook::yoga
Definition Benchmark.cpp:19
GridLineType
Definition GridLine.h:15
Definition GridLine.h:21
static constexpr GridLine fromInteger(int32_t value)
Definition GridLine.h:30
static constexpr GridLine auto_()
Definition GridLine.h:26
constexpr bool isInteger() const
Definition GridLine.h:42
int32_t integer
Definition GridLine.h:24
bool operator==(const GridLine &other) const =default
static constexpr GridLine span(int32_t value)
Definition GridLine.h:34
constexpr bool isAuto() const
Definition GridLine.h:38
constexpr bool isSpan() const
Definition GridLine.h:46
GridLineType type
Definition GridLine.h:22