]> git.saurik.com Git - wxWidgets.git/blob - src/stc/scintilla/src/StyleContext.cxx
Compilation fix for wxUSE_PROTOCOL && !wxUSE_URL.
[wxWidgets.git] / src / stc / scintilla / src / 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
13 #include "Platform.h"
14
15 #include "PropSet.h"
16 #include "Accessor.h"
17 #include "StyleContext.h"
18
19 #ifdef SCI_NAMESPACE
20 using namespace Scintilla;
21 #endif
22
23 static void getRange(unsigned int start,
24 unsigned int end,
25 Accessor &styler,
26 char *s,
27 unsigned int len) {
28 unsigned int i = 0;
29 while ((i < end - start + 1) && (i < len-1)) {
30 s[i] = styler[start + i];
31 i++;
32 }
33 s[i] = '\0';
34 }
35
36 void StyleContext::GetCurrent(char *s, unsigned int len) {
37 getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
38 }
39
40 static void getRangeLowered(unsigned int start,
41 unsigned int end,
42 Accessor &styler,
43 char *s,
44 unsigned int len) {
45 unsigned int i = 0;
46 while ((i < end - start + 1) && (i < len-1)) {
47 s[i] = static_cast<char>(tolower(styler[start + i]));
48 i++;
49 }
50 s[i] = '\0';
51 }
52
53 void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
54 getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
55 }