MCPcopy Create free account
hub / github.com/d99kris/rapidcsv / SetCell

Method SetCell

src/rapidcsv.h:1325–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1323 */
1324 template<typename T>
1325 void SetCell(const size_t pColumnIdx, const size_t pRowIdx, const T& pCell)
1326 {
1327 const size_t dataColumnIdx = GetDataColumnIndex(pColumnIdx);
1328 const size_t dataRowIdx = GetDataRowIndex(pRowIdx);
1329
1330 while ((dataRowIdx + 1) > GetDataRowCount())
1331 {
1332 std::vector<std::string> row;
1333 row.resize(GetDataColumnCount());
1334 mData.push_back(row);
1335 }
1336
1337 if ((dataColumnIdx + 1) > GetDataColumnCount())
1338 {
1339 for (auto itRow = mData.begin(); itRow != mData.end(); ++itRow)
1340 {
1341 if (std::distance(mData.begin(), itRow) >= mLabelParams.mColumnNameIdx)
1342 {
1343 itRow->resize(dataColumnIdx + 1);
1344 }
1345 }
1346 }
1347
1348 std::string str;
1349 Converter<T> converter(mConverterParams);
1350 converter.ToStr(pCell, str);
1351 mData.at(dataRowIdx).at(dataColumnIdx) = str;
1352 }
1353
1354 /**
1355 * @brief Set cell by name.

Callers

nothing calls this directly

Calls 1

ToStrMethod · 0.45

Tested by

no test coverage detected