本文整理汇总了C++中VString::EqualTo方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::EqualTo方法的具体用法?C++ VString::EqualTo怎么用?C++ VString::EqualTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VString
的用法示例。
在下文中一共展示了VString::EqualTo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsTagWithoutClose
static bool IsTagWithoutClose( const VString &inTag )
{
static const char *sList[] = {
"!DOCTYPE",
"AREA",
"BASE",
"BASEFONT",
"BR",
"COL",
"FRAME",
"HR"
"IMG",
"INPUT",
"ISINDEX",
"LINK",
"META",
"PARAM",
};
for (sLONG i = 0; i < sizeof( sList ) / sizeof( const char * ); i++) {
if (inTag.EqualTo( VString( sList[ i ] ), false )) return true;
}
return false;
}
示例2: _GetProperty
void VJSLanguageSyntaxTesterColorResults::_GetProperty( VJSParms_getProperty &ioParams, IJSLanguageSyntaxTesterColorResults *inResults )
{
VString propName;
if (ioParams.GetPropertyName( propName )) {
sLONG result = -1;
if (propName.EqualTo( CVSTR( "kColumnName" ), true )) result = eColumnName;
else if (propName.EqualTo( CVSTR( "kTableName" ), true )) result = eTableName;
else if (propName.EqualTo( CVSTR( "kComment" ), true )) result = eComment;
else if (propName.EqualTo( CVSTR( "kKeyword" ), true )) result = eKeyword;
else if (propName.EqualTo( CVSTR( "kNormal" ), true )) result = eNormal;
else if (propName.EqualTo( CVSTR( "kNumber" ), true )) result = eNumber;
else if (propName.EqualTo( CVSTR( "kString" ), true )) result = eString;
else if (propName.EqualTo( CVSTR( "kName" ), true )) result = eName;
else if (propName.EqualTo( CVSTR( "kComparison" ), true )) result = eComparison;
else if (propName.EqualTo( CVSTR( "kFunctionKeyword" ), true )) result = eFunctionKeyword;
else if (propName.EqualTo( CVSTR( "kDebug" ), true )) result = eDebug;
if (-1 != result) ioParams.ReturnNumber( result );
}
}
示例3: IsMultiLineCommentStart
bool HTMLLexer::IsMultiLineCommentStart( UniChar inChar, sLONG &outType )
{
// We are looking for <!--, which requires three more tokens of lookahead.
if (CHAR_LESS_THAN_SIGN != inChar) return false;
if (!fLexerInput->HasMoreChars()) return false;
VString subStr;
fLexerInput->GetSubString( fLexerInput->GetCurrentPosition(), 4, subStr );
if (subStr.EqualTo( CVSTR( "<!--" ), false )) {
outType = kHTMLMultilineComment;
return true;
}
return false;
}
示例4: IsMultiLineCommentEnd
bool HTMLLexer::IsMultiLineCommentEnd( UniChar inChar, sLONG &outCharsToConsume, sLONG inType )
{
// We have to check for newlines for no other reason than bookkeeping. This records when we
// locate a newline so that the fLineNumber property remains properly in-sync. We will consume
// the newline for the caller if that's what we've gotten.
if (IsLineEnding( inChar )) ConsumeLineEnding( inChar );
// We are looking for -->
if (inType != kCommentContinuationType &&
inType != kHTMLMultilineComment) return false;
if (CHAR_HYPHEN_MINUS != inChar) return false;
if (!fLexerInput->HasMoreChars()) return false;
VString subStr;
fLexerInput->GetSubString( fLexerInput->GetCurrentPosition() + 1, 2, subStr );
if (subStr.EqualTo( CVSTR( "->" ), false )) {
// We're at the end of the comment, but the caller still needs to consume two characters
outCharsToConsume = 2;
return true;
}
return false;
}
示例5: GetSuggestions
void VHTMLSyntax::GetSuggestions( ICodeEditorDocument* inDocument, sLONG inLineNumber, sLONG inPos, ITipInfoArray *outSuggestions, sLONG& outStartOffset, bool inAll )
{
// Get the text for the line up to the point of insertion, and we'll lex that to see if we can come up
// with some rational suggestions for the user.
VString xstr;
inDocument->GetLine( inLineNumber, xstr );
xstr.Truncate( inPos );
char *lexinput = CreateUTF8String( xstr );
struct htmlLexeme *list = parseHTML( lexinput );
// Gin up some line params for tracking state information
VLineSyntaxParams *currentLineParams = currentLineParams = new VLineSyntaxParams();
if (inLineNumber > 0) {
// We're starting where we left off on the previous line
currentLineParams->CopyState( static_cast< VLineSyntaxParams * >( inDocument->GetLineSyntaxParams( inLineNumber - 1 ) ) );
}
// Given the list of HTML tokens, let's walk over the list and try to make some sense
// of them. Walk over the list one token at a time, and see if we can make sense of
// what we've got. This is going to be awfully similar to the way we do things in the
// SetLine method, except that we're not actually updating the line state for the current
// line. Instead, we're working on a copy of the existing information.
struct htmlLexeme *cur = list;
int lastTokenProcessed = 0;
while (cur) {
if (kKeyword == cur->fStyle) {
lastTokenProcessed = 3;
// Keywords a bit trickier than you might think because we need to be sure they're actually part of a
// tag. If the user types something like: <b>This table rocks</b>, we only want to highlight the b in the
// begin and end tag, and not the "table" in the user's text. To deal with this, we have an "in tag" flag
// that basically turns keyword highlighting on and off.
if (currentLineParams->IsProcessingTag()) {
// If we're processing an opening tag, then we want to push the keyword onto the tag stack. But if we're
// processing a closing tag, then we want to pop the last keyword off the tag stack and try to match it up
// to what we just processed. If they match, we're golden. If not, we just assume the user's mismatching
// their tags because they're an idiot.
VString tagName;
xstr.GetSubString( cur->fOffset + 1, cur->fLength, tagName );
if (currentLineParams->IsProcessingStartTag()) {
currentLineParams->PushTag( tagName );
// Note that we are no longer processing the start of a tag. This allows us to handle attributes
// separately from the tag itself.
currentLineParams->SetIsProcessingStartTag( false );
} else {
VString lastTag;
currentLineParams->PopTag( lastTag );
if (!lastTag.EqualTo( tagName, false )) {
// The tags don't match, so we're just going to ignore the issue
// TODO: do something more sensible here
}
}
}
} else if (kTagOpen == cur->fStyle || kEndTagOpen == cur->fStyle) {
lastTokenProcessed = (kTagOpen == cur->fStyle) ? 1 : 2;
currentLineParams->SetIsProcessingTag( true );
currentLineParams->SetIsProcessingStartTag( kTagOpen == cur->fStyle );
} else if (kTagClose == cur->fStyle || kTagSelfClose == cur->fStyle) {
lastTokenProcessed = 0;
currentLineParams->SetIsProcessingTag( false );
// If we just handled a self-closing tag (like <br />), then we want to pop it from the stack
// TODO: some tags can't have matching pairs, like <br>, so even if it's not self-closing, we want
// to pop it off the tag stack. Handle that here
if (kTagSelfClose == cur->fStyle) {
VString toss;
currentLineParams->PopTag( toss );
}
} else {
lastTokenProcessed = 0;
}
cur = cur->fNext;
}
if (lastTokenProcessed == 1) {
// We processed a tag opener, but no keyword for the tag. So let's make a bunch of suggestions!
} else if (lastTokenProcessed == 2) {
// We processed a tag closer, but no keyword for the tag. Grab the last opened tag from the list
// and suggest it as the closer
VString suggestion;
currentLineParams->LastTag( suggestion );
outSuggestions->AddTip( new VCodeEditorTipInfo( inDocument, suggestion, htmlcolorShadow[ keyword_col ] ) );
}
delete currentLineParams;
FreeLexemeList( list );
}
示例6: SetLine
//.........这里部分代码省略.........
// token, but they never opened it. We're going to ignore that state, and flag this as being normal
inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ scommentend_col ] );
} else if (kString == cur->fStyle) {
inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ string_col ] );
} else if (kKeyword == cur->fStyle) {
// Keywords a bit trickier than you might think because we need to be sure they're actually part of a
// tag. If the user types something like: <b>This table rocks</b>, we only want to highlight the b in the
// begin and end tag, and not the "table" in the user's text. To deal with this, we have an "in tag" flag
// that basically turns keyword highlighting on and off.
if (currentLineParams->IsProcessingTag()) {
inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ keyword_col ] );
// If we're processing an opening tag, then we want to push the keyword onto the tag stack. But if we're
// processing a closing tag, then we want to pop the last keyword off the tag stack and try to match it up
// to what we just processed. If they match, we're golden. If not, we just assume the user's mismatching
// their tags because they're an idiot.
VString tagName;
xstr.GetSubString( cur->fOffset + 1, cur->fLength, tagName );
if (currentLineParams->IsProcessingStartTag()) {
if (!IsTagWithoutClose( tagName )) {
openList.push_back( tagName );
}
currentLineParams->PushTag( tagName );
// Note that we are no longer processing the start of a tag. This allows us to handle attributes
// separately from the tag itself.
currentLineParams->SetIsProcessingStartTag( false );
} else {
// Check to see if this closed tag is on the open list. If it is, we want to remove it from the
// list. Otherwise, we want to add it to the close list.
bool bAddToClose = true;
for (std::vector< VString >::iterator iter = openList.begin(); bAddToClose && iter != openList.end();) {
if (tagName.EqualTo( *iter, false )) {
iter = openList.erase( iter );
bAddToClose = false;
} else {
++iter;
}
}
if (bAddToClose) closeList.push_back( tagName );
VString lastTag;
currentLineParams->PopTag( lastTag );
if (!lastTag.EqualTo( tagName, false )) {
// The tags don't match, so we're just going to ignore the issue
// TODO: do something more sensible here
}
}
}
} else if (kNumber == cur->fStyle) {
inDocument->SetLineStyle( inLineNumber, cur->fOffset, cur->fOffset + cur->fLength, htmlcolorShadow[ allnum_col ] );
} else if (kTagOpen == cur->fStyle || kEndTagOpen == cur->fStyle) {
currentLineParams->SetIsProcessingTag( true );
currentLineParams->SetIsProcessingStartTag( kTagOpen == cur->fStyle );
} else if (kTagClose == cur->fStyle || kTagSelfClose == cur->fStyle) {
currentLineParams->SetIsProcessingTag( false );
// If we just handled a self-closing tag (like <br />), then we want to pop it from the stack
VString lastTag;
currentLineParams->LastTag( lastTag );
if (kTagSelfClose == cur->fStyle || IsTagWithoutClose( lastTag )) {
VString toss;
currentLineParams->PopTag( toss );
示例7: MatchesCloseTag
bool MatchesCloseTag( const VString &inTag ) {
for (std::vector< VString >::iterator iter = fUnmatchedCloseTags.begin(); iter != fUnmatchedCloseTags.end(); ++iter) {
if (inTag.EqualTo( *iter, false )) return true;
}
return false;
}