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

Method getColumnIndizes

src/csvdatastorage.cpp:467–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467std::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
495std::string CsvDataStorage::setColumn(std::string rowString, table_index_t column, std::string content) {

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected