xref: /MusicPlayer2/scintilla/src/CharClassify.h (revision 67ca1ef4c5be62e9a917ffa576a24422d15e109a)
1 // Scintilla source code edit control
2 /** @file CharClassify.h
3  ** Character classifications used by Document and RESearch.
4  **/
5 // Copyright 2006-2009 by Neil Hodgson <[email protected]>
6 // The License.txt file describes the conditions under which this software may be distributed.
7 
8 #ifndef CHARCLASSIFY_H
9 #define CHARCLASSIFY_H
10 
11 namespace Scintilla {
12 
13 class CharClassify {
14 public:
15 	CharClassify();
16 
17 	enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
18 	void SetDefaultCharClasses(bool includeWordClass);
19 	void SetCharClasses(const unsigned char *chars, cc newCharClass);
20 	int GetCharsOfClass(cc characterClass, unsigned char *buffer) const noexcept;
21 	cc GetClass(unsigned char ch) const noexcept { return static_cast<cc>(charClass[ch]);}
22 	bool IsWord(unsigned char ch) const noexcept { return static_cast<cc>(charClass[ch]) == ccWord;}
23 
24 private:
25 	enum { maxChar=256 };
26 	unsigned char charClass[maxChar];    // not type cc to save space
27 };
28 
29 }
30 
31 #endif
32