本文整理汇总了C++中Symbol::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ Symbol::equals方法的具体用法?C++ Symbol::equals怎么用?C++ Symbol::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol::equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lookup
Symbol* SymbolTable::lookup(int index, const char* name,
int len, unsigned int hash) {
int count = 0;
for (HashtableEntry<Symbol*, mtSymbol>* e = bucket(index); e != NULL; e = e->next()) {
count++; // count all entries in this bucket, not just ones with same hash
if (e->hash() == hash) {
Symbol* sym = e->literal();
if (sym->equals(name, len)) {
// something is referencing this symbol now.
sym->increment_refcount();
return sym;
}
}
}
// If the bucket size is too deep check if this hash code is insufficient.
if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
_needs_rehashing = check_rehash_table(count);
}
return NULL;
}
示例2: calcSymbolsBinding
float Simulation::calcSymbolsBinding(SimObj* obj,
int symTable,
gbULINT symID,
Symbol* symbol,
BindingType type)
{
SymbolTable* table = obj->getSymbolTable(symTable);
if (table == NULL)
{
return 0.0f;
}
Symbol* sym = table->getSymbol(symID);
if (sym == NULL)
{
return 0.0f;
}
float binding = 0.0f;
switch (type)
{
case BINDING_EQUALS:
if (sym->equals(symbol))
{
binding = 1.0f;
}
break;
case BINDING_PROXIMITY:
binding = sym->proximity(symbol);
break;
}
return binding;
}