Пример #1
0
/*
    JSObjectGetData
*/
void *JSObjectGetData(JSObjectRef ref)
{
    void *result = 0;
    JSUserObject* ptr = (JSUserObject*)ref;
    if (ptr && (ptr->GetTypeID() == kJSObjectTypeID))
    {
        result = ptr->GetData();
    }
    return result;
}
Пример #2
0
UInt8 JSUserObject::Equal(JSBase* other)
{
    UInt8 result = false;
    JSUserObject* obj = (JSUserObject*)other;
    if (obj->GetTypeID() == kJSObjectTypeID)
    {
        if (fCallBacks.equal)
        {
            result = fCallBacks.equal(GetData(), obj->GetData());
        }
        else
        {
            CFTypeRef cf1 = CopyCFValue();
            CFTypeRef cf2 = obj->CopyCFValue();
            if (cf1 && cf2)
            {
                result = CFEqual(cf1, cf2);
            }
            ReleaseCFType(cf2);
            ReleaseCFType(cf1);
        }
    }
    return result;
}