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


C++ AbstractConfiguration::getString方法代码示例

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


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

示例1:

DictionarySpecialAttribute::DictionarySpecialAttribute(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix)
	: name{config.getString(config_prefix + ".name", "")},
	  expression{config.getString(config_prefix + ".expression", "")}
{
	if (name.empty() && !expression.empty())
		throw Exception{
			"Element " + config_prefix + ".name is empty",
			ErrorCodes::BAD_ARGUMENTS};
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:9,代码来源:DictionaryStructure.cpp

示例2: MongoDBDictionarySource

MongoDBDictionarySource::MongoDBDictionarySource(
	const DictionaryStructure & dict_struct, const Poco::Util::AbstractConfiguration & config,
	const std::string & config_prefix, Block & sample_block)
	: MongoDBDictionarySource(
		dict_struct,
		config.getString(config_prefix + ".host"),
		config.getUInt(config_prefix + ".port"),
		config.getString(config_prefix + ".user", ""),
		config.getString(config_prefix + ".password", ""),
		config.getString(config_prefix + ".db", ""),
		config.getString(config_prefix + ".collection"),
		sample_block)
{
}
开发者ID:jacktang,项目名称:ClickHouse,代码行数:14,代码来源:MongoDBDictionarySource.cpp

示例3: log

HTTPDictionarySource::HTTPDictionarySource(const DictionaryStructure & dict_struct_,
    const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
    Block & sample_block, const Context & context)
    : log(&Logger::get("HTTPDictionarySource")),
    update_time{std::chrono::system_clock::from_time_t(0)},
    dict_struct{dict_struct_},
    url{config.getString(config_prefix + ".url", "")},
    update_field{config.getString(config_prefix + ".update_field", "")},
    format{config.getString(config_prefix + ".format")},
    sample_block{sample_block},
    context(context),
    timeouts(ConnectionTimeouts::getHTTPTimeouts(context.getSettingsRef()))
{
}
开发者ID:filimonov,项目名称:ClickHouse,代码行数:14,代码来源:HTTPDictionarySource.cpp

示例4:

MySQLDictionarySource::MySQLDictionarySource(const DictionaryStructure & dict_struct_,
	const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
	const Block & sample_block)
	: dict_struct{dict_struct_},
	  db{config.getString(config_prefix + ".db", "")},
	  table{config.getString(config_prefix + ".table")},
	  where{config.getString(config_prefix + ".where", "")},
	  dont_check_update_time{config.getBool(config_prefix + ".dont_check_update_time", false)},
	  sample_block{sample_block},
	  pool{config, config_prefix},
	  query_builder{dict_struct, db, table, where},
	  load_all_query{query_builder.composeLoadAllQuery()}
{
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:14,代码来源:MySQLDictionarySource.cpp

示例5: loadFromConfig

void SettingsConstraints::loadFromConfig(const String & path_to_constraints, const Poco::Util::AbstractConfiguration & config)
{
    if (!config.has(path_to_constraints))
        throw Exception("There is no path '" + path_to_constraints + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG);

    Poco::Util::AbstractConfiguration::Keys names;
    config.keys(path_to_constraints, names);

    for (const String & name : names)
    {
        String path_to_name = path_to_constraints + "." + name;
        Poco::Util::AbstractConfiguration::Keys constraint_types;
        config.keys(path_to_name, constraint_types);
        for (const String & constraint_type : constraint_types)
        {
            auto get_constraint_value = [&]{ return config.getString(path_to_name + "." + constraint_type); };
            if (constraint_type == "min")
                setMinValue(name, get_constraint_value());
            else if (constraint_type == "max")
                setMaxValue(name, get_constraint_value());
            else if (constraint_type == "readonly")
                setReadOnly(name, true);
            else
                throw Exception("Setting " + constraint_type + " value for " + name + " isn't supported", ErrorCodes::NOT_IMPLEMENTED);
        }
    }
}
开发者ID:yandex,项目名称:ClickHouse,代码行数:27,代码来源:SettingsConstraints.cpp

示例6: Exception

LibraryDictionarySource::LibraryDictionarySource(
    const DictionaryStructure & dict_struct_,
    const Poco::Util::AbstractConfiguration & config,
    const std::string & config_prefix,
    Block & sample_block)
    : log(&Logger::get("LibraryDictionarySource"))
    , dict_struct{dict_struct_}
    , config_prefix{config_prefix}
    , path{config.getString(config_prefix + ".path", "")}
    , sample_block{sample_block}
{
    if (!Poco::File(path).exists())
        throw Exception(
            "LibraryDictionarySource: Can't load lib " + toString() + ": " + Poco::File(path).path() + " - File doesn't exist",
            ErrorCodes::FILE_DOESNT_EXIST);
    description.init(sample_block);
    library = std::make_shared<SharedLibrary>(path, RTLD_LAZY
#if defined(RTLD_DEEPBIND) // Does not exists in freebsd
        | RTLD_DEEPBIND
#endif
    );
    settings = std::make_shared<CStringsHolder>(getLibSettings(config, config_prefix + lib_config_settings));
    if (auto libNew = library->tryGet<decltype(lib_data) (*)(decltype(&settings->strings), decltype(&ClickHouseLibrary::log))>(
            "ClickHouseDictionary_v3_libNew"))
        lib_data = libNew(&settings->strings, ClickHouseLibrary::log);
}
开发者ID:greck2908,项目名称:ClickHouse,代码行数:26,代码来源:LibraryDictionarySource.cpp

示例7:

SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfiguration & config)
{
    query_log = createSystemLog<QueryLog>(global_context, "system", "query_log", config, "query_log");
    query_thread_log = createSystemLog<QueryThreadLog>(global_context, "system", "query_thread_log", config, "query_thread_log");
    part_log = createSystemLog<PartLog>(global_context, "system", "part_log", config, "part_log");

    part_log_database = config.getString("part_log.database", "system");
}
开发者ID:greck2908,项目名称:ClickHouse,代码行数:8,代码来源:SystemLog.cpp

示例8:

Macros::Macros(const Poco::Util::AbstractConfiguration & config, const String & root_key)
{
    Poco::Util::AbstractConfiguration::Keys keys;
    config.keys(root_key, keys);
    for (const String & key : keys)
    {
        macros[key] = config.getString(root_key + "." + key);
    }
}
开发者ID:chipitsine,项目名称:ClickHouse,代码行数:9,代码来源:Macros.cpp

示例9: Initialize

/*virtual*/
void Renderer::Initialize(uint width,uint height,bool fullScreen)
{
    Poco::Util::AbstractConfiguration* pConfigurationFile =
        Poly::Application::Get()->ConfigurationFile();

    mFpsLogging = pConfigurationFile->getBool("Renderer.LogFPS",false);
    mShadersPath = pConfigurationFile->getString("Renderer.ShadersPath","");
    mVerticalSync = pConfigurationFile->getBool("Renderer.VerticalSync",false);
}
开发者ID:Xaklse,项目名称:Polygony-Engine,代码行数:10,代码来源:Renderer.cpp

示例10:

std::unique_ptr<RegionsHierarchies> GeoDictionariesLoader::reloadRegionsHierarchies(
    const Poco::Util::AbstractConfiguration & config)
{
    static constexpr auto config_key = "path_to_regions_hierarchy_file";

    if (!config.has(config_key))
        return {};

    const auto default_hierarchy_file = config.getString(config_key);
    auto data_provider = std::make_unique<RegionsHierarchiesDataProvider>(default_hierarchy_file);
    return std::make_unique<RegionsHierarchies>(std::move(data_provider));
}
开发者ID:kellylg,项目名称:ClickHouse,代码行数:12,代码来源:GeoDictionariesLoader.cpp

示例11: loadSettingsFromConfig

void Settings::loadSettingsFromConfig(const String & path, const Poco::Util::AbstractConfiguration & config)
{
	if (!config.has(path))
		throw Exception("There is no path '" + path + "' in configuration file.", ErrorCodes::NO_ELEMENTS_IN_CONFIG);

	Poco::Util::AbstractConfiguration::Keys config_keys;
	config.keys(path, config_keys);

	for (const std::string & key : config_keys)
	{
		set(key, config.getString(path + "." + key));
	}
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:13,代码来源:Settings.cpp

示例12: Exception

Pool::Pool(const Poco::Util::AbstractConfiguration & cfg, const std::string & config_name,
     unsigned default_connections_, unsigned max_connections_,
     const char * parent_config_name_)
    : default_connections(default_connections_), max_connections(max_connections_)
{
    server = cfg.getString(config_name + ".host");

    if (parent_config_name_)
    {
        const std::string parent_config_name(parent_config_name_);
        db = cfg.getString(config_name + ".db", cfg.getString(parent_config_name + ".db", ""));
        user = cfg.has(config_name + ".user")
            ? cfg.getString(config_name + ".user")
            : cfg.getString(parent_config_name + ".user");
        password = cfg.has(config_name + ".password")
            ? cfg.getString(config_name + ".password")
            : cfg.getString(parent_config_name + ".password");

        if (!cfg.has(config_name + ".port") && !cfg.has(config_name + ".socket")
            && !cfg.has(parent_config_name + ".port") && !cfg.has(parent_config_name + ".socket"))
            throw Poco::Exception("mysqlxx::Pool configuration: expected port or socket");

        port = cfg.has(config_name + ".port")
            ? cfg.getInt(config_name + ".port")
            : cfg.getInt(parent_config_name + ".port", 0);
        socket = cfg.has(config_name + ".socket")
            ? cfg.getString(config_name + ".socket")
            : cfg.getString(parent_config_name + ".socket", "");
        ssl_ca = cfg.has(config_name + ".ssl_ca")
            ? cfg.getString(config_name + ".ssl_ca")
            : cfg.getString(parent_config_name + ".ssl_ca", "");
        ssl_cert = cfg.has(config_name + ".ssl_cert")
            ? cfg.getString(config_name + ".ssl_cert")
            : cfg.getString(parent_config_name + ".ssl_cert", "");
        ssl_key = cfg.has(config_name + ".ssl_key")
            ? cfg.getString(config_name + ".ssl_key")
            : cfg.getString(parent_config_name + ".ssl_key", "");
    }
    else
    {
        db = cfg.getString(config_name + ".db", "");
        user = cfg.getString(config_name + ".user");
        password = cfg.getString(config_name + ".password");

        if (!cfg.has(config_name + ".port") && !cfg.has(config_name + ".socket"))
            throw Poco::Exception("mysqlxx::Pool configuration: expected port or socket");

        port = cfg.getInt(config_name + ".port", 0);
        socket = cfg.getString(config_name + ".socket", "");
        ssl_ca = cfg.getString(config_name + ".ssl_ca", "");
        ssl_cert = cfg.getString(config_name + ".ssl_cert", "");
        ssl_key = cfg.getString(config_name + ".ssl_key", "");
    }

    connect_timeout = cfg.getInt(config_name + ".connect_timeout",
        cfg.getInt("mysql_connect_timeout",
            MYSQLXX_DEFAULT_TIMEOUT));

    rw_timeout =
        cfg.getInt(config_name + ".rw_timeout",
            cfg.getInt("mysql_rw_timeout",
                MYSQLXX_DEFAULT_RW_TIMEOUT));
}
开发者ID:bamx23,项目名称:ClickHouse,代码行数:63,代码来源:Pool.cpp

示例13: getAttributeUnderlyingType

std::vector<DictionaryAttribute> DictionaryStructure::getAttributes(
	const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix,
	const bool hierarchy_allowed, const bool allow_null_values)
{
	Poco::Util::AbstractConfiguration::Keys keys;
	config.keys(config_prefix, keys);
	auto has_hierarchy = false;

	std::vector<DictionaryAttribute> attributes;

	for (const auto & key : keys)
	{
		if (0 != strncmp(key.data(), "attribute", strlen("attribute")))
			continue;

		const auto prefix = config_prefix + '.' + key + '.';

		const auto name = config.getString(prefix + "name");
		const auto type_string = config.getString(prefix + "type");
		const auto type = DataTypeFactory::instance().get(type_string);
		const auto underlying_type = getAttributeUnderlyingType(type_string);

		const auto expression = config.getString(prefix + "expression", "");
		if (!expression.empty())
			has_expressions = true;

		Field null_value;
		if (allow_null_values)
		{
			const auto null_value_string = config.getString(prefix + "null_value");
			try
			{
				ReadBufferFromString null_value_buffer{null_value_string};
				ColumnPtr column_with_null_value = type->createColumn();
				type->deserializeTextEscaped(*column_with_null_value, null_value_buffer);
				null_value = (*column_with_null_value)[0];
			}
			catch (const std::exception & e)
			{
				throw Exception{
					std::string{"Error parsing null_value: "} + e.what(),
					ErrorCodes::BAD_ARGUMENTS};
			}
		}

		const auto hierarchical = config.getBool(prefix + "hierarchical", false);
		const auto injective = config.getBool(prefix + "injective", false);
		if (name.empty())
			throw Exception{
				"Properties 'name' and 'type' of an attribute cannot be empty",
				ErrorCodes::BAD_ARGUMENTS};

		if (has_hierarchy && !hierarchy_allowed)
			throw Exception{
				"Hierarchy not allowed in '" + prefix,
				ErrorCodes::BAD_ARGUMENTS};

		if (has_hierarchy && hierarchical)
			throw Exception{
				"Only one hierarchical attribute supported",
				ErrorCodes::BAD_ARGUMENTS};

		has_hierarchy = has_hierarchy || hierarchical;

		attributes.emplace_back(DictionaryAttribute{
			name, underlying_type, type, expression, null_value, hierarchical, injective
		});
	}

	return attributes;
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:71,代码来源:DictionaryStructure.cpp


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