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

Method humanReadableSelection

src/csvwindow.cpp:695–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693
694
695std::string CsvWindow::humanReadableSelection() {
696 long rows = table->getNumberRows();
697 long cols = table->getNumberCols();
698 std::vector<int> sel = grid->getSelection();
699 std::string human = "";
700 if(
701 (sel[0] == sel[2] && sel[1] == sel[3]) ||
702 (sel[0] == 0 && sel[1] == 0 && sel[2] == rows - 1 && sel[3] == cols - 1 )
703 ) {
704 // Full Table
705 human = "Full Table";
706 } else if( sel[0] == 0 && sel[2] == rows - 1 ) {
707 // Column(s)
708 if( sel[1] == sel[3] ) {
709 human = "Column '" + table->getHeaderCell(sel[1], false)+"'";
710 } else {
711 human = "Columns '" + table->getHeaderCell(sel[1], false) + "' > '" + table->getHeaderCell(sel[3], false) + "'";
712 }
713 } else {
714 // Selection
715 human = "Selection (" + table->getHeaderCell(sel[1], false) + ":" + std::to_string(sel[0]+1) + " > " + table->getHeaderCell(sel[3], false) + ":" + std::to_string(sel[2]+1) + ")";
716 }
717 return human;
718}
719
720
721

Callers 2

findMethod · 0.80
updateSearchWindowMethod · 0.80

Calls 5

to_stringFunction · 0.85
getNumberRowsMethod · 0.80
getNumberColsMethod · 0.80
getHeaderCellMethod · 0.80
getSelectionMethod · 0.45

Tested by

no test coverage detected