@@ -191,8 +191,8 @@ struct filtered_logline_cmp {
191191
192192 bool operator ()(const uint32_t & lhs, const uint32_t & rhs) const
193193 {
194- auto cl_lhs = ( content_line_t ) llss_controller.lss_index [lhs];
195- auto cl_rhs = ( content_line_t ) llss_controller.lss_index [rhs];
194+ auto cl_lhs = llss_controller.lss_index [lhs]. value () ;
195+ auto cl_rhs = llss_controller.lss_index [rhs]. value () ;
196196 auto ll_lhs = this ->llss_controller .find_line (cl_lhs);
197197 auto ll_rhs = this ->llss_controller .find_line (cl_rhs);
198198
@@ -207,7 +207,7 @@ struct filtered_logline_cmp {
207207
208208 bool operator ()(const uint32_t & lhs, const timeval& rhs) const
209209 {
210- const auto cl_lhs = ( content_line_t ) llss_controller.lss_index [lhs];
210+ const auto cl_lhs = llss_controller.lss_index [lhs]. value () ;
211211 const auto * ll_lhs = this ->llss_controller .find_line (cl_lhs);
212212
213213 if (ll_lhs == nullptr ) {
@@ -810,18 +810,19 @@ logfile_sub_source::text_attrs_for_line(textview_curses& lv,
810810struct logline_cmp {
811811 logline_cmp (logfile_sub_source& lc) : llss_controller(lc) {}
812812
813- bool operator ()(const content_line_t & lhs, const content_line_t & rhs) const
813+ bool operator ()(const logfile_sub_source::indexed_content& lhs,
814+ const logfile_sub_source::indexed_content& rhs) const
814815 {
815- const auto * ll_lhs = this ->llss_controller .find_line (lhs);
816- const auto * ll_rhs = this ->llss_controller .find_line (rhs);
816+ const auto * ll_lhs = this ->llss_controller .find_line (lhs. value () );
817+ const auto * ll_rhs = this ->llss_controller .find_line (rhs. value () );
817818
818819 return (*ll_lhs) < (*ll_rhs);
819820 }
820821
821822 bool operator ()(const uint32_t & lhs, const uint32_t & rhs) const
822823 {
823- content_line_t cl_lhs = ( content_line_t ) llss_controller.lss_index [lhs];
824- content_line_t cl_rhs = ( content_line_t ) llss_controller.lss_index [rhs];
824+ auto cl_lhs = llss_controller.lss_index [lhs]. value () ;
825+ auto cl_rhs = llss_controller.lss_index [rhs]. value () ;
825826 const auto * ll_lhs = this ->llss_controller .find_line (cl_lhs);
826827 const auto * ll_rhs = this ->llss_controller .find_line (cl_rhs);
827828
@@ -846,9 +847,10 @@ struct logline_cmp {
846847 }
847848#endif
848849
849- bool operator ()(const content_line_t & lhs, const struct timeval & rhs) const
850+ bool operator ()(const logfile_sub_source::indexed_content& lhs,
851+ const struct timeval & rhs) const
850852 {
851- const auto * ll_lhs = this ->llss_controller .find_line (lhs);
853+ const auto * ll_lhs = this ->llss_controller .find_line (lhs. value () );
852854
853855 return *ll_lhs < rhs;
854856 }
@@ -946,7 +948,7 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
946948 && lf->size () > ld.ld_lines_indexed )
947949 {
948950 auto & new_file_line = (*lf)[ld.ld_lines_indexed ];
949- content_line_t cl = this ->lss_index .back ();
951+ auto cl = this ->lss_index .back (). value ();
950952 auto * last_indexed_line = this ->find_line (cl);
951953
952954 // If there are new lines that are older than what
@@ -1084,7 +1086,7 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
10841086 if (this ->lss_index_delegate ) {
10851087 this ->lss_index_delegate ->index_start (*this );
10861088 for (const auto row_in_full_index : this ->lss_filtered_index ) {
1087- auto cl = this ->lss_index [row_in_full_index];
1089+ auto cl = this ->lss_index [row_in_full_index]. value () ;
10881090 uint64_t line_number;
10891091 auto ld_iter = this ->find_data (cl, line_number);
10901092 auto & ld = *ld_iter;
@@ -1167,7 +1169,8 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
11671169 .insert_once (start_con_line);
11681170 }
11691171 }
1170- this ->lss_index .push_back (con_line);
1172+ this ->lss_index .push_back (
1173+ indexed_content{con_line, lf_iter});
11711174 }
11721175 }
11731176
@@ -1245,7 +1248,8 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
12451248 .insert_once (start_con_line);
12461249 }
12471250 }
1248- this ->lss_index .push_back (con_line);
1251+ this ->lss_index .push_back (
1252+ indexed_content{con_line, lf_iter});
12491253 }
12501254
12511255 merge.next ();
@@ -1285,7 +1289,7 @@ logfile_sub_source::rebuild_index(std::optional<ui_clock::time_point> deadline)
12851289 index_index < this ->lss_index .size ();
12861290 index_index++)
12871291 {
1288- const auto cl = ( content_line_t ) this ->lss_index [index_index];
1292+ const auto cl = this ->lss_index [index_index]. value () ;
12891293 uint64_t line_number;
12901294 auto ld = this ->find_data (cl, line_number);
12911295
@@ -1373,12 +1377,12 @@ logfile_sub_source::text_update_marks(vis_bookmarks& bm)
13731377 }
13741378
13751379 for (; vl < (int ) this ->lss_filtered_index .size (); ++vl) {
1376- const content_line_t orig_cl = this ->at (vl) ;
1377- content_line_t cl = orig_cl ;
1378- auto lf = this ->find_file_ptr (cl);
1380+ const auto & orig_ic = this ->lss_index [ this -> lss_filtered_index [vl]] ;
1381+ auto cl = orig_ic. value () ;
1382+ auto * lf = this ->find_file_ptr (cl);
13791383
13801384 for (auto & lss_user_mark : this ->lss_user_marks ) {
1381- if (lss_user_mark.second .bv_tree .exists (orig_cl )) {
1385+ if (lss_user_mark.second .bv_tree .exists (orig_ic. value () )) {
13821386 bm[lss_user_mark.first ].insert_once (vl);
13831387
13841388 if (lss_user_mark.first == &textview_curses::BM_USER ) {
@@ -1393,22 +1397,17 @@ logfile_sub_source::text_update_marks(vis_bookmarks& bm)
13931397 bm[&BM_FILES ].insert_once (vl);
13941398 }
13951399
1396- auto line_iter = lf->begin () + cl;
1397- if (line_iter->is_message ()) {
1398- switch (line_iter->get_msg_level ()) {
1399- case LEVEL_WARNING :
1400- bm[&textview_curses::BM_WARNINGS ].insert_once (vl);
1401- break ;
1400+ switch (orig_ic.level ()) {
1401+ case indexed_content::level_t ::warning:
1402+ bm[&textview_curses::BM_WARNINGS ].insert_once (vl);
1403+ break ;
14021404
1403- case LEVEL_FATAL :
1404- case LEVEL_ERROR :
1405- case LEVEL_CRITICAL :
1406- bm[&textview_curses::BM_ERRORS ].insert_once (vl);
1407- break ;
1405+ case indexed_content::level_t ::error:
1406+ bm[&textview_curses::BM_ERRORS ].insert_once (vl);
1407+ break ;
14081408
1409- default :
1410- break ;
1411- }
1409+ default :
1410+ break ;
14121411 }
14131412
14141413 last_file = lf;
@@ -1453,7 +1452,7 @@ logfile_sub_source::text_filters_changed()
14531452 for (size_t index_index = 0 ; index_index < this ->lss_index .size ();
14541453 index_index++)
14551454 {
1456- content_line_t cl = ( content_line_t ) this ->lss_index [index_index];
1455+ auto cl = this ->lss_index [index_index]. value () ;
14571456 uint64_t line_number;
14581457 auto ld = this ->find_data (cl, line_number);
14591458
@@ -2236,8 +2235,8 @@ logfile_sub_source::reload_index_delegate()
22362235 }
22372236
22382237 this ->lss_index_delegate ->index_start (*this );
2239- for (unsigned int index : this ->lss_filtered_index ) {
2240- content_line_t cl = ( content_line_t ) this ->lss_index [index];
2238+ for (const auto index : this ->lss_filtered_index ) {
2239+ auto cl = this ->lss_index [index]. value () ;
22412240 uint64_t line_number;
22422241 auto ld = this ->find_data (cl, line_number);
22432242 std::shared_ptr<logfile> lf = (*ld)->get_file ();
@@ -3339,7 +3338,7 @@ logfile_sub_source::row_for(const row_info& ri)
33393338 if (lb != this ->lss_filtered_index .end ()) {
33403339 auto first_lb = lb;
33413340 while (true ) {
3342- auto cl = this ->lss_index [*lb];
3341+ auto cl = this ->lss_index [*lb]. value () ;
33433342 if (content_line_t (ri.ri_id ) == cl) {
33443343 first_lb = lb;
33453344 break ;
0 commit comments