From 154d7cffa2b186529551ccb4627811e291f24030 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Sun, 7 May 2017 00:04:46 +0200 Subject: [PATCH] replace and purge boost::function --- apps/openmw/mwgui/bookpage.cpp | 6 +++--- apps/openmw/mwgui/bookpage.hpp | 3 +-- apps/openmw/mwgui/journalviewmodel.cpp | 14 ++++++-------- apps/openmw/mwgui/journalviewmodel.hpp | 13 ++++++------- apps/openmw/mwgui/journalwindow.cpp | 2 -- apps/openmw/mwgui/tradewindow.cpp | 2 ++ components/sceneutil/lightmanager.cpp | 9 ++------- 7 files changed, 20 insertions(+), 29 deletions(-) diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 883195f51..5def91eb8 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -892,7 +892,7 @@ public: Style* mFocusItem; bool mItemActive; MyGUI::MouseButton mLastDown; - boost::function mLinkClicked; + std::function mLinkClicked; std::shared_ptr mBook; @@ -1260,14 +1260,14 @@ public: mPageDisplay->showPage (book, page); } - void adviseLinkClicked (boost::function linkClicked) + void adviseLinkClicked (std::function linkClicked) { mPageDisplay->mLinkClicked = linkClicked; } void unadviseLinkClicked () { - mPageDisplay->mLinkClicked = boost::function (); + mPageDisplay->mLinkClicked = std::function (); } protected: diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp index 8800508b4..e75e1e1d3 100644 --- a/apps/openmw/mwgui/bookpage.hpp +++ b/apps/openmw/mwgui/bookpage.hpp @@ -6,7 +6,6 @@ #include #include -#include namespace MWGui { @@ -101,7 +100,7 @@ namespace MWGui public: typedef TypesetBook::InteractiveId InteractiveId; - typedef boost::function ClickCallback; + typedef std::function ClickCallback; /// Make the widget display the specified page from the specified book. virtual void showPage (TypesetBook::Ptr Book, size_t Page) = 0; diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index 2e0d07787..b5d08eec6 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -5,8 +5,6 @@ #include -#include - #include #include "../mwbase/world.hpp" @@ -149,7 +147,7 @@ struct JournalViewModelImpl : JournalViewModel return toUtf8Span (utf8text); } - void visitSpans (boost::function < void (TopicId, size_t, size_t)> visitor) const + void visitSpans (std::function < void (TopicId, size_t, size_t)> visitor) const { ensureLoaded (); mModel->ensureKeyWordSearchLoaded (); @@ -193,7 +191,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitQuestNames (bool active_only, boost::function visitor) const + void visitQuestNames (bool active_only, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get ().getJournal (); @@ -268,7 +266,7 @@ struct JournalViewModelImpl : JournalViewModel } }; - void visitJournalEntries (const std::string& questName, boost::function visitor) const + void visitJournalEntries (const std::string& questName, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -301,13 +299,13 @@ struct JournalViewModelImpl : JournalViewModel } } - void visitTopicName (TopicId topicId, boost::function visitor) const + void visitTopicName (TopicId topicId, std::function visitor) const { MWDialogue::Topic const & topic = * reinterpret_cast (topicId); visitor (toUtf8Span (topic.getName())); } - void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const + void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -341,7 +339,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitTopicEntries (TopicId topicId, boost::function visitor) const + void visitTopicEntries (TopicId topicId, std::function visitor) const { typedef MWDialogue::Topic::TEntryIter iterator_t; diff --git a/apps/openmw/mwgui/journalviewmodel.hpp b/apps/openmw/mwgui/journalviewmodel.hpp index 5739a311f..3edde3d31 100644 --- a/apps/openmw/mwgui/journalviewmodel.hpp +++ b/apps/openmw/mwgui/journalviewmodel.hpp @@ -5,7 +5,6 @@ #include #include #include -#include namespace MWGui { @@ -37,7 +36,7 @@ namespace MWGui /// Visits each subset of text in the body, delivering the beginning /// and end of the span relative to the body, and a valid topic ID if /// the span represents a keyword, or zero if not. - virtual void visitSpans (boost::function visitor) const = 0; + virtual void visitSpans (std::function visitor) const = 0; }; /// An interface to topic data. @@ -67,20 +66,20 @@ namespace MWGui virtual bool isEmpty () const = 0; /// walks the active and optionally completed, quests providing the name and completed status - virtual void visitQuestNames (bool active_only, boost::function visitor) const = 0; + virtual void visitQuestNames (bool active_only, std::function visitor) const = 0; /// walks over the journal entries related to all quests with the given name /// If \a questName is empty, simply visits all journal entries - virtual void visitJournalEntries (const std::string& questName, boost::function visitor) const = 0; + virtual void visitJournalEntries (const std::string& questName, std::function visitor) const = 0; /// provides the name of the topic specified by its id - virtual void visitTopicName (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicName (TopicId topicId, std::function visitor) const = 0; /// walks over the topics whose names start with the specified character providing the topics name - virtual void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const = 0; + virtual void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const = 0; /// walks over the topic entries for the topic specified by its identifier - virtual void visitTopicEntries (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicEntries (TopicId topicId, std::function visitor) const = 0; // create an instance of the default journal view model implementation static Ptr create (); diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 5f309f148..879f1b417 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -9,8 +9,6 @@ #include #include -#include - #include #include #include diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index e191c16bb..fbdda8395 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -1,5 +1,7 @@ #include "tradewindow.hpp" +#include + #include #include #include diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 341bc8034..bc042f7d6 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -1,15 +1,9 @@ #include "lightmanager.hpp" -#include - -#include - #include #include -#include - namespace SceneUtil { @@ -220,7 +214,8 @@ namespace SceneUtil // possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists) size_t hash = 0; for (unsigned int i=0; imLightSource->getId()); + hash = hash ^ (lightList[i]->mLightSource->getId() << 1); // or use boost::hash_combine + // original: boost::hash_combine(hash, lightList[i]->mLightSource->getId()); LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2];