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

Function StringVecToIntVec

src/OpenColorIO/ParseUtils.cpp:649–667  ·  view source on GitHub ↗

This will resize intArray to the size of lineParts. Returns true if all lineParts have been recognized as int. Content of intArray will be unknown if function returns false.

Source from the content-addressed store, hash-verified

647// Returns true if all lineParts have been recognized as int.
648// Content of intArray will be unknown if function returns false.
649bool StringVecToIntVec(std::vector<int> &intArray, const StringUtils::StringVec &lineParts)
650{
651 intArray.resize(lineParts.size());
652
653 for(unsigned int i=0; i<lineParts.size(); i++)
654 {
655 int x;
656 // When reading a vector of string as int, ints that
657 // are followed by other characters (ex. "3d") are
658 // not considered as int.
659 if ( !StringToInt(&x, lineParts[i].c_str(), true) )
660 {
661 return false;
662 }
663 intArray[i] = x;
664 }
665
666 return true;
667}
668
669////////////////////////////////////////////////////////////////////////////
670

Callers 4

readMethod · 0.85
readMethod · 0.85
readMethod · 0.85
OCIO_ADD_TESTFunction · 0.85

Calls 3

StringToIntFunction · 0.70
resizeMethod · 0.45
sizeMethod · 0.45

Tested by 1

OCIO_ADD_TESTFunction · 0.68