本文整理汇总了C++中StyleContext类的典型用法代码示例。如果您正苦于以下问题:C++ StyleContext类的具体用法?C++ StyleContext怎么用?C++ StyleContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StyleContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsValidHrule
// Separator line
static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
int c, count = 1;
unsigned int i = 0;
while (++i) {
c = sc.GetRelative(i);
if (c == sc.ch)
++count;
// hit a terminating character
else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) {
// Are we a valid HRULE
if ((IsNewline(c) || sc.currentPos + i == endPos) &&
count >= 20 && !HasPrevLineContent(sc)) {
sc.SetState(SCE_TXT2TAGS_HRULE);
sc.Forward(i);
sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
return true;
}
else {
sc.SetState(SCE_TXT2TAGS_DEFAULT);
return false;
}
}
}
return false;
}
示例2: CheckForKeyword
/**
* Check if the current content context represent a keyword and set the context state if so.
*/
static void CheckForKeyword(StyleContext& sc, WordList* keywordlists[], int activeState)
{
int length = sc.LengthCurrent() + 1; // +1 for the next char
char* s = new char[length];
sc.GetCurrentLowered(s, length);
if (keywordlists[0]->InList(s))
sc.ChangeState(SCE_MYSQL_MAJORKEYWORD | activeState);
else
if (keywordlists[1]->InList(s))
sc.ChangeState(SCE_MYSQL_KEYWORD | activeState);
else
if (keywordlists[2]->InList(s))
sc.ChangeState(SCE_MYSQL_DATABASEOBJECT | activeState);
else
if (keywordlists[3]->InList(s))
sc.ChangeState(SCE_MYSQL_FUNCTION | activeState);
else
if (keywordlists[5]->InList(s))
sc.ChangeState(SCE_MYSQL_PROCEDUREKEYWORD | activeState);
else
if (keywordlists[6]->InList(s))
sc.ChangeState(SCE_MYSQL_USER1 | activeState);
else
if (keywordlists[7]->InList(s))
sc.ChangeState(SCE_MYSQL_USER2 | activeState);
else
if (keywordlists[8]->InList(s))
sc.ChangeState(SCE_MYSQL_USER3 | activeState);
delete [] s;
}
示例3: ForwardDefaultState
static void ForwardDefaultState(StyleContext& sc, int activeState)
{
if (activeState == 0)
sc.ForwardSetState(SCE_MYSQL_DEFAULT);
else
sc.ForwardSetState(SCE_MYSQL_HIDDENCOMMAND);
}
示例4: ColouriseString
static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
sc.SetState(SCE_ADA_STRING);
sc.Forward();
ColouriseContext(sc, '"', SCE_ADA_STRINGEOL);
}
示例5: LongDelimCheck
// Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ],
// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
// The maximum number of '=' characters allowed is 254.
static int LongDelimCheck(StyleContext &sc) {
int sep = 1;
while (sc.GetRelative(sep) == '=' && sep < 0xFF)
sep++;
if (sc.GetRelative(sep) == sc.ch)
return sep;
return 0;
}
示例6: ColouriseComment
static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) {
// Apostrophe meaning is not changed, but the parameter is present for uniformity
sc.SetState(SCE_ADA_COMMENTLINE);
while (!sc.atLineEnd) {
sc.Forward();
}
}
示例7: ColouriseTADS3HTMLTagStart
static void ColouriseTADS3HTMLTagStart(StyleContext &sc) {
sc.SetState(SCE_T3_HTML_TAG);
sc.Forward();
if (sc.ch == '/') {
sc.Forward();
}
while (IsAnHTMLChar(sc.ch)) {
sc.Forward();
}
}
示例8: ColouriseContext
static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) {
while (!sc.atLineEnd && !sc.Match(chEnd)) {
sc.Forward();
}
if (!sc.atLineEnd) {
sc.ForwardSetState(SCE_ADA_DEFAULT);
} else {
sc.ChangeState(stateEOL);
}
}
示例9: ColouriseCharacter
static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true;
sc.SetState(SCE_ADA_CHARACTER);
// Skip the apostrophe and one more character (so that '' is shown as non-terminated and '''
// is handled correctly)
sc.Forward();
sc.Forward();
ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL);
}
示例10: HasPrevLineContent
// Does the previous line have more than spaces and tabs?
static bool HasPrevLineContent(StyleContext &sc) {
int i = 0;
// Go back to the previous newline
while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))
;
while (--i + sc.currentPos) {
if (IsNewline(sc.GetRelative(i)))
break;
if (!IsASpaceOrTab(sc.GetRelative(i)))
return true;
}
return false;
}
示例11: ColouriseTADS3Number
static void ColouriseTADS3Number(StyleContext &sc) {
int endState = sc.state;
bool inHexNumber = false;
bool seenE = false;
bool seenDot = sc.ch == '.';
sc.SetState(SCE_T3_NUMBER);
if (sc.More()) {
sc.Forward();
}
if (sc.chPrev == '0' && tolower(sc.ch) == 'x') {
inHexNumber = true;
sc.Forward();
}
while (sc.More()) {
if (inHexNumber) {
if (!IsAHexDigit(sc.ch)) {
break;
}
} else if (!isdigit(sc.ch)) {
if (!seenE && tolower(sc.ch) == 'e') {
seenE = true;
seenDot = true;
if (sc.chNext == '+' || sc.chNext == '-') {
sc.Forward();
}
} else if (!seenDot && sc.ch == '.') {
seenDot = true;
} else {
break;
}
}
sc.Forward();
}
sc.SetState(endState);
}
示例12: ColouriseLabel
static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = false;
sc.SetState(SCE_ADA_LABEL);
// Skip "<<"
sc.Forward();
sc.Forward();
std::string identifier;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
identifier += static_cast<char>(tolower(sc.ch));
sc.Forward();
}
// Skip ">>"
if (sc.Match('>', '>')) {
sc.Forward();
sc.Forward();
} else {
sc.ChangeState(SCE_ADA_ILLEGAL);
}
// If the name is an invalid identifier or a keyword, then make it invalid label
if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) {
sc.ChangeState(SCE_ADA_ILLEGAL);
}
sc.SetState(SCE_ADA_DEFAULT);
}
示例13: ColouriseToEndOfLine
static void ColouriseToEndOfLine(StyleContext &sc, int initState, int endState) {
sc.SetState(initState);
while (sc.More()) {
if (sc.ch == '\\') {
sc.Forward();
if (IsEOLSkip(sc)) {
return;
}
}
if (IsEOL(sc.ch, sc.chNext)) {
sc.SetState(endState);
return;
}
sc.Forward();
}
}
示例14: build
void Tile::build(StyleContext& _ctx, const Scene& _scene, const TileData& _data, const DataSource& _source) {
const auto& layers = _scene.layers();
_ctx.setGlobal("$zoom", m_id.z);
for (auto& style : _scene.styles()) {
style->onBeginBuildTile(*this);
}
for (const auto& datalayer : layers) {
if (datalayer.source() != _source.name()) { continue; }
for (const auto& collection : _data.layers) {
if (!collection.name.empty() && collection.name != datalayer.collection()) { continue; }
for (const auto& feat : collection.features) {
_ctx.setFeature(feat);
std::vector<DrawRule> rules;
datalayer.match(feat, _ctx, rules);
for (auto& rule : rules) {
auto* style = _scene.findStyle(rule.style);
if (style) {
rule.eval(_ctx);
style->buildFeature(*this, feat, rule);
}
}
}
}
}
for (auto& style : _scene.styles()) {
style->onEndBuildTile(*this);
}
for (auto& geometry : m_geometry) {
geometry.second->compileVertexBuffer();
}
}
示例15: GlobScan
static int GlobScan(StyleContext &sc) {
// forward scan for a glob-like (...), no whitespace allowed
int c, sLen = 0;
while ((c = sc.GetRelativeCharacter(++sLen)) != 0) {
if (IsASpace(c)) {
return 0;
} else if (c == ')') {
return sLen;
}
}
return 0;
}