Only replace template filename matching start of word on saving.
[geany-mirror.git] / scintilla / CharClassify.h
blobd746fe02dd59769710c8ea2dac82351aabbf17e1
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 class CharClassify {
12 public:
13 CharClassify();
15 enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
16 void SetDefaultCharClasses(bool includeWordClass);
17 void SetCharClasses(const unsigned char *chars, cc newCharClass);
18 cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
19 bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
21 private:
22 enum { maxChar=256 };
23 unsigned char charClass[maxChar]; // not type cc to save space
26 // These functions are implemented because each platform calls them something different.
27 int CompareCaseInsensitive(const char *a, const char *b);
28 int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
30 inline char MakeUpperCase(char ch) {
31 if (ch < 'a' || ch > 'z')
32 return ch;
33 else
34 return static_cast<char>(ch - 'a' + 'A');
37 #endif