summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-14 18:57:18 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-14 21:36:32 (GMT)
commitcb05f5a908e20006c954ce38755c2e422ecc2388 (patch)
treea793551a5fe279a57d4330119560e8542f745484 /SwifTools/TabComplete.cpp
parentcad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff)
downloadswift-cb05f5a908e20006c954ce38755c2e422ecc2388.zip
swift-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2
Removed Swift::String.
Diffstat (limited to 'SwifTools/TabComplete.cpp')
-rw-r--r--SwifTools/TabComplete.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/SwifTools/TabComplete.cpp b/SwifTools/TabComplete.cpp
index 1e15595..b123360 100644
--- a/SwifTools/TabComplete.cpp
+++ b/SwifTools/TabComplete.cpp
@@ -7,25 +7,26 @@
#include "SwifTools/TabComplete.h"
#include <algorithm>
+#include <boost/algorithm/string.hpp>
#include "Swiften/Base/foreach.h"
namespace Swift {
-void TabComplete::addWord(const String& word) {
+void TabComplete::addWord(const std::string& word) {
words_.erase(std::remove(words_.begin(), words_.end(), word), words_.end());
words_.insert(words_.begin(), word);
- if (word.getLowerCase().beginsWith(lastShort_)) {
+ if (boost::starts_with(boost::to_lower_copy(word), lastShort_)) {
lastCompletionCandidates_.insert(lastCompletionCandidates_.begin(), word);
}
}
-void TabComplete::removeWord(const String& word) {
+void TabComplete::removeWord(const std::string& word) {
words_.erase(std::remove(words_.begin(), words_.end(), word), words_.end());
lastCompletionCandidates_.erase(std::remove(lastCompletionCandidates_.begin(), lastCompletionCandidates_.end(), word), lastCompletionCandidates_.end());
}
-String TabComplete::completeWord(const String& word) {
+std::string TabComplete::completeWord(const std::string& word) {
if (word == lastCompletion_) {
if (lastCompletionCandidates_.size() != 0) {
size_t match = 0;
@@ -39,10 +40,10 @@ String TabComplete::completeWord(const String& word) {
lastCompletion_ = lastCompletionCandidates_[nextIndex];
}
} else {
- lastShort_ = word.getLowerCase();
+ lastShort_ = boost::to_lower_copy(word);
lastCompletionCandidates_.clear();
- foreach (String candidate, words_) {
- if (candidate.getLowerCase().beginsWith(word.getLowerCase())) {
+ foreach (std::string candidate, words_) {
+ if (boost::starts_with(boost::to_lower_copy(candidate), boost::to_lower_copy(word))) {
lastCompletionCandidates_.push_back(candidate);
}
}