diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-05-21 19:11:34 +0300 |
---|---|---|
committer | gmoryes <gmoryes@gmail.com> | 2019-05-22 11:40:48 +0300 |
commit | 04394def48acc692bdf38184c383d47992f2b0b5 (patch) | |
tree | fe2b14054f3088fbbe4a3909caf4e7ec4c9b2ba2 /storage | |
parent | 670039d1fc6d6707225cb07f5887067c800076d8 (diff) |
[tests] Add ContriesNamesTest.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/storage.cpp | 7 | ||||
-rw-r--r-- | storage/storage.hpp | 8 |
2 files changed, 13 insertions, 2 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp index ef7a46c117..59da1cbc94 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -364,6 +364,13 @@ Country const & Storage::CountryByCountryId(CountryId const & countryId) const return node->Value(); } +bool Storage::IsNode(CountryId const & countryId) const +{ + if (!IsCountryIdValid(countryId)) + return false; + return m_countries.FindFirst(countryId) != nullptr; +} + bool Storage::IsLeaf(CountryId const & countryId) const { if (!IsCountryIdValid(countryId)) diff --git a/storage/storage.hpp b/storage/storage.hpp index 2686f2a308..fcb398ac2d 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -536,9 +536,13 @@ public: CountryId FindCountryIdByFile(string const & name) const; - // These two functions check whether |countryId| is a leaf - // or an inner node of the country tree. + // Returns true iff |countryId| exists as a node in the tree. + bool IsNode(CountryId const & countryId) const; + + // Returns true iff |countryId| is a leaf of the tree. bool IsLeaf(CountryId const & countryId) const; + + // Returns true iff |countryId| is an inner node of the tree. bool IsInnerNode(CountryId const & countryId) const; LocalAndRemoteSize CountrySizeInBytes(CountryId const & countryId, MapOptions opt) const; |