Esempio n. 1
0
void SetContext(lua_State* L, Context* context)
{
    if (context == 0)
        contextMapping.Erase(L);
    else
        contextMapping[L] = context;
}
void AttributeCache::RemovePackage(
    /* [in] */ const String& packageName)
{
    AutoLock lock(mLock);
    HashMap<Int32, HashMap<String, AutoPtr<Package> >* >::Iterator it = mPackages.Begin();
    for (; it != mPackages.End(); it++) {
        HashMap<String, AutoPtr<Package> >* map = it->mSecond;
        if (map != NULL)
            map->Erase(packageName);
    }
}
Esempio n. 3
0
void RemoveNamedAttribute(HashMap<StringHash, Vector<AttributeInfo> >& attributes, StringHash objectType, const char* name)
{
    HashMap<StringHash, Vector<AttributeInfo> >::Iterator i = attributes.Find(objectType);
    if (i == attributes.End())
        return;

    Vector<AttributeInfo>& infos = i->second_;

    for (Vector<AttributeInfo>::Iterator j = infos.Begin(); j != infos.End(); ++j)
    {
        if (!j->name_.Compare(name, true))
        {
            infos.Erase(j);
            break;
        }
    }

    // If the vector became empty, erase the object type from the map
    if (infos.Empty())
        attributes.Erase(i);
}