~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to deprecated/management/profile-editor/src/wxStyledTextCtrl/StyleContext.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-08-10 18:12:34 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110810181234-b6obckg60cp99crg
Tags: upstream-2.7.0~beta1+bzr1774
ImportĀ upstreamĀ versionĀ 2.7.0~beta1+bzr1774

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
static void getRange(unsigned int start,
20
 
                unsigned int end,
21
 
                Accessor &styler,
22
 
                char *s,
23
 
                unsigned int len) {
24
 
        unsigned int i = 0;
25
 
        while ((i < end - start + 1) && (i < len-1)) {
26
 
                s[i] = styler[start + i];
27
 
                i++;
28
 
        }
29
 
        s[i] = '\0';
30
 
}
31
 
 
32
 
void StyleContext::GetCurrent(char *s, unsigned int len) {
33
 
        getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len);
34
 
}
35
 
 
36
 
static void getRangeLowered(unsigned int start,
37
 
                unsigned int end,
38
 
                Accessor &styler,
39
 
                char *s,
40
 
                unsigned int len) {
41
 
        unsigned int i = 0;
42
 
        while ((i < end - start + 1) && (i < len-1)) {
43
 
                s[i] = static_cast<char>(tolower(styler[start + i]));
44
 
                i++;
45
 
        }
46
 
        s[i] = '\0';
47
 
}
48
 
 
49
 
void StyleContext::GetCurrentLowered(char *s, unsigned int len) {
50
 
        getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len);
51
 
}