Qt 4.8
Classes | Macros | Enumerations | Functions | Variables
qscriptsyntaxhighlighter.cpp File Reference
#include "qscriptsyntaxhighlighter_p.h"
#include "private/qfunctions_p.h"

Go to the source code of this file.

Classes

struct  KeywordHelper
 

Macros

#define MAX_KEYWORD   63
 

Enumerations

enum  ScriptIds {
  Comment = 1, Number, String, Type,
  Keyword, PreProcessor, Label
}
 

Functions

static bool isKeyword (const QString &word)
 
Q_STATIC_GLOBAL_OPERATOR bool operator< (const KeywordHelper &helper, const char *kw)
 
Q_STATIC_GLOBAL_OPERATOR bool operator< (const char *kw, const KeywordHelper &helper)
 

Variables

static const char *const keywords [MAX_KEYWORD]
 

Macro Definition Documentation

◆ MAX_KEYWORD

#define MAX_KEYWORD   63

Definition at line 59 of file qscriptsyntaxhighlighter.cpp.

Referenced by isKeyword().

Enumeration Type Documentation

◆ ScriptIds

enum ScriptIds
Enumerator
Comment 
Number 
String 
Type 
Keyword 
PreProcessor 
Label 

Definition at line 49 of file qscriptsyntaxhighlighter.cpp.

Function Documentation

◆ isKeyword()

static bool isKeyword ( const QString word)
static

Definition at line 142 of file qscriptsyntaxhighlighter.cpp.

Referenced by QScriptSyntaxHighlighter::highlightWord().

143 {
144  const char * const *start = &keywords[0];
145  const char * const *end = &keywords[MAX_KEYWORD - 1];
146  const char * const *kw = qBinaryFind(start, end, KeywordHelper(word));
147 
148  return kw != end;
149 }
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
Definition: qalgorithms.h:295
#define MAX_KEYWORD
static const char *const keywords[MAX_KEYWORD]
static const KeyPair *const end

◆ operator<() [1/2]

Q_STATIC_GLOBAL_OPERATOR bool operator< ( const KeywordHelper helper,
const char *  kw 
)

Definition at line 132 of file qscriptsyntaxhighlighter.cpp.

133 {
134  return helper.needle < QLatin1String(kw);
135 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

◆ operator<() [2/2]

Q_STATIC_GLOBAL_OPERATOR bool operator< ( const char *  kw,
const KeywordHelper helper 
)

Definition at line 137 of file qscriptsyntaxhighlighter.cpp.

138 {
139  return QLatin1String(kw) < helper.needle;
140 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString

Variable Documentation

◆ keywords

const char* const keywords[MAX_KEYWORD]
static