本文整理汇总了C++中Identifier::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::equals方法的具体用法?C++ Identifier::equals怎么用?C++ Identifier::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
Dsymbol *Import::search(Loc loc, Identifier *ident, int flags)
{
//printf("%s.Import::search(ident = '%s', flags = x%x)\n", toChars(), ident->toChars(), flags);
if (!pkg)
{ load(NULL);
mod->semantic();
}
if (names.dim) // selective import
{
for (size_t i = 0; i < names.dim; i++)
{
Identifier *name = (Identifier *)names[i];
Identifier *alias = (Identifier *)aliases[i];
if (!alias)
alias = name;
if (alias->equals(ident))
return mod->search(loc, name, flags);
}
// What should happen when renamed and selective imports are mixed?
// This makes the whole module available with the renamed id.
if (aliasId && aliasId->equals(ident))
return mod;
}
else // non-selective import
{
// For renamed imports, only the alias name is visible.
if (aliasId)
{
if (aliasId->equals(ident))
return mod;
return 0;
}
// For non-static imports, prefer symbols in the module over the module name.
if (!isstatic)
{
Dsymbol *s = mod->search(loc, ident, flags);
if (s)
return s;
}
// Make the start of the package name available.
if (pkg->ident->equals(ident))
{
return pkg;
}
}
return 0;
}
示例2: tokenizer
//.........这里部分代码省略.........
objectTypeM = ntProcedure; break;
case kwROLE:
objectTypeM = ntRole; break;
case kwTABLE:
objectTypeM = ntTable; break;
case kwTRIGGER:
objectTypeM = ntTrigger; break;
case kwVIEW:
objectTypeM = ntView; break;
default:
// this will scan over things like "EXTERNAL", "UNIQUE",
// "ASCENDING", "STATISTICS" etc., until object type is found
typeTokenIndex++;
break;
}
}
if (objectTypeM == ntUnknown || !databaseM)
return; // false;
objectM = databaseM->findByNameAndType(objectTypeM, nameM.get());
// map "CREATE OR ALTER" and "RECREATE" to correct action
if (actionM == actCREATE_OR_ALTER || actionM == actRECREATE)
actionM = (objectM ? actALTER : actCREATE);
// -------------- STEP 2 ------------------------------------------------
// if we decide to have a two-step evaluation, this is the breaking point
// get remaining tokens, and token content for identifiers + strings
while (tkEOF != (stt = tokenizer.getCurrentToken()))
{
if (stt != tkCOMMENT && stt != tkWHITESPACE)
{
tokensM.add(stt);
if (stt == tkIDENTIFIER || stt == tkSTRING)
{
wxString ts(tokenizer.getCurrentTokenString());
tokenStringsM[tokensM.size() - 1] = ts;
}
}
tokenizer.nextToken();
}
// check for "UPDATE RDB$RELATION_FIELDS SET RDB$NULL_FLAG"
// convert this change in NULL flag to "ALTER TABLE" and act accordingly
if (actionM == actUPDATE && nameM.equals("RDB$RELATION_FIELDS")
&& tokensM[2] == kwSET && tokensM[3] == tkIDENTIFIER)
{
Identifier id;
id.setFromSql(tokenStringsM[3]);
if (!id.equals("RDB$NULL_FLAG"))
return; // true;
actionM = actALTER;
objectTypeM = ntTable;
objectM = 0;
// find "RDB$RELATION_NAME" in map
for (std::map<int, wxString>::const_iterator mit = tokenStringsM.begin();
mit != tokenStringsM.end(); mit++)
{
if ((*mit).second.CmpNoCase("RDB$RELATION_NAME") == 0)
{
size_t i = (*mit).first;
if (tokensM[i + 1] == tkEQUALS && tokensM[i + 2] == tkSTRING)
{
nameM.setFromSql(tokenStringsM[i + 2]);
objectM = databaseM->findByNameAndType(ntTable, nameM.get());
break;
}
}
}
if (!objectM)
return; // true;
}
if (actionM == actALTER) // check for alter column
{
// handle "ALTER TABLE xyz ALTER [COLUMN] fgh TYPE {domain or datatype}
if (objectTypeM == ntTable && tokensM[identifierTokenIndexM + 1] == kwALTER)
{
size_t fieldNameIndex = identifierTokenIndexM + 2;
if (tokensM[fieldNameIndex] == kwCOLUMN)
fieldNameIndex++;
if (tokensM[fieldNameIndex + 1] == kwTYPE)
{
isAlterColumnM = true;
fieldNameM.setFromSql(tokenStringsM[fieldNameIndex]);
stt = tokensM[fieldNameIndex + 2];
isDatatypeM = (stt == kwCHAR || stt == kwVARCHAR
|| stt == kwINTEGER || stt == kwSMALLINT || stt == kwBIGINT
|| stt == kwDECIMAL || stt == kwNUMERIC
|| stt == kwDATE || stt == kwTIME || stt == kwTIMESTAMP
|| stt == kwFLOAT || stt == kwBLOB)
|| (stt == kwDOUBLE && tokensM[fieldNameIndex + 3] == kwPRECISION);
}
}
}
}