summaryrefslogtreecommitdiff
path: root/src/options
diff options
context:
space:
mode:
authorTim King <taking@google.com>2016-02-01 10:59:49 -0800
committerTim King <taking@google.com>2016-02-01 11:05:37 -0800
commit2ce56a3c2f094b176e913720c1a34e92e810cec9 (patch)
tree1de5600a07682fb5f5d5af761c34532166833bd4 /src/options
parent1df86d534849429e269eeea9be914a3df5abd8ea (diff)
Making the references to std more explicit in didyoumean.cpp.
Diffstat (limited to 'src/options')
-rw-r--r--src/options/didyoumean.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/options/didyoumean.cpp b/src/options/didyoumean.cpp
index 573ee913f..1066c7a1f 100644
--- a/src/options/didyoumean.cpp
+++ b/src/options/didyoumean.cpp
@@ -20,20 +20,22 @@
#include "options/didyoumean.h"
#include <iostream>
+#include <set>
#include <sstream>
+#include <string>
+#include <vector>
-using namespace std;
namespace CVC4 {
-vector<string> DidYouMean::getMatch(string input) {
+std::vector<std::string> DidYouMean::getMatch(std::string input) {
/** Magic numbers */
const int similarityThreshold = 7;
const unsigned numMatchesThreshold = 10;
- set< pair<int, string> > scores;
- vector<string> ret;
+ std::set< std::pair<int, std::string> > scores;
+ std::vector<std::string> ret;
for(typeof(d_words.begin()) it = d_words.begin(); it != d_words.end(); ++it) {
- string s = (*it);
+ std::string s = (*it);
if( s == input ) {
// if input matches AS-IS just return that
ret.push_back(s);
@@ -60,7 +62,9 @@ vector<string> DidYouMean::getMatch(string input) {
#endif
}
}
- if(ret.size() > numMatchesThreshold ) ret.resize(numMatchesThreshold);;
+ if(ret.size() > numMatchesThreshold ){
+ ret.resize(numMatchesThreshold);
+ }
return ret;
}
@@ -137,11 +141,11 @@ int DidYouMean::editDistance(const std::string& a, const std::string& b)
return result;
}
-string DidYouMean::getMatchAsString(string input, int prefixNewLines, int suffixNewLines) {
- vector<string> matches = getMatch(input);
- ostringstream oss;
+std::string DidYouMean::getMatchAsString(std::string input, int prefixNewLines, int suffixNewLines) {
+ std::vector<std::string> matches = getMatch(input);
+ std::ostringstream oss;
if(matches.size() > 0) {
- while(prefixNewLines --> 0) { oss << endl; }
+ while(prefixNewLines --> 0) { oss << std::endl; }
if(matches.size() == 1) {
oss << "Did you mean this?";
} else {
@@ -150,8 +154,9 @@ string DidYouMean::getMatchAsString(string input, int prefixNewLines, int suffix
for(unsigned i = 0; i < matches.size(); ++i) {
oss << "\n " << matches[i];
}
- while(suffixNewLines --> 0) { oss << endl; }
+ while(suffixNewLines --> 0) { oss << std::endl; }
}
return oss.str();
}
+
}/* CVC4 namespace */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback