MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseDimension

Method parseDimension

valdi_core/src/valdi_core/cpp/Attributes/AttributeUtils.cpp:147–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147std::optional<Dimension> AttributeParser::parseDimension() {
148 tryParseWhitespaces();
149 auto d = parseDouble();
150 if (!d) {
151 return std::nullopt;
152 }
153
154 Dimension::Unit unit = Dimension::Unit::None;
155 if (tryParse("px")) {
156 unit = Dimension::Unit::Px;
157 } else if (tryParse("pt")) {
158 unit = Dimension::Unit::Pt;
159 } else if (tryParse('%')) {
160 unit = Dimension::Unit::Percent;
161 }
162
163 return Dimension(d.value(), unit);
164}
165
166bool hasPrefix(const std::string_view& str, size_t index, const char* term) {
167 if (index >= str.size()) {

Callers 8

TESTFunction · 0.80
preprocessBorderFunction · 0.80
preprocessBoxShadowFunction · 0.80
preprocessGradientFunction · 0.80
toDoubleMethod · 0.80
parsePercentMethod · 0.80
parseYGStyleLengthMethod · 0.80

Calls 2

DimensionClass · 0.70
valueMethod · 0.65

Tested by 1

TESTFunction · 0.64