MCPcopy Create free account
hub / github.com/NVIDIA-RTX/Donut / parse

Function parse

src/core/string_utils.cpp:49–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 template <> std::optional<float> parse(std::string_view s)
50 {
51 trim(s);
52 trim(s, '+');
53
54 char buf[32];
55 buf[sizeof(buf) - 1] = 0;
56 strncpy(buf, s.data(), std::min(s.size(), sizeof(buf) - 1));
57 char* endptr = buf;
58 float value = strtof(buf, &endptr);
59
60 if (endptr == buf)
61 return std::optional<float>();
62
63 return value;
64 }
65
66 template <> std::optional<double> parse(std::string_view s)
67 {

Callers

nothing calls this directly

Calls 4

trimFunction · 0.85
minFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected