| 277 | } |
| 278 | |
| 279 | size_t TextRanges::findIndex( const TextRange& range ) const { |
| 280 | if ( !mIsSorted ) { |
| 281 | auto it = std::find( begin(), end(), range ); |
| 282 | return it != end() ? std::distance( begin(), it ) : static_cast<size_t>( -1 ); |
| 283 | } else { |
| 284 | auto it = std::lower_bound( begin(), end(), range ); |
| 285 | return ( it != end() && *it == range ) ? std::distance( begin(), it ) |
| 286 | : static_cast<size_t>( -1 ); |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | bool TextRanges::hasSelection() const { |
| 291 | for ( const auto& r : *this ) |
no test coverage detected