* Adds an empty column after (or before) the given colNr */
| 172 | * Adds an empty column after (or before) the given colNr |
| 173 | */ |
| 174 | void CsvTable::addCol(table_index_t colNr, bool before) { |
| 175 | if( colNr >= storage.columns() ) |
| 176 | colNr = storage.columns() - 1; |
| 177 | if( colNr < 0 ) |
| 178 | colNr = 0; |
| 179 | |
| 180 | storage.insertColumn(colNr, before); |
| 181 | |
| 182 | // add column to headerRow |
| 183 | if( hasCustomHeaderRow ) { |
| 184 | if( before ) |
| 185 | headerRow->insert(headerRow->begin()+colNr, ""); |
| 186 | else |
| 187 | headerRow->insert(headerRow->begin()+colNr+1, ""); |
| 188 | } else { |
| 189 | headerRow->clear(); |
| 190 | headerRow->resize(storage.columns() + 1); |
| 191 | } |
| 192 | updateInternals(); |
| 193 | } |
| 194 | |
| 195 | |
| 196 |
no test coverage detected