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


C++ HashMap::Clear方法代码示例

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


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

示例1: BuildSpellCheckerMapLocked

ECode CTextServicesManagerService::BuildSpellCheckerMapLocked(
    IContext* context,
    List<AutoPtr<ISpellCheckerInfo> >& list,
    HashMap<String, AutoPtr<ISpellCheckerInfo> >& map,
    TextServicesSettings* settings)
{
    // TODO
    return NOERROR;

    list.Clear();
    map.Clear();
    const AutoPtr<IPackageManager> pm;
    context->GetPackageManager((IPackageManager**)&pm);
    assert(pm != NULL);
    AutoPtr<IObjectContainer> services;
    AutoPtr<IIntent> intent;
    Int32 currentUserId;
    FAIL_RETURN(CIntent::New(String("android.service.textservice.SpellCheckerService"), (IIntent**)&intent));
    settings->GetCurrentUserId(&currentUserId);
    FAIL_RETURN(pm->QueryIntentServicesAsUser(intent, IPackageManager::GET_META_DATA, currentUserId, (IObjectContainer**)&services));
    if (services != NULL) {
        AutoPtr<IObjectEnumerator> enumerator;
        services->GetObjectEnumerator((IObjectEnumerator**)&enumerator);
        Boolean hasNext = FALSE;
        while(enumerator->MoveNext(&hasNext), hasNext) {
            AutoPtr<IResolveInfo> ri;
            AutoPtr<IServiceInfo> si;
            enumerator->Current((IInterface**)&ri);
            assert(ri != NULL);
            ri->GetServiceInfo((IServiceInfo**)&si);
            String packageName, name, permission;
            assert(si != NULL);
            si->GetPackageName(&packageName);
            si->GetName(&name);
            si->GetPermission(&permission);
            AutoPtr<IComponentName> compName;
            CComponentName::New(packageName, name, (IComponentName**)&compName);
            String strCompName;
            compName->ToString(&strCompName);
            if (!Elastos::Droid::Manifest::Permission::BIND_TEXT_SERVICE.Equals(permission)) {
                Slogger::W(TAG, "Skipping text service %s : it does not require the permission: %s ", strCompName.string(), Elastos::Droid::Manifest::Permission::BIND_TEXT_SERVICE.string());
                continue;
            }
            if (DBG) Slogger::D(TAG, "Add: %s", strCompName.string());
            //try {
            AutoPtr<ISpellCheckerInfo> sci;
            // CSpellCheckerInfo::New(context, ri, (ISpellCheckerInfo**)&sci);
            assert(0);
            Int32 subtypeCount;
            sci->GetSubtypeCount(&subtypeCount);
            if (subtypeCount <= 0) {
                Slogger::W(TAG, "Skipping text service %s : it does not contain subtypes.", strCompName.string());
                continue;
            }
            list.PushBack(sci);
            String sciId;
            sci->GetId(&sciId);
            map[sciId] = sci;
            // } catch (XmlPullParserException e) {
            //     Slog.w(TAG, "Unable to load the spell checker " + compName, e);
            // } catch (IOException e) {
            //     Slog.w(TAG, "Unable to load the spell checker " + compName, e);
            // }
        }
        if (DBG) {
            Slogger::D(TAG, "buildSpellCheckerMapLocked: %d, %d", list.GetSize(), map.GetSize());
        }
    }
    return NOERROR;
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:70,代码来源:CTextServicesManagerService.cpp


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