Esempio n. 1
0
        public static bool Matches(this ILineReader reader, Func <string, string> comparer)
        {
            ILineReaderEntry entry = reader.Current;

            if (entry == null)
            {
                return(false);
            }
            return(comparer(entry.Text) != null);
        }
Esempio n. 2
0
 public void Flush(ILineReaderEntry stopAt = null)
 {
     if (stopAt != null)
     {
         m_index = (stopAt as EntryWrapper).Index;
     }
     else
     {
         m_index = m_list.Count;
     }
     m_current = null;
 }
Esempio n. 3
0
        public static string Find(this ILineReader reader, [Implicit] ICallContext context, Func <string, string> comparer, bool flushIfNotFound = false)
        {
            var peaker            = reader.Peak();
            ILineReaderEntry last = null;

            foreach (var entry in peaker)
            {
                var result = comparer(entry.Text);
                if (result != null)
                {
                    reader.Flush(entry);
                    return(result);
                }
                last = entry;
            }
            if (flushIfNotFound)
            {
                reader.Flush(last);     // First flush until the last seen entry
                reader.Next();          // ... then also flush the last seen.
            }
            return(null);
        }