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


C++ GetterSetter::getter方法代码示例

本文整理汇总了C++中GetterSetter::getter方法的典型用法代码示例。如果您正苦于以下问题:C++ GetterSetter::getter方法的具体用法?C++ GetterSetter::getter怎么用?C++ GetterSetter::getter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GetterSetter的用法示例。


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

示例1: setDescriptor

void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes)
{
    ASSERT(value);
    ASSERT(value.isGetterSetter() == !!(attributes & Accessor));

    m_attributes = attributes;
    if (value.isGetterSetter()) {
        m_attributes &= ~ReadOnly; // FIXME: we should be able to ASSERT this!

        GetterSetter* accessor = asGetterSetter(value);
        m_getter = accessor->getter() ? accessor->getter() : jsUndefined();
        m_setter = accessor->setter() ? accessor->setter() : jsUndefined();
        m_seenAttributes = EnumerablePresent | ConfigurablePresent;
    } else {
        m_value = value;
        m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent;
    }
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:18,代码来源:PropertyDescriptor.cpp

示例2: setDescriptor

void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes)
{
    ASSERT(value);
    m_attributes = attributes;
    if (attributes & (Getter | Setter)) {
        GetterSetter* accessor = asGetterSetter(value);
        m_getter = accessor->getter();
        m_setter = accessor->setter();
        ASSERT(m_getter || m_setter);
        m_seenAttributes = EnumerablePresent | ConfigurablePresent;
        m_attributes &= ~ReadOnly;
    } else {
        m_value = value;
        m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent;
    }
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:16,代码来源:PropertyDescriptor.cpp

示例3: setDescriptor

void PropertyDescriptor::setDescriptor(JSValue value, unsigned attributes)
{
    ASSERT(value);

    // We need to mask off the PropertyAttribute::CustomValue bit because
    // PropertyDescriptor::attributesEqual() does an equivalent test on
    // m_attributes, and a property that has a CustomValue should be indistinguishable
    // from a property that has a normal value as far as JS code is concerned.
    // PropertyAttribute does not need knowledge of the underlying implementation
    // actually being a CustomValue. So, we'll just mask it off up front here.
    m_attributes = attributes & ~PropertyAttribute::CustomValue;
    if (value.isGetterSetter()) {
        m_attributes &= ~PropertyAttribute::ReadOnly; // FIXME: we should be able to ASSERT this!

        GetterSetter* accessor = jsCast<GetterSetter*>(value);
        m_getter = !accessor->isGetterNull() ? accessor->getter() : jsUndefined();
        m_setter = !accessor->isSetterNull() ? accessor->setter() : jsUndefined();
        m_seenAttributes = EnumerablePresent | ConfigurablePresent;
    } else {
        m_value = value;
        m_seenAttributes = EnumerablePresent | ConfigurablePresent | WritablePresent;
    }
}
开发者ID:wolfviking0,项目名称:webcl-webkit,代码行数:23,代码来源:PropertyDescriptor.cpp

示例4: objectProtoFuncLookupGetter

EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec)
{
    JSObject* thisObject = exec->thisValue().toThis(exec, StrictMode).toObject(exec);
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    auto propertyName = exec->argument(0).toPropertyKey(exec);
    if (exec->hadException())
        return JSValue::encode(jsUndefined());

    PropertySlot slot(thisObject);
    if (thisObject->getPropertySlot(exec, propertyName, slot) && slot.isAccessor()) {
        GetterSetter* getterSetter = slot.getterSetter();
        return getterSetter->isGetterNull() ? JSValue::encode(jsUndefined()) : JSValue::encode(getterSetter->getter());
    }

    return JSValue::encode(jsUndefined());
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:18,代码来源:ObjectPrototype.cpp


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