diff options
author | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-04-30 08:05:11 +0300 |
---|---|---|
committer | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-04-30 08:05:11 +0300 |
commit | eca582410006443d0b101a9ae188e302f34f8a03 (patch) | |
tree | 35212762fbe666330205e2a9ef09d16a918d077c /misc | |
parent | 85acdc62b1548863a6db18bebb538406cfcfa038 (diff) |
Remove trailing whitespace in C++ files.
Diffstat (limited to 'misc')
-rw-r--r-- | misc/merge-sorted.cc | 22 | ||||
-rw-r--r-- | misc/pmoses/pmoses.cc | 34 |
2 files changed, 28 insertions, 28 deletions
diff --git a/misc/merge-sorted.cc b/misc/merge-sorted.cc index ae693215b..4550a491d 100644 --- a/misc/merge-sorted.cc +++ b/misc/merge-sorted.cc @@ -19,10 +19,10 @@ class Part string my_lines[2]; size_t ctr; public: - string const& line() const - { + string const& line() const + { static string empty_line; - return f ? my_lines[ctr%2] : empty_line; + return f ? my_lines[ctr%2] : empty_line; } Part(string _fname) : ctr(0) @@ -32,7 +32,7 @@ public: if (!getline(*f, my_lines[0])) f.reset(); } - bool next() + bool next() { if (!f) return false; if (!getline(*f, my_lines[++ctr%2])) @@ -45,16 +45,16 @@ public: return true; } - bool operator <(Part const& other) const + bool operator <(Part const& other) const { return line() < other.line(); } - bool operator <=(Part const& other) const + bool operator <=(Part const& other) const { return line() <= other.line(); } - bool operator >(Part const& other) const + bool operator >(Part const& other) const { return line() > other.line(); } - bool operator >=(Part const& other) const + bool operator >=(Part const& other) const { return line() >= other.line(); } bool go(ostream& out) @@ -66,20 +66,20 @@ public: out << fname << "-" << ctr - 1 << "-"; out << my_lines[(ctr - 1)%2] << endl; } - do + do { out << fname << " " << ctr << " "; out << line() << "\n"; } while (next() && my_lines[0] == my_lines[1]); #else - do { out << line() << "\n"; } + do { out << line() << "\n"; } while (next() && my_lines[0] == my_lines[1]); out.flush(); #endif return f != NULL; } - + }; diff --git a/misc/pmoses/pmoses.cc b/misc/pmoses/pmoses.cc index 8b8134adc..caf66cee5 100644 --- a/misc/pmoses/pmoses.cc +++ b/misc/pmoses/pmoses.cc @@ -33,25 +33,25 @@ using namespace Moses; //Delete white spaces from the end and the begining of the string string trim(string str) { string::iterator it; - + while ((str.length()>0)&&((*(it=str.begin()))==' ')) { str.erase(it); } - + while ((str.length()>0)&&((*(it=(str.end()-1)))==' ')) { str.erase(it); } - + for(unsigned i=0; i<str.length(); i++) { if ((str[i]==' ') && ((i+1)<str.length()) && (str[i+1]==' ')) { str=str.erase(i,1); i--; } } - + return str; } - + int main (int argc, char *argv[]) { vector<FactorType> input, output; @@ -64,12 +64,12 @@ int main (int argc, char *argv[]) { input.push_back(0); output.push_back(0); - + + weight.push_back(0); weight.push_back(0); weight.push_back(0); weight.push_back(0); weight.push_back(0); - weight.push_back(0); if (argc<3) { cerr<<"Error: Wrong number of parameters."<<endl; @@ -86,19 +86,19 @@ int main (int argc, char *argv[]) { } cerr<<"numScoreComponent: "<<numScoreComponent<<endl; - cerr<<"numInputScores: "<<numInputScores<<endl; + cerr<<"numInputScores: "<<numInputScores<<endl; PhraseDictionaryTreeAdaptor *pd=new PhraseDictionaryTreeAdaptor(numScoreComponent, numInputScores); - + cerr<<"Table limit: "<<tableLimit<<endl; cerr<<"WeightWordPenalty: "<<weightWP<<endl; cerr<<"Source phrase: ___"<<source_str<<"___"<<endl; - + if (!pd->Load(input, output, filePath, weight, tableLimit, lmList, weightWP)) { delete pd; return false; } - + cerr<<"-------------------------------------------------"<<endl; FactorDirection direction; Phrase phrase(direction); @@ -106,15 +106,15 @@ int main (int argc, char *argv[]) { phrase.CreateFromString(input, source_str, "|"); TargetPhraseCollection *tpc = (TargetPhraseCollection*) pd->GetTargetPhraseCollection(phrase); - if (tpc == NULL) + if (tpc == NULL) cerr<<"Not found."<<endl; - else { + else { TargetPhraseCollection::iterator iterTargetPhrase; for (iterTargetPhrase = tpc->begin(); iterTargetPhrase != tpc->end(); ++iterTargetPhrase) { //cerr<<(*(*iterTargetPhrase))<<endl; - + stringstream strs; - strs<<static_cast<const Phrase&>(*(*iterTargetPhrase)); + strs<<static_cast<const Phrase&>(*(*iterTargetPhrase)); cerr<<source_str<<" => ___"<<trim(strs.str())<<"___ "; ScoreComponentCollection scc = (*iterTargetPhrase)->GetScoreBreakdown(); cerr<<"Scores: "; @@ -123,6 +123,6 @@ int main (int argc, char *argv[]) { } cerr<<endl; } - } - cerr<<"-------------------------------------------------"<<endl; + } + cerr<<"-------------------------------------------------"<<endl; } |