MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / tryParseNumber

Function tryParseNumber

lib/Epub/Epub/css/CssParser.cpp:115–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113// non-numeric suffix, or any from_chars error.
114template <typename T>
115bool tryParseNumber(std::string_view s, T& out) {
116 const char* begin = s.data();
117 const char* end = s.data() + s.size();
118 if (begin < end && *begin == '+') ++begin;
119 const auto r = std::from_chars(begin, end, out);
120 return r.ec == std::errc{} && r.ptr == end;
121}
122
123// Collect up to 4 whitespace-separated tokens for a CSS edge-value shorthand
124// (margin, padding, and the border-* family). Returns the number of tokens

Callers 2

interpretFontWeightMethod · 0.85
tryInterpretLengthMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected