Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2014-01-22 14:54:27 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:13:19 +0300
commit8e4dd0f39d3dd124b7f9a4314271e7b22cbf8751 (patch)
tree403ead2d205ad3a1e31b69b4731833960bf7a59c /indexer/feature_impl.cpp
parent8db8356f7f63599a1d98028e27b08d790ce36545 (diff)
[search] Factor out feature::IsHouseNumber to separate files.
Diffstat (limited to 'indexer/feature_impl.cpp')
-rw-r--r--indexer/feature_impl.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/indexer/feature_impl.cpp b/indexer/feature_impl.cpp
new file mode 100644
index 0000000000..bcac11206c
--- /dev/null
+++ b/indexer/feature_impl.cpp
@@ -0,0 +1,38 @@
+#include "feature_impl.hpp"
+
+#include "../base/string_utils.hpp"
+
+
+namespace feature
+{
+
+bool IsDigit(int c)
+{
+ return (c <= 127 && isdigit(c));
+}
+
+bool IsNumber(strings::UniString const & s)
+{
+ for (size_t i = 0; i < s.size(); ++i)
+ {
+ // android production ndk-r8d has bug. "еда" detected as a number.
+ if (!IsDigit(s[i]))
+ return false;
+ }
+ return true;
+}
+
+/// Check that token can be house number.
+bool IsHouseNumber(strings::UniString const & s)
+{
+ size_t const count = s.size();
+ /// @todo Probably, call some check function from House::
+ return (count > 0 && count < 8 && IsDigit(s[0]));
+}
+
+bool IsHouseNumber(string const & s)
+{
+ return (!s.empty() && IsDigit(s[0]));
+}
+
+}