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


C++ XPCNativeSet::GetInterfaceAt方法代码示例

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


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

示例1: return

bool
NativeSetMap::Entry::Match(const PLDHashEntryHdr* entry, const void* key)
{
    auto Key = static_cast<const XPCNativeSetKey*>(key);
    XPCNativeSet*       SetInTable = ((Entry*)entry)->key_value;
    XPCNativeSet*       Set        = Key->GetBaseSet();
    XPCNativeInterface* Addition   = Key->GetAddition();

    if (!Set) {
        // This is a special case to deal with the invariant that says:
        // "All sets have exactly one nsISupports interface and it comes first."
        // See XPCNativeSet::NewInstance for details.
        //
        // Though we might have a key that represents only one interface, we
        // know that if that one interface were contructed into a set then
        // it would end up really being a set with two interfaces (except for
        // the case where the one interface happened to be nsISupports).

        return (SetInTable->GetInterfaceCount() == 1 &&
                SetInTable->GetInterfaceAt(0) == Addition) ||
               (SetInTable->GetInterfaceCount() == 2 &&
                SetInTable->GetInterfaceAt(1) == Addition);
    }

    if (!Addition && Set == SetInTable)
        return true;

    uint16_t count = Set->GetInterfaceCount();
    if (count + (Addition ? 1 : 0) != SetInTable->GetInterfaceCount())
        return false;

    XPCNativeInterface** CurrentInTable = SetInTable->GetInterfaceArray();
    XPCNativeInterface** Current = Set->GetInterfaceArray();
    for (uint16_t i = 0; i < count; i++) {
        if (*(Current++) != *(CurrentInTable++))
            return false;
    }
    return !Addition || Addition == *(CurrentInTable++);
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:39,代码来源:XPCMaps.cpp

示例2: printf

NativeSetSweeper(JSDHashTable *table, JSDHashEntryHdr *hdr,
                 uint32 number, void *arg)
{
    XPCNativeSet* set = ((NativeSetMap::Entry*)hdr)->key_value;
    if(set->IsMarked())
    {
        set->Unmark();
        return JS_DHASH_NEXT;
    }

#ifdef XPC_REPORT_NATIVE_INTERFACE_AND_SET_FLUSHING
    printf("- Destroying XPCNativeSet for:\n");
    PRUint16 count = set->GetInterfaceCount();
    for(PRUint16 k = 0; k < count; k++)
    {
        XPCNativeInterface* iface = set->GetInterfaceAt(k);
        printf("    %s\n",JS_GetStringBytes(JSVAL_TO_STRING(iface->GetName())));
    }
#endif

    XPCNativeSet::DestroyInstance(set);
    return JS_DHASH_REMOVE;
}
开发者ID:,项目名称:,代码行数:23,代码来源:


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