本文整理汇总了C++中multiname::normalizedNameId方法的典型用法代码示例。如果您正苦于以下问题:C++ multiname::normalizedNameId方法的具体用法?C++ multiname::normalizedNameId怎么用?C++ multiname::normalizedNameId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiname
的用法示例。
在下文中一共展示了multiname::normalizedNameId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeVar
void variables_map::initializeVar(const multiname& mname, ASObject* obj, multiname* typemname, ABCContext* context, TRAIT_KIND traitKind)
{
const Type* type = NULL;
/* If typename is a builtin type, we coerce obj.
* It it's not it must be a user defined class,
* so we only allow Null and Undefined (which are both coerced to Null) */
type = Type::getBuiltinType(typemname);
if(type==NULL)
{
assert_and_throw(obj->is<Null>() || obj->is<Undefined>());
if(obj->is<Undefined>())
{
//Casting undefined to an object (of unknown class)
//results in Null
obj->decRef();
obj = getSys()->getNullRef();
}
}
else
obj = type->coerce(obj);
assert(traitKind==DECLARED_TRAIT || traitKind==CONSTANT_TRAIT);
uint32_t name=mname.normalizedNameId();
Variables.insert(make_pair(varName(name, mname.ns[0]), variable(traitKind, obj, typemname, type)));
}
示例2: killObjVar
void variables_map::killObjVar(const multiname& mname)
{
uint32_t name=mname.normalizedNameId();
//The namespaces in the multiname are ordered. So it's possible to use lower_bound
//to find the first candidate one and move from it
assert(!mname.ns.empty());
var_iterator ret=Variables.lower_bound(varName(name,mname.ns.front()));
auto nsIt=mname.ns.begin();
//Find the namespace
while(ret!=Variables.end() && ret->first.nameId==name)
{
//breaks when the namespace is not found
const nsNameAndKind& ns=ret->first.ns;
if(ns==*nsIt)
{
Variables.erase(ret);
return;
}
else if(*nsIt<ns)
{
++nsIt;
if(nsIt==mname.ns.end())
break;
}
else if(ns<*nsIt)
++ret;
}
throw RunTimeException("Variable to kill not found");
}