From 47f4d5c03a16988eab91de5e26218f8e0d35b8b8 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 27 Apr 2015 08:58:18 +0000 Subject: Boltun common project git-svn-id: http://svn.miranda-ng.org/main/trunk@13194 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/src/Engine/Mind.cpp | 80 +++++++++++++------------- plugins/Boltun/src/Engine/Mind.h | 4 +- plugins/Boltun/src/Engine/MyCodeCvt.cpp | 34 +++++------ plugins/Boltun/src/Engine/MyCodeCvt.h | 22 +++---- plugins/Boltun/src/Engine/PerContactData.h | 8 +-- plugins/Boltun/src/Engine/TalkEngine.cpp | 82 +++++++++++++-------------- plugins/Boltun/src/Engine/TalkEngine.h | 28 ++++----- plugins/Boltun/src/Engine/UnrecentChooser.cpp | 2 +- plugins/Boltun/src/Engine/ValueChooser.h | 4 +- plugins/Boltun/src/Engine/WordsList.cpp | 32 +++++------ 10 files changed, 145 insertions(+), 151 deletions(-) (limited to 'plugins/Boltun/src/Engine') diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index 1067711bdf..ec6c58528b 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -18,18 +18,18 @@ // //*********************************************************** -#include "..\boltun.h" +#include "..\stdafx.h" using namespace std; -typedef vector string_vec; -typedef multimap string_mmap; +typedef vector string_vec; +typedef multimap string_mmap; Mind::Mind() { data = new MindData(); data->referenceCount = 1; - data->maxSmileLen = 0; + data->maxSmileLen = 0; } Mind::~Mind() @@ -103,7 +103,7 @@ void Mind::Load(tstring filename) file.open(filename.c_str(), ios_base::in | ios_base::binary); tstring s1, st; - TCHAR *c, *co; + TCHAR *c, *co = NULL; size_t count; int error = 0; int line = 1; @@ -133,7 +133,7 @@ void Mind::Load(tstring filename) format(st); count = st.length(); - c = co = new TCHAR[count+1]; + c = co = new TCHAR[count + 1]; _tcscpy(c, st.c_str()); size_t pos = 0; while (pos < count && _istspace(*c)) @@ -213,41 +213,41 @@ void Mind::Load(tstring filename) ++c; count -= 2; c[count] = '\0'; - if (_tcscmp(c,_T("QUESTION")) == 0) + if (_tcscmp(c, _T("QUESTION")) == 0) { toLowerStr(c); data->question.insert(s1); } else - if (_tcscmp(c,_T("IGNORED")) == 0) - { - toLowerStr(c); - data->special.insert(s1); - } - else - if (_tcscmp(c,_T("ESCAPE")) == 0) - { - data->escape.push_back(s1); - } - else - if (_tcscmp(c,_T("FAILURE")) == 0) - { - data->failure.push_back(s1); - } - else - if (_tcscmp(c,_T("REPEAT")) == 0) - { - data->repeats.push_back(s1); - } - else - { - if (_tcscmp(c,_T("INITIAL")) != 0) - throw error; - data->initial.push_back(s1); - } + if (_tcscmp(c, _T("IGNORED")) == 0) + { + toLowerStr(c); + data->special.insert(s1); + } + else + if (_tcscmp(c, _T("ESCAPE")) == 0) + { + data->escape.push_back(s1); + } + else + if (_tcscmp(c, _T("FAILURE")) == 0) + { + data->failure.push_back(s1); + } + else + if (_tcscmp(c, _T("REPEAT")) == 0) + { + data->repeats.push_back(s1); + } + else + { + if (_tcscmp(c, _T("INITIAL")) != 0) + throw error; + data->initial.push_back(s1); + } break; case '@': - { + { if (file.eof()) throw error; getline(file, s1); @@ -267,8 +267,8 @@ void Mind::Load(tstring filename) data->raliases.insert(make_pair(sc, strs)); for (vector::const_iterator it = strs.begin(); it != strs.end(); ++it) data->aliases.insert(make_pair(*it, sc)); - } - break; + } + break; default: if (file.eof()) throw error; @@ -296,7 +296,7 @@ void Mind::Load(tstring filename) } delete co; } - catch(...) + catch (...) { throw CorruptedMind(line); delete co; @@ -375,7 +375,7 @@ void Mind::Save(tstring filename) const file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (map>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it) + for (map>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it) { tstring s; const vector& v = (*it).second; @@ -408,7 +408,7 @@ void Mind::LoadSmiles(tstring filename) { getline(file, s); if (s.length() > l) - l = (int)s.length(); + l = (int)s.length(); data->smiles.insert(s); } data->maxSmileLen = l; @@ -427,7 +427,7 @@ void Mind::LoadSmiles(void *smiles, size_t size) lend++; tstring s(buf, lend - buf); if ((unsigned)(lend - buf) > l) - l = (int)s.length(); + l = (int)s.length(); data->smiles.insert(s); if (lend == end) break; diff --git a/plugins/Boltun/src/Engine/Mind.h b/plugins/Boltun/src/Engine/Mind.h index 2b1e6a20c5..d11eb6cd78 100644 --- a/plugins/Boltun/src/Engine/Mind.h +++ b/plugins/Boltun/src/Engine/Mind.h @@ -37,7 +37,7 @@ typedef struct std::vector escape; std::vector failure; std::vector repeats; - unsigned int maxSmileLen; + unsigned int maxSmileLen; std::set smiles; std::multimap keywords; std::multimap qkeywords; @@ -55,7 +55,7 @@ class Mind { private: MindData *data; - bool fileTypeMark; + bool fileTypeMark; std::vector Parse(std::tstring s); public: diff --git a/plugins/Boltun/src/Engine/MyCodeCvt.cpp b/plugins/Boltun/src/Engine/MyCodeCvt.cpp index e34575f811..39a4d064b5 100644 --- a/plugins/Boltun/src/Engine/MyCodeCvt.cpp +++ b/plugins/Boltun/src/Engine/MyCodeCvt.cpp @@ -18,47 +18,47 @@ // //*********************************************************** -#include "..\boltun.h" +#include "..\stdafx.h" using namespace std; MyCodeCvt::MyCodeCvt(size_t _R) - : MyCodeCvtBase(_R) -{ + : MyCodeCvtBase(_R) +{ } -MyCodeCvt::result MyCodeCvt::do_in(_St& _State , - const _To* _F1, const _To* _L1, const _To*& _Mid1, - _E* F2, _E* _L2, _E*& _Mid2) const +MyCodeCvt::result MyCodeCvt::do_in(_St&, + const _To*, const _To*, const _To*&, + _E*, _E*, _E*&) const { return noconv; } - + #ifdef MSVC MyCodeCvt::result MyCodeCvt::do_out(_St& _State, - const _E* _F1, const _E* _L1, const _E*& _Mid1, - _To* F2, _E* _L2, _To*& _Mid2) const + const _E* _F1, const _E* _L1, const _E*& _Mid1, + _To* F2, _E* _L2, _To*& _Mid2) const #else -MyCodeCvt::result MyCodeCvt::do_out(_St& _State, - const _E* _F1, const _E* _L1, const _E*& _Mid1, - _To* F2, _To* _L2, _To*& _Mid2) const +MyCodeCvt::result MyCodeCvt::do_out(_St&, + const _E*, const _E*, const _E*&, + _To*, _To*, _To*&) const #endif { return noconv; } -MyCodeCvt::result MyCodeCvt::do_unshift( _St& _State, - _To* _F2, _To* _L2, _To*& _Mid2) const +MyCodeCvt::result MyCodeCvt::do_unshift(_St&, + _To*, _To*, _To*&) const { return noconv; } #ifdef MSVC int MyCodeCvt::do_length(_St& _State, const _To* _F1, - const _To* _L1, size_t _N2) const _THROW0() + const _To* _L1, size_t _N2) const _THROW0() #else -int MyCodeCvt::do_length(const _St& _State, const _To* _F1, - const _To* _L1, size_t _N2) const _THROW0() +int MyCodeCvt::do_length(const _St&, const _To* _F1, + const _To* _L1, size_t _N2) const _THROW0() #endif { diff --git a/plugins/Boltun/src/Engine/MyCodeCvt.h b/plugins/Boltun/src/Engine/MyCodeCvt.h index 40ca093795..df78cbad1b 100644 --- a/plugins/Boltun/src/Engine/MyCodeCvt.h +++ b/plugins/Boltun/src/Engine/MyCodeCvt.h @@ -27,19 +27,19 @@ class MyCodeCvt : public MyCodeCvtBase { public: - typedef wchar_t _E; - typedef char _To; - typedef std::mbstate_t _St; - explicit MyCodeCvt( size_t _R=0 ); + typedef wchar_t _E; + typedef char _To; + typedef std::mbstate_t _St; + explicit MyCodeCvt(size_t _R = 0); protected: - virtual result do_in(_St& _State, const _To* _F1, const _To* _L1, const _To*& _Mid1, - _E* F2 , _E* _L2 , _E*& _Mid2) const; + virtual result do_in(_St& _State, const _To* _F1, const _To* _L1, const _To*& _Mid1, + _E* F2, _E* _L2, _E*& _Mid2) const; #ifdef MSVC virtual result do_out(_St& _State, const _E* _F1, const _E* _L1, const _E*& _Mid1, - _To* F2, _E* _L2 , _To*& _Mid2) const; + _To* F2, _E* _L2, _To*& _Mid2) const; #else virtual result do_out(_St& _State, const _E* _F1, const _E* _L1, const _E*& _Mid1, - _To* F2, _To* _L2 , _To*& _Mid2) const; + _To* F2, _To* _L2, _To*& _Mid2) const; #endif virtual result do_unshift(_St& _State, _To* _F2, _To* _L2, _To*& _Mid2) const; #ifdef MSVC @@ -48,8 +48,8 @@ protected: virtual int do_length(const _St& _State, const _To* _F1, const _To* _L1, size_t _N2) const _THROW0(); #endif virtual bool do_always_noconv() const _THROW0(); - virtual int do_max_length() const _THROW0(); - virtual int do_encoding() const _THROW0(); -} ; + virtual int do_max_length() const _THROW0(); + virtual int do_encoding() const _THROW0(); +}; #endif /* MYCODECVT_H */ \ No newline at end of file diff --git a/plugins/Boltun/src/Engine/PerContactData.h b/plugins/Boltun/src/Engine/PerContactData.h index d130a03838..e81192053f 100644 --- a/plugins/Boltun/src/Engine/PerContactData.h +++ b/plugins/Boltun/src/Engine/PerContactData.h @@ -41,7 +41,7 @@ class PerContactData } inline InternalData() - :data(NULL) + : data(NULL) { assert(false); } @@ -133,12 +133,12 @@ void PerContactData::CleanupData() mapLock.Enter(); time_t now; time(&now); - for (mapIt it = datas.begin(); it != datas.end(); ) + for (mapIt it = datas.begin(); it != datas.end();) { if ((*it).second->time) //it's being in use { int diff = (int)difftime(now, (*it).second->time); - if (diff >= 30*60) //half of an hour + if (diff >= 30 * 60) //half of an hour { mapIt tmp = it; it++; @@ -160,7 +160,7 @@ void PerContactData::CleanupData() } template -VOID CALLBACK RunTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +VOID CALLBACK RunTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) { PerContactData* val = (PerContactData*)perContactDataObjects[idEvent]; val->CleanupData(); diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp index 3fe283c64a..0391c11112 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.cpp +++ b/plugins/Boltun/src/Engine/TalkEngine.cpp @@ -18,7 +18,7 @@ // //*********************************************************** -#include "..\boltun.h" +#include "..\stdafx.h" #ifdef _DEBUG @@ -61,7 +61,7 @@ void TalkBot::UpdateStartChar(tstring& str) TCHAR ncl = (TCHAR)CharLower((LPTSTR)(void*)(long)str[i + 1]); TCHAR ncu = (TCHAR)CharUpper((LPTSTR)(void*)(long)str[i + 1]); if (ncl != ncu && str[i + 1] == ncu) - break; + break; } if (cl != cu) { @@ -73,7 +73,7 @@ void TalkBot::UpdateStartChar(tstring& str) } TalkBot::TalkBot(const Mind& goodMind) - :mind(goodMind), beSilent(false), makeLowercase(false), + :mind(goodMind), beSilent(false), makeLowercase(false), understandAlways(false) { contactDatas = new PerContactData(mind); @@ -104,7 +104,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) { unsigned max = (int)(sentence.length() - i); if (max > mind.GetData()->maxSmileLen) - max = mind.GetData()->maxSmileLen; + max = mind.GetData()->maxSmileLen; for (unsigned j = max; j > 0; j--) { tstring item = sentence.substr(i, j); @@ -116,7 +116,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) } } } - len = (int)sentence.length(); + len = (int)sentence.length(); bool hadQuestionSigns = false; int it = 0; while (it != len) @@ -127,7 +127,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) hadQuestionSigns = true; map::iterator smit; if (sentence[it] == '\1') - { + { smit = sm.find(it); result.append((*smit).second); } @@ -162,7 +162,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contactData, Level &maxValue, std::multimap &mm) { tstring res; - //Part 1 + //Part 1 if (FindExact(contactData, incomingMessage, mind.GetData()->widelyUsed, res)) //widelyUsed { return res; @@ -222,16 +222,16 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact if (maxValue > LOOKSLIKE) maxValue = LOOKSLIKE; } -/* if (ures != _T("")) - { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(LOOKSLIKE2, _T("(keywords_unstrict) ")+ures)); -#else - mm.insert(make_pair(LOOKSLIKE2, ures)); -#endif - if (maxValue > LOOKSLIKE2) + /* if (ures != _T("")) + { + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(LOOKSLIKE2, _T("(keywords_unstrict) ")+ures)); + #else + mm.insert(make_pair(LOOKSLIKE2, ures)); + #endif + if (maxValue > LOOKSLIKE2) maxValue = LOOKSLIKE2; - }*/ + }*/ //Part 9 if (FindByOthers(contactData, otherwords, res, isQuestion)) //specialEscapes { @@ -274,14 +274,14 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage, bool saveChoice) { - TCHAR* str = new TCHAR[incomingMessage.length()+1]; + TCHAR* str = new TCHAR[incomingMessage.length() + 1]; _tcscpy(str, incomingMessage.c_str()); CharLower(str); incomingMessage = str; - delete [] str; + delete[] str; ContactData *contactData = contactDatas->GetData(contact); - if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30*60*1000) + if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30 * 60 * 1000) { MessageInfo *info; //only 2-3 repeats @@ -400,7 +400,7 @@ void TalkBot::SplitSectences(const tstring &incomingMessage, vector& ve { //FIXME: (THINK ABOUT IT:-))these chars not always mark the end of sentence. const TCHAR symbols[] = _T(".?!"); - int it = 0, len = (int)incomingMessage.length(); + int it = 0, len = (int)incomingMessage.length(); while (it != len) { while (it != len && _istspace(incomingMessage[it])) @@ -411,9 +411,9 @@ void TalkBot::SplitSectences(const tstring &incomingMessage, vector& ve if (_tcschr(symbols, incomingMessage[it++])) { //Test for a :-! smile - if (it > 2 && incomingMessage[it-1] == _T('!') - && incomingMessage[it-2] == _T('-') - && incomingMessage[it-3] == _T(':')) + if (it > 2 && incomingMessage[it - 1] == _T('!') + && incomingMessage[it - 2] == _T('-') + && incomingMessage[it - 3] == _T(':')) continue; while (it != len && _tcschr(symbols, incomingMessage[it])) it++; @@ -427,14 +427,14 @@ void TalkBot::SplitSectences(const tstring &incomingMessage, vector& ve #ifdef _DEBUG tstring LevelToStr(TalkBot::Level target) { - tstring lev; + tstring lev; switch (target) { - case TalkBot::BEST: lev = _T("BEST(0)"); break; - case TalkBot::LOOKSLIKE: lev = _T("LOOKSLIKE(1)"); break; - case TalkBot::BAD: lev = _T("BAD(2)"); break; - case TalkBot::FAIL: lev = _T("FAIL(3)"); break; - case TalkBot::NOTHING: lev = _T("NOTHING(4)"); break; + case TalkBot::BEST: lev = _T("BEST(0)"); break; + case TalkBot::LOOKSLIKE: lev = _T("LOOKSLIKE(1)"); break; + case TalkBot::BAD: lev = _T("BAD(2)"); break; + case TalkBot::FAIL: lev = _T("FAIL(3)"); break; + case TalkBot::NOTHING: lev = _T("NOTHING(4)"); break; } return lev; } @@ -451,14 +451,8 @@ tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const mu if (maxValue == NOTHING) return _T(""); Level target = maxValue; - int num = (int)mm.count(target); -/* if (!num) - { - target = maxValue; - num = mm.count(target); - }*/ typedef multimap::const_iterator lt_cit; - pair range = mm.equal_range(target); + pair range = mm.equal_range(target); for (lt_cit it = range.first; it != range.second; ++it) contactData->chooser.AddChoice((*it).second); #ifdef DEBUG_SHOW_LEVEL @@ -474,16 +468,16 @@ void TalkBot::FindByKeywords(ContactData *contactData, const vector &ke { if (keywords.size() == 0) return; - const multimap &keys = isQuestion ? mind.GetData()->qkeywords : + const multimap &keys = isQuestion ? mind.GetData()->qkeywords : mind.GetData()->keywords; for (multimap::const_iterator it = keys.begin(); it != keys.end(); ++it) { float prio; if ((*it).first.MatchesAll(keywords/*, strict*/, prio)) #ifdef DEBUG_SHOW_SOLUTION_REASON - contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second, prio); + contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second, prio); #else - contactData->chooser.AddChoice((*it).second, prio); + contactData->chooser.AddChoice((*it).second, prio); #endif } res = contactData->chooser.Choose(); @@ -492,9 +486,9 @@ void TalkBot::FindByKeywords(ContactData *contactData, const vector &ke bool TalkBot::FindByOthers(ContactData *contactData, const vector &otherwords, tstring& res, bool isQuestion) { //vector results; - const multimap &specs = isQuestion ? mind.GetData()->qspecialEscapes : + const multimap &specs = isQuestion ? mind.GetData()->qspecialEscapes : mind.GetData()->specialEscapes; - for (multimap::const_iterator it = specs.begin(); + for (multimap::const_iterator it = specs.begin(); it != specs.end(); ++it) if ((*it).first.MatchesAny(otherwords)) { @@ -527,7 +521,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, { unsigned max = (int)(sentence.length() - i); if (max > mind.GetData()->maxSmileLen) - max = mind.GetData()->maxSmileLen; + max = mind.GetData()->maxSmileLen; for (unsigned j = max; j > 0; j--) { tstring item = sentence.substr(i, j); @@ -540,7 +534,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, } } } - len = (int)sentence.length(); + len = (int)sentence.length(); bool hadQuestionSigns = false; int it = 0; while (it != len) @@ -556,7 +550,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, } if (it == len) break; - hadQuestionSigns = false; + hadQuestionSigns = false; int start = it; while (true) { diff --git a/plugins/Boltun/src/Engine/TalkEngine.h b/plugins/Boltun/src/Engine/TalkEngine.h index 423d6a2666..6f95541941 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.h +++ b/plugins/Boltun/src/Engine/TalkEngine.h @@ -31,18 +31,18 @@ class TalkBot public: struct MessageInfo { - private: - std::tstring Question; - MessageInfo(std::tstring q, std::tstring a) - :Question(q), Answer(a) - { - } - public: - std::tstring Answer; - MessageInfo(std::tstring q) - :Question(q) - { - } + private: + std::tstring Question; + MessageInfo(std::tstring q, std::tstring a) + :Question(q), Answer(a) + { + } + public: + std::tstring Answer; + MessageInfo(std::tstring q) + :Question(q) + { + } friend class TalkBot; }; private: @@ -50,7 +50,7 @@ private: { BEST, LOOKSLIKE/*, LOOKSLIKE2*/, BAD, FAIL, NOTHING } Level; - friend std::tstring LevelToStr(TalkBot::Level target); + friend std::tstring LevelToStr(TalkBot::Level target); struct ContactData { @@ -80,7 +80,7 @@ private: bool makeLowercase; bool understandAlways; void UpdateStartChar(std::tstring &str); - typedef std::multimap::const_iterator mm_cit; + typedef std::multimap::const_iterator mm_cit; bool FindExact(ContactData *contactData, const std::tstring &incomingMessage, const std::multimap &map, std::tstring &res); bool FindAny(ValueChooser<> &ch, std::tstring &res); void FindByKeywords(ContactData *contactData, const std::vector &keywords, std::tstring &res/*, std::tstring& ures*/, bool isQuestion); diff --git a/plugins/Boltun/src/Engine/UnrecentChooser.cpp b/plugins/Boltun/src/Engine/UnrecentChooser.cpp index 5a3d4f7fd1..77e1a71d36 100644 --- a/plugins/Boltun/src/Engine/UnrecentChooser.cpp +++ b/plugins/Boltun/src/Engine/UnrecentChooser.cpp @@ -18,7 +18,7 @@ // //*********************************************************** -#include "..\boltun.h" +#include "..\stdafx.h" using namespace std; diff --git a/plugins/Boltun/src/Engine/ValueChooser.h b/plugins/Boltun/src/Engine/ValueChooser.h index e3f9f3c0b9..10256a5b70 100644 --- a/plugins/Boltun/src/Engine/ValueChooser.h +++ b/plugins/Boltun/src/Engine/ValueChooser.h @@ -37,12 +37,12 @@ public: numbers = NULL; UpdateLength(); } - + ~ValueChooser() { delete numbers; } - + void UpdateLength() { delete numbers; //normal if numbers == NULL diff --git a/plugins/Boltun/src/Engine/WordsList.cpp b/plugins/Boltun/src/Engine/WordsList.cpp index d9ba65aa90..439ee229dd 100644 --- a/plugins/Boltun/src/Engine/WordsList.cpp +++ b/plugins/Boltun/src/Engine/WordsList.cpp @@ -18,7 +18,7 @@ // //*********************************************************** -#include "..\boltun.h" +#include "..\stdafx.h" using namespace std; @@ -31,7 +31,7 @@ WordsList::operator tstring() const { tstring res; //if (unstrict) - // res = _T("~"); + // res = _T("~"); set::const_iterator it = words.begin(); if (!words.empty()) while (true) @@ -58,11 +58,11 @@ void WordsList::Parse(tstring s/*, bool allowUnstrict*/) isQuestion = false; /*if (allowUnstrict && s.length() && s[0] == _T('~')) { - s = s.substr(1, s.npos); - unstrict = true; + s = s.substr(1, s.npos); + unstrict = true; } else - unstrict = false;*/ + unstrict = false;*/ int len = (int)s.length() - 1; while (len != -1 && _istspace(s[len])) len--; @@ -94,15 +94,15 @@ bool WordsList::MatchesAll(const vector& s/*, bool& WasStrict*/, float& //WasStrict = true; for (vector::const_iterator it = s.begin(); it != s.end(); ++it) { -/* if (words.find(*it) == words.end()) - if (unstrict) - { - WasStrict = false; - continue; - } - else - return false; - temp.insert((*it));*/ + /* if (words.find(*it) == words.end()) + if (unstrict) + { + WasStrict = false; + continue; + } + else + return false; + temp.insert((*it));*/ if (words.find(*it) != words.end()) temp.insert((*it)); } @@ -137,10 +137,10 @@ vector WordsList::DoesntIncludeAny(const set& list) const res.push_back(*it); return res; } - + bool WordsList::operator<(const WordsList& value) const { - return (tstring)*this < (tstring)value; + return (tstring)*this < (tstring)value; } bool WordsList::operator!=(const WordsList& value) const -- cgit v1.2.3