diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-09 07:53:12 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-04-22 21:12:21 (GMT) |
commit | a7fb55381ab4a5c470bf891b31ac6e201611a2c1 (patch) | |
tree | 475b3b7fc0142946863580506b00aa250ef8ca14 /Swift/Controllers/ContactSuggester.h | |
parent | 4444aeb255f8d1712b794c31166f362bb3ec335a (diff) | |
download | swift-a7fb55381ab4a5c470bf891b31ac6e201611a2c1.zip swift-a7fb55381ab4a5c470bf891b31ac6e201611a2c1.tar.bz2 |
Fix crash in QtUserSearchWindow.
Avoid storing pointers to items in vectors. Using shared_ptr for Contact items.
Change-Id: I3baa05fc058011b2beca14dc620ab794988a2b37
Diffstat (limited to 'Swift/Controllers/ContactSuggester.h')
-rw-r--r-- | Swift/Controllers/ContactSuggester.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Swift/Controllers/ContactSuggester.h b/Swift/Controllers/ContactSuggester.h index 137e5d3..67b912c 100644 --- a/Swift/Controllers/ContactSuggester.h +++ b/Swift/Controllers/ContactSuggester.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + #pragma once #include <string> @@ -21,14 +27,16 @@ namespace Swift { void addContactProvider(ContactProvider* provider); - std::vector<Contact> getSuggestions(const std::string& search) const; + std::vector<Contact::ref> getSuggestions(const std::string& search) const; private: - static bool matchContact(const std::string& search, const Contact& c); + 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 chatSortPredicate(const Contact& a, const Contact& b); + 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_; |