1*af2ec015STomasz Sapeta #include "JsiUtils.h" 2*af2ec015STomasz Sapeta #include <vector> 3*af2ec015STomasz Sapeta 4*af2ec015STomasz Sapeta using namespace ABI49_0_0facebook; 5*af2ec015STomasz Sapeta 6*af2ec015STomasz Sapeta namespace ABI49_0_0reanimated::jsi_utils { 7*af2ec015STomasz Sapeta convertStringToArray(jsi::Runtime & rt,const std::string & value,const unsigned int expectedSize)8*af2ec015STomasz Sapetajsi::Array convertStringToArray( 9*af2ec015STomasz Sapeta jsi::Runtime &rt, 10*af2ec015STomasz Sapeta const std::string &value, 11*af2ec015STomasz Sapeta const unsigned int expectedSize) { 12*af2ec015STomasz Sapeta std::vector<float> transformMatrixList; 13*af2ec015STomasz Sapeta std::istringstream stringStream(value); 14*af2ec015STomasz Sapeta std::copy( 15*af2ec015STomasz Sapeta std::istream_iterator<float>(stringStream), 16*af2ec015STomasz Sapeta std::istream_iterator<float>(), 17*af2ec015STomasz Sapeta std::back_inserter(transformMatrixList)); 18*af2ec015STomasz Sapeta assert(transformMatrixList.size() == expectedSize); 19*af2ec015STomasz Sapeta jsi::Array matrix(rt, expectedSize); 20*af2ec015STomasz Sapeta for (int i = 0; i < expectedSize; i++) { 21*af2ec015STomasz Sapeta matrix.setValueAtIndex(rt, i, transformMatrixList[i]); 22*af2ec015STomasz Sapeta } 23*af2ec015STomasz Sapeta return matrix; 24*af2ec015STomasz Sapeta } 25*af2ec015STomasz Sapeta 26*af2ec015STomasz Sapeta } // namespace ABI49_0_0reanimated::jsi_utils 27