MCPcopy Create free account
hub / github.com/bdring/FluidNC / floatArray

Method floatArray

FluidNC/src/Configuration/Parser.cpp:135–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133 }
134
135 std::vector<float> Parser::floatArray() const {
136 auto str = string_util::trim(_token._value);
137 std::vector<float> values;
138 float float_value;
139
140 while (!str.empty()) {
141 str = string_util::trim(str);
142 auto next_ws_delim = str.find(' ');
143 auto entry_str = string_util::trim(str.substr(0, next_ws_delim));
144
145 str.remove_prefix(next_ws_delim + 1);
146
147 if (!string_util::from_float(entry_str, float_value)) {
148 log_error("Bad number " << entry_str);
149 values.clear();
150 break;
151 }
152 values.push_back(float_value);
153
154 if (str == entry_str)
155 break;
156 }
157
158 if (!values.size())
159 log_info("Using default value");
160
161 return values;
162 }
163
164 // cppcheck-suppress unusedFunction
165 Pin Parser::pinValue() const {

Callers 1

itemMethod · 0.80

Calls 5

from_floatFunction · 0.85
trimFunction · 0.50
findMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected