-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWordCache.h
More file actions
28 lines (22 loc) · 801 Bytes
/
WordCache.h
File metadata and controls
28 lines (22 loc) · 801 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
// Copyright 2006-13 HumaNature Studios Inc.
#ifndef __WORDCACHE_H__
#define __WORDCACHE_H__
namespace core {
// Collection of phrases, with lists to associate with each phrase.
// Data is organized for fast lookup.
class WordCache
{
protected:
std::vector<std::string> mPhrases;
public:
struct Match
{
const std::string& phrase; // the matching phrase
unsigned int phraseInTextUnicodeIndex; // Number of UTF-8 characters preceding phrase in text (not the byte index)
};
// Search text for phrases. Fill outMatches with results.
// text will be altered by this function.
void findMatches(const char* text, std::vector<Match>& outMatches) const;
};
}
#endif // __WORDCACHE_H__