MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / StringVecToFloatVec

Function StringVecToFloatVec

src/OpenColorIO/ParseUtils.cpp:627–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627bool StringVecToFloatVec(std::vector<float> &floatArray, const StringUtils::StringVec &lineParts)
628{
629 floatArray.resize(lineParts.size());
630
631 for(unsigned int i=0; i<lineParts.size(); i++)
632 {
633 float x = NAN;
634 const char *str = lineParts[i].c_str();
635 const auto result = NumberUtils::from_chars(str, str + lineParts[i].size(), x);
636 if (result.ec != std::errc())
637 {
638 return false;
639 }
640 floatArray[i] = x;
641 }
642
643 return true;
644}
645
646// This will resize intArray to the size of lineParts.
647// Returns true if all lineParts have been recognized as int.

Callers 6

readMethod · 0.50
readMethod · 0.50
readMethod · 0.50
readMethod · 0.50
readMethod · 0.50
readMethod · 0.50

Calls 2

resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected