]>
git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/CharacterSet.h
4e8ffbdf6fe8a1907593581a9b396bbae4a33ba5
1 // Scintilla source code edit control
2 /** @file CharacterSet.h
3 ** Encapsulates a set of characters. Used to test if a character is within a set.
5 // Copyright 2007 by Neil Hodgson <neilh@scintilla.org>
6 // The License.txt file describes the conditions under which this software may be distributed.
18 setAlpha
=setLower
|setUpper
,
19 setAlphaNum
=setAlpha
|setDigits
21 CharacterSet(setBase base
=setNone
, const char *initialSet
="", int size_
=0x80, bool valueAfter_
=false) {
23 valueAfter
= valueAfter_
;
24 bset
= new bool[size
];
25 for (int i
=0; i
< size
; i
++) {
28 AddString(initialSet
);
30 AddString("abcdefghijklmnopqrstuvwxyz");
32 AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
34 AddString("0123456789");
42 PLATFORM_ASSERT(val
>= 0);
43 PLATFORM_ASSERT(val
< size
);
46 void AddString(const char *CharacterSet
) {
47 for (const char *cp
=CharacterSet
; *cp
; cp
++) {
48 int val
= static_cast<unsigned char>(*cp
);
49 PLATFORM_ASSERT(val
>= 0);
50 PLATFORM_ASSERT(val
< size
);
54 bool Contains(int val
) const {
55 PLATFORM_ASSERT(val
>= 0);
56 return (val
< size
) ? bset
[val
] : valueAfter
;