/[debian]/mimetic/trunk/mimetic/utils.h
ViewVC logotype

Diff of /mimetic/trunk/mimetic/utils.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 196 by gregoa, Sat Feb 25 16:49:22 2006 UTC revision 197 by gregoa, Sun Apr 16 12:21:05 2006 UTC
# Line 2  Line 2 
2      copyright            : (C) 2002-2005 by Stefano Barbato      copyright            : (C) 2002-2005 by Stefano Barbato
3      email                : stefano@codesink.org      email                : stefano@codesink.org
4    
5      $Id: utils.h,v 1.21 2005/03/07 15:35:08 tat Exp $      $Id: utils.h,v 1.22 2006/04/10 08:42:44 tat Exp $
6   ***************************************************************************/   ***************************************************************************/
7    
8  /***************************************************************************  /***************************************************************************
# Line 49  int str2int(const std::string& s); Line 49  int str2int(const std::string& s);
49  /// returns a string hexadecimal representation of \p n  /// returns a string hexadecimal representation of \p n
50  std::string int2hex(unsigned int n);  std::string int2hex(unsigned int n);
51    
 // boyer-moore find  
 /**  
  * find the first occurrence of \p word in (\p bit, \p eit]  
  *  
  * returns an Iterator pointing at the first character of the found pattern  
  * or \p eit if the search fails  
  */  
 template<typename Iterator>  
 Iterator find_bm(Iterator bit, Iterator eit, const std::string& word)  
 {  
     return find_bm(bit, eit, word,  
         typename std::iterator_traits<Iterator>::iterator_category());  
 }  
   
52  // find_bm specialization for random access iterators  // find_bm specialization for random access iterators
53  template<typename Iterator>  template<typename Iterator>
54  Iterator find_bm(Iterator bit, Iterator eit, const std::string& word, const std::random_access_iterator_tag&)  Iterator find_bm(Iterator bit, Iterator eit, const std::string& word, const std::random_access_iterator_tag&)
# Line 94  Iterator find_bm(Iterator bit, Iterator Line 80  Iterator find_bm(Iterator bit, Iterator
80      return bit + i + 1;      return bit + i + 1;
81  }  }
82    
83    // boyer-moore find
84    /**
85     * find the first occurrence of \p word in (\p bit, \p eit]
86     *
87     * returns an Iterator pointing at the first character of the found pattern
88     * or \p eit if the search fails
89     */
90    template<typename Iterator>
91    Iterator find_bm(Iterator bit, Iterator eit, const std::string& word)
92    {
93        return find_bm(bit, eit, word,
94            typename std::iterator_traits<Iterator>::iterator_category());
95    }
96    
97    
98    
99  } // ns utils  } // ns utils

Legend:
Removed from v.196  
changed lines
  Added in v.197

  ViewVC Help
Powered by ViewVC 1.1.26