1 | #pragma once |
2 | |
3 | #include <memory> |
4 | #include "Entries.h" |
5 | |
6 | |
7 | // Iterates over all name entries in data source |
8 | class ILanguageRegionsNamesReader |
9 | { |
10 | public: |
11 | virtual bool readNext(RegionNameEntry & entry) = 0; |
12 | |
13 | virtual ~ILanguageRegionsNamesReader() {} |
14 | }; |
15 | |
16 | using ILanguageRegionsNamesReaderPtr = std::unique_ptr<ILanguageRegionsNamesReader>; |
17 | |
18 | |
19 | // Regions names data source for one language |
20 | class ILanguageRegionsNamesDataSource |
21 | { |
22 | public: |
23 | // data modified since last createReader invocation |
24 | virtual bool isModified() const = 0; |
25 | |
26 | // Upper bound on total length of all names |
27 | virtual size_t estimateTotalSize() const = 0; |
28 | |
29 | virtual ILanguageRegionsNamesReaderPtr createReader() = 0; |
30 | |
31 | virtual std::string getLanguage() const = 0; |
32 | |
33 | virtual std::string getSourceName() const = 0; |
34 | |
35 | virtual ~ILanguageRegionsNamesDataSource() {} |
36 | }; |
37 | |
38 | using ILanguageRegionsNamesDataSourcePtr = std::unique_ptr<ILanguageRegionsNamesDataSource>; |
39 | |
40 | |
41 | // Provides regions names data sources for different languages |
42 | class IRegionsNamesDataProvider |
43 | { |
44 | public: |
45 | /// Returns nullptr if the language data does not exist. |
46 | virtual ILanguageRegionsNamesDataSourcePtr getLanguageRegionsNamesSource(const std::string & language) const = 0; |
47 | |
48 | virtual ~IRegionsNamesDataProvider() {} |
49 | }; |
50 | |
51 | using IRegionsNamesDataProviderPtr = std::unique_ptr<IRegionsNamesDataProvider>; |
52 | |