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


C++ PropertyDict::insert方法代码示例

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


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

示例1: Command

AddDelServerLoggingCommand::AddDelServerLoggingCommand(
        const QString& name, const QString& type,
        QMap<QString,QString> props,
        ProjectWindow* pw, MainWindow* mw ) :
    Command(pw, mw,
            qApp->translate("AddDelServerLoggingCommand", "Add ServerLogging")),
    d(new AddDelServerLoggingCommandPrivate)
{
    Q_CHECK_PTR(d);

    d->mode = AddDelServerLoggingCommandPrivate::Add;
    d->cn = name;
    d->ct = type;
    d->props = props;

    PropertyDict pd;
    for(QMap<QString,QString>::const_iterator it = d->props.begin();
            it != d->props.end(); ++it) {

        Property* p = new Property(it.key(), "string", it.data());
        Q_CHECK_PTR(p);
        pd.insert(it.key(), p);
    }
    d->sl = new ServerLogging(d->ct, pd);
    Q_CHECK_PTR(d->sl);

    d->canDelete = true;
}
开发者ID:acassis,项目名称:lintouch,代码行数:28,代码来源:AddDelServerLoggingCommand.cpp

示例2: sync

void
PropertiesAdminI::setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr& cb, const PropertyDict& props,
                                           const Current&)
{
    Lock sync(*this);

    PropertyDict old = _properties->getPropertiesForPrefix("");
    PropertyDict::const_iterator p;
    const int traceLevel = _properties->getPropertyAsInt("Ice.Trace.Admin.Properties");

    //
    // Compute the difference between the new property set and the existing property set:
    //
    // 1) Any properties in the new set that were not defined in the existing set.
    //
    // 2) Any properties that appear in both sets but with different values.
    //
    // 3) Any properties not present in the new set but present in the existing set.
    //    In other words, the property has been removed.
    //
    PropertyDict added, changed, removed;
    for(p = props.begin(); p != props.end(); ++p)
    {
        PropertyDict::iterator q = old.find(p->first);
        if(q == old.end())
        {
            if(!p->second.empty())
            {
                //
                // This property is new.
                //
                added.insert(*p);
            }
        }
        else
        {
            if(p->second != q->second)
            {
                if(p->second.empty())
                {
                    //
                    // This property was removed.
                    //
                    removed.insert(*p);
                }
                else
                {
                    //
                    // This property has changed.
                    //
                    changed.insert(*p);
                }
            }
        }
    }

    if(traceLevel > 0 && (!added.empty() || !changed.empty() || !removed.empty()))
    {
        Trace out(_logger, traceCategory);

        out << "Summary of property changes";

        if(!added.empty())
        {
            out << "\nNew properties:";
            for(p = added.begin(); p != added.end(); ++p)
            {
                out << "\n  " << p->first;
                if(traceLevel > 1)
                {
                    out << " = " << p->second;
                }
            }
        }

        if(!changed.empty())
        {
            out << "\nChanged properties:";
            for(p = changed.begin(); p != changed.end(); ++p)
            {
                out << "\n  " << p->first;
                if(traceLevel > 1)
                {
                    out << " = " << p->second << " (old value = " << _properties->getProperty(p->first) << ")";
                }
            }
        }

        if(!removed.empty())
        {
            out << "\nRemoved properties:";
            for(p = removed.begin(); p != removed.end(); ++p)
            {
                out << "\n  " << p->first;
            }
        }
    }

    //
    // Update the property set.
//.........这里部分代码省略.........
开发者ID:RichardChengshaojin,项目名称:ice,代码行数:101,代码来源:PropertiesAdminI.cpp


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