slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
YGValue.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 <stdbool.h>
11
12#include <yoga/YGEnums.h>
13#include <yoga/YGMacros.h>
14
18#ifdef __cplusplus
19#include <limits>
20constexpr float YGUndefined = std::numeric_limits<float>::quiet_NaN();
21#else
22#include <math.h>
23#define YGUndefined NAN
24#endif
25
27
31typedef struct YGValue {
32 float value;
33 YGUnit unit;
35
39YG_EXPORT extern const YGValue YGValueAuto;
40
45
49YG_EXPORT extern const YGValue YGValueZero;
50
54YG_EXPORT bool YGFloatIsUndefined(float value);
55
57
58// Equality operators for comparison of YGValue in C++
59#ifdef __cplusplus
60inline bool operator==(const YGValue& lhs, const YGValue& rhs) {
61 if (lhs.unit != rhs.unit) {
62 return false;
63 }
64
65 switch (lhs.unit) {
66 case YGUnitUndefined:
67 case YGUnitAuto:
70 case YGUnitStretch:
71 return true;
72 case YGUnitPoint:
73 case YGUnitPercent:
74 return lhs.value == rhs.value;
75 default:
76 return false;
77 }
78}
79
80inline YGValue operator-(const YGValue& value) {
81 return {-value.value, value.unit};
82}
83#endif
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitPercent
Definition YGEnums.h:149
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitPoint
Definition YGEnums.h:148
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitUndefined
Definition YGEnums.h:147
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitFitContent
Definition YGEnums.h:152
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitMaxContent
Definition YGEnums.h:151
YG_EXTERN_C_BEGIN YGBoxSizingContentBox YGDirectionRTL YGEdgeAll YGExperimentalFeatureFixFlexBasisFitContent YGGridTrackTypeMinmax YGJustifyEnd YGMeasureModeAtMost YGOverflowScroll YGUnitAuto
Definition YGEnums.h:150
#define YG_EXTERN_C_END
Definition YGMacros.h:19
#define YG_EXTERN_C_BEGIN
Definition YGMacros.h:18
#define YG_EXPORT
Definition YGMacros.h:35
YG_EXPORT const YGValue YGValueAuto
Definition YGValue.cpp:16
YG_EXPORT const YGValue YGValueUndefined
Definition YGValue.cpp:15
YG_EXTERN_C_BEGIN struct YGValue YGValue
#define YGUndefined
Definition YGValue.h:23
YG_EXPORT const YGValue YGValueZero
Definition YGValue.cpp:14
YG_EXPORT bool YGFloatIsUndefined(float value)
Definition YGValue.cpp:18
bool operator==(const json_pointer< RefStringTypeLhs > &lhs, const json_pointer< RefStringTypeRhs > &rhs) noexcept
Definition json.hpp:14737
@ value
the parser finished reading a JSON value
Definition YGValue.h:31
YGUnit unit
Definition YGValue.h:33
float value
Definition YGValue.h:32