• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ abstractconfiguration::Keys类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: printProperties

	void printProperties(const std::string& base)
	{
		AbstractConfiguration::Keys keys;
		config().keys(base, keys);
		if (keys.empty())
		{
			if (config().hasProperty(base))
			{
				std::string msg;
				msg.append(base);
				msg.append(" = ");
				msg.append(config().getString(base));
				logger().information(msg);
			}
		}
		else
		{
			for (AbstractConfiguration::Keys::const_iterator it = keys.begin(); it != keys.end(); ++it)
			{
				std::string fullKey = base;
				if (!fullKey.empty()) fullKey += '.';
				fullKey.append(*it);
				printProperties(fullKey);
			}
		}
	}
开发者ID:119,项目名称:vdc,代码行数:26,代码来源:SampleApp.cpp


示例2: testOneLayer

void LayeredConfigurationTest::testOneLayer()
{
	AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
	AutoPtr<MapConfiguration> pMC = new MapConfiguration;
	
	pMC->setString("prop1", "value1");
	pMC->setString("prop2", "value2");
	
	pLC->addWriteable(pMC, 0);

	AbstractConfiguration::Keys keys;
	pLC->keys(keys);
	assert (keys.size() == 2);
	assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
	
	assert (pLC->getString("prop1") == "value1");
	assert (pLC->getString("prop2") == "value2");

	pLC->setString("prop3", "value3");
	assert (pLC->getString("prop3") == "value3");

	pLC->remove("prop3");
	assert (!pLC->hasProperty("prop3"));
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:25,代码来源:LayeredConfigurationTest.cpp


示例3: testEmpty

void LayeredConfigurationTest::testEmpty()
{
	AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
	
	AbstractConfiguration::Keys keys;
	pLC->keys(keys);
	assert (keys.empty());
	
	assert (!pLC->hasProperty("foo"));
	try
	{
		pLC->setString("foo", "bar");
		fail("empty LayeredConfiguration - must throw");
	}
	catch (RuntimeException&)
	{
	}
	
	try
	{
		std::string s = pLC->getString("foo");
		fail("empty LayeredConfiguration - must throw");
	}
	catch (NotFoundException&)
	{
	}
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:27,代码来源:LayeredConfigurationTest.cpp


示例4: writeObject

void AMFWriter::writeObject(const AMFObject& amfObject) {
	beginObject();
	AbstractConfiguration::Keys keys;
	amfObject.keys(keys);
	AbstractConfiguration::Keys::const_iterator it;
	for(it=keys.begin();it!=keys.end();++it) {
		string name = *it;
		_writer.writeString16(name);
		int type = amfObject.getInt(name+".type",-1);
		switch(type) {
			case AMF_BOOLEAN:
				writeBool(amfObject.getBool(name));
				break;
			case AMF_STRING:
				write(amfObject.getString(name));
				break;
			case AMF_NUMBER:
				writeNumber(amfObject.getDouble(name));
				break;
			case AMF_UNDEFINED:
				write("");
				break;
			case AMF_NULL:
				writeNull();
				break;
			default:
				ERROR("Unknown AMF '%d' type",type);
		}
	}
	endObject();
}
开发者ID:holdensmagicalunicorn,项目名称:Cumulus,代码行数:31,代码来源:AMFWriter.cpp


示例5: testRemove

void LayeredConfigurationTest::testRemove()
{
	AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
	AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
	AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
	
	pMC1->setString("prop1", "value1");
	pMC1->setString("prop2", "value2");
	pMC2->setString("prop2", "value3");
	pMC2->setString("prop3", "value4");
	
	pLC->add(pMC1, 0);
	pLC->add(pMC2, -1);

	AbstractConfiguration::Keys keys;
	pLC->keys(keys);
	assert (keys.size() == 3);
	assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
	
	assert (pLC->getString("prop1") == "value1");
	assert (pLC->getString("prop2") == "value3");
	assert (pLC->getString("prop3") == "value4");

	pLC->removeConfiguration(pMC2);
	keys.clear();
	pLC->keys(keys);
	assert (keys.size() == 2);
	
	assert (pLC->getString("prop1") == "value1");
	assert (pLC->getString("prop2") == "value2");
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:33,代码来源:LayeredConfigurationTest.cpp


示例6: prepareApplicationLoggingFiles

//============================================================================//
void Configuration::prepareApplicationLoggingFiles(AbstractConfiguration &config, const string &prefix)
{

    // find all files loggers
    AbstractConfiguration::Keys             channelsKeys;
    AbstractConfiguration::Keys::iterator   keyIt;

    config.keys("logging.channels", channelsKeys);

    config.setString("application.logger", prefix);


    for(keyIt = channelsKeys.begin(); keyIt != channelsKeys.end(); ++keyIt) {
        if(!config.getString("logging.channels." + *keyIt + ".class", "").
            compare("FileChannel")) {

            config.setString("logging.channels." + *keyIt + ".path",
                Path(config.getString("logging.channels." + *keyIt + ".path", "") +
                    Path::separator()).makeAbsolute().
                    setFileName(
                        "UpSys" + prefix + 
                        config.getString("args.software_identifier")
                        + ".log").toString());
        }
    }

}
开发者ID:AlekNS,项目名称:bigking-update,代码行数:28,代码来源:Configuration.cpp


示例7: writeSimpleObject

void AMFWriter::writeSimpleObject(const AMFSimpleObject& object) {
	beginObject();
	AbstractConfiguration::Keys keys;
	object.keys(keys);
	AbstractConfiguration::Keys::const_iterator it;
	for(it=keys.begin();it!=keys.end();++it) {
		string name = *it;
		int type = object.getInt(name+".type",-1);
		switch(type) {
			case AMF::Boolean:
				writeObjectProperty(name,object.getBool(name));
				break;
			case AMF::String:
				writeObjectProperty(name,object.getString(name));
				break;
			case AMF::Number:
				writeObjectProperty(name,object.getDouble(name));
				break;
			case AMF::Integer:
				writeObjectProperty(name,object.getInt(name));
				break;
			case AMF::Date: {
				Timestamp date((Timestamp::TimeVal)object.getDouble(name)*1000);
				writeObjectProperty(name,date);
				break;
			}
			case AMF::Null:
				writeObjectProperty(name);
				break;
			default:
				ERROR("Unknown AMFObject %d type",type);
		}
	}
	endObject();
}
开发者ID:Windslash,项目名称:Cumulus,代码行数:35,代码来源:AMFWriter.cpp


示例8: createChannel

Channel* LoggingConfigurator::createChannel(AbstractConfiguration* pConfig)
{
    AutoPtr<Channel> pChannel(LoggingFactory::defaultFactory().createChannel(pConfig->getString("class")));
    AutoPtr<Channel> pWrapper(pChannel);
    AbstractConfiguration::Keys props;
    pConfig->keys(props);
    for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it)
    {
        if (*it == "pattern")
        {
            AutoPtr<Formatter> pPatternFormatter(new PatternFormatter(pConfig->getString(*it)));
            pWrapper = new FormattingChannel(pPatternFormatter, pChannel);
        }
        else if (*it == "formatter")
        {
            AutoPtr<FormattingChannel> pFormattingChannel(new FormattingChannel(0, pChannel));
            if (pConfig->hasProperty("formatter.class"))
            {
                AutoPtr<AbstractConfiguration> pFormatterConfig(pConfig->createView(*it));
                AutoPtr<Formatter> pFormatter(createFormatter(pFormatterConfig));
                pFormattingChannel->setFormatter(pFormatter);
            }
            else pFormattingChannel->setProperty(*it, pConfig->getString(*it));
#if defined(__GNUC__) && __GNUC__ < 3
            pWrapper = pFormattingChannel.duplicate();
#else
            pWrapper = pFormattingChannel;
#endif
        }
    }
    return pWrapper.duplicate();
}
开发者ID:Victorcasas,项目名称:georest,代码行数:32,代码来源:LoggingConfigurator.cpp


示例9: configureFormatters

void LoggingConfigurator::configureFormatters(AbstractConfiguration* pConfig)
{
    AbstractConfiguration::Keys formatters;
    pConfig->keys(formatters);
    for (AbstractConfiguration::Keys::const_iterator it = formatters.begin(); it != formatters.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pFormatterConfig(pConfig->createView(*it));
        AutoPtr<Formatter> pFormatter(createFormatter(pFormatterConfig));
        LoggingRegistry::defaultRegistry().registerFormatter(*it, pFormatter);
    }
}
开发者ID:Victorcasas,项目名称:georest,代码行数:11,代码来源:LoggingConfigurator.cpp


示例10: configureChannel

void LoggingConfigurator::configureChannel(Channel* pChannel, AbstractConfiguration* pConfig)
{
    AbstractConfiguration::Keys props;
    pConfig->keys(props);
    for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it)
    {
        if (*it != "pattern" && *it != "formatter" && *it != "class")
        {
            pChannel->setProperty(*it, pConfig->getString(*it));
        }
    }
}
开发者ID:Victorcasas,项目名称:georest,代码行数:12,代码来源:LoggingConfigurator.cpp


示例11: createFormatter

Formatter* LoggingConfigurator::createFormatter(AbstractConfiguration* pConfig)
{
    AutoPtr<Formatter> pFormatter(LoggingFactory::defaultFactory().createFormatter(pConfig->getString("class")));
    AbstractConfiguration::Keys props;
    pConfig->keys(props);
    for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it)
    {
        if (*it != "class")
            pFormatter->setProperty(*it, pConfig->getString(*it));
    }
    return pFormatter.duplicate();
}
开发者ID:Victorcasas,项目名称:georest,代码行数:12,代码来源:LoggingConfigurator.cpp


示例12: testTwoLayers

void LayeredConfigurationTest::testTwoLayers()
{
	AutoPtr<LayeredConfiguration> pLC = new LayeredConfiguration;
	AutoPtr<MapConfiguration> pMC1 = new MapConfiguration;
	AutoPtr<MapConfiguration> pMC2 = new MapConfiguration;
	
	pMC1->setString("prop1", "value1");
	pMC1->setString("prop2", "value2");
	pMC2->setString("prop2", "value3");
	pMC2->setString("prop3", "value4");
	
	pLC->add(pMC1, 0);
	pLC->addWriteable(pMC2, 1);

	AbstractConfiguration::Keys keys;
	pLC->keys(keys);
	assert (keys.size() == 3);
	assert (std::find(keys.begin(), keys.end(), "prop1") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "prop2") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "prop3") != keys.end());
	
	assert (pLC->getString("prop1") == "value1");
	assert (pLC->getString("prop2") == "value2");
	assert (pLC->getString("prop3") == "value4");

	pLC->setString("prop4", "value4");
	assert (pLC->getString("prop4") == "value4");

	assert (!pMC1->hasProperty("prop4"));
	assert (pMC2->hasProperty("prop4"));

	pLC->setString("prop1", "value11");
	assert (pLC->getString("prop1") == "value1");
	assert (pMC2->getString("prop1") == "value11");
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:35,代码来源:LayeredConfigurationTest.cpp


示例13: createConfiguration

void ConfigurationMapperTest::testMapper4()
{
	AutoPtr<AbstractConfiguration> pConf = createConfiguration();
	AutoPtr<AbstractConfiguration> pMapper = new ConfigurationMapper("prop5", "", pConf);

	assert (pMapper->hasProperty("string1"));
	assert (pMapper->hasProperty("string2"));

	AbstractConfiguration::Keys keys;
	pMapper->keys(keys);
	assert (keys.size() == 4);
	assert (std::find(keys.begin(), keys.end(), "string1") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "string2") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "sub1") != keys.end());
	assert (std::find(keys.begin(), keys.end(), "sub2") != keys.end());
	
	assert (pMapper->getString("string1") == "foo");
	assert (pMapper->getString("sub1.string1") == "FOO");
	
	pMapper->setString("string3", "baz");
	assert (pMapper->getString("string3") == "baz");
	assert (pConf->getString("prop5.string3") == "baz");

	pMapper->remove("string3");
	assert (!pMapper->hasProperty("string3"));
	assert (!pConf->hasProperty("prop5.string3"));
}
开发者ID:macchina-io,项目名称:macchina.io,代码行数:27,代码来源:ConfigurationMapperTest.cpp


示例14: copyProperties

void Client::copyProperties(const AbstractConfiguration& abstractConfigs,const string& root) {
	AbstractConfiguration::Keys keys;
	abstractConfigs.keys(root,keys);
	AbstractConfiguration::Keys::const_iterator it;
	for(it=keys.begin();it!=keys.end();++it) {
		string key(root);
		if(!key.empty())
			key+=".";
		key += (*it);
		if(abstractConfigs.hasOption(key))
			setString(key,abstractConfigs.getString(key));
		else
			copyProperties(abstractConfigs,key);
	}
}
开发者ID:Rajan,项目名称:Cumulus,代码行数:15,代码来源:Clients.cpp


示例15: prepareApplicationLoggingDisableConsole

//============================================================================//
void Configuration::prepareApplicationLoggingDisableConsole(AbstractConfiguration &config)
{
    // find all files loggers
    AbstractConfiguration::Keys             channelsKeys;
    AbstractConfiguration::Keys::iterator   keyIt;

    config.keys("logging.channels", channelsKeys);

    for(keyIt = channelsKeys.begin(); keyIt != channelsKeys.end(); ++keyIt) {
        if(!config.getString("logging.channels." + *keyIt + ".class", "").
            compare("ConsoleChannel")) {

            config.setString("logging.channels." + *keyIt + ".class",
                "NullChannel");
        }
    }
}
开发者ID:AlekNS,项目名称:bigking-update,代码行数:18,代码来源:Configuration.cpp


示例16: configureChannels

void LoggingConfigurator::configureChannels(AbstractConfiguration* pConfig)
{
    AbstractConfiguration::Keys channels;
    pConfig->keys(channels);
    for (AbstractConfiguration::Keys::const_iterator it = channels.begin(); it != channels.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
        AutoPtr<Channel> pChannel = createChannel(pChannelConfig);
        LoggingRegistry::defaultRegistry().registerChannel(*it, pChannel);
    }
    for (AbstractConfiguration::Keys::const_iterator it = channels.begin(); it != channels.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
        Channel* pChannel = LoggingRegistry::defaultRegistry().channelForName(*it);
        configureChannel(pChannel, pChannelConfig);
    }
}
开发者ID:Victorcasas,项目名称:georest,代码行数:17,代码来源:LoggingConfigurator.cpp


示例17: testCaseInsensitiveRemove

void IniFileConfigurationTest::testCaseInsensitiveRemove()
{
	AutoPtr<AbstractConfiguration> pConf = createConfiguration();
	AbstractConfiguration::Keys keys;

	assert (pConf->hasProperty("Prop1"));
	assert (pConf->hasProperty("prop4.BOOL1"));
	assert (pConf->hasProperty("Prop4.bool2"));
	assert (pConf->hasProperty("PROP4.Bool3"));
	pConf->keys(keys);
	assert (keys.size() == 13);
	pConf->keys("prop4", keys);
	assert (keys.size() == 17);

	pConf->remove("PROP4.Bool1");
	assert (pConf->hasProperty("Prop1"));
	assert (!pConf->hasProperty("prop4.BOOL1"));
	assert (pConf->hasProperty("Prop4.bool2"));
	assert (pConf->hasProperty("PROP4.Bool3"));
	pConf->keys(keys);
	assert (keys.size() == 13);
	pConf->keys("PROP4", keys);
	assert (keys.size() == 16);

	pConf->remove("Prop4");
	assert (pConf->hasProperty("Prop1"));
	assert (!pConf->hasProperty("prop4.BOOL1"));
	assert (!pConf->hasProperty("Prop4.bool2"));
	assert (!pConf->hasProperty("PROP4.Bool3"));
	pConf->keys(keys);
	assert (keys.size() == 12);
	pConf->keys("prop4", keys);
	assert (keys.size() == 0);
}
开发者ID:Chingliu,项目名称:poco,代码行数:34,代码来源:IniFileConfigurationTest.cpp


示例18: configureLoggers

void LoggingConfigurator::configureLoggers(AbstractConfiguration* pConfig)
{
    typedef std::map<std::string, AutoPtr<AbstractConfiguration> > LoggerMap;

    AbstractConfiguration::Keys loggers;
    pConfig->keys(loggers);
    // use a map to sort loggers by their name, ensuring initialization in correct order (parents before children)
    LoggerMap loggerMap;
    for (AbstractConfiguration::Keys::const_iterator it = loggers.begin(); it != loggers.end(); ++it)
    {
        AutoPtr<AbstractConfiguration> pLoggerConfig(pConfig->createView(*it));
        loggerMap[pLoggerConfig->getString("name", "")] = pLoggerConfig;
    }
    for (LoggerMap::iterator it = loggerMap.begin(); it != loggerMap.end(); ++it)
    {
        configureLogger(it->second);
    }
}
开发者ID:Victorcasas,项目名称:georest,代码行数:18,代码来源:LoggingConfigurator.cpp


示例19: create

//============================================================================//
void AnalyzerDispatcher::create(AbstractConfiguration &config)
{
    AbstractConfiguration::Keys             analyzersCodes;
    AbstractConfiguration::Keys::iterator   iter;

    config.keys("analyzers.list", analyzersCodes);

    for(iter = analyzersCodes.begin(); iter != analyzersCodes.end(); ++iter) {

        string type = config.getString("analyzers.list."+(*iter)+".type");

        if(config.has("analyzers.list."+(*iter)+".disabled")) {
            poco_information_f2(Logger::get(_loggerName),
                "analyzer type of [%s] with code [%s] disabled",
                type, string(*iter));
            continue;
        }

        if(_fabrics->isClass(type)) {

            poco_information_f1(Logger::get(_loggerName), "create analyzer for type [%s]", type);

            Analyzer::Arguments  args(*iter, config);
            Analyzer *a = _fabrics->create(type, args);

            poco_information_f2(Logger::get(_loggerName),
                "starting analyzer type of [%s] with code [%s]",
                type, string(a->getCode()));

            try {
                a->start();
                _analyzers.insert(pair<string, SharedPtr<Analyzer> >(*iter, a));
            }
            catch(exception &e) {
                delete a;
            }
        }
        else {
            poco_warning_f1(Logger::get(_loggerName), "unknown analyzer type [%s]... skip this.", type);
        }
    }

    poco_information_f1(Logger::get(_loggerName), "[%d] analyzers was registered", (int)_analyzers.size());
}
开发者ID:AlekNS,项目名称:smitlab-service,代码行数:45,代码来源:AnalyzerDispatcher.cpp


示例20: configureLogger

void LoggingConfigurator::configureLogger(AbstractConfiguration* pConfig)
{
    Logger& logger = Logger::get(pConfig->getString("name", ""));
    AbstractConfiguration::Keys props;
    pConfig->keys(props);
    for (AbstractConfiguration::Keys::const_iterator it = props.begin(); it != props.end(); ++it)
    {
        if (*it == "channel" && pConfig->hasProperty("channel.class"))
        {
            AutoPtr<AbstractConfiguration> pChannelConfig(pConfig->createView(*it));
            AutoPtr<Channel> pChannel(createChannel(pChannelConfig));
            configureChannel(pChannel, pChannelConfig);
            Logger::setChannel(logger.name(), pChannel);
        }
        else if (*it != "name")
        {
            Logger::setProperty(logger.name(), *it, pConfig->getString(*it));
        }
    }
}
开发者ID:Victorcasas,项目名称:georest,代码行数:20,代码来源:LoggingConfigurator.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ accessibilityobject::AccessibilityChildrenVector类代码示例发布时间:2022-05-31
下一篇:
C++ zxing类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap