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

Method getNextFlaggedRow

src/csvtable.cpp:919–939  ·  view source on GitHub ↗

* Returns the index of the next flagged row */

Source from the content-addressed store, hash-verified

917 * Returns the index of the next flagged row
918 */
919table_index_t CsvTable::getNextFlaggedRow(table_index_t rowNr) {
920 std::set<table_index_t, std::greater<table_index_t> >::const_iterator iterReturn;
921 if( flags.empty() ) {
922 return -1;
923 }
924 auto it = flags.lower_bound(rowNr);
925 auto lastIt = flags.end();
926 --lastIt; // lastIt now points to the last elemen (first flagged row)
927 if( it == flags.end() ) {
928 // 'it' above the first flagged row - starting at the last element (top-most in display)
929 it = lastIt;
930 } else {
931 if( it == flags.begin() ) {
932 it = lastIt;
933 } else {
934 --it;
935 }
936 }
937
938 return *it;
939}
940
941/*
942 * Returns the index of the previous flagged row

Callers 1

jumpToFlaggedRowMethod · 0.80

Calls 2

endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected