diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-28 19:26:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-28 19:26:54 +0000 |
commit | 9060bf2b23f86be8eaecbdc90262a8d1c0e7b374 (patch) | |
tree | 4a4e135eeff281816682b8ea13f09845d6bd9f80 /plugins/Boltun | |
parent | 7fd3863d1a8da7ad32f44762792c1df82eebf5bf (diff) |
compilation fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@3809 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Boltun')
-rw-r--r-- | plugins/Boltun/src/Engine/Mind.h | 40 | ||||
-rw-r--r-- | plugins/Boltun/src/Engine/TalkEngine.h | 46 | ||||
-rw-r--r-- | plugins/Boltun/src/Engine/UnrecentChooser.h | 18 | ||||
-rw-r--r-- | plugins/Boltun/src/Engine/ValueChooser.h | 2 | ||||
-rw-r--r-- | plugins/Boltun/src/Engine/WordsList.h | 20 | ||||
-rw-r--r-- | plugins/Boltun/src/Engine/tstring.h | 34 | ||||
-rw-r--r-- | plugins/Boltun/src/actionQueue.cpp | 12 | ||||
-rw-r--r-- | plugins/Boltun/src/boltun.h | 5 | ||||
-rw-r--r-- | plugins/Boltun/src/config.cpp | 9 |
9 files changed, 64 insertions, 122 deletions
diff --git a/plugins/Boltun/src/Engine/Mind.h b/plugins/Boltun/src/Engine/Mind.h index cdee200002..2b1e6a20c5 100644 --- a/plugins/Boltun/src/Engine/Mind.h +++ b/plugins/Boltun/src/Engine/Mind.h @@ -25,30 +25,28 @@ #include <map>
#include <set>
#include "WordsList.h"
-#include "tstring.h"
-
class Mind;
typedef struct
{
friend class Mind;
- std::vector<tstring> initial;
- std::set<tstring> question;
- std::set<tstring> special;
- std::vector<tstring> escape;
- std::vector<tstring> failure;
- std::vector<tstring> repeats;
+ std::vector<std::tstring> initial;
+ std::set<std::tstring> question;
+ std::set<std::tstring> special;
+ std::vector<std::tstring> escape;
+ std::vector<std::tstring> failure;
+ std::vector<std::tstring> repeats;
unsigned int maxSmileLen;
- std::set<tstring> smiles;
- std::multimap<WordsList, tstring> keywords;
- std::multimap<WordsList, tstring> qkeywords;
- std::multimap<tstring, tstring> widelyUsed;
- std::multimap<WordsList, tstring> specialEscapes;
- std::multimap<WordsList, tstring> qspecialEscapes;
- std::multimap<tstring, tstring> study;
- std::map<tstring, tstring> aliases;
- std::map<tstring, std::vector<tstring>> raliases;
+ std::set<std::tstring> smiles;
+ std::multimap<WordsList, std::tstring> keywords;
+ std::multimap<WordsList, std::tstring> qkeywords;
+ std::multimap<std::tstring, std::tstring> widelyUsed;
+ std::multimap<WordsList, std::tstring> specialEscapes;
+ std::multimap<WordsList, std::tstring> qspecialEscapes;
+ std::multimap<std::tstring, std::tstring> study;
+ std::map<std::tstring, std::tstring> aliases;
+ std::map<std::tstring, std::vector<std::tstring>> raliases;
private:
int referenceCount;
} MindData;
@@ -59,7 +57,7 @@ private: MindData *data;
bool fileTypeMark;
- std::vector<tstring> Parse(tstring s);
+ std::vector<std::tstring> Parse(std::tstring s);
public:
Mind();
~Mind();
@@ -77,9 +75,9 @@ public: };
const MindData *GetData() const;
- void Load(tstring filename);
- void Save(tstring filename) const;
- void LoadSmiles(tstring filename);
+ void Load(std::tstring filename);
+ void Save(std::tstring filename) const;
+ void LoadSmiles(std::tstring filename);
void LoadSmiles(void* smiles, size_t size);
};
diff --git a/plugins/Boltun/src/Engine/TalkEngine.h b/plugins/Boltun/src/Engine/TalkEngine.h index 364f4193d1..b57cb7f89c 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.h +++ b/plugins/Boltun/src/Engine/TalkEngine.h @@ -32,14 +32,14 @@ public: struct MessageInfo
{
private:
- tstring Question;
- MessageInfo(tstring q, tstring a)
+ std::tstring Question;
+ MessageInfo(std::tstring q, std::tstring a)
:Question(q), Answer(a)
{
}
public:
- tstring Answer;
- MessageInfo(tstring q)
+ std::tstring Answer;
+ MessageInfo(std::tstring q)
:Question(q)
{
}
@@ -50,17 +50,17 @@ private: {
BEST, LOOKSLIKE/*, LOOKSLIKE2*/, BAD, FAIL, NOTHING
} Level;
- friend tstring LevelToStr(TalkBot::Level target);
+ friend std::tstring LevelToStr(TalkBot::Level target);
struct ContactData
{
ValueChooser<> initial;
- //ValueChooser<std::set<tstring> > question;
- //ValueChooser<std::set<tstring> > special;
+ //ValueChooser<std::set<std::tstring> > question;
+ //ValueChooser<std::set<std::tstring> > special;
ValueChooser<> escape;
ValueChooser<> failure;
UnRecentChooser chooser;
- tstring lastMessage;
+ std::tstring lastMessage;
long long lastMessageTime;
int repeatCount;
inline ContactData(const Mind& mind)
@@ -79,23 +79,23 @@ private: bool beSilent;
bool makeLowercase;
bool understandAlways;
- void UpdateStartChar(tstring& str);
- typedef std::multimap<tstring, tstring>::const_iterator mm_cit;
- bool FindExact(ContactData* contactData, const tstring &incomingMessage,
- const std::multimap<tstring, tstring>& map, tstring& res);
- bool FindAny(ValueChooser<> &ch, tstring& res);
- void FindByKeywords(ContactData* contactData, const std::vector<tstring> &keywords, tstring& res/*, tstring& ures*/, bool isQuestion);
- bool FindByOthers(ContactData* contactData, const std::vector<tstring> &otherwords, tstring& res, bool isQuestion);
- tstring AllReplies(const tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap<Level, tstring> &mm);
- tstring ReplaceAliases(const tstring &message);
- tstring ChooseResult(ContactData* contactData, Level maxValue, const std::multimap<Level, tstring> &mm);
+ void UpdateStartChar(std::tstring& str);
+ typedef std::multimap<std::tstring, std::tstring>::const_iterator mm_cit;
+ bool FindExact(ContactData* contactData, const std::tstring &incomingMessage,
+ const std::multimap<std::tstring, std::tstring>& map, std::tstring& res);
+ bool FindAny(ValueChooser<> &ch, std::tstring& res);
+ void FindByKeywords(ContactData* contactData, const std::vector<std::tstring> &keywords, std::tstring& res/*, std::tstring& ures*/, bool isQuestion);
+ bool FindByOthers(ContactData* contactData, const std::vector<std::tstring> &otherwords, std::tstring& res, bool isQuestion);
+ std::tstring AllReplies(const std::tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap<Level, std::tstring> &mm);
+ std::tstring ReplaceAliases(const std::tstring &message);
+ std::tstring ChooseResult(ContactData* contactData, Level maxValue, const std::multimap<Level, std::tstring> &mm);
void RecordAnswer(ContactData *contactData, const TalkBot::MessageInfo& info);
#ifdef _DEBUG
public:
#endif
- void SplitSectences(const tstring &incomingMessage, std::vector<tstring>& vec);
- void SplitAndSortWords(tstring sentence, std::vector<tstring>& keywords,
- std::vector<tstring>& otherwords, bool& isQuestion);
+ void SplitSectences(const std::tstring &incomingMessage, std::vector<std::tstring>& vec);
+ void SplitAndSortWords(std::tstring sentence, std::vector<std::tstring>& keywords,
+ std::vector<std::tstring>& otherwords, bool& isQuestion);
public:
TalkBot(const Mind& goodMind);
~TalkBot();
@@ -104,8 +104,8 @@ public: void SetLowercase(const bool isLowercase);
void SetUnderstandAlways(const bool understandAlways);
//const MindData *GetData();
- tstring GetInitMessage(void* contact);
- MessageInfo* Reply(void* contact, const tstring incomingMessage, bool saveChoice);
+ std::tstring GetInitMessage(void* contact);
+ MessageInfo* Reply(void* contact, const std::tstring incomingMessage, bool saveChoice);
void AnswerGiven(void* contact, const MessageInfo& info);
};
diff --git a/plugins/Boltun/src/Engine/UnrecentChooser.h b/plugins/Boltun/src/Engine/UnrecentChooser.h index e815a6ec96..72245773de 100644 --- a/plugins/Boltun/src/Engine/UnrecentChooser.h +++ b/plugins/Boltun/src/Engine/UnrecentChooser.h @@ -21,24 +21,22 @@ #ifndef UnRecentChooserH
#define UnRecentChooserH
-#include "tstring.h"
-
class UnRecentChooser
{
- std::map<tstring, size_t> items;
- std::vector<tstring> itemsList;
- std::vector<tstring> newItems;
+ std::map<std::tstring, size_t> items;
+ std::vector<std::tstring> itemsList;
+ std::vector<std::tstring> newItems;
float newItemsPrio, maxOldPrio;
- std::map<size_t, tstring> oldItems;
- std::map<tstring, float> oldPrios;
+ std::map<size_t, std::tstring> oldItems;
+ std::map<std::tstring, float> oldPrios;
size_t last;
int minimum;
static const size_t maxItems = 100;
public:
UnRecentChooser();
- void AddChoice(tstring value, float prio = 1.0);
- tstring Choose();
- void SaveChoice(tstring choice);
+ void AddChoice(std::tstring value, float prio = 1.0);
+ std::tstring Choose();
+ void SaveChoice(std::tstring choice);
};
#endif /* UnRecentChooserH */
\ No newline at end of file diff --git a/plugins/Boltun/src/Engine/ValueChooser.h b/plugins/Boltun/src/Engine/ValueChooser.h index 8a3add430a..e3f9f3c0b9 100644 --- a/plugins/Boltun/src/Engine/ValueChooser.h +++ b/plugins/Boltun/src/Engine/ValueChooser.h @@ -21,7 +21,7 @@ #ifndef StringChooserH
#define StringChooserH
-template<class container = std::vector<tstring> >
+template<class container = std::vector<std::tstring> >
class ValueChooser
{
private:
diff --git a/plugins/Boltun/src/Engine/WordsList.h b/plugins/Boltun/src/Engine/WordsList.h index b6e0792101..4cac8cd969 100644 --- a/plugins/Boltun/src/Engine/WordsList.h +++ b/plugins/Boltun/src/Engine/WordsList.h @@ -21,26 +21,24 @@ #ifndef WordsListH
#define WordsListH
-#include "tstring.h"
-
class WordsList
{
WordsList();
- void Parse(tstring s/*, bool allowUnstrict = false*/);
+ void Parse(std::tstring s/*, bool allowUnstrict = false*/);
//bool unstrict;
#ifdef _DEBUG
public:
#endif
- std::set<tstring> words;
+ std::set<std::tstring> words;
bool isQuestion;
public:
- WordsList(const tstring &data/*, bool allowUnstrict = false*/);
- operator tstring() const;
- bool MatchesAll(const std::vector<tstring>& s/*, bool& WasStrict*/, float& priority) const;
- bool MatchesAny(const std::vector<tstring>& s) const;
- std::vector<tstring> ConsistsOf(const std::set<tstring>& list) const;
- std::vector<tstring> DoesntIncludeAny(const std::set<tstring>& list) const;
- WordsList& operator= (const tstring& s);
+ WordsList(const std::tstring &data/*, bool allowUnstrict = false*/);
+ operator std::tstring() const;
+ bool MatchesAll(const std::vector<std::tstring>& s/*, bool& WasStrict*/, float& priority) const;
+ bool MatchesAny(const std::vector<std::tstring>& s) const;
+ std::vector<std::tstring> ConsistsOf(const std::set<std::tstring>& list) const;
+ std::vector<std::tstring> DoesntIncludeAny(const std::set<std::tstring>& list) const;
+ WordsList& operator= (const std::tstring& s);
bool operator<(const WordsList& value) const;
bool operator==(const WordsList& value) const;
bool operator!=(const WordsList& value) const;
diff --git a/plugins/Boltun/src/Engine/tstring.h b/plugins/Boltun/src/Engine/tstring.h deleted file mode 100644 index e21984a12c..0000000000 --- a/plugins/Boltun/src/Engine/tstring.h +++ /dev/null @@ -1,34 +0,0 @@ -//***********************************************************
-// Copyright © 2008 Valentin Pavlyuchenko
-//
-// This file is part of Boltun.
-//
-// Boltun is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 2 of the License, or
-// (at your option) any later version.
-//
-// Boltun is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Boltun. If not, see <http://www.gnu.org/licenses/>.
-//
-//***********************************************************
-
-#ifndef TSTRING_H
-#define TSTRING_H
-
-#include <tchar.h>
-#include <string>
-
-#ifndef TCHAR
-#define TCHAR _TCHAR
-#endif
-
-typedef std::basic_string<TCHAR, std::char_traits<TCHAR>,
- std::allocator<TCHAR> > tstring;
-
-#endif
diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index d0ba9adae8..c8e8e02aa4 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -18,19 +18,7 @@ //
//***********************************************************
-#include "actionQueue.h"
-#include "config.h"
#include "boltun.h"
-#include "Engine/tstring.h"
-#include "Engine/TalkEngine.h"
-
-#include <list>
-#include <set>
-#include <time.h>
-#include "Engine/CriticalSection.h"
-#ifdef _DEBUG
-#include <assert.h>
-#endif
#define MIRANDA_VER 0x0A00
#include "newpluginapi.h"
diff --git a/plugins/Boltun/src/boltun.h b/plugins/Boltun/src/boltun.h index 12d5638f69..e831eaeb8d 100644 --- a/plugins/Boltun/src/boltun.h +++ b/plugins/Boltun/src/boltun.h @@ -28,8 +28,12 @@ #include <fstream>
#include <assert.h>
+#include <string>
+#include <list>
+
#include "newpluginapi.h"
#include "m_clist.h"
+#include "m_system_cpp.h"
#include "m_database.h"
#include "m_options.h"
#include "m_langpack.h"
@@ -43,7 +47,6 @@ #include "Engine/UnrecentChooser.h"
#include "Engine/MyCodeCvt.h"
#include "Engine/Mind.h"
-#include "Engine/tstring.h"
#define BOLTUN_KEY "Boltun"
diff --git a/plugins/Boltun/src/config.cpp b/plugins/Boltun/src/config.cpp index 4a88bf2df3..b2dcf3849f 100644 --- a/plugins/Boltun/src/config.cpp +++ b/plugins/Boltun/src/config.cpp @@ -18,15 +18,6 @@ //
//***********************************************************
-#include "config.h"
-
-#include <windows.h>
-#include <time.h>
-#include <string>
-
-#include "newpluginapi.h"
-#include "m_database.h"
-#include "m_langpack.h"
#include "boltun.h"
//Database keys
|