Beispiel #1
0
        private bool matches_case_insensitive(line l)
        {
            Debug.Assert(part != part_type.font);
            string line_part = this.line_part(l).ToLower();

            return(compare(line_part, lo_text, lo_words));
        }
Beispiel #2
0
 public match(BitArray matches, font_info font, line line, int line_idx)
 {
     this.matches  = matches;
     this.font     = font;
     this.line     = line;
     this.line_idx = line_idx;
 }
Beispiel #3
0
        public List <filter_line.match_index> match_indexes(line l, info_type type)
        {
            List <filter_line.match_index> indexes = null;
            bool has_match_color = font_.match_fg != util.transparent || font_.match_bg != util.transparent;

            if (has_match_color)
            {
                foreach (filter_line line in items_)
                {
                    var now = line.match_indexes(l, type);
                    if (now.Count > 0)
                    {
                        if (indexes == null)
                        {
                            indexes = new List <filter_line.match_index>();
                        }
                        // here, we need to set the match colors
                        foreach (var index in now)
                        {
                            index.fg = font_.match_fg;
                            index.bg = font_.match_bg;
                        }
                        indexes.AddRange(now);
                    }
                }
            }
            return(indexes ?? empty_);
        }
Beispiel #4
0
 public static line empty_line() {
     line l = new line();
     for (int i = 0; i < l.parts.Length / 2; ++i) {
         l.parts[i * 2] = -1;
         l.parts[i * 2 + 1] = 0;
     }
     return l;
 }
Beispiel #5
0
 public static line empty_line() {
     line l = new line();
     for (int i = 0; i < l.parts.Length / 2; ++i) {
         l.parts[i * 2] = -1;
         l.parts[i * 2 + 1] = 0;
     }
     return l;
 }
Beispiel #6
0
        // returns all the matches from all columns
        public List <match_index> match_indexes_any_column(line l)
        {
            List <match_index> indexes = new List <match_index>();

            foreach (var type in info_type_io.searchable)
            {
                indexes.AddRange(match_indexes(l, type));
            }
            return(indexes);
        }
Beispiel #7
0
 public static bool matches(line l, IEnumerable <info_type> cols, search_for search)
 {
     // 1.6.27+ faster way to find out if the message is contained - just look at the full message (instead of looking at each part)
     if (matches_cell(l.raw_full_msg(), search))
     {
         return(cols.Any(x => matches_cell(l.part(x), search)));
     }
     else
     {
         return(false);
     }
 }
Beispiel #8
0
        private bool matches_case_sensitive(line l)
        {
            Debug.Assert(part != part_type.font);
            if (part == part_type.any)
            {
                return(matches_case_sensitive_any_column(l));
            }

            string line_part = this.line_part(l);

            return(compare(line_part, text, words));
        }
Beispiel #9
0
        private bool matches_case_insensitive_any_column(line l)
        {
            string line_part = l.raw_full_msg().ToLower();

            if (compare(line_part, lo_text, lo_words))
            {
                // we need an extra step, so that we don't mistakenly match the text in the time/date column, for instance
                foreach (var type in info_type_io.searchable)
                {
                    if (compare(l.part(type).ToLower(), lo_text, lo_words))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Beispiel #10
0
        public List <filter_line.match_index> match_indexes(line l, info_type type)
        {
            List <filter_line.match_index> indexes = new List <filter_line.match_index>();

            lock (this)
                foreach (var row in rows_)
                {
                    indexes.AddRange(row.match_indexes(l, type));
                }

            indexes.Sort((x, y) => {
                if (x.start != y.start)
                {
                    return(x.start - y.start);
                }
                return(-(x.len - y.len));
            });
            return(indexes);
        }
Beispiel #11
0
        public List <match_index> match_indexes(line l, info_type type)
        {
            if (part == part_type.font || part == part_type.case_sensitive_info)
            {
                return(empty_);
            }

            // 1.2.6 for now, care about match indexes only for msg column
            if (type != info_type.msg)
            {
                return(empty_);
            }

            // we only care about "positive" matches - those that have "containing", "startswith", regex, etc.
            switch (comparison)
            {
            case comparison_type.does_not_start_with:
            case comparison_type.does_not_contain:
            case comparison_type.contains_none:
                return(empty_);

            case comparison_type.equal:
            case comparison_type.not_equal:
            case comparison_type.starts_with:
            case comparison_type.contains:
            case comparison_type.contains_any:
            case comparison_type.regex:
                break;

            default:
                Debug.Assert(false);
                return(empty_);
            }

            return(case_sensitive ? matches_case_sensitive_with_indexes(l, type) : matches_case_insensitive_with_indexes(l, type));
        }
Beispiel #12
0
 public bool matches(line l) {
     return case_sensitive ? matches_case_sensitive(l) : matches_case_insensitive(l);
 }
Beispiel #13
0
 private bool matches_case_insensitive_any_column(line l) {
     string line_part = l.raw_full_msg().ToLower();
     if ( compare(line_part, lo_text, lo_words))
         // we need an extra step, so that we don't mistakenly match the text in the time/date column, for instance
         foreach ( var type in info_type_io.searchable)
             if (compare(l.part(type).ToLower(), lo_text, lo_words))
                 return true;
     return false;
 }
Beispiel #14
0
 private bool matches_case_insensitive(line l) {
     Debug.Assert( part != part_type.font );
     if (part == part_type.any)
         return matches_case_insensitive_any_column(l);
     string line_part = this.line_part(l).ToLower() ;
     return compare(line_part, lo_text, lo_words);
 }
Beispiel #15
0
 private string line_part(line l) {
     return l.part(part_type_io.to_info_type(part));
 }
Beispiel #16
0
 private List<match_index> matches_case_sensitive_with_indexes(line l, info_type type) {
     string line_part = l.part(type);
     return compare_with_indexes(line_part, text, words);
 }
Beispiel #17
0
 private bool matches_case_sensitive(line l) {
     Debug.Assert( part != part_type.font );
     string line_part = this.line_part(l);
     return compare(line_part, text, words);
 }
Beispiel #18
0
        private match new_match(BitArray ba, line l, int idx, font_info f)
        {
            match m = create_match(ba, f, l, idx);

            return(m);
        }
Beispiel #19
0
 private List<match_index> matches_case_insensitive_with_indexes(line l, info_type type) {
     string line_part = l.part(type).ToLower();
     return compare_with_indexes(line_part, lo_text, lo_words, type);
 }
Beispiel #20
0
        private List <match_index> matches_case_sensitive_with_indexes(line l, info_type type)
        {
            string line_part = l.part(type);

            return(compare_with_indexes(line_part, text, words, type));
        }
Beispiel #21
0
        public List< match_index > match_indexes(line l, info_type type) {
            if (part == part_type.font || part == part_type.case_sensitive_info)
                return empty_;

            // 1.2.6 for now, care about match indexes only for msg column
            if (type != info_type.msg)
                return empty_;

            // we only care about "positive" matches - those that have "containing", "startswith", regex, etc.
            switch (comparison) {
            case comparison_type.does_not_start_with:
            case comparison_type.does_not_contain:
            case comparison_type.contains_none:
                return empty_;

            case comparison_type.equal:
            case comparison_type.not_equal:
            case comparison_type.starts_with:
            case comparison_type.contains:
            case comparison_type.contains_any:
            case comparison_type.regex:
                break;
            default:
                Debug.Assert(false);
                return empty_;
            }

            return case_sensitive ? matches_case_sensitive_with_indexes(l, type) : matches_case_insensitive_with_indexes(l, type);
        }
Beispiel #22
0
 // returns all the matches from all columns
 public List<match_index> match_indexes_any_column(line l) {
     List<match_index> indexes = new List<match_index>();
     foreach ( var type in info_type_io.searchable)
         indexes.AddRange( match_indexes(l, type) );
     return indexes;
 }
Beispiel #23
0
 public static bool matches(line l, IEnumerable<info_type> cols, search_for search) {
     // 1.6.27+ faster way to find out if the message is contained - just look at the full message (instead of looking at each part)
     if (matches_cell(l.raw_full_msg(), search))
         return cols.Any(x => matches_cell(l.part(x), search));
     else
         return false;
 }
Beispiel #24
0
 private string line_part(line l)
 {
     return(l.part(part_type_io.to_info_type(part)));
 }
Beispiel #25
0
        public List<filter_line.match_index> match_indexes(line l, info_type type) {
            List<filter_line.match_index> indexes = new List<filter_line.match_index>();
            lock (this) 
                foreach ( var row in rows_)
                    indexes.AddRange( row.match_indexes(l, type));

            indexes.Sort((x, y) => {
                if (x.start != y.start)
                    return x.start - y.start;
                return -(x.len - y.len);
            });
            return indexes;
        } 
Beispiel #26
0
 public bool matches(line l)
 {
     return(case_sensitive ? matches_case_sensitive(l) : matches_case_insensitive(l));
 }
Beispiel #27
0
 public match(BitArray matches, font_info font, line line, int lineIdx) {
     this.matches = matches;
     this.font = font;
     this.line = line;
     line_idx = lineIdx;
 }
Beispiel #28
0
        private List <match_index> matches_case_insensitive_with_indexes(line l, info_type type)
        {
            string line_part = l.part(type).ToLower();

            return(compare_with_indexes(line_part, lo_text, lo_words));
        }
Beispiel #29
0
 private match new_match(BitArray ba, line l, int idx, font_info f ) {
     match m = create_match(ba, f, l, idx);
     return m;
 }