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

Method SetRow

src/rapidcsv.h:1019–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017 */
1018 template<typename T>
1019 void SetRow(const size_t pRowIdx, const std::vector<T>& pRow)
1020 {
1021 const size_t dataRowIdx = GetDataRowIndex(pRowIdx);
1022
1023 while ((dataRowIdx + 1) > GetDataRowCount())
1024 {
1025 std::vector<std::string> row;
1026 row.resize(GetDataColumnCount());
1027 mData.push_back(row);
1028 }
1029
1030 if (pRow.size() > GetDataColumnCount())
1031 {
1032 for (auto itRow = mData.begin(); itRow != mData.end(); ++itRow)
1033 {
1034 if (std::distance(mData.begin(), itRow) >= mLabelParams.mColumnNameIdx)
1035 {
1036 itRow->resize(GetDataColumnIndex(pRow.size()));
1037 }
1038 }
1039 }
1040
1041 Converter<T> converter(mConverterParams);
1042 for (auto itCol = pRow.begin(); itCol != pRow.end(); ++itCol)
1043 {
1044 std::string str;
1045 converter.ToStr(*itCol, str);
1046 mData.at(dataRowIdx).at(static_cast<size_t>(std::distance(pRow.begin(),
1047 itCol) + mLabelParams.mRowNameIdx + 1)) = str;
1048 }
1049 }
1050
1051 /**
1052 * @brief Set row by name.

Callers 2

test078.cppFile · 0.80
test082.cppFile · 0.80

Calls 1

ToStrMethod · 0.45

Tested by

no test coverage detected