1#pragma once
2
3#include <Common/FileUpdatesTracker.h>
4#include "INamesProvider.h"
5
6
7// Represents local file with list of regions ids / names
8class LanguageRegionsNamesDataSource : public ILanguageRegionsNamesDataSource
9{
10private:
11 std::string path;
12 FileUpdatesTracker updates_tracker;
13 std::string language;
14
15public:
16 LanguageRegionsNamesDataSource(const std::string & path_, const std::string & language_)
17 : path(path_), updates_tracker(path_), language(language_)
18 {
19 }
20
21 bool isModified() const override;
22
23 size_t estimateTotalSize() const override;
24
25 ILanguageRegionsNamesReaderPtr createReader() override;
26
27 std::string getLanguage() const override;
28
29 std::string getSourceName() const override;
30};
31
32using ILanguageRegionsNamesDataSourcePtr = std::unique_ptr<ILanguageRegionsNamesDataSource>;
33
34
35// Provides access to directory with multiple data source files: one file per language
36class RegionsNamesDataProvider : public IRegionsNamesDataProvider
37{
38private:
39 std::string directory;
40
41public:
42 RegionsNamesDataProvider(const std::string & directory_);
43
44 ILanguageRegionsNamesDataSourcePtr getLanguageRegionsNamesSource(const std::string & language) const override;
45
46private:
47 std::string getDataFilePath(const std::string & language) const;
48};
49