From 664e37abfe5c796c1279b8295fb030f126b0a7d8 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 30 Nov 2011 11:36:13 -0600 Subject: Initial import of qscintilla from 2007 --- src/StyleContext.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 src/StyleContext.cpp (limited to 'src/StyleContext.cpp') diff --git a/src/StyleContext.cpp b/src/StyleContext.cpp new file mode 100755 index 0000000..d9da0ed --- /dev/null +++ b/src/StyleContext.cpp @@ -0,0 +1,51 @@ +// Scintilla source code edit control +/** @file StyleContext.cxx + ** Lexer infrastructure. + **/ +// Copyright 1998-2004 by Neil Hodgson +// This file is in the public domain. + +#include +#include +#include +#include + +#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(tolower(styler[start + i])); + i++; + } + s[i] = '\0'; +} + +void StyleContext::GetCurrentLowered(char *s, unsigned int len) { + getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); +} -- cgit v1.2.3