diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-05-15 19:59:04 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:38:27 +0300 |
commit | 729d81da3182ab29c4b0e33f075c82535c5a48a1 (patch) | |
tree | fad47ed637242b5080f7dfd6c9a9b7aa3367ff31 /storage | |
parent | 09d97d23cb9ee23c7c9994bd581783a8cbf9d59f (diff) |
added Storage::FindIndexByName function.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/storage.cpp | 11 | ||||
-rw-r--r-- | storage/storage.hpp | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp index 47c2a49735..1ff85d3cdb 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -488,4 +488,15 @@ namespace storage { return m_currentVersion; } + + TIndex const Storage::FindIndexByName(string const & name) const + { + for (unsigned i = 0; i < m_countries.SiblingsCount(); ++i) + for (unsigned j = 0; j < m_countries[i].SiblingsCount(); ++j) + for (unsigned k = 0; k < m_countries[i][j].SiblingsCount(); ++k) + if (m_countries[i][j][k].Value().Name() == name) + return TIndex(i, j, k); + + return TIndex(); + } } diff --git a/storage/storage.hpp b/storage/storage.hpp index 09859c5cc7..ca9ad44fe1 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -146,6 +146,8 @@ namespace storage void Unsubscribe(int slotId); //@} + TIndex const FindIndexByName(string const & name) const; + size_t CountriesCount(TIndex const & index) const; string const & CountryName(TIndex const & index) const; string const & CountryFlag(TIndex const & index) const; |