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


C++ ConfigObject类代码示例

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


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

示例1: BOOST_ASSERT

ConfigObject* ConfigObject::addObject(const ConfigFieldDescriptor* field,
                                      const std::string& key) {
    BOOST_ASSERT(field &&
                 field->repeatedType == ConfigFieldDescriptor::MAP &&
                 "addObject field type must be map");

    if (key.empty()) {
        LOG_ERROR << "can not add an empty key to the map.";
        return NULL;
    }

    std::map<std::string, ConfigObject*>* repeated =
        mutableRaw<std::map<std::string, ConfigObject*> >(field);

    // We must allocate a new object.
    const ConfigObject* prototype =
        ConfigObject::defaultObject(field->className);

    if (NULL == prototype) {
        LOG_ERROR << "can not find such object "
                  << field->className;

        return NULL;
    }

    ConfigObject* newObject = prototype->create();
    newObject->setName(key);
    repeated->insert(std::make_pair(key, newObject));

    return newObject;
}
开发者ID:1suming,项目名称:cetty2,代码行数:31,代码来源:ConfigObject.cpp

示例2: slotEventAction_GrpNumchanged

void ConfigTreeObject_EventAction::slotEventAction_GrpNumchanged()
{
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_GRPNUM);
    if(pObj) {
        quint32 groupNum = pObj->getData().toUInt();
        pObj->setStrShowOn(QString("%1").arg(groupNum+1));
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:8,代码来源:configtreeobject_EventAction.cpp

示例3: slotMathConstantKItemChanged

void ConfigTreeObject_Math::slotMathConstantKItemChanged()
{
    Menu *menu = static_cast<Menu *>(this->sender());
    QString strName = menu->objectName();
    ConfigObject *pConfigObj = ConfigTreeObject::getConfigObject(QString(MATH_DELEGATE_CONSTANTNUM_X).arg(strName));
    QString valueStr = pConfigObj->getData().toString().toUpper();
    pConfigObj->setStrShowOn(valueStr);
}
开发者ID:urielyan,项目名称:F270,代码行数:8,代码来源:configtreeobject_Math.cpp

示例4: locker

// static
void Sandbox::shutdown() {
    QMutexLocker locker(&s_mutex);
    ConfigObject<ConfigValue>* pSandboxPermissions = s_pSandboxPermissions;
    s_pSandboxPermissions = NULL;
    if (pSandboxPermissions) {
        pSandboxPermissions->save();
        delete pSandboxPermissions;
    }
}
开发者ID:flashpig,项目名称:mixxx,代码行数:10,代码来源:sandbox.cpp

示例5: QChar

void ConfigTreeObject_Math::updateAllConstKInfoMenu()
{
    ConfigObject *pConfigObj;
    QString valueStr;
    for(int i=0;i<100;++i) {
        pConfigObj = ConfigTreeObject::getConfigObject(QString(MATH_DELEGATE_CONSTANTNUM_INDEX).arg(i+1, 3, 10, QChar('0')));
        valueStr = pConfigObj->getData().toString().toUpper();
        pConfigObj->setStrShowOn(valueStr);
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:10,代码来源:configtreeobject_Math.cpp

示例6: slotReportChannelNumberChange

void ConfigTreeObject_Report::slotReportChannelNumberChange()
{
    QString num;
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_Number);

    if(pObj){
        num = pObj->getData().toString();
        pObj->setStrShowOn(QString("%1").arg(num.toInt()+1));
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:10,代码来源:configtreeobject_Report.cpp

示例7: subnetConfig

RRDVisAnalyzer::RRDVisAnalyzer(const ConfigObject& configObject, ReporterBase& reporter)
	: AnalyzerBase(configObject, reporter), configSection("rrdvisualizer"), firstFlow(true), lastFlowStart(0)
{
	configFile = configObject.getConfString(configSection, "configfile");
	rrdPath    = configObject.getConfString(configSection, "rrdtool_path");
	rrdDbPath  = configObject.getConfString(configSection, "db_path");

	// parse subnet config file
	std::ifstream subnetConfig(configFile.c_str());
	std::string token;
	bool subnet = true;
	std::string subnet_string;

	tree = lpm_init();

	std::vector<std::string> subnetList;

	while (subnetConfig) {
		subnetConfig >> token;
		if (subnet) {
			subnet_string = token;
			subnet = false;
		} else {
			size_t pos = subnet_string.find("/");
			if (pos == std::string::npos) {
				throw std::runtime_error("Error: Cannot parse subnet \"" + subnet_string + "\"");
			}
			std::string ip   = subnet_string.substr(0, pos);
			std::string mask = subnet_string.substr(pos + 1, subnet_string.size());

			rrdDBMap[subnet_string] = token;

			lpm_insert(tree, ip.c_str(), atoi(mask.c_str()));
			
			subnet = true;
		}
	}

	// define the number of values that need to be aggregated
	// by the rrdtools
	intervals.push_back(1);
	intervals.push_back(5);
	intervals.push_back(30);
	intervals.push_back(120);
	intervals.push_back(24*60);

	// graph time spans
	graphTimeSpans.push_back("-1d");
	graphTimeSpans.push_back("-1w");
	graphTimeSpans.push_back("-1m");
	graphTimeSpans.push_back("-1y");
}
开发者ID:constcast,项目名称:flowgrepper,代码行数:52,代码来源:rrdvis.cpp

示例8: switch

void ConfigTreeObject_EventAction::slotEventAction_A_Typechanged()
{
    QFile file;
    Operation_Mode_Type mode = (Operation_Mode_Type)ConfigTreeObject \
            ::getConfigObject(EVENT_DELEGATE_EVENT_MODE)->getData().toUInt();

    switch(mode) {
    case Operation_Mode_Type_RisingEdge:
    case Operation_Mode_Type_FallingEdge:
    case Operation_Mode_Type_Edge:
        file.setFileName(XML_EVENT_ACTION_TYPE);
        break;
    case Operation_Mode_Type_Both:
        file.setFileName(XML_EVENT_ACTION_TYPE_C);
        break;
    }

    QVariant value = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_ACTION_TYPE)->getData();

    if(!file.open(QFile::ReadOnly | QFile::Text)){
        qWarning()<< "Can't open the file:EventAction_ActionType!";
    }else{
        XmlConfigParser::parseValueChangeXml(file, value);
        file.close();
    }

    QMap<quint32,QString> m_map;

    Action_Type valueCur = (Action_Type)value.toUInt();
    if(Action_Type1_Recorded == valueCur) {
        m_map.insert(Action_Detail_Start, tr("Start"));
        m_map.insert(Action_Detail_Stop, tr("Stop"));
    } else if (Action_Type1_Computation == valueCur) {
        m_map.insert(Action_Detail_Start, tr("Start"));
        m_map.insert(Action_Detail_Stop, tr("Stop"));
        m_map.insert(Action_Detail_Reset, tr("Reset"));
    } else if (Action_Type1_Message == valueCur) {
        m_map.insert(Action_Detail_AllGrp, tr("All groups"));
        m_map.insert(Action_Detail_SpecGrp, tr("Specified group"));
    } else {
        return;
    }

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_ACTION_DETAIL);
    if(pObj) {
        Action_Detail detailCur = (Action_Detail)pObj->getData().toUInt();
        if(!(m_map.contains(detailCur))) {
            pObj->changeData(m_map.firstKey(), false);
        }
    }

}
开发者ID:urielyan,项目名称:F270,代码行数:52,代码来源:configtreeobject_EventAction.cpp

示例9:

ControlDoublePrivate::~ControlDoublePrivate() {
    s_qCOHashMutex.lock();
    //qDebug() << "ControlDoublePrivate::s_qCOHash.remove(" << m_key.group << "," << m_key.item << ")";
    s_qCOHash.remove(m_key);
    s_qCOHashMutex.unlock();

    if (m_bPersistInConfiguration) {
        ConfigObject<ConfigValue>* pConfig = ControlDoublePrivate::s_pUserConfig;
        if (pConfig != NULL) {
            pConfig->set(m_key, QString::number(get()));
        }
    }
}
开发者ID:coinhelper,项目名称:mixxx,代码行数:13,代码来源:control.cpp

示例10: slotReportBasicTimeMinuteChange

void ConfigTreeObject_Report::slotReportBasicTimeMinuteChange()
{
    QString num;

    ConfigObject *pObj = ConfigTreeObject::getConfigObject(Config_Report_Delegate_Basic_Time_Minute);


    if(pObj){
        num = pObj->getData().toString();

        pObj->setStrShowOn(QString("%1").arg(num.toInt()));
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:13,代码来源:configtreeobject_Report.cpp

示例11: resetPartialSettings

void ConfigTreeObject_Math::resetPartialSettings()
{
    ConfigObject* pObj = ConfigTreeObject::getConfigObject(DISP_DELEGATE_TREND_PARTIAL_SWITCH);
    if(pObj) {
        QVariant valueSwitch = pObj->getData();
        if(valueSwitch.toUInt() == 1) {
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART)->setHideFlag(false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->setHideFlag(false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->changeData(0, false, false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_BOUND)->setHideFlag(true);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_EXPAND)->setHideFlag(true);
        }
    }
}
开发者ID:urielyan,项目名称:F270,代码行数:14,代码来源:configtreeobject_Math.cpp

示例12: slotResetMenus

void WinDIAlarmLvl1Type::initMenu()
{
    m_map.clear();

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(DI_DELEGATE_RANG_RANGE_CALCU);
    if(pObj) {
        DI_Range_Calculate calcu = (DI_Range_Calculate)pObj->getData().toUInt();
        if(calcu == DI_Range_Calculate_Delta) {
            m_map = m_map_AlarmLvl1Type_Delta;
        } else {
            m_map = m_map_AlarmLvl1Type;
        }
    }

    slotResetMenus();
}
开发者ID:urielyan,项目名称:F270,代码行数:16,代码来源:windiconfig.cpp

示例13: initMenu

void WinDIRangeRangeType::initMenu()
{
    m_map.clear();
    //此处有问题,只有一个模块能被设置为远程输入 TODO
    ConfigObject* pObj = ConfigTreeObject::getConfigObject(MEASURE_DELEGATE_U_M_DIMODE_MODE);
    if(pObj) {
        DI_OpeMode mode = (DI_OpeMode)pObj->getData().toUInt();

        if(DI_OpeMode_Remote == mode) {
            m_map = m_map_RangeRangeType_noPluse;
        } else {
            m_map = m_map_RangeRangeType;
        }
    }

    slotResetMenus();
}
开发者ID:urielyan,项目名称:F270,代码行数:17,代码来源:windiconfig.cpp

示例14: initialize

void ControlDoublePrivate::initialize(double defaultValue) {
    m_defaultValue.setValue(defaultValue);
    double initialValue = defaultValue;
    if (m_bPersistInConfiguration) {
        ConfigObject<ConfigValue>* pConfig = ControlDoublePrivate::s_pUserConfig;
        if (pConfig != NULL) {
            // Assume toDouble() returns 0 if conversion fails.
            initialValue = pConfig->getValueString(m_key).toDouble();
        }
    }
    m_value.setValue(initialValue);

    //qDebug() << "Creating:" << m_trackKey << "at" << &m_value << sizeof(m_value);

    if (m_bTrack) {
        // TODO(rryan): Make configurable.
        Stat::track(m_trackKey, static_cast<Stat::StatType>(m_trackType),
                    static_cast<Stat::ComputeFlags>(m_trackFlags),
                    m_value.getValue());
    }
}
开发者ID:coinhelper,项目名称:mixxx,代码行数:21,代码来源:control.cpp

示例15: Frontend_DVBS

Frontend *Frontend::Create( Adapter &adapter, std::string configfile )
{
  ConfigObject cfg;
  cfg.SetConfigFile( configfile );
  cfg.ReadConfigFile( );
  Source::Type type;
  cfg.ReadConfig( "Type", (int &) type );
  switch( type )
  {
    case Source::Type_DVBS:
      return new Frontend_DVBS( adapter, configfile );
    case Source::Type_DVBC:
      return new Frontend_DVBC( adapter, configfile );
    case Source::Type_DVBT:
      return new Frontend_DVBT( adapter, configfile );
    case Source::Type_ATSC:
      return new Frontend_ATSC( adapter, configfile );
    case Source::Type_Any:
      return NULL;
  }
  return NULL;
}
开发者ID:,项目名称:,代码行数:22,代码来源:


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