diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-14 09:46:23 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-25 08:38:24 (GMT) |
commit | d5f701fdd6826421c0c83b8e299918065b6c99d1 (patch) | |
tree | 90d5c425b8dda4c293e3e902ad9cea4f7750430f /Swift/Controllers/ContactSuggester.h | |
parent | e4704555946626980014d936dcfe6ede2710501b (diff) | |
download | swift-d5f701fdd6826421c0c83b8e299918065b6c99d1.zip swift-d5f701fdd6826421c0c83b8e299918065b6c99d1.tar.bz2 |
Sort ContactSuggester results using case-insensitive substring match, plus unit tests.
Change-Id: I806f696dac582ba2d818ceb22df3a10495ce0b16
Diffstat (limited to 'Swift/Controllers/ContactSuggester.h')
-rw-r--r-- | Swift/Controllers/ContactSuggester.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Swift/Controllers/ContactSuggester.h b/Swift/Controllers/ContactSuggester.h index 67b912c..1c796c9 100644 --- a/Swift/Controllers/ContactSuggester.h +++ b/Swift/Controllers/ContactSuggester.h @@ -17,6 +17,8 @@ #include <Swift/Controllers/Contact.h> +class ContactSuggesterTest; + namespace Swift { class ContactProvider; @@ -28,15 +30,12 @@ namespace Swift { void addContactProvider(ContactProvider* provider); std::vector<Contact::ref> getSuggestions(const std::string& search) const; - private: + public: static bool matchContact(const std::string& search, const Contact::ref& c); /** * Performs fuzzy matching on the string text. Matches when each character of match string is present in sequence in text string. */ static bool fuzzyMatch(std::string text, std::string match); - static bool contactLexicographicalSortPredicate(const Contact::ref& a, const Contact::ref& b); - static bool contactEqualityPredicate(const Contact::ref& a, const Contact::ref& b); - static bool contactSmartSortPredicate(const Contact::ref& a, const Contact::ref& b); private: std::vector<ContactProvider*> contactProviders_; |