/Tools/MaterialEditor/wxscintilla_1.69.2/src/scintilla/src/StyleContext.cxx
C++ | 51 lines | 38 code | 7 blank | 6 comment | 4 complexity | faec4a36e74e79d8b1bb23fe682ca21a MD5 | raw file
Possible License(s): LGPL-2.1, MIT
- // Scintilla source code edit control
- /** @file StyleContext.cxx
- ** Lexer infrastructure.
- **/
- // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
- // This file is in the public domain.
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdio.h>
- #include "Platform.h"
- #include "PropSet.h"
- #include "Accessor.h"
- #include "StyleContext.h"
- static void getRange(unsigned int start,
- unsigned int end,
- Accessor &styler,
- char *s,
- unsigned int len) {
- unsigned int i = 0;
- while ((i < end - start + 1) && (i < len-1)) {
- s[i] = styler[start + i];
- i++;
- }
- s[i] = '\0';
- }
- void StyleContext::GetCurrent(char *s, unsigned int len) {
- getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
- }
- static void getRangeLowered(unsigned int start,
- unsigned int end,
- Accessor &styler,
- char *s,
- unsigned int len) {
- unsigned int i = 0;
- while ((i < end - start + 1) && (i < len-1)) {
- s[i] = static_cast<char>(tolower(styler[start + i]));
- i++;
- }
- s[i] = '\0';
- }
- void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
- getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
- }