当前位置: 首页>>代码示例>>C++>>正文


C++ WeakMapData类代码示例

本文整理汇总了C++中WeakMapData的典型用法代码示例。如果您正苦于以下问题:C++ WeakMapData类的具体用法?C++ WeakMapData怎么用?C++ WeakMapData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WeakMapData类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: protoFuncWeakMapHas

EncodedJSValue JSC_HOST_CALL protoFuncWeakMapHas(CallFrame* callFrame)
{
    WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue());
    if (!map)
        return JSValue::encode(jsUndefined());
    JSValue key = callFrame->argument(0);
    return JSValue::encode(jsBoolean(key.isObject() && map->contains(asObject(key))));
}
开发者ID:eocanha,项目名称:webkit,代码行数:8,代码来源:WeakMapPrototype.cpp

示例2: protoFuncWeakMapClear

EncodedJSValue JSC_HOST_CALL protoFuncWeakMapClear(CallFrame* callFrame)
{
    WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue());
    if (!map)
        return JSValue::encode(jsUndefined());
    map->clear();
    return JSValue::encode(jsUndefined());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: protoFuncWeakMapGet

EncodedJSValue JSC_HOST_CALL protoFuncWeakMapGet(CallFrame* callFrame)
{
    WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue());
    if (!map)
        return JSValue::encode(jsUndefined());
    JSValue key = callFrame->argument(0);
    if (!key.isObject())
        return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("A WeakMap cannot have a non-object key")));
    return JSValue::encode(map->get(asObject(key)));
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例4: protoFuncWeakMapSet

EncodedJSValue JSC_HOST_CALL protoFuncWeakMapSet(CallFrame* callFrame)
{
    WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue());
    if (!map)
        return JSValue::encode(jsUndefined());
    JSValue key = callFrame->argument(0);
    if (!key.isObject())
        return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("Attempted to set a non-object key in a WeakMap")));
    map->set(callFrame->vm(), asObject(key), callFrame->argument(1));
    return JSValue::encode(callFrame->thisValue());
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:11,代码来源:WeakMapPrototype.cpp

示例5: protoFuncWeakMapSet

EncodedJSValue JSC_HOST_CALL protoFuncWeakMapSet(CallFrame* callFrame)
{
    VM& vm = callFrame->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);

    WeakMapData* map = getWeakMapData(callFrame, callFrame->thisValue());
    ASSERT(!!scope.exception() == !map);
    if (!map)
        return JSValue::encode(jsUndefined());
    JSValue key = callFrame->argument(0);
    if (!key.isObject())
        return JSValue::encode(throwTypeError(callFrame, scope, WTF::ASCIILiteral("Attempted to set a non-object key in a WeakMap")));
    map->set(vm, asObject(key), callFrame->argument(1));
    return JSValue::encode(callFrame->thisValue());
}
开发者ID:eocanha,项目名称:webkit,代码行数:15,代码来源:WeakMapPrototype.cpp


注:本文中的WeakMapData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。