From 9060bf2b23f86be8eaecbdc90262a8d1c0e7b374 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 Feb 2013 19:26:54 +0000 Subject: compilation fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@3809 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/src/Engine/Mind.h | 40 ++++++++++++------------- plugins/Boltun/src/Engine/TalkEngine.h | 46 ++++++++++++++--------------- plugins/Boltun/src/Engine/UnrecentChooser.h | 18 +++++------ plugins/Boltun/src/Engine/ValueChooser.h | 2 +- plugins/Boltun/src/Engine/WordsList.h | 20 ++++++------- plugins/Boltun/src/Engine/tstring.h | 34 --------------------- plugins/Boltun/src/actionQueue.cpp | 12 -------- plugins/Boltun/src/boltun.h | 5 +++- plugins/Boltun/src/config.cpp | 9 ------ 9 files changed, 64 insertions(+), 122 deletions(-) delete mode 100644 plugins/Boltun/src/Engine/tstring.h (limited to 'plugins/Boltun/src') 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 #include #include "WordsList.h" -#include "tstring.h" - class Mind; typedef struct { friend class Mind; - std::vector initial; - std::set question; - std::set special; - std::vector escape; - std::vector failure; - std::vector repeats; + std::vector initial; + std::set question; + std::set special; + std::vector escape; + std::vector failure; + std::vector repeats; unsigned int maxSmileLen; - std::set smiles; - std::multimap keywords; - std::multimap qkeywords; - std::multimap widelyUsed; - std::multimap specialEscapes; - std::multimap qspecialEscapes; - std::multimap study; - std::map aliases; - std::map> raliases; + std::set smiles; + std::multimap keywords; + std::multimap qkeywords; + std::multimap widelyUsed; + std::multimap specialEscapes; + std::multimap qspecialEscapes; + std::multimap study; + std::map aliases; + std::map> raliases; private: int referenceCount; } MindData; @@ -59,7 +57,7 @@ private: MindData *data; bool fileTypeMark; - std::vector Parse(tstring s); + std::vector 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 > question; - //ValueChooser > special; + //ValueChooser > question; + //ValueChooser > 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::const_iterator mm_cit; - bool FindExact(ContactData* contactData, const tstring &incomingMessage, - const std::multimap& map, tstring& res); - bool FindAny(ValueChooser<> &ch, tstring& res); - void FindByKeywords(ContactData* contactData, const std::vector &keywords, tstring& res/*, tstring& ures*/, bool isQuestion); - bool FindByOthers(ContactData* contactData, const std::vector &otherwords, tstring& res, bool isQuestion); - tstring AllReplies(const tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap &mm); - tstring ReplaceAliases(const tstring &message); - tstring ChooseResult(ContactData* contactData, Level maxValue, const std::multimap &mm); + void UpdateStartChar(std::tstring& str); + 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); + bool FindByOthers(ContactData* contactData, const std::vector &otherwords, std::tstring& res, bool isQuestion); + std::tstring AllReplies(const std::tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap &mm); + std::tstring ReplaceAliases(const std::tstring &message); + std::tstring ChooseResult(ContactData* contactData, Level maxValue, const std::multimap &mm); void RecordAnswer(ContactData *contactData, const TalkBot::MessageInfo& info); #ifdef _DEBUG public: #endif - void SplitSectences(const tstring &incomingMessage, std::vector& vec); - void SplitAndSortWords(tstring sentence, std::vector& keywords, - std::vector& otherwords, bool& isQuestion); + void SplitSectences(const std::tstring &incomingMessage, std::vector& vec); + void SplitAndSortWords(std::tstring sentence, std::vector& keywords, + std::vector& 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 items; - std::vector itemsList; - std::vector newItems; + std::map items; + std::vector itemsList; + std::vector newItems; float newItemsPrio, maxOldPrio; - std::map oldItems; - std::map oldPrios; + std::map oldItems; + std::map 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 > +template > 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 words; + std::set words; bool isQuestion; public: - WordsList(const tstring &data/*, bool allowUnstrict = false*/); - operator tstring() const; - bool MatchesAll(const std::vector& s/*, bool& WasStrict*/, float& priority) const; - bool MatchesAny(const std::vector& s) const; - std::vector ConsistsOf(const std::set& list) const; - std::vector DoesntIncludeAny(const std::set& list) const; - WordsList& operator= (const tstring& s); + WordsList(const std::tstring &data/*, bool allowUnstrict = false*/); + operator std::tstring() const; + bool MatchesAll(const std::vector& s/*, bool& WasStrict*/, float& priority) const; + bool MatchesAny(const std::vector& s) const; + std::vector ConsistsOf(const std::set& list) const; + std::vector DoesntIncludeAny(const std::set& 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 . -// -//*********************************************************** - -#ifndef TSTRING_H -#define TSTRING_H - -#include -#include - -#ifndef TCHAR -#define TCHAR _TCHAR -#endif - -typedef std::basic_string, - std::allocator > 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 -#include -#include -#include "Engine/CriticalSection.h" -#ifdef _DEBUG -#include -#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 #include +#include +#include + #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 -#include -#include - -#include "newpluginapi.h" -#include "m_database.h" -#include "m_langpack.h" #include "boltun.h" //Database keys -- cgit v1.2.3