MCPcopy Create free account
hub / github.com/FastLED/FastLED / parse_int_array

Method parse_int_array

src/fl/stl/json.cpp.hpp:805–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

803 // Parse integer array directly from span into vector (zero allocations)
804 template<typename T>
805 bool parse_int_array(const fl::span<const char>& span, fl::vector<T>& out_vec) {
806 const char* p = span.data();
807 const char* end = p + span.size();
808
809 while (p < end) {
810 // Skip whitespace
811 while (p < end && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
812 if (p >= end) break;
813
814 // Parse number
815 const char* num_start = p;
816 if (*p == '-') p++;
817 while (p < end && *p >= '0' && *p <= '9') p++;
818
819 i64 val = fl::parseInt(num_start, p - num_start);
820 out_vec.push_back(static_cast<T>(val));
821
822 // Skip whitespace
823 while (p < end && (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\r')) p++;
824
825 // Skip comma
826 if (p < end && *p == ',') p++;
827 }
828
829 return true;
830 }
831
832 // Parse float array directly from span into vector (zero allocations)
833 template<typename T>

Callers

nothing calls this directly

Calls 4

parseIntFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected