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

Function StringVecToFloatVec

tests/testutils/UnitTest.cpp:25–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25static bool StringVecToFloatVec(std::vector<float> &floatArray, const StringUtils::StringVec &lineParts)
26{
27 floatArray.resize(lineParts.size());
28
29 for(unsigned int i=0; i<lineParts.size(); i++)
30 {
31 float x = NAN;
32 const char *str = lineParts[i].c_str();
33 const auto result = OCIO::NumberUtils::from_chars(str, str + lineParts[i].size(), x);
34 if (result.ec != std::errc())
35 {
36 return false;
37 }
38 floatArray[i] = x;
39 }
40
41 return true;
42}
43
44bool StringFloatVecClose(std::string value, std::string expected, float eps)
45{

Callers 3

StringFloatVecCloseFunction · 0.70
CompareFloatsFunction · 0.50
compareFloatsFunction · 0.50

Calls 2

resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected