2018-11-28 11:37:12 +00:00
|
|
|
#include "GeoDictionariesLoader.h"
|
2017-11-28 22:15:06 +00:00
|
|
|
|
2018-11-28 11:37:12 +00:00
|
|
|
#include <Poco/Util/AbstractConfiguration.h>
|
|
|
|
#include "GeodataProviders/HierarchiesProvider.h"
|
|
|
|
#include "GeodataProviders/NamesProvider.h"
|
2017-11-28 22:15:06 +00:00
|
|
|
|
2018-12-10 15:25:45 +00:00
|
|
|
std::unique_ptr<RegionsHierarchies> GeoDictionariesLoader::reloadRegionsHierarchies(const Poco::Util::AbstractConfiguration & config)
|
2017-11-28 22:15:06 +00:00
|
|
|
{
|
|
|
|
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);
|
2018-05-07 02:01:11 +00:00
|
|
|
auto data_provider = std::make_unique<RegionsHierarchiesDataProvider>(default_hierarchy_file);
|
2017-11-28 22:15:06 +00:00
|
|
|
return std::make_unique<RegionsHierarchies>(std::move(data_provider));
|
|
|
|
}
|
|
|
|
|
2018-12-10 15:25:45 +00:00
|
|
|
std::unique_ptr<RegionsNames> GeoDictionariesLoader::reloadRegionsNames(const Poco::Util::AbstractConfiguration & config)
|
2017-11-28 22:15:06 +00:00
|
|
|
{
|
|
|
|
static constexpr auto config_key = "path_to_regions_names_files";
|
|
|
|
|
|
|
|
if (!config.has(config_key))
|
|
|
|
return {};
|
|
|
|
|
|
|
|
const auto directory = config.getString(config_key);
|
|
|
|
auto data_provider = std::make_unique<RegionsNamesDataProvider>(directory);
|
|
|
|
return std::make_unique<RegionsNames>(std::move(data_provider));
|
|
|
|
}
|