From 457288fab6184dab913dccf6e4016e9217e467ca Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Thu, 21 Nov 2024 13:53:36 -0300 Subject: [PATCH] Minor code style fixes. Signed-off-by: Viktor Govako --- .../app/organicmaps/search/SearchResult.java | 10 ++++++---- search/highlighting.cpp | 20 +++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/search/SearchResult.java b/android/app/src/main/java/app/organicmaps/search/SearchResult.java index d2be945e8d..f903188ece 100644 --- a/android/app/src/main/java/app/organicmaps/search/SearchResult.java +++ b/android/app/src/main/java/app/organicmaps/search/SearchResult.java @@ -122,12 +122,14 @@ public class SearchResult return title; } - public void formatText(SpannableStringBuilder builder, int[] ranges) { - if (ranges != null) { + public void formatText(SpannableStringBuilder builder, int[] ranges) + { + if (ranges != null) + { final int size = ranges.length / 2; int index = 0; - - for (int i = 0; i < size; i++) { + for (int i = 0; i < size; i++) + { final int start = ranges[index++]; final int len = ranges[index++]; diff --git a/search/highlighting.cpp b/search/highlighting.cpp index 2469304cb6..f876b97e13 100644 --- a/search/highlighting.cpp +++ b/search/highlighting.cpp @@ -1,7 +1,7 @@ #include "search/highlighting.hpp" -using namespace std; - +namespace search +{ namespace { // Makes continuous range for tokens and prefix. @@ -42,8 +42,7 @@ public: }; } // namespace -namespace search -{ + void HighlightResult(QueryTokens const & tokens, strings::UniString const & prefix, Result & res) { using Iter = QueryTokens::const_iterator; @@ -52,15 +51,16 @@ void HighlightResult(QueryTokens const & tokens, strings::UniString const & pref CombinedIter beg(tokens.begin(), tokens.end(), prefix.empty() ? nullptr : &prefix); CombinedIter end(tokens.end() /* cur */, tokens.end() /* end */, nullptr); - // Highlight Title - SearchStringTokensIntersectionRanges(res.GetString(), beg, end, - [&](pair const &range) { + // Highlight Title + SearchStringTokensIntersectionRanges(res.GetString(), beg, end, + [&](std::pair const & range) + { res.AddHighlightRange(range); - }); + }); // Highlight description. - SearchStringTokensIntersectionRanges(res.GetAddress(), beg, end, - [&](pair const &range) + SearchStringTokensIntersectionRanges(res.GetAddress(), beg, end, + [&](std::pair const & range) { res.AddDescHighlightRange(range); });