MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / resize

Method resize

src/csvdatastorage.cpp:60–78  ·  view source on GitHub ↗

resize(long R, long C = 0) Resize to R,C dimensions. Table can grow only, shrinking has to be done by deleteColumns() or deleteRows(). If R == 0 or C == 0: this dimension isn't changed */

Source from the content-addressed store, hash-verified

58 If R == 0 or C == 0: this dimension isn't changed
59 */
60void CsvDataStorage::resize(table_index_t R, table_index_t C) {
61 table_index_t old_rows = rows();
62 table_index_t old_columns = columns();
63
64 if( C > old_columns ) {
65 for( table_index_t i = 0; i < old_rows; ++i) {
66 tableData.at(i) += emptyCellsString(C - old_columns);
67 }
68 }
69 if( R > 0 && R > rows() ) {
70 tableData.resize(R);
71 for( table_index_t i = old_rows; i < R; ++i) { // add empty vectors into the newly created rows
72 tableData.at(i) = emptyCellsString(C - 1);
73 }
74 }
75 if( C > old_columns ) {
76 numColumns = C;
77 }
78}
79
80
81/**

Callers 15

CsvTableMethod · 0.80
addColMethod · 0.80
resizeTableMethod · 0.80
updateInternalsMethod · 0.80
saveCsvMethod · 0.80
draw_cellMethod · 0.80
startEditingMethod · 0.80
parseCsvStreamMethod · 0.80
storeMethod · 0.80
createUndoStateTableMethod · 0.80
undoMethod · 0.80
AddButtonMethod · 0.80

Calls 1

atMethod · 0.80

Tested by

no test coverage detected