2013-08-02 13:12:24 -07:00
|
|
|
// Matt Wells, copyright Jan 2007
|
|
|
|
|
2016-03-08 22:14:30 +01:00
|
|
|
#ifndef GB_MATCHES2_H
|
|
|
|
#define GB_MATCHES2_H
|
2013-08-02 13:12:24 -07:00
|
|
|
|
2016-08-10 12:54:45 +02:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
2013-08-02 13:12:24 -07:00
|
|
|
// use these routines for matching any of a list of substrings in the haystack.
|
|
|
|
// the Matches array is the list of substrings to match in the "haystack". this
|
|
|
|
// should be *very* fast.
|
|
|
|
class Needle {
|
|
|
|
public:
|
2016-04-07 17:57:16 +02:00
|
|
|
const char *m_string;
|
2013-08-02 13:12:24 -07:00
|
|
|
char m_stringSize;
|
|
|
|
char m_id;
|
|
|
|
// if m_isSection is true, getMatch() only matches if haystack
|
|
|
|
// ptr is < linkPos
|
|
|
|
char m_isSection;
|
2014-11-10 14:45:11 -08:00
|
|
|
int32_t m_count;
|
2013-08-02 13:12:24 -07:00
|
|
|
char *m_firstMatch;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
char *getMatches2 ( Needle *needles ,
|
2014-11-10 14:45:11 -08:00
|
|
|
int32_t numNeedles ,
|
2013-08-02 13:12:24 -07:00
|
|
|
char *haystack ,
|
2014-11-10 14:45:11 -08:00
|
|
|
int32_t haystackSize ,
|
2013-08-02 13:12:24 -07:00
|
|
|
char *linkPos ,
|
2014-11-10 14:45:11 -08:00
|
|
|
int32_t *n ,
|
2013-08-02 13:12:24 -07:00
|
|
|
bool stopAtFirstMatch ,
|
|
|
|
bool *hadPreMatch ,
|
|
|
|
bool saveQuickTables ,
|
2014-11-10 14:45:11 -08:00
|
|
|
int32_t niceness );
|
2013-08-02 13:12:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-08 22:14:30 +01:00
|
|
|
#endif // GB_MATCHES2_H
|