Boost 1.54 deprecates Boost.Signal. Use Boost.Signal2 for >= 1.54.

This was SVN commit r13716.
This commit is contained in:
leper 2013-08-19 22:11:54 +00:00
parent 0b4fe2ef94
commit 54bbbb9797
3 changed files with 52 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -25,7 +25,12 @@
#include "wx/filename.h"
#include <boost/signal.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 105400
# include <boost/signals2/signal.hpp>
#else
# include <boost/signal.hpp>
#endif
class AtObj;
@ -48,7 +53,11 @@ public:
AtlasWindow(wxWindow* parent, const wxString& title, const wxSize& size);
#if BOOST_VERSION >= 105400
boost::signals2::signal<void ()> sig_FileSaved;
#else
boost::signal<void ()> sig_FileSaved;
#endif
private:

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2011 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -39,11 +39,17 @@ variable_to_be_watched.NotifyObservers();
*/
#include <boost/signals.hpp>
#include <boost/bind.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 105400
# include <boost/signals2.hpp>
typedef boost::signals2::connection ObservableConnection;
typedef boost::signals2::scoped_connection ObservableScopedConnection;
#else
# include <boost/signals.hpp>
typedef boost::signals::connection ObservableConnection;
typedef boost::signals::scoped_connection ObservableScopedConnection;
#endif
#include <boost/bind.hpp>
template <typename T> class Observable : public T
{
@ -90,9 +96,15 @@ public:
else
{
// Temporarily disable conn
#if BOOST_VERSION >= 105400
boost::signals2::shared_connection_block blocker(conn);
#else
conn.block();
#endif
NotifyObservers();
#if BOOST_VERSION < 105400
conn.unblock();
#endif
}
}
@ -103,7 +115,11 @@ public:
}
private:
#if BOOST_VERSION >= 105400
boost::signals2::signal<void (const T&)> m_Signal;
#else
boost::signal<void (const T&)> m_Signal;
#endif
};
// A similar thing, but for wrapping pointers instead of objects
@ -163,15 +179,25 @@ public:
else
{
// Temporarily disable conn
#if BOOST_VERSION >= 105400
boost::signals2::shared_connection_block blocker(conn);
#else
conn.block();
#endif
NotifyObservers();
#if BOOST_VERSION < 105400
conn.unblock();
#endif
}
}
private:
T* m_Ptr;
#if BOOST_VERSION >= 105400
boost::signals2::signal<void (T*)> m_Signal;
#else
boost::signal<void (T*)> m_Signal;
#endif
};
class ObservableScopedConnections

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2009 Wildfire Games.
/* Copyright (C) 2013 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -84,7 +84,13 @@
#include <limits>
#include <cassert>
#include <boost/signals.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 105400
// Signals is deprecated since 1.54
# include <boost/signals2.hpp>
#else
# include <boost/signals.hpp>
#endif
#include <boost/bind.hpp>
// Nicer memory-leak detection:
@ -95,12 +101,12 @@
# endif
#endif
#endif // HAVE_PCH
#else // HAVE_PCH
#if !HAVE_PCH
// If no PCH, just include the most common headers anyway
# include "wx/wx.h"
#endif
#endif // HAVE_PCH
#ifdef _WIN32
# define ATLASDLLIMPEXP extern "C" __declspec(dllexport)