| 465 | } |
| 466 | |
| 467 | std::pair<table_index_t,table_index_t> CsvDataStorage::getColumnIndizes(std::string rowString, table_index_t column) { |
| 468 | bool colFound = false; |
| 469 | size_t str_size = rowString.size(); |
| 470 | table_index_t fromIdx = -1; |
| 471 | table_index_t toIdx = -1; |
| 472 | table_index_t colCounter = 0; |
| 473 | for( size_t i = 0; i < str_size; ++i ) { |
| 474 | if( static_cast<unsigned char>(rowString[i]) == CsvDataStorage::TCRUNCHER_UTF_8_DELIMITER ) { |
| 475 | if( colCounter == column ) { |
| 476 | toIdx = i; |
| 477 | colFound = true; |
| 478 | break; |
| 479 | } |
| 480 | ++colCounter; |
| 481 | fromIdx = i; |
| 482 | } |
| 483 | } |
| 484 | if( !colFound ) { |
| 485 | if( column == colCounter ) { |
| 486 | toIdx = rowString.size(); |
| 487 | } else { |
| 488 | toIdx = -1; |
| 489 | } |
| 490 | } |
| 491 | return std::make_pair(fromIdx, toIdx); |
| 492 | } |
| 493 | |
| 494 | |
| 495 | std::string CsvDataStorage::setColumn(std::string rowString, table_index_t column, std::string content) { |