Notepad3/scintilla/src/CharClassify.h
Derick Payne 8214c0c04b revert: Undo partial Scintilla 5.5.8 upgrade (incompatible src/win32)
The partial upgrade approach failed - Scintilla 5.5.8 src/ files have
tight coupling with win32/ that cannot be separated due to changes in
PLATFORM_ASSERT and other shared macros. Scintilla stays at 5.5.7.

Lexilla 5.4.6 upgrade remains intact.
2026-01-18 00:52:54 +02:00

33 lines
1017 B
C++

// Scintilla source code edit control
/** @file CharClassify.h
** Character classifications used by Document and RESearch.
**/
// Copyright 2006-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef CHARCLASSIFY_H
#define CHARCLASSIFY_H
namespace Scintilla::Internal {
enum class CharacterClass : unsigned char { space, newLine, word, punctuation };
class CharClassify {
public:
CharClassify() noexcept;
void SetDefaultCharClasses(bool includeWordClass) noexcept;
void SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) noexcept;
int GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const noexcept;
CharacterClass GetClass(unsigned char ch) const noexcept { return charClass[ch];}
bool IsWord(unsigned char ch) const noexcept { return charClass[ch] == CharacterClass::word;}
private:
static constexpr int maxChar=256;
CharacterClass charClass[maxChar];
};
}
#endif