Replace boost::function with std::function

c++11
scrawl 10 years ago
parent fc17e47ecb
commit 829b22b9de

@ -7,7 +7,7 @@
#include "MyGUI_FactoryManager.h"
#include <stdint.h>
#include <boost/function.hpp>
#include <functional>
#include <components/misc/utf8stream.hpp>
@ -864,7 +864,7 @@ public:
Style* mFocusItem;
bool mItemActive;
MyGUI::MouseButton mLastDown;
boost::function <void (intptr_t)> mLinkClicked;
std::function <void (intptr_t)> mLinkClicked;
std::shared_ptr <TypesetBookImpl> mBook;
@ -1214,7 +1214,7 @@ public:
throw std::runtime_error ("The main sub-widget for a BookPage must be a PageDisplay.");
}
void adviseLinkClicked (boost::function <void (InteractiveId)> linkClicked)
void adviseLinkClicked (std::function <void (InteractiveId)> linkClicked)
{
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
{
@ -1226,7 +1226,7 @@ public:
{
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
{
pd->mLinkClicked = boost::function <void (InteractiveId)> ();
pd->mLinkClicked = std::function <void (InteractiveId)> ();
}
}

@ -6,7 +6,6 @@
#include <functional>
#include <stdint.h>
#include <boost/function.hpp>
namespace MWGui
@ -102,7 +101,7 @@ namespace MWGui
public:
typedef TypesetBook::InteractiveId InteractiveId;
typedef boost::function <void (InteractiveId)> ClickCallback;
typedef std::function <void (InteractiveId)> ClickCallback;
/// Make the widget display the specified page from the specified book.
virtual void showPage (TypesetBook::Ptr Book, size_t Page) = 0;

@ -1,6 +1,6 @@
#include "dialogue.hpp"
#include <boost/bind.hpp>
#include <functional>
#include <MyGUI_LanguageManager.h>
#include <MyGUI_Window.h>
@ -276,7 +276,8 @@ namespace MWGui
mScrollBar->eventScrollChangePosition += MyGUI::newDelegate(this, &DialogueWindow::onScrollbarMoved);
mHistory->eventMouseWheel += MyGUI::newDelegate(this, &DialogueWindow::onMouseWheel);
BookPage::ClickCallback callback = boost::bind (&DialogueWindow::notifyLinkClicked, this, _1);
using namespace std::placeholders;
BookPage::ClickCallback callback = std::bind (&DialogueWindow::notifyLinkClicked, this, _1);
mHistory->adviseLinkClicked(callback);
mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);

@ -154,7 +154,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 ();
@ -198,7 +198,7 @@ struct JournalViewModelImpl : JournalViewModel
};
void visitQuestNames (bool active_only, boost::function <void (const std::string&, bool)> visitor) const
void visitQuestNames (bool active_only, std::function <void (const std::string&, bool)> visitor) const
{
MWBase::Journal * journal = MWBase::Environment::get ().getJournal ();
@ -273,7 +273,7 @@ struct JournalViewModelImpl : JournalViewModel
}
};
void visitJournalEntries (const std::string& questName, boost::function <void (JournalEntry const &)> visitor) const
void visitJournalEntries (const std::string& questName, std::function <void (JournalEntry const &)> visitor) const
{
MWBase::Journal * journal = MWBase::Environment::get().getJournal();
@ -306,13 +306,13 @@ struct JournalViewModelImpl : JournalViewModel
}
}
void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const
void visitTopicName (TopicId topicId, std::function <void (Utf8Span)> visitor) const
{
MWDialogue::Topic const & topic = * reinterpret_cast <MWDialogue::Topic const *> (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();
@ -346,7 +346,7 @@ struct JournalViewModelImpl : JournalViewModel
};
void visitTopicEntries (TopicId topicId, boost::function <void (TopicEntry const &)> visitor) const
void visitTopicEntries (TopicId topicId, std::function <void (TopicEntry const &)> visitor) const
{
typedef MWDialogue::Topic::TEntryIter iterator_t;

@ -5,7 +5,6 @@
#include <memory>
#include <functional>
#include <stdint.h>
#include <boost/function.hpp>
namespace MWGui
@ -38,7 +37,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 <void (TopicId, size_t, size_t)> visitor) const = 0;
virtual void visitSpans (std::function <void (TopicId, size_t, size_t)> visitor) const = 0;
};
/// An interface to topic data.
@ -68,20 +67,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 <void (const std::string&, bool)> visitor) const = 0;
virtual void visitQuestNames (bool active_only, std::function <void (const std::string&, bool)> 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 <void (JournalEntry const &)> visitor) const = 0;
virtual void visitJournalEntries (const std::string& questName, std::function <void (JournalEntry const &)> visitor) const = 0;
/// provides the name of the topic specified by its id
virtual void visitTopicName (TopicId topicId, boost::function <void (Utf8Span)> visitor) const = 0;
virtual void visitTopicName (TopicId topicId, std::function <void (Utf8Span)> 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 <void (TopicEntry const &)> visitor) const = 0;
virtual void visitTopicEntries (TopicId topicId, std::function <void (TopicEntry const &)> visitor) const = 0;
// create an instance of the default journal view model implementation
static Ptr create ();

@ -5,13 +5,11 @@
#include <stack>
#include <string>
#include <utility>
#include <functional>
#include <MyGUI_TextBox.h>
#include <MyGUI_Button.h>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <components/misc/stringops.hpp>
#include <components/widgets/imagebutton.hpp>
#include <components/widgets/list.hpp>
@ -120,10 +118,11 @@ namespace
Gui::MWList* topicsList = getWidget<Gui::MWList>(TopicsList);
topicsList->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyTopicSelected);
using namespace std::placeholders;
{
MWGui::BookPage::ClickCallback callback;
callback = boost::bind (&JournalWindowImpl::notifyTopicClicked, this, _1);
callback = std::bind (&JournalWindowImpl::notifyTopicClicked, this, _1);
getPage (LeftBookPage)->adviseLinkClicked (callback);
getPage (RightBookPage)->adviseLinkClicked (callback);
@ -135,7 +134,7 @@ namespace
{
MWGui::BookPage::ClickCallback callback;
callback = boost::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1);
callback = std::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1);
getPage (LeftTopicIndex)->adviseLinkClicked (callback);
getPage (RightTopicIndex)->adviseLinkClicked (callback);

@ -1,5 +1,7 @@
#include "tradewindow.hpp"
#include <climits>
#include <MyGUI_Button.h>
#include <MyGUI_InputManager.h>
#include <MyGUI_ControllerManager.h>

@ -3,8 +3,8 @@
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>
#include <boost/bind.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/filesystem/fstream.hpp>
@ -122,8 +122,9 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs, bool cre
}
}
using namespace std::placeholders;
dataDirs.erase(std::remove_if(dataDirs.begin(), dataDirs.end(),
boost::bind(&boost::filesystem::path::empty, _1)), dataDirs.end());
std::bind(&boost::filesystem::path::empty, _1)), dataDirs.end());
}
void ConfigurationManager::loadConfig(const boost::filesystem::path& path,

Loading…
Cancel
Save