]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/lexlib/StyleContext.cxx
Added ability to switch off more components of the size page UI
[wxWidgets.git] / src / stc / scintilla / lexlib / StyleContext.cxx
1 // Scintilla source code edit control
2 /** @file StyleContext.cxx
3 ** Lexer infrastructure.
4 **/
5 // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
6 // This file is in the public domain.
7
8 #include <stdlib.h>
9 #include <string.h>
10 #include <ctype.h>
11 #include <stdio.h>
12 #include <assert.h>
13
14 #include "ILexer.h"
15
16 #include "LexAccessor.h"
17 #include "Accessor.h"
18 #include "StyleContext.h"
19
20 #ifdef SCI_NAMESPACE
21 using namespace Scintilla;
22 #endif
23
24 static void getRange(unsigned int start,
25 unsigned int end,
26 LexAccessor &styler,
27 char *s,
28 unsigned int len) {
29 unsigned int i = 0;
30 while ((i < end - start + 1) && (i < len-1)) {
31 s[i] = styler[start + i];
32 i++;
33 }
34 s[i] = '\0';
35 }
36
37 void StyleContext::GetCurrent(char *s, unsigned int len) {
38 getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
39 }
40
41 static void getRangeLowered(unsigned int start,
42 unsigned int end,
43 LexAccessor &styler,
44 char *s,
45 unsigned int len) {
46 unsigned int i = 0;
47 while ((i < end - start + 1) && (i < len-1)) {
48 s[i] = static_cast<char>(tolower(styler[start + i]));
49 i++;
50 }
51 s[i] = '\0';
52 }
53
54 void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
55 getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
56 }