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


C++ AutoPtr::AddAlias方法代码示例

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


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

示例1: UpdatePropertyServiceTable

void Provider::UpdatePropertyServiceTable()
{
    AutoPtr<IProviderService> s;
    String serviceName;
    String algorithm;
    Boolean isEmpty;
    if (mChangedProperties == NULL || (mChangedProperties->IsEmpty(&isEmpty), isEmpty)) {
        return;
    }
    AutoPtr<ISet> entrySet;
    mChangedProperties->GetEntrySet((ISet**)&entrySet);
    AutoPtr<IIterator> it;
    entrySet->GetIterator((IIterator**)&it);
    Boolean hasNext;
    while (it->HasNext(&hasNext), hasNext) {
        AutoPtr<IMapEntry> entry;
        it->GetNext((IInterface**)&entry);
        AutoPtr<IInterface> _key;
        AutoPtr<IInterface> _value;
        entry->GetKey((IInterface**)&_key);
        entry->GetValue((IInterface**)&_value);
        if (_key == NULL || _value == NULL || (IString::Probe(_key) == NULL)
                || (IString::Probe(_value) == NULL)) {
            continue;
        }
        String key, value;
        ICharSequence::Probe(_key)->ToString(&key);
        ICharSequence::Probe(_value)->ToString(&value);
        if (key.StartWith("Provider")) {
            // Provider service type is reserved
            continue;
        }
        Int32 i;
        if (key.StartWith("Alg.Alias.")) {
            // Alg.Alias.<crypto_service>.<aliasName>=<standardName>
            String aliasName;
            String service_alias = key.Substring(10);
            i = service_alias.IndexOf('.');
            serviceName = service_alias.Substring(0, i);
            aliasName = service_alias.Substring(i + 1);
            algorithm = value;
            String propertyServiceTableKey = Key(serviceName, algorithm);
            AutoPtr<IInterface> o;
            if (mPropertyServiceTable == NULL) {
                CLinkedHashMap::New(128, (ILinkedHashMap**)&mPropertyServiceTable);
            }
            else {
                AutoPtr<ICharSequence> keyObj;
                CString::New(propertyServiceTableKey, (ICharSequence**)&keyObj);
                mPropertyServiceTable->Get(keyObj, (IInterface**)&o);
            }
            if (o != NULL) {
                s = IProviderService::Probe(o);
                s->AddAlias(aliasName);
                if (mPropertyAliasTable == NULL) {
                    CLinkedHashMap::New(256, (ILinkedHashMap**)&mPropertyAliasTable);
                }
                AutoPtr<ICharSequence> keyObj;
                CString::New(Key(serviceName, aliasName), (ICharSequence**)&keyObj);
                mPropertyAliasTable->Put(keyObj, s);
            }
            else {
                AutoPtr<ICharSequence> keyObj;
                CString::New(serviceName + "." + algorithm, (ICharSequence**)&keyObj);
                AutoPtr<IInterface> valueObj;
                mChangedProperties->Get(keyObj, (IInterface**)&valueObj);
                String className;
                ICharSequence::Probe(valueObj)->ToString(&className);
                if (!className.IsNull()) {
                    AutoPtr<IList> l;
                    CArrayList::New((IList**)&l);
                    AutoPtr<ICharSequence> aliasNameObj;
                    CString::New(aliasName, (ICharSequence**)&aliasNameObj);
                    l->Add(aliasNameObj);
                    AutoPtr<IMap> attributes;
                    CHashMap::New((IMap**)&attributes);
                    s = NULL;
                    CProviderService::New(this, serviceName, algorithm, className,
                            l, attributes, (IProviderService**)&s);
                    keyObj = NULL;
                    CString::New(propertyServiceTableKey, (ICharSequence**)&keyObj);
                    mPropertyServiceTable->Put(keyObj, s);
                    if (mPropertyAliasTable == NULL) {
                        CLinkedHashMap::New(256, (ILinkedHashMap**)&mPropertyAliasTable);
                    }
                    keyObj = NULL;
                    CString::New(Key(serviceName, aliasName), (ICharSequence**)&keyObj);
                    mPropertyAliasTable->Put(keyObj, s);
                }
            }
            continue;
        }
        Int32 j = key.IndexOf('.');
        if (j == -1) { // unknown format
            continue;
        }
        i = key.IndexOf(' ');
        if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className>
            serviceName = key.Substring(0, j);
            algorithm = key.Substring(j + 1);
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:101,代码来源:Provider.cpp


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