-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiFindCallback.h
More file actions
40 lines (32 loc) · 938 Bytes
/
MultiFindCallback.h
File metadata and controls
40 lines (32 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Non-blocking version of MultiFind which calls a callback
// function when it finds a match
//
// (c) Copyright 2014 MCQN Ltd
#ifndef MULTIFINDCALLBACK_H
#define MULTIFINDCALLBACK_H
#include "MultiFind.h"
typedef void (*CallbackFn)(const char* aMatchString, void* aUserData);
class FindItemCallback : public FindItem
{
public:
FindItemCallback(const char* aFindString =NULL, CallbackFn aCallback =NULL, void* aUserData =NULL);
void makeCallback();
protected:
CallbackFn iCallback;
void* iUserData;
};
class MultiFindCallback
{
public:
MultiFindCallback(FindItemCallback* aItemsToFind, int aCount);
void reset();
// Find one of the given items and if so, call its callback
// @param aStream - stream to search
// @return true if it found an item (and called the callback)
// otherwise it didn't find an item
bool find(Stream& aStream);
protected:
FindItemCallback* iItems;
int iCount;
};
#endif