* Returns the index of the next flagged row */
| 917 | * Returns the index of the next flagged row |
| 918 | */ |
| 919 | table_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 |
no test coverage detected