Scintilla 4.0.3
[TortoiseGit.git] / ext / scintilla / src / CharClassify.h
blob19e927bdd39a787722226a5bf0c1f27930ff7d9f
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 <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
8 #ifndef CHARCLASSIFY_H
9 #define CHARCLASSIFY_H
11 namespace Scintilla {
13 class CharClassify {
14 public:
15 CharClassify();
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;
21 cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
22 bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
24 private:
25 enum { maxChar=256 };
26 unsigned char charClass[maxChar]; // not type cc to save space
31 #endif