mkdir $(CopyDir)
mkdir $(CopyDir)\bin
copy $(BinDir)\glibmm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).dll $(CopyDir)\bin
-copy $(BinDir)\glibmm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).pdb $(CopyDir)\bin
copy $(BinDir)\giomm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).dll $(CopyDir)\bin
-copy $(BinDir)\giomm-vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion).pdb $(CopyDir)\bin
mkdir $(CopyDir)\lib\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\include
mkdir $(CopyDir)\lib\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\include
-2.50.1 (stable):
+2.51.1:
-Glib
-* Dispatcher: Don't cast a HANDLE to an int on Windows.
- (Kjell Ahlstedt) Bug 772074
+This is the first release of the glibmm-2.52 API/ABI.
+It installs in parallel with the gtkmm-2.4 API/ABI, of which
+the most recent version is glibmm 2.50. We know that is a bit
+confusing. We are taking the opportunity to do this glibmm ABI
+break while GTK+ (and therefore gtkmm) is also doing an ABI
+break. But we cannot call this glibmm-3.0 because there is no
+glib 3.0.
+
+Build:
+* Require C++14.
+ (Murray Cumming)
+* Use libsigc++-3.0 instead of libsigc++-2.0.
+ https://www.murrayc.com/permalink/2016/03/07/libsigc-3-0-very-variadic/
+ (Murray Cumming)
+* Remove lots of deprecated API.
+ (Kjell Ahlstedt)
Gio:
-* Action: Include variant.h in the header.
- (Daniel Boles) Bug #777953
-* Application::get_default(): Correct the refcounting.
- (Daniel Boles) Bug #779936
-* SettingsSchemaSource: Correct the refcounting.
+* BufferedInputStream, InputStream, OutputStream: Add vfuncs,
+ allowing implementation in C++.
+ (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471
+* SettingsSchemaSource::get_default(): Correct the reference count.
(Marcin Kolny) Bug #774593
+* Settings: Fix type of 'key' parameter of writable-change-event signal
+ (Marcin Kolny) Bug #773977
-Gio::DBus
-* Proxy: Fix memory leak in get_cached_property_names().
- (Kjell Ahlstedt) Bug #775210
-
-Documentation:
-* Glib::Variant: Improve documentation of "maybe" types.
- (Daniel Boles) Bug #778219
- Gio::ActionMap: Clarify doc of ActivateWithParameterSlot.
- (Daniel Boles)
-
-Build:
-* C++11: Variant: Replace throw(std::bad_cast) with noexcept(false).
- See https://bugzilla.redhat.com/show_bug.cgi?id=1438766
-* Visual Studio: Install the .pdb files.
- (Chun-wei Fan)
+Glib:
+* ustring: Add cbegin() and cend().
-2.50.0 (stable):
+2.50.0:
No changes since 2.49.7.
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.50.1],
+AC_INIT([glibmm], [2.51.1],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
MM_PREREQ([0.9.10])
-MM_INIT_MODULE([glibmm-2.4])
-MM_INIT_MODULE([giomm-2.4])
+MM_INIT_MODULE([glibmm-2.52])
+MM_INIT_MODULE([giomm-2.52])
# Copy the mm-common .pl scripts into docs/,
# and use them from there,
AC_SUBST([LIBGLIBMM_SO_VERSION], [4:0:3])
AC_PROG_CXX
-MM_AX_CXX_COMPILE_STDCXX([11], [noext],[mandatory])
+MM_AX_CXX_COMPILE_STDCXX([14], [noext],[mandatory])
AC_DISABLE_STATIC
LT_INIT([win32-dll])
glibreq='2.0 >= 2.50.0'
-GLIBMM_MODULES="sigc++-2.0 >= 2.9.1 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
+GLIBMM_MODULES="sigc++-3.0 >= 2.99.5 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq"
test "x$glibmm_host_windows" = xyes || GIOMM_MODULES="$GIOMM_MODULES gio-unix-$glibreq"
# Check whether --enable-debug-refcounting was given.
GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING
+glibmm_warnings_fatal='-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow -Wno-long-long'
# Evaluate the --enable-warnings=level option.
MM_ARG_ENABLE_WARNINGS([GLIBMM_WXXFLAGS],
[-Wall],
- [-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow -Wno-long-long],
+ [$glibmm_warnings_fatal],
+ [G SIGCXX])
+
+MM_ARG_ENABLE_WARNINGS([GLIBMM_INTERFACE_TEST_WXXFLAGS],
+ [-Wall],
+ [$glibmm_warnings_fatal -Wno-unused-function],
[G SIGCXX])
# Offer the ability to omit some API from the library,
web_host = gtkmm.org
-web_path_gtkmm = /home/murrayc/gtkmm.org/docs/glibmm-2.4/
-#web_path_gtkmm = /home/groups/g/gt/gtkmm/htdocs/docs/glibmm-2.4/
+web_path_gtkmm = /home/murrayc/gtkmm.org/docs/glibmm-2.52/
+#web_path_gtkmm = /home/groups/g/gt/gtkmm/htdocs/docs/glibmm-2.52/
web_path_docs = $(web_path_gtkmm)docs/
rsync_args = -vz --rsh ssh
-gtkmm_docdir = $(datadir)/doc/glibmm-2.4/docs
+gtkmm_docdir = $(datadir)/doc/glibmm-2.52/docs
options/example \
properties/example \
regex/example \
- settings/settings \
- thread/dispatcher \
- thread/dispatcher2 \
- thread/thread \
- thread/threadpool
+ settings/settings
glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib)
giomm_includes = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio)
+++ /dev/null
-
-#include <condition_variable>
-#include <iostream>
-#include <memory>
-#include <mutex>
-#include <queue>
-#include <thread>
-#if defined(_MSC_VER) && (_MSC_VER < 1900)
-/* For using noexcept on Visual Studio 2013 */
-#include <glibmmconfig.h>
-#endif
-#include <glibmm/init.h>
-#include <glibmm/random.h>
-#include <glibmm/timer.h>
-
-namespace
-{
-
-class MessageQueue
-{
-public:
- MessageQueue();
- ~MessageQueue();
-
- void producer();
- void consumer();
-
-private:
- std::mutex mutex_;
- std::condition_variable cond_push_;
- std::condition_variable cond_pop_;
- std::queue<int> queue_;
-};
-
-MessageQueue::MessageQueue()
-{
-}
-
-MessageQueue::~MessageQueue()
-{
-}
-
-void
-MessageQueue::producer()
-{
- Glib::Rand rand(1234);
-
- for (auto i = 0; i < 200; ++i)
- {
- {
- std::unique_lock<std::mutex> lock(mutex_);
-
- cond_pop_.wait(lock, [this]() -> bool { return queue_.size() < 64; });
-
- queue_.push(i);
- std::cout << '*';
- std::cout.flush();
-
- // We unlock before notifying, because that is what the documentation suggests:
- // http://en.cppreference.com/w/cpp/thread/condition_variable
- lock.unlock();
- cond_push_.notify_one();
- }
-
- if (rand.get_bool())
- continue;
-
- Glib::usleep(rand.get_int_range(0, 100000));
- }
-}
-
-void
-MessageQueue::consumer()
-{
- Glib::Rand rand(4567);
-
- for (;;)
- {
- {
- std::unique_lock<std::mutex> lock(mutex_);
-
- cond_push_.wait(lock, [this]() -> bool { return !queue_.empty(); });
-
- const int i = queue_.front();
- queue_.pop();
- std::cout << "\x08 \x08";
- std::cout.flush();
-
- // We unlock before notifying, because that is what the documentation suggests:
- // http://en.cppreference.com/w/cpp/thread/condition_variable
- lock.unlock();
- cond_pop_.notify_one();
-
- if (i >= 199)
- break;
- }
-
- if (rand.get_bool())
- continue;
-
- Glib::usleep(rand.get_int_range(10000, 200000));
- }
-}
-}
-
-int
-main(int, char**)
-{
- Glib::init();
-
- MessageQueue queue;
-
- // TODO: Use std::make_unique() when we use C++14:
- const auto producer =
- std::unique_ptr<std::thread>(new std::thread(&MessageQueue::producer, &queue));
-
- const auto consumer =
- std::unique_ptr<std::thread>(new std::thread(&MessageQueue::consumer, &queue));
-
- producer->join();
- consumer->join();
-
- std::cout << std::endl;
-
- return 0;
-}
+++ /dev/null
-
-#include <iostream>
-#include <mutex>
-#include <thread>
-
-// TODO: Remove this example sometime. Glib::ThreadPool is deprecated.
-// TODO: Maybe use std::async() instead?
-#undef GLIBMM_DISABLE_DEPRECATED
-
-#include <glibmmconfig.h>
-
-#ifdef GLIBMM_DISABLE_DEPRECATED
-int
-main(int, char**)
-{
- // If glibmm is configured with --disable-deprecated-api,
- // GLIBMM_DISABLE_DEPRECATED is defined in glibmmconfig.h.
- std::cout << "Glib::ThreadPool not available because deprecated API has been disabled."
- << std::endl;
- return 77; // Tell automake's test harness to skip this test.
-}
-
-#else
-
-#include <glibmm/random.h>
-#include <glibmm/threadpool.h>
-#include <glibmm/timer.h>
-
-namespace
-{
-
-std::mutex mutex;
-
-void
-print_char(char c)
-{
- Glib::Rand rand;
-
- for (auto i = 0; i < 100; ++i)
- {
- {
- std::lock_guard<std::mutex> lock(mutex);
- std::cout << c;
- std::cout.flush();
- }
- Glib::usleep(rand.get_int_range(10000, 100000));
- }
-}
-
-} // anonymous namespace
-
-int
-main(int, char**)
-{
- Glib::ThreadPool pool(10);
-
- for (auto c = 'a'; c <= 'z'; ++c)
- {
- pool.push(sigc::bind(sigc::ptr_fun(&print_char), c));
- }
-
- pool.shutdown();
-
- std::cout << std::endl;
-
- return 0;
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
try
{
// Recreate the specific slot from the generic slot node.
- return (*static_cast<sigc::slot<bool, Glib::IOCondition>*>(slot))((Glib::IOCondition)condition);
+ return (*static_cast<sigc::slot<bool(Glib::IOCondition)>*>(slot))((Glib::IOCondition)condition);
}
catch (...)
{
}
sigc::connection
-SignalSocket::connect(const sigc::slot<bool, Glib::IOCondition>& slot,
+SignalSocket::connect(const sigc::slot<bool(Glib::IOCondition)>& slot,
const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
const Glib::RefPtr<Cancellable>& cancellable, int priority)
{
* @param priority The priority of the new event source.
* @return A connection handle, which can be used to disconnect the handler.
*/
- sigc::connection connect(const sigc::slot<bool, Glib::IOCondition>& slot,
+ sigc::connection connect(const sigc::slot<bool(Glib::IOCondition)>& slot,
const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>(),
int priority = Glib::PRIORITY_DEFAULT);
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <glibmm/exceptionhandler.h>
+#include <glibmm/variant.h>
#include <gio/gio.h>
namespace Gio
_CONFIGINCLUDE(giommconfig.h)
#include <glibmm/interface.h>
-#include <glibmm/variant.h>
#include <glibmm/varianttype.h>
#include <gio/gio.h>
typedef struct _GActionInterface GActionInterface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+namespace Glib
+{
+
+class VariantBase;
+
+}
+
namespace Gio
{
_WRAP_METHOD(void change_state_variant(const Glib::VariantBase& value), g_action_change_state)
- _WRAP_METHOD(void change_state(const Glib::VariantBase& value), g_action_change_state, deprecated "Use the templated method instead, passing a normal C++ type.")
-
/** Queries the current state of the action.
*
* If the action is not stateful then a null Variant will be returned. If the
_WRAP_METHOD(void activate_variant(const Glib::VariantBase& parameter), g_action_activate)
- _WRAP_METHOD(void activate(const Glib::VariantBase& parameter), g_action_activate, deprecated "Use the templated method instead, passing a normal C++ type.")
-
_WRAP_METHOD(static bool name_is_valid(const Glib::ustring& action_name), g_action_name_is_valid )
/** Parses a detailed action name into its separate name and target components.
_WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint_variant(const Glib::ustring& action_name) const, g_action_group_get_action_state_hint)
-
- _WRAP_METHOD(Glib::VariantBase get_action_state(const Glib::ustring& action_name) const, g_action_group_get_action_state, deprecated "Use the get_action_state() method that takes an output parameter instead.")
-
//TODO: How do we check for a nullptr Variant?
/** Queries the current state of the named action within the action group.
*
_WRAP_METHOD(Glib::RefPtr<Action> lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Action> lookup_action(const Glib::ustring& action_name) const, g_action_map_lookup_action, constversion, refreturn)
- /** A Slot to be called when an action has been activated,
- * passing a parameter of a specified type.
+ /** A Slot to be called when an action has been activated.
* See add_action_with_parameter().
*
* For instance,
* void on_slot_activated(const Glib::VariantBase& parameter);
*/
- using ActivateWithParameterSlot = sigc::slot<void, const Glib::VariantBase&>;
+ using ActivateWithParameterSlot = sigc::slot<void(const Glib::VariantBase&)>;
//This is an equivalent for g_action_map_add_action_entries().
/** A convenience method for creating a SimpleAction instance
/** A Slot to be called when an action has been activated,
* without passing a parameter to the slot.
- * See add_action() and add_action_bool().
+ * See add_action().
*
* For instance,
* void on_slot_activated();
*/
- using ActivateSlot = sigc::slot<void>;
+ using ActivateSlot = sigc::slot<void()>;
/** A convenience method for creating a SimpleAction instance
* and adding it to the ActionMap.
* See add_action_radio_string().
*
* For instance,
- * void on_slot_activated(const Glib::ustring& parameter);
+ * void on_slot_activated(const Glib::VariantBase& parameter);
*/
- using ActivateWithStringParameterSlot = sigc::slot<void, const Glib::ustring&>;
+ using ActivateWithStringParameterSlot = sigc::slot<void(const Glib::ustring&)>;
//TODO: Docs: Add hints about how to specify the various possible states in the GtkBuilder XML.
/** A convenience method for creating a string-based radio SimpleAction instance
Glib::RefPtr<SimpleAction> add_action_radio_integer(const Glib::ustring& name, gint32 state);
/** A Slot to be called when an action has been activated.
- * See add_action_radio_integer().
+ * See add_action_radio_int().
*
* For instance,
- * void on_slot_activated(int parameter);
+ * void on_slot_activated(const Glib::VariantBase& parameter);
*/
- using ActivateWithIntParameterSlot = sigc::slot<void, int>;
-
+ using ActivateWithIntParameterSlot = sigc::slot<void(int)>;
+
//TODO: Docs: Add hints about how to specify the various possible states in the GtkBuilder XML.
/** A convenience method for creating an integer-based radio SimpleAction instance
* and adding it to the ActionMap.
_WRAP_METHOD(bool supports_files() const, g_app_info_supports_files)
#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
- _WRAP_METHOD(bool launch_uris(const Glib::ListHandle<std::string>& uris,
- GAppLaunchContext* launch_context),
- g_app_info_launch_uris,
- errthrow, deprecated "Use the method that takes an AppLaunchContext")
//TODO: I think we use Glib::ustring elsewhere for URIs:
_WRAP_METHOD(bool launch_uris(const Glib::ListHandle<std::string>& uris,
Application_signal_open_callback(
GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data)
{
- using SlotType = sigc::slot<void, const Gio::Application::type_vec_files&, const Glib::ustring&>;
+ using SlotType = sigc::slot<void(const Gio::Application::type_vec_files&, const Glib::ustring&)>;
Gio::Application::type_vec_files vec_files(n_files);
for (int i = 0; i < n_files; ++i)
GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data)
{
using namespace Gio;
- using SlotType = sigc::slot<void, const Application::type_vec_files&, const Glib::ustring&>;
+ using SlotType = sigc::slot<void(const Application::type_vec_files&, const Glib::ustring&)>;
Application::type_vec_files vec_files(n_files);
for (int i = 0; i < n_files; i++)
(*base->open)(self, files, n_files, hint);
}
-Glib::SignalProxy<void, const Application::type_vec_files&, const Glib::ustring&>
+Glib::SignalProxy<void(const Application::type_vec_files&, const Glib::ustring&)>
Application::signal_open()
{
- return Glib::SignalProxy<void, const Application::type_vec_files&, const Glib::ustring&>(
+ return Glib::SignalProxy<void(const Application::type_vec_files&, const Glib::ustring&)>(
this, &Application_signal_open_info);
}
*/
void unset_resource_base_path();
- _WRAP_METHOD(void set_action_group(const Glib::RefPtr<ActionGroup>& action_group), g_application_set_action_group,
- deprecated "Use the Gio::ActionMap interface instead.")
+ _IGNORE(g_application_set_action_group)
//Note: We would like to add a group, not just some entries,
//so we can do pre and post parsing. See https://bugzilla.gnome.org/show_bug.cgi?id=727602
/// Unsets any existing default application.
static void unset_default();
- _WRAP_METHOD(static Glib::RefPtr<Application> get_default(), g_application_get_default, refreturn)
+ _WRAP_METHOD(static Glib::RefPtr<Application> get_default(), g_application_get_default)
_WRAP_METHOD(void mark_busy(), g_application_mark_busy)
_WRAP_METHOD(void unmark_busy(), g_application_unmark_busy)
// _WRAP_METHOD(void bind_busy_property(const Glib::RefPtr<Glib::ObjectBase>& object, const Glib::ustring& property), g_application_bind_busy_property)
// _WRAP_METHOD(void unbind_busy_property(const Glib::RefPtr<Glib::ObjectBase>& object, const Glib::ustring& property), g_application_unbind_busy_property)
- _WRAP_PROPERTY("action-group", Glib::RefPtr<ActionGroup>, deprecated "Use the Gio::ActionMap interface instead.")
+ _IGNORE_PROPERTY("action-group")
_WRAP_PROPERTY("application-id", Glib::ustring)
_WRAP_PROPERTY("flags", ApplicationFlags)
_WRAP_PROPERTY("inactivity-timeout", guint)
//We wrap the open signal without _WRAP_SIGNAL(), because we need to change its parameters.
//See bug https://bugzilla.gnome.org/show_bug.cgi?id=637457
- Glib::SignalProxy< void, const type_vec_files&, const Glib::ustring& > signal_open();
+ Glib::SignalProxy<void(const type_vec_files&, const Glib::ustring&)> signal_open();
_IGNORE_SIGNAL(open)
#m4 _CONVERSION(`GApplicationCommandLine*', `const Glib::RefPtr<ApplicationCommandLine>&',`Glib::wrap($3, true)')
*
* @newin{2,16}
*/
-using SlotAsyncReady = sigc::slot<void, Glib::RefPtr<AsyncResult>&>;
+using SlotAsyncReady = sigc::slot<void(Glib::RefPtr<AsyncResult>&)>;
/** Provides a base class for implementing asynchronous function results.
* Asynchronous operations are broken up into two separate operations which are chained together by a SlotAsyncReady.
public:
_IGNORE(g_async_result_get_user_data)
-
- //Note that this returns a reference, unlike most GTK+ get_*() functions,
- //so we don't need to use refreturn.
- _WRAP_METHOD(Glib::RefPtr<Glib::Object> get_source_object(),
- g_async_result_get_source_object, deprecated "Use get_source_object_base()")
- _WRAP_METHOD(Glib::RefPtr<const Glib::Object> get_source_object() const,
- g_async_result_get_source_object, constversion, deprecated "Use get_source_object_base()")
+ _IGNORE(g_async_result_get_source_object)
//Note that this returns a reference, unlike most GTK+ get_*() functions,
//so we don't need to use refreturn.
_WRAP_PROPERTY("buffer-size", guint)
protected:
- //TODO: When we can break ABI, add vfunc. See https://bugzilla.gnome.org/show_bug.cgi?id=572471
#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3, true)')
- //_WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), fill, errthrow, err_return_value -1)
+ _WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), fill, errthrow, err_return_value -1)
};
} // namespace Gio
_CTOR_DEFAULT
public:
- using SlotCancelledCallback = sigc::slot<void>;
+ using SlotCancelledCallback = sigc::slot<void()>;
_WRAP_CREATE()
* Glib::ustring& signal_name, const Glib::VariantContainerBase& parameters);.
* @endcode
*/
- using SlotSignal = sigc::slot<void, const Glib::RefPtr<Connection>&,
+ using SlotSignal = sigc::slot<void(const Glib::RefPtr<Connection>&,
const Glib::ustring&, const Glib::ustring&, const Glib::ustring&,
- const Glib::ustring&, const Glib::VariantContainerBase&>;
+ const Glib::ustring&, const Glib::VariantContainerBase&)>;
/** Signature for slot used in add_filter().
* For example,
* drop a message can simply return <tt>0</tt>. And filter function may
* modify a message by copying it and return the copy.
*/
- using SlotMessageFilter = sigc::slot<Glib::RefPtr<Message>,
+ using SlotMessageFilter = sigc::slot<Glib::RefPtr<Message>(
const Glib::RefPtr<Connection>&,
- const Glib::RefPtr<Message>&, bool>;
+ const Glib::RefPtr<Message>&, bool)>;
/** Asynchronously connects to the message bus specified by @a bus_type.
*
* @endcode
*/
using SlotInterfaceMethodCall = sigc::slot<
- void,
+ void(
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::VariantContainerBase&,
- const Glib::RefPtr<MethodInvocation>&
+ const Glib::RefPtr<MethodInvocation>&)
>;
/** The type for a slot which handles getting a property for a D-Bus
* @throw Glib::Error.
*/
using SlotInterfaceGetProperty = sigc::slot<
- void,
+ void(
Glib::VariantBase&,
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
- const Glib::ustring&
+ const Glib::ustring&)
>;
/** The type for a slot which handles setting a property for a D-Bus
* @throw Glib::Error.
*/
using SlotInterfaceSetProperty = sigc::slot<
- bool,
+ bool(
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
- const Glib::VariantBase&
+ const Glib::VariantBase&)
>;
/** Constructs a new InterfaceVTable using the specified slots.
* @newin{2,28}
* @ingroup DBus
*/
-using SlotBusAcquired = sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring>;
+using SlotBusAcquired = sigc::slot<void(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring)>;
/** For example,
* void on_name_acquired(const Glib::RefPtr<Gio::DBus::Connection>& connection,
* const Glib::ustring& name);
* @ingroup DBus
*/
-using SlotNameAcquired = sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring>;
+using SlotNameAcquired = sigc::slot<void(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring)>;
/** For example,
* void on_name_lost(const Glib::RefPtr<Gio::DBus::Connection>& connection,
* const Glib::ustring& name);
* @ingroup DBus
*/
-using SlotNameLost = sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring>;
+using SlotNameLost = sigc::slot<void(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring)>;
//TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=646427 about the apparent uselessness of SlotNameAcquired.
//TODO: Add example from C API in class docs.
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
/* Copyright (C) 2010 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
_WRAP_METHOD(void set_cached_property(const Glib::ustring& property_name, const Glib::VariantBase& value), g_dbus_proxy_set_cached_property)
-#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
+#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3)')
_WRAP_METHOD(Glib::StringArrayHandle get_cached_property_names() const, g_dbus_proxy_get_cached_property_names)
_WRAP_METHOD(void set_interface_info(const Glib::RefPtr<InterfaceInfo>& info), g_dbus_proxy_set_interface_info)
* @endcode
*/
using SlotSubtreeEnumerate = sigc::slot<
- std::vector<Glib::ustring>,
+ std::vector<Glib::ustring>(
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
- const Glib::ustring&
+ const Glib::ustring&)
>;
/** The type for a slot which handles introspecting a child node.
* @endcode
*/
using SlotSubtreeIntrospect = sigc::slot<
- std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> >,
+ std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> >(
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
const Glib::ustring&,
- const Glib::ustring&
+ const Glib::ustring&)
>;
/** The type for a slot which handles dispatching a remote call on a child
* @endcode
*/
using SlotSubtreeDispatch = sigc::slot<
- const InterfaceVTable*,
+ const InterfaceVTable*(
const Glib::RefPtr<Connection>&,
const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&,
- const Glib::ustring&
+ const Glib::ustring&)
>;
/** Constructs a new SubtreeVTable using specified slots.
* const Glib::ustring& name, const Glib::ustring& name_owner);
* @ingroup DBus
*/
-using SlotNameAppeared = sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring, const Glib::ustring&>;
+using SlotNameAppeared = sigc::slot<void(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring, const Glib::ustring&)>;
/** For example,
* void on_name_vanished(const Glib::RefPtr<Gio::DBus::Connection>& connection,
* const Glib::ustring& name);
* @ingroup DBus
*/
-using SlotNameVanished = sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring>;
+using SlotNameVanished = sigc::slot<void(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring)>;
//TODO: Add example from C API in class docs?
/** Starts watching @a name on the bus specified by @a bus_type and calls
_WRAP_METHOD(std::string get_filename() const, g_desktop_app_info_get_filename)
_WRAP_METHOD(bool is_hidden() const, g_desktop_app_info_get_is_hidden)
- _WRAP_METHOD(static void set_desktop_env(const std::string& desktop_env), g_desktop_app_info_set_desktop_env,
- deprecated "Do not use this API. Since 2.42 the value of the `XDG_CURRENT_DESKTOP` environment variable will be used.")
+
+ _IGNORE(g_desktop_app_info_set_desktop_env)
#m4 _CONVERSION(`const char* const*', `std::vector<Glib::ustring>', `Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_NONE)')
_WRAP_METHOD(std::vector<Glib::ustring> get_keywords() const, g_desktop_app_info_get_keywords)
/** A signal handler would be, for instance:
* void on_file_progress(goffset current_num_bytes, goffset total_num_bytes);
*/
- using SlotFileProgress = sigc::slot<void, goffset, goffset>;
+ using SlotFileProgress = sigc::slot<void(goffset, goffset)>;
/** Copies the file source to the location specified by destination. Can not handle recursive copies of directories.
* If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten.
*
* @newin{2,38}
*/
- using SlotFileMeasureProgress = sigc::slot<void, bool, guint64, guint64, guint64>;
+ using SlotFileMeasureProgress = sigc::slot<void(bool, guint64, guint64, guint64)>;
//We do not use the {callback} syntax with _WRAP_METHOD here, because it expects to use user_data rather than progress_data.
//We ignore the gboolean result, because we throw an exception if it is false.
/** A signal handler would be, for instance:
* bool on_read_more(const char* file_contents, goffset file_size);
*/
- using SlotReadMore = sigc::slot<bool, const char*, goffset>;
+ using SlotReadMore = sigc::slot<bool(const char*, goffset)>;
//Note that slot_read_more can be nullptr but that would not be a useful method overload, because the documentation says that it would
//then be equivalent to load_contents_async.
(return-type "gboolean")
(when "last")
(parameters
- '("guint" "p0")
+ '("GQuark" "p0")
)
)
(return-type "gboolean")
(when "last")
(parameters
- '("guint" "p0")
+ '("GQuark" "p0")
)
)
)
)
+@@ -1049,6 +1049,6 @@
+ (return-type "gboolean")
+ (when "last")
+ (parameters
+- '("guint" "p0")
++ '("GQuark" "p0")
+ )
+ )
+
+@@ -1752,6 +1752,6 @@
+ (return-type "gboolean")
+ (when "last")
+ (parameters
+- '("guint" "p0")
++ '("GQuark" "p0")
+ )
+ )
+
@@ -1824,8 +1824,8 @@
(return-type "void")
(when "last")
_WRAP_METHOD(bool set_pending(), g_input_stream_set_pending, errthrow, newin "2,50")
_WRAP_METHOD(void clear_pending(), g_input_stream_clear_pending, newin "2,50")
- //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471
#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3, true)')
- //_WRAP_VFUNC(gssize read(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable), read_fn, errthrow, err_return_value -1)
- //_WRAP_VFUNC(gssize skip(gsize count, const Glib::RefPtr<Cancellable>& cancellable), skip, errthrow, err_return_value -1)
- //_WRAP_VFUNC(bool close(const Glib::RefPtr<Cancellable>& cancellable), close_fn, errthrow)
+ _WRAP_VFUNC(gssize read(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable), read_fn, errthrow, err_return_value -1)
+ _WRAP_VFUNC(gssize skip(gsize count, const Glib::RefPtr<Cancellable>& cancellable), skip, errthrow, err_return_value -1)
+ _WRAP_VFUNC(bool close(const Glib::RefPtr<Cancellable>& cancellable), close_fn, errthrow)
};
} // namespace Gio
*
* @newin{2,50}
*/
- using SlotCompare = sigc::slot<int, const Glib::RefPtr<const Glib::ObjectBase>&, const Glib::RefPtr<const Glib::ObjectBase>&>;
+ using SlotCompare = sigc::slot<int(const Glib::RefPtr<const Glib::ObjectBase>&, const Glib::RefPtr<const Glib::ObjectBase>&)>;
_WRAP_METHOD(guint insert_sorted(const Glib::RefPtr<Glib::ObjectBase>& item,
const SlotCompare& slot{compare_func}), g_list_store_insert_sorted,
*
* @newin{2,50}
*/
- using SlotCompare = sigc::slot<int, const Glib::RefPtr<const T_item>&, const Glib::RefPtr<const T_item>&>;
+ using SlotCompare = sigc::slot<int(const Glib::RefPtr<const T_item>&, const Glib::RefPtr<const T_item>&)>;
/** Inserts @a item at a position to be determined by the @a slot.
*
namespace Gio
{
-_DEPRECATE_IFDEF_START
-void
-MemoryInputStream::add_data(const std::string& data)
-{
- char* data_copy = g_strdup(data.c_str());
- g_memory_input_stream_add_data(gobj(), data_copy, -1, g_free);
-}
-
-void
-MemoryInputStream::add_data(const void* data, gssize len)
-{
- char* data_copy = nullptr;
-
- // copy the data so that the caller doesn't need to keep the data alive
- if (len < 0)
- data_copy = g_strdup(static_cast<const gchar*>(data));
- else
- data_copy = static_cast<gchar*>(g_memdup(data, len));
-
- g_memory_input_stream_add_data(gobj(), data_copy, len, g_free);
-}
-_DEPRECATE_IFDEF_END
-
void
MemoryInputStream::add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot)
{
public:
_WRAP_CREATE()
-_DEPRECATE_IFDEF_START
- /** Appends to data that can be read from the input stream.
- *
- * @param data Input data.
- *
- * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead.
- */
- void add_data(const std::string& data);
-
- /** Appends to data that can be read from the input stream.
- *
- * Note that the data will be copied internally and freed when no longer needed.
- *
- * @param data Input data.
- * @param len Length of the data, may be -1 if data is a null-terminated string.
- *
- * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead.
- */
- void add_data(const void* data, gssize len);
-_DEPRECATE_IFDEF_END
-
_WRAP_METHOD(void add_data(const void* data, gssize len, GDestroyNotify destroy), g_memory_input_stream_add_data)
/** For example,
*
* @newin{2,40}
*/
- using SlotDestroyData = sigc::slot<void, void*>;
+ using SlotDestroyData = sigc::slot<void(void*)>;
/** Appends to data that can be read from the input stream.
*
set_submenu(submenu);
}
-_DEPRECATE_IFDEF_START
-void
-MenuItem::set_action_and_target(const Glib::ustring& action)
-{
- g_menu_item_set_action_and_target_value(gobj(), action.c_str(), nullptr);
-}
-_DEPRECATE_IFDEF_END
-
void
MenuItem::set_action(const Glib::ustring& action)
{
//void set_attribute(const Glib::ustring& attribute, const T_Value& value) const;
_WRAP_METHOD(void set_attribute_value(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value)
- _WRAP_METHOD(void set_attribute(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value, deprecated "Use set_attribute() instead.")
_IGNORE(g_menu_item_set_attribute)
//These are documented as transfer-full, so we don't need to use refreturn.
//void get_attribute(const Glib::ustring& attribute, T_Value& value) const;
//_WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value)
- _WRAP_METHOD(Glib::VariantBase get_attribute(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value, deprecated "Use get_attribute_value() instead.")
_WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value)
// Ignore varargs function.
_IGNORE(g_menu_item_get_attribute)
-_DEPRECATE_IFDEF_START
- /** Unsets the target for the specified @a action.
- * @deprecated Use set_action() or unset_target() instead.
- */
- void set_action_and_target(const Glib::ustring& action);
-_DEPRECATE_IFDEF_END
-
/** Sets the action for the menu item.
* See set_action_and_target().
*
_WRAP_METHOD(void set_title(const Glib::ustring& title), g_notification_set_title)
_WRAP_METHOD(void set_body(const Glib::ustring& body), g_notification_set_body)
_WRAP_METHOD(void set_icon(const Glib::RefPtr<Icon>& icon), g_notification_set_icon)
- _WRAP_METHOD(void set_urgent(bool urgent = true), g_notification_set_urgent, deprecated "Use set_priority() instead.")
+ _IGNORE(g_notification_set_urgent)
_WRAP_METHOD(void set_priority(NotificationPriority priority = NOTIFICATION_PRIORITY_NORMAL), g_notification_set_priority, newin "2,44")
_WRAP_METHOD(void add_button(const Glib::ustring& label, const Glib::ustring& detailed_action), g_notification_add_button)
_WRAP_METHOD(bool set_pending(), g_output_stream_set_pending, errthrow, newin "2,50")
_WRAP_METHOD(void clear_pending(), g_output_stream_clear_pending, newin "2,50")
- //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471
#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3, true)')
#m4 _CONVERSION(`GInputStream*', `const Glib::RefPtr<InputStream>&', `Glib::wrap($3, true)')
- //_WRAP_VFUNC(gssize write(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable), write_fn, errthrow, err_return_value -1)
- //_WRAP_VFUNC(gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable{.}, OutputStreamSpliceFlags flags{.}), splice, errthrow, err_return_value -1)
- //_WRAP_VFUNC(bool flush(const Glib::RefPtr<Cancellable>& cancellable), flush, errthrow)
- //_WRAP_VFUNC(bool close(const Glib::RefPtr<Cancellable>& cancellable), close_fn, errthrow)
+ _WRAP_VFUNC(gssize write(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable), write_fn, errthrow, err_return_value -1)
+ _WRAP_VFUNC(gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable{.}, OutputStreamSpliceFlags flags{.}), splice, errthrow, err_return_value -1)
+ _WRAP_VFUNC(bool flush(const Glib::RefPtr<Cancellable>& cancellable), flush, errthrow)
+ _WRAP_VFUNC(bool close(const Glib::RefPtr<Cancellable>& cancellable), close_fn, errthrow)
};
} // namespace Gio
bind_writable(key, property_proxy.get_object(), property_proxy.get_name(), inverted);
}
-_DEPRECATE_IFDEF_START
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-std::vector<Glib::ustring>
-Settings::list_schemas()
-{
- return Glib::ArrayHandler<Glib::ustring>::array_to_vector(
- g_settings_list_schemas(), Glib::OWNERSHIP_NONE);
-}
-G_GNUC_END_IGNORE_DEPRECATIONS
-_DEPRECATE_IFDEF_END
}
_WRAP_METHOD(gint64 get_int64(const Glib::ustring& key) const, g_settings_get_int64)
_WRAP_METHOD(void set_int64(const Glib::ustring& key, gint64 value), g_settings_set_int64)
_WRAP_METHOD(guint get_uint(const Glib::ustring& key) const, g_settings_get_uint)
- _WRAP_METHOD(void set_uiint(const Glib::ustring& key, guint value), g_settings_set_uint, deprecated "Use set_uint() instead.")
+ _IGNORE(g_settings_set_uint)
_WRAP_METHOD(void set_uint(const Glib::ustring& key, guint value), g_settings_set_uint)
_WRAP_METHOD(guint64 get_uint64(const Glib::ustring& key) const, g_settings_get_uint64)
_WRAP_METHOD(void set_uint64(const Glib::ustring& key, guint64 value), g_settings_set_uint64)
_WRAP_METHOD(void reset(const Glib::ustring& key), g_settings_reset)
-_DEPRECATE_IFDEF_START
-//We must hand-code this because gmmproc is confused by the static keyword with the vector.
-//#m4 _CONVERSION(`const gchar*const*',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_NONE)')
- _WRAP_METHOD_DOCS_ONLY(g_settings_list_schemas)
- static std::vector<Glib::ustring> list_schemas();
- _IGNORE(g_settings_list_schemas)
-_DEPRECATE_IFDEF_END
-
#m4 _CONVERSION(`gchar**',`std::vector<Glib::ustring>',`Glib::ArrayHandler<Glib::ustring>::array_to_vector($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector<Glib::ustring> list_children() const, g_settings_list_children)
- _WRAP_METHOD(std::vector<Glib::ustring> list_keys() const, g_settings_list_keys, deprecated "Use SettingsSchema::list_kes().")
+ _IGNORE(g_settings_list_keys)
_IGNORE(g_settings_get_range, g_settings_list_relocatable_schemas) // deprecated
- _WRAP_METHOD(bool range_check(const Glib::ustring& key, const Glib::VariantBase& value) const, g_settings_range_check,
- deprecated "Use g_settings_schema_key_range_check() instead.")
+ _IGNORE(g_settings_range_check)
//TODO: Wrap GSettingsSchema
#m4 _CONVERSION(`Glib::ObjectBase*',`gpointer',(gpointer)$3->gobj())
_WRAP_PROPERTY("delay-apply", bool)
_WRAP_PROPERTY("has-unapplied", bool)
_WRAP_PROPERTY("path", std::string)
- _WRAP_PROPERTY("schema", Glib::ustring, deprecated "Use the 'schema-id' property instead. In a future version, this property may instead refer to a SettingsSchema.")
+ _IGNORE_PROPERTY("schema")
_WRAP_PROPERTY("schema-id", Glib::ustring)
//TODO: _WRAP_PROPERTY("settings-schema", Glib::RefPtr<SettingsSchema>)
#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
_WRAP_SIGNAL(void changed(const Glib::ustring& key), "changed", detail_name key, two_signal_methods)
- _WRAP_SIGNAL(bool writable_change_event(guint key), "writable-change-event")
+ _WRAP_SIGNAL(bool writable_change_event(GQuark key), "writable-change-event")
_WRAP_SIGNAL(void writable_changed(const Glib::ustring& key), writable_changed)
};
*/
explicit SimpleAction(const Glib::ustring& name);
- /** Creates a new stateful action.
+ /** Creates a new new stateful action.
+ *
+ * The created action is stateless.
*
* @a state is the initial state of the action. All future state values
* must have the same VariantType as the initial state.
_WRAP_METHOD_DOCS_ONLY(g_simple_action_group_new)
_WRAP_CREATE()
- _WRAP_METHOD(Glib::RefPtr<Action> lookup(const Glib::ustring& action_name), g_simple_action_group_lookup, refreturn, deprecated "Use ActionMap::lookup_action() instead")
- _WRAP_METHOD(Glib::RefPtr<const Action> lookup(const Glib::ustring& action_name) const, g_simple_action_group_lookup, refreturn, constversion, deprecated "Use ActionMap::lookup_action() instead")
-
- _WRAP_METHOD(void insert(const Glib::RefPtr<Action>& action), g_simple_action_group_insert, deprecated "Use ActionMap::add_action() instead")
- _WRAP_METHOD(void remove(const Glib::ustring& action_name), g_simple_action_group_remove, deprecated "Use ActionMap::remove_action() instead")
+ _IGNORE(g_simple_action_group_lookup, g_simple_action_group_insert, g_simple_action_group_remove)
_IGNORE(g_simple_action_group_add_entries) // deprecated
};
_WRAP_METHOD(void set_rehandshake_mode(TlsRehandshakeMode mode), g_tls_connection_set_rehandshake_mode)
_WRAP_METHOD(TlsRehandshakeMode get_rehandshake_mode() const, g_tls_connection_get_rehandshake_mode)
- _WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb = true), g_tls_connection_set_use_system_certdb,
- deprecated "Use set_database() instead.")
- _WRAP_METHOD(bool get_use_system_certdb() const, g_tls_connection_get_use_system_certdb,
- deprecated "Use get_database() instead.")
+ _IGNORE(g_tls_connection_set_use_system_certdb, g_tls_connection_get_use_system_certdb)
_WRAP_METHOD(Glib::RefPtr<TlsDatabase> get_database(), g_tls_connection_get_database)
_WRAP_METHOD(Glib::RefPtr<const TlsDatabase> get_database() const, g_tls_connection_get_database, constversion)
_WRAP_PROPERTY("peer-certificate-errors", TlsCertificateFlags)
_WRAP_PROPERTY("rehandshake-mode", TlsRehandshakeMode)
_WRAP_PROPERTY("require-close-notify", bool)
- _WRAP_PROPERTY("use-system-certdb", bool, deprecated "Use property_database() instead.")
+ _IGNORE_PROPERTY("use-system-certdb")
#m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr<const TlsCertificate>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(bool accept_certificate(const Glib::RefPtr<const TlsCertificate>& peer_cert, TlsCertificateFlags errors), "accept_certificate")
_WRAP_METHOD(static bool abstract_names_supported(), g_unix_socket_address_abstract_names_supported)
- _WRAP_PROPERTY("abstract", bool, deprecated "Use property_address_type() instead, which distinguishes between zero-padded and non-zero-padded abstract addresses.")
+ _IGNORE_PROPERTY("abstract")
_WRAP_PROPERTY("address-type", UnixSocketAddressType)
_WRAP_PROPERTY("path", std::string)
_WRAP_PROPERTY("path-as-array", Glib::RefPtr<ByteArray>)
_WRAP_METHOD(Glib::RefPtr<Volume> get_volume_for_uuid(const std::string& uuid), g_volume_monitor_get_volume_for_uuid, refreturn)
_WRAP_METHOD(Glib::RefPtr<Mount> get_mount_for_uuid(const std::string& uuid), g_volume_monitor_get_mount_for_uuid, refreturn)
- _WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount), g_volume_monitor_adopt_orphan_mount,
- deprecated "Instead of using this function, create shadow mounts with the URI of the mount you intend to adopt.")
+ _IGNORE(g_volume_monitor_adopt_orphan_mount)
#m4 _CONVERSION(`GVolume*',`const Glib::RefPtr<Volume>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void volume_added(const Glib::RefPtr<Volume>& volume), volume_added)
*
* If your source file is @c program.cc, you can compile it with:
* @code
- * g++ program.cc -o program `pkg-config --cflags --libs glibmm-2.4 giomm-2.4`
+ * g++ program.cc -o program `pkg-config --cflags --libs glibmm-2.52 giomm-2.52`
* @endcode
*
* Alternatively, if using autoconf, use the following in @c configure.ac:
* @code
- * PKG_CHECK_MODULES([GLIBMM], [glibmm-2.4 giomm-2.4])
+ * PKG_CHECK_MODULES([GLIBMM], [glibmm-2.52 giomm-2.52])
* @endcode
* Then use the generated @c GLIBMM_CFLAGS and @c GLIBMM_LIBS variables in the
* project Makefile.am files. For example:
//#include <glibmm/i18n.h> //This must be included by the application, after system headers such as
//<iostream>.
-// Include this first because we need it to be the first thing to include <glib.h>,
-// so we can do an undef trick to still use deprecated API in the header:
-#include <glibmm/thread.h>
-
-#include <glibmm/threads.h>
-
#include <glibmm/arrayhandle.h>
#include <glibmm/balancedtree.h>
#include <glibmm/base64.h>
#include <glibmm/slisthandle.h>
#include <glibmm/spawn.h>
#include <glibmm/stringutils.h>
-#include <glibmm/threadpool.h>
#include <glibmm/timer.h>
#include <glibmm/timeval.h>
#include <glibmm/timezone.h>
#include <glibmm/uriutils.h>
#include <glibmm/ustring.h>
#include <glibmm/value.h>
-#include <glibmm/valuearray.h>
#include <glibmm/variant.h>
#include <glibmm/variantdict.h>
#include <glibmm/variantiter.h>
Description: C++ wrapper for GLib
Version: @PACKAGE_VERSION@
URL: http://www.gtkmm.org/
-Requires: gobject-2.0 sigc++-2.0
+Requires: gobject-2.0 sigc++-3.0
Libs: -L${libdir} -lglibmm-@GLIBMM_API_VERSION@
Cflags: -I${includedir}/@GLIBMM_MODULE_NAME@ -I${libdir}/@GLIBMM_MODULE_NAME@/include
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef GLIBMM_CAN_USE_THREAD_LOCAL
-#include <glibmm/threads.h>
-#endif
-
#include <glibmm/dispatcher.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/fileutils.h>
explicit DispatchNotifier(const Glib::RefPtr<MainContext>& context);
private:
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
static thread_local DispatchNotifier* thread_specific_instance_;
-#else
- static Glib::Threads::Private<DispatchNotifier> thread_specific_instance_;
-#endif
std::set<const Dispatcher*> deleted_dispatchers_;
// static
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
thread_local DispatchNotifier* DispatchNotifier::thread_specific_instance_ = nullptr;
-#else
-Glib::Threads::Private<DispatchNotifier> DispatchNotifier::thread_specific_instance_;
-#endif
DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
: deleted_dispatchers_(),
try
{
- // PollFD::fd_t is the type of GPollFD::fd.
- // In Windows, it has the same size as HANDLE, but it's not guaranteed to be the same type.
- // In Unix, a file descriptor is an int.
- const auto fd = (PollFD::fd_t)fd_receiver_;
-
+#ifdef G_OS_WIN32
+ const int fd = GPOINTER_TO_INT(fd_receiver_);
+#else
+ const int fd = fd_receiver_;
+#endif
// The following code is equivalent to
// context_->signal_io().connect(
// sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN);
DispatchNotifier::reference_instance(
const Glib::RefPtr<MainContext>& context, const Dispatcher* dispatcher)
{
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
DispatchNotifier* instance = thread_specific_instance_;
-#else
- DispatchNotifier* instance = thread_specific_instance_.get();
-#endif
if (!instance)
{
instance = new DispatchNotifier(context);
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
thread_specific_instance_ = instance;
-#else
- thread_specific_instance_.replace(instance);
-#endif
}
else
{
void
DispatchNotifier::unreference_instance(DispatchNotifier* notifier, const Dispatcher* dispatcher)
{
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
DispatchNotifier* const instance = thread_specific_instance_;
-#else
- DispatchNotifier* const instance = thread_specific_instance_.get();
-#endif
// Yes, the notifier argument is only used to check for sanity.
g_return_if_fail(instance == notifier);
{
g_return_if_fail(instance->ref_count_ == 0); // could be < 0 if messed up
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
delete thread_specific_instance_;
thread_specific_instance_ = nullptr;
-#else
- thread_specific_instance_.replace(nullptr);
-#endif
}
}
}
sigc::connection
-Dispatcher::connect(const sigc::slot<void>& slot)
+Dispatcher::connect(const sigc::slot<void()>& slot)
{
return signal_.connect(slot);
}
sigc::connection
-Dispatcher::connect(sigc::slot<void>&& slot)
+Dispatcher::connect(sigc::slot<void()>&& slot)
{
return signal_.connect(std::move(slot));
}
/** Signal class for inter-thread communication.
* @ingroup Threads
- * Glib::Dispatcher works similar to sigc::signal<void>. But unlike normal
+ * Glib::Dispatcher works similar to sigc::signal<void()>. But unlike normal
* signals, the notification happens asynchronously through a pipe. This is
* a simple and efficient way of communicating between threads, and especially
* useful in a thread model with a single GUI thread.
void emit();
void operator()();
- sigc::connection connect(const sigc::slot<void>& slot);
+ sigc::connection connect(const sigc::slot<void()>& slot);
/** @newin{2,48}
*/
- sigc::connection connect(sigc::slot<void>&& slot);
+ sigc::connection connect(sigc::slot<void()>&& slot);
private:
- sigc::signal<void> signal_;
+ sigc::signal<void()> signal_;
DispatchNotifier* notifier_;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef GLIBMM_CAN_USE_THREAD_LOCAL
-#include <glibmm/threads.h>
-#endif
#include <glibmmconfig.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
// Each thread has its own list of exception handlers
// to avoid thread synchronization problems.
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
static thread_local HandlerList* thread_specific_handler_list = nullptr;
-#else
-static Glib::Threads::Private<HandlerList> thread_specific_handler_list;
-#endif
static void
glibmm_exception_warning(const GError* error)
{
sigc::connection
-add_exception_handler(const sigc::slot<void>& slot)
+add_exception_handler(const sigc::slot<void()>& slot)
{
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
HandlerList* handler_list = thread_specific_handler_list;
-#else
- HandlerList* handler_list = thread_specific_handler_list.get();
-#endif
if (!handler_list)
{
handler_list = new HandlerList();
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
thread_specific_handler_list = handler_list;
-#else
- thread_specific_handler_list.set(handler_list);
-#endif
}
handler_list->emplace_back(slot);
// handled. If there are no more handlers in the list and the exception
// is still unhandled, call glibmm_unexpected_exception().
-#ifdef GLIBMM_CAN_USE_THREAD_LOCAL
if (HandlerList* const handler_list = thread_specific_handler_list)
-#else
- if(HandlerList *const handler_list = thread_specific_handler_list.get())
-#endif
{
HandlerList::iterator pslot = handler_list->begin();
/** Specify a slot to be called when an exception is thrown by a signal handler.
*/
-sigc::connection add_exception_handler(const sigc::slot<void>& slot);
+sigc::connection add_exception_handler(const sigc::slot<void()>& slot);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// internal
signalproxy_connectionnode.cc \
streamiochannel.cc \
stringutils.cc \
- threadpool.cc \
timer.cc \
timeval.cc \
ustring.cc \
slisthandle.h \
streamiochannel.h \
stringutils.h \
- threadpool.h \
timer.h \
timeval.h \
ustring.h \
#include <glibmmconfig.h> // May define GLIBMM_DISABLE_DEPRECATED
-#ifndef GLIBMM_DISABLE_DEPRECATED
-// Include glibmm/thread.h first because we need it to be first to include <glib.h>,
-// so we can do an undef trick to still use deprecated API in the header:
-#include <glibmm/thread.h>
-#include <glibmm/threads.h>
-#endif // GLIBMM_DISABLE_DEPRECATED
-
#include <glibmm/main.h>
#include <glibmm/exceptionhandler.h>
#include <glibmm/wrap.h>
namespace
{
-#ifdef GLIBMM_DISABLE_DEPRECATED
void
time64_to_time_val(gint64 time64, Glib::TimeVal& time_val)
{
static_cast<long>(time64 - static_cast<gint64>(seconds) * G_GINT64_CONSTANT(1000000));
time_val = Glib::TimeVal(seconds, microseconds);
}
-#endif // GLIBMM_DISABLE_DEPRECATED
// TODO: At the next ABI break, replace ExtraSourceData by new data members in Source.
// Then the mutex is not necessary, but to keep the code thread-safe, use the
// Accesses to extra_source_data must be thread-safe.
std::mutex extra_source_data_mutex;
-class SourceConnectionNode
+class SourceConnectionNode : public sigc::notifiable
{
public:
explicit inline SourceConnectionNode(const sigc::slot_base& slot);
- static void* notify(void* data);
- static void destroy_notify_callback(void* data);
+ static void notify(sigc::notifiable* data);
+ static void destroy_notify_callback(sigc::notifiable* data);
inline void install(GSource* source);
inline sigc::slot_base* get_slot();
slot_.set_parent(this, &SourceConnectionNode::notify);
}
-void*
-SourceConnectionNode::notify(void* data)
+void
+SourceConnectionNode::notify(sigc::notifiable* data)
{
SourceConnectionNode* const self = static_cast<SourceConnectionNode*>(data);
// Destroying the object triggers execution of destroy_notify_handler(),
// either immediately or later, so we leave that to do the deletion.
}
-
- return nullptr;
}
// static
void
-SourceConnectionNode::destroy_notify_callback(void* data)
+SourceConnectionNode::destroy_notify_callback(sigc::notifiable* data)
{
SourceConnectionNode* const self = static_cast<SourceConnectionNode*>(data);
try
{
// Recreate the specific slot from the generic slot node.
- return (*static_cast<sigc::slot<bool>*>(conn_data->get_slot()))();
+ return (*static_cast<sigc::slot<bool()>*>(conn_data->get_slot()))();
}
catch (...)
{
try
{
// Recreate the specific slot from the generic slot node.
- (*static_cast<sigc::slot<void>*>(conn_data->get_slot()))();
+ (*static_cast<sigc::slot<void()>*>(conn_data->get_slot()))();
}
catch (...)
{
return 0; // Destroy the event source after one call
}
+static void
+glibmm_source_destroy_notify_callback(void* data)
+{
+ SourceConnectionNode* const conn_data = static_cast<SourceConnectionNode*>(data);
+ SourceConnectionNode::destroy_notify_callback(conn_data);
+}
+
static gboolean
glibmm_iosource_callback(GIOChannel*, GIOCondition condition, void* data)
{
try
{
// Recreate the specific slot from the generic slot node.
- return (*static_cast<sigc::slot<bool, Glib::IOCondition>*>(callback_data->node->get_slot()))(
+ return (*static_cast<sigc::slot<bool(Glib::IOCondition)>*>(callback_data->node->get_slot()))(
(Glib::IOCondition)condition);
}
catch (...)
try
{
// Recreate the specific slot from the generic slot node.
- (*static_cast<sigc::slot<void, GPid, int>*>(conn_data->get_slot()))(pid, child_status);
+ (*static_cast<sigc::slot<void(GPid, int)>*>(conn_data->get_slot()))(pid, child_status);
}
catch (...)
{
static void
glibmm_signal_connect_once(
- const sigc::slot<void>& slot, int priority, GSource* source, GMainContext* context)
+ const sigc::slot<void()>& slot, int priority, GSource* source, GMainContext* context)
{
SourceConnectionNode* const conn_node = new SourceConnectionNode(slot);
g_source_set_priority(source, priority);
g_source_set_callback(source, &glibmm_source_callback_once, conn_node,
- &SourceConnectionNode::destroy_notify_callback);
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context);
try
{
// Recreate the specific slot from the generic slot node.
- return (*static_cast<sigc::slot<bool>*>(slot))();
+ return (*static_cast<sigc::slot<bool()>*>(slot))();
}
catch (...)
{
gobject_.revents = 0;
}
-PollFD::PollFD(PollFD::fd_t fd)
+PollFD::PollFD(int fd)
{
gobject_.fd = fd;
gobject_.events = 0;
gobject_.revents = 0;
}
-PollFD::PollFD(PollFD::fd_t fd, IOCondition events)
+PollFD::PollFD(int fd, IOCondition events)
{
gobject_.fd = fd;
gobject_.events = events;
/* Note that this is our equivalent of g_timeout_add(). */
sigc::connection
-SignalTimeout::connect(const sigc::slot<bool>& slot, unsigned int interval, int priority)
+SignalTimeout::connect(const sigc::slot<bool()>& slot, unsigned int interval, int priority)
{
SourceConnectionNode* const conn_node = new SourceConnectionNode(slot);
const sigc::connection connection(*conn_node->get_slot());
g_source_set_priority(source, priority);
g_source_set_callback(
- source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+ source, &glibmm_source_callback, conn_node,
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context_);
}
void
-SignalTimeout::connect_once(const sigc::slot<void>& slot, unsigned int interval, int priority)
+SignalTimeout::connect_once(const sigc::slot<void()>& slot, unsigned int interval, int priority)
{
GSource* const source = g_timeout_source_new(interval);
glibmm_signal_connect_once(slot, priority, source, context_);
/* Note that this is our equivalent of g_timeout_add_seconds(). */
sigc::connection
-SignalTimeout::connect_seconds(const sigc::slot<bool>& slot, unsigned int interval, int priority)
+SignalTimeout::connect_seconds(const sigc::slot<bool()>& slot, unsigned int interval, int priority)
{
SourceConnectionNode* const conn_node = new SourceConnectionNode(slot);
const sigc::connection connection(*conn_node->get_slot());
g_source_set_priority(source, priority);
g_source_set_callback(
- source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+ source, &glibmm_source_callback, conn_node,
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context_);
void
SignalTimeout::connect_seconds_once(
- const sigc::slot<void>& slot, unsigned int interval, int priority)
+ const sigc::slot<void()>& slot, unsigned int interval, int priority)
{
GSource* const source = g_timeout_source_new_seconds(interval);
glibmm_signal_connect_once(slot, priority, source, context_);
}
sigc::connection
-SignalIdle::connect(const sigc::slot<bool>& slot, int priority)
+SignalIdle::connect(const sigc::slot<bool()>& slot, int priority)
{
SourceConnectionNode* const conn_node = new SourceConnectionNode(slot);
const sigc::connection connection(*conn_node->get_slot());
g_source_set_priority(source, priority);
g_source_set_callback(
- source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback);
+ source, &glibmm_source_callback, conn_node,
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context_);
}
void
-SignalIdle::connect_once(const sigc::slot<void>& slot, int priority)
+SignalIdle::connect_once(const sigc::slot<void()>& slot, int priority)
{
GSource* const source = g_idle_source_new();
glibmm_signal_connect_once(slot, priority, source, context_);
sigc::connection
SignalIO::connect(
- const sigc::slot<bool, IOCondition>& slot, PollFD::fd_t fd, IOCondition condition, int priority)
+ const sigc::slot<bool(IOCondition)>& slot, int fd, IOCondition condition, int priority)
{
const auto source = IOSource::create(fd, condition);
}
sigc::connection
-SignalIO::connect(const sigc::slot<bool, IOCondition>& slot, const Glib::RefPtr<IOChannel>& channel,
+SignalIO::connect(const sigc::slot<bool(IOCondition)>& slot, const Glib::RefPtr<IOChannel>& channel,
IOCondition condition, int priority)
{
const auto source = IOSource::create(channel, condition);
}
sigc::connection
-SignalChildWatch::connect(const sigc::slot<void, GPid, int>& slot, GPid pid, int priority)
+SignalChildWatch::connect(const sigc::slot<void(GPid, int)>& slot, GPid pid, int priority)
{
SourceConnectionNode* const conn_node = new SourceConnectionNode(slot);
const sigc::connection connection(*conn_node->get_slot());
if (priority != G_PRIORITY_DEFAULT)
g_source_set_priority(source, priority);
- g_source_set_callback(source, (GSourceFunc)&glibmm_child_watch_callback, conn_node,
- &SourceConnectionNode::destroy_notify_callback);
+ g_source_set_callback(source, (GSourceFunc)&glibmm_child_watch_callback,
+ conn_node,
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context_);
return g_main_context_acquire(gobj());
}
-#ifndef GLIBMM_DISABLE_DEPRECATED
-bool
-MainContext::wait(Glib::Cond& cond, Glib::Mutex& mutex)
-{
- return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
-}
-
-bool
-MainContext::wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex)
-{
- return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
-
void
MainContext::release()
{
}
void
-MainContext::invoke(const sigc::slot<bool>& slot, int priority)
+MainContext::invoke(const sigc::slot<bool()>& slot, int priority)
{
// Make a copy of slot on the heap.
- sigc::slot_base* const slot_copy = new sigc::slot<bool>(slot);
+ sigc::slot_base* const slot_copy = new sigc::slot<bool()>(slot);
g_main_context_invoke_full(gobj(), priority, glibmm_main_context_invoke_callback, slot_copy,
glibmm_main_context_invoke_destroy_notify_callback);
g_source_remove_poll(gobject_, poll_fd.gobj());
}
-#ifndef GLIBMM_DISABLE_DEPRECATED
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-void
-Source::get_current_time(Glib::TimeVal& current_time)
-{
- g_source_get_current_time(gobject_, ¤t_time);
-}
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif // GLIBMM_DISABLE_DEPRECATED
-
gint64
Source::get_time() const
{
g_source_set_priority(source, priority);
g_source_set_callback(
- source, callback_func, conn_node, &SourceConnectionNode::destroy_notify_callback);
+ source, callback_func, conn_node,
+ &glibmm_source_destroy_notify_callback);
conn_node->install(source);
g_source_attach(source, context);
}
sigc::connection
-TimeoutSource::connect(const sigc::slot<bool>& slot)
+TimeoutSource::connect(const sigc::slot<bool()>& slot)
{
return connect_generic(slot);
}
TimeoutSource::prepare(int& timeout)
{
Glib::TimeVal current_time;
-#ifndef GLIBMM_DISABLE_DEPRECATED
- get_current_time(current_time);
-#else
time64_to_time_val(get_time(), current_time);
-#endif // GLIBMM_DISABLE_DEPRECATED
Glib::TimeVal remaining = expiration_;
remaining.subtract(current_time);
TimeoutSource::check()
{
Glib::TimeVal current_time;
-#ifndef GLIBMM_DISABLE_DEPRECATED
- get_current_time(current_time);
-#else
time64_to_time_val(get_time(), current_time);
-#endif // GLIBMM_DISABLE_DEPRECATED
return (expiration_ <= current_time);
}
bool
TimeoutSource::dispatch(sigc::slot_base* slot)
{
- const bool again = (*static_cast<sigc::slot<bool>*>(slot))();
+ const bool again = (*static_cast<sigc::slot<bool()>*>(slot))();
if (again)
{
-#ifndef GLIBMM_DISABLE_DEPRECATED
- get_current_time(expiration_);
-#else
time64_to_time_val(get_time(), expiration_);
-#endif // GLIBMM_DISABLE_DEPRECATED
expiration_.add_milliseconds(std::min<unsigned long>(G_MAXLONG, interval_));
}
}
sigc::connection
-IdleSource::connect(const sigc::slot<bool>& slot)
+IdleSource::connect(const sigc::slot<bool()>& slot)
{
return connect_generic(slot);
}
bool
IdleSource::dispatch(sigc::slot_base* slot)
{
- return (*static_cast<sigc::slot<bool>*>(slot))();
+ return (*static_cast<sigc::slot<bool()>*>(slot))();
}
/**** Glib::IOSource *******************************************************/
// static
Glib::RefPtr<IOSource>
-IOSource::create(PollFD::fd_t fd, IOCondition condition)
+IOSource::create(int fd, IOCondition condition)
{
return Glib::RefPtr<IOSource>(new IOSource(fd, condition));
}
}
sigc::connection
-IOSource::connect(const sigc::slot<bool, IOCondition>& slot)
+IOSource::connect(const sigc::slot<bool(IOCondition)>& slot)
{
return connect_generic(slot);
}
-IOSource::IOSource(PollFD::fd_t fd, IOCondition condition) : poll_fd_(fd, condition)
+IOSource::IOSource(int fd, IOCondition condition) : poll_fd_(fd, condition)
{
add_poll(poll_fd_);
}
bool
IOSource::dispatch(sigc::slot_base* slot)
{
- return (*static_cast<sigc::slot<bool, IOCondition>*>(slot))(poll_fd_.get_revents());
+ return (*static_cast<sigc::slot<bool(IOCondition)>*>(slot))(poll_fd_.get_revents());
}
} // namespace Glib
namespace Glib
{
-#ifndef GLIBMM_DISABLE_DEPRECATED
-class Cond;
-class Mutex;
-
-namespace Threads
-{
-class Cond;
-class Mutex;
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
-
/** @defgroup MainLoop The Main Event Loop
* Manages all available sources of events.
* @{
class PollFD
{
public:
- using fd_t = decltype(GPollFD::fd);
-
PollFD();
- explicit PollFD(fd_t fd);
- PollFD(fd_t fd, IOCondition events);
+ explicit PollFD(int fd);
+ PollFD(int fd, IOCondition events);
- void set_fd(fd_t fd) { gobject_.fd = fd; }
- fd_t get_fd() const { return gobject_.fd; }
+ void set_fd(int fd) { gobject_.fd = fd; }
+ int get_fd() const { return gobject_.fd; }
void set_events(IOCondition events) { gobject_.events = events; }
IOCondition get_events() const { return static_cast<IOCondition>(gobject_.events); }
GPollFD gobject_;
};
-// Concerning SignalTimeout::connect_once(), SignalTimeout::connect_seconds_once()
-// and SignalIdle::connect_once():
-// See https://bugzilla.gnome.org/show_bug.cgi?id=396963 and
-// http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
-// It's recommended to replace sigc::slot<void>& by std::function<void()>& in
-// Threads::Thread::create() and ThreadPool::push() at the next ABI break.
-// Such a replacement would be a mixed blessing in SignalTimeout and SignalIdle.
-// In a single-threaded program auto-disconnection of trackable slots is safe
-// and can be useful.
-
class SignalTimeout
{
public:
* @return A connection handle, which can be used to disconnect the handler.
*/
sigc::connection connect(
- const sigc::slot<bool>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
+ const sigc::slot<bool()>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
/** Connects a timeout handler that runs only once.
* This method takes a function pointer to a function with a void return
* @param priority The priority of the new event source.
*/
void connect_once(
- const sigc::slot<void>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
+ const sigc::slot<void()>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
/** Connects a timeout handler with whole second granularity.
*
* @newin{2,14}
*/
sigc::connection connect_seconds(
- const sigc::slot<bool>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
+ const sigc::slot<bool()>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
/** Connects a timeout handler that runs only once with whole second
* granularity.
* @param priority The priority of the new event source.
*/
void connect_seconds_once(
- const sigc::slot<void>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
+ const sigc::slot<void()>& slot, unsigned int interval, int priority = PRIORITY_DEFAULT);
private:
GMainContext* context_;
* @param priority The priority of the new event source.
* @return A connection handle, which can be used to disconnect the handler.
*/
- sigc::connection connect(const sigc::slot<bool>& slot, int priority = PRIORITY_DEFAULT_IDLE);
+ sigc::connection connect(const sigc::slot<bool()>& slot, int priority = PRIORITY_DEFAULT_IDLE);
/** Connects an idle handler that runs only once.
* This method takes a function pointer to a function with a void return
* @endcode
* @param priority The priority of the new event source.
*/
- void connect_once(const sigc::slot<void>& slot, int priority = PRIORITY_DEFAULT_IDLE);
+ void connect_once(const sigc::slot<void()>& slot, int priority = PRIORITY_DEFAULT_IDLE);
private:
GMainContext* context_;
* @param priority The priority of the new event source.
* @return A connection handle, which can be used to disconnect the handler.
*/
- sigc::connection connect(const sigc::slot<bool, IOCondition>& slot, PollFD::fd_t fd, IOCondition condition,
+ sigc::connection connect(const sigc::slot<bool(IOCondition)>& slot, int fd, IOCondition condition,
int priority = PRIORITY_DEFAULT);
/** Connects an I/O handler that watches an I/O channel.
* @param priority The priority of the new event source.
* @return A connection handle, which can be used to disconnect the handler.
*/
- sigc::connection connect(const sigc::slot<bool, IOCondition>& slot,
+ sigc::connection connect(const sigc::slot<bool(IOCondition)>& slot,
const Glib::RefPtr<IOChannel>& channel, IOCondition condition, int priority = PRIORITY_DEFAULT);
private:
* @return A connection handle, which can be used to disconnect the handler.
*/
sigc::connection connect(
- const sigc::slot<void, GPid, int>& slot, GPid pid, int priority = PRIORITY_DEFAULT);
+ const sigc::slot<void(GPid, int)>& slot, GPid pid, int priority = PRIORITY_DEFAULT);
private:
GMainContext* context_;
*/
bool acquire();
-#ifndef GLIBMM_DISABLE_DEPRECATED
- /** Tries to become the owner of the specified context, as with acquire(). But if another thread
- * is the owner,
- * atomically drop mutex and wait on cond until that owner releases ownership or until cond is
- * signaled, then try
- * again (once) to become the owner.
- * @param cond A condition variable.
- * @param mutex A mutex, currently held.
- * @return true if the operation succeeded, and this thread is now the owner of context.
- *
- * @deprecated Use wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex) instead.
- */
- bool wait(Glib::Cond& cond, Glib::Mutex& mutex);
-
- // Deprecated mostly because it uses deprecated Glib::Threads:: for parameters.
- /** Tries to become the owner of the specified context, as with acquire(). But if another thread
- * is the owner,
- * atomically drop mutex and wait on cond until that owner releases ownership or until cond is
- * signaled, then try
- * again (once) to become the owner.
- * @param cond A condition variable.
- * @param mutex A mutex, currently held.
- * @return true if the operation succeeded, and this thread is now the owner of context.
- *
- * @deprecated Please use the underlying g_main_context_wait() function if you really need this
- * functionality.
- */
- bool wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex);
-#endif // GLIBMM_DISABLE_DEPRECATED
-
/** Releases ownership of a context previously acquired by this thread with acquire(). If the
* context was acquired
* multiple times, the only release ownership when release() is called as many times as it was
*
* @newin{2,38}
*/
- void invoke(const sigc::slot<bool>& slot, int priority = PRIORITY_DEFAULT);
+ void invoke(const sigc::slot<bool()>& slot, int priority = PRIORITY_DEFAULT);
/** Timeout signal, attached to this MainContext.
* @return A signal proxy; you want to use SignalTimeout::connect().
using CppObjectType = Glib::TimeoutSource;
static Glib::RefPtr<TimeoutSource> create(unsigned int interval);
- sigc::connection connect(const sigc::slot<bool>& slot);
+ sigc::connection connect(const sigc::slot<bool()>& slot);
protected:
explicit TimeoutSource(unsigned int interval);
using CppObjectType = Glib::IdleSource;
static Glib::RefPtr<IdleSource> create();
- sigc::connection connect(const sigc::slot<bool>& slot);
+ sigc::connection connect(const sigc::slot<bool()>& slot);
protected:
IdleSource();
public:
using CppObjectType = Glib::IOSource;
- static Glib::RefPtr<IOSource> create(PollFD::fd_t fd, IOCondition condition);
+ static Glib::RefPtr<IOSource> create(int fd, IOCondition condition);
static Glib::RefPtr<IOSource> create(
const Glib::RefPtr<IOChannel>& channel, IOCondition condition);
- sigc::connection connect(const sigc::slot<bool, IOCondition>& slot);
+ sigc::connection connect(const sigc::slot<bool(IOCondition)>& slot);
protected:
- IOSource(PollFD::fd_t fd, IOCondition condition);
+ IOSource(int fd, IOCondition condition);
IOSource(const Glib::RefPtr<IOChannel>& channel, IOCondition condition);
/** Wrap an existing GSource object and install the given callback function.
void
ObjectBase::connect_property_changed(
- const Glib::ustring& property_name, const sigc::slot<void>& slot)
+ const Glib::ustring& property_name, const sigc::slot<void()>& slot)
{
connect_property_changed_with_return(property_name, slot);
}
void
-ObjectBase::connect_property_changed(const Glib::ustring& property_name, sigc::slot<void>&& slot)
+ObjectBase::connect_property_changed(const Glib::ustring& property_name, sigc::slot<void()>&& slot)
{
connect_property_changed_with_return(property_name, std::move(slot));
}
sigc::connection
ObjectBase::connect_property_changed_with_return(
- const Glib::ustring& property_name, const sigc::slot<void>& slot)
+ const Glib::ustring& property_name, const sigc::slot<void()>& slot)
{
// Create a proxy to hold our connection info
// This will be deleted by destroy_notify_handler.
sigc::connection
ObjectBase::connect_property_changed_with_return(
- const Glib::ustring& property_name, sigc::slot<void>&& slot)
+ const Glib::ustring& property_name, sigc::slot<void()>&& slot)
{
// Create a proxy to hold our connection info
// This will be deleted by destroy_notify_handler.
*
* See also connect_property_changed_with_return().
*/
- void connect_property_changed(const Glib::ustring& property_name, const sigc::slot<void>& slot);
+ void connect_property_changed(const Glib::ustring& property_name, const sigc::slot<void()>& slot);
/** You can use the signal_changed() signal of the property proxy instead.
*
* @newin{2,48}
*/
- void connect_property_changed(const Glib::ustring& property_name, sigc::slot<void>&& slot);
+ void connect_property_changed(const Glib::ustring& property_name, sigc::slot<void()>&& slot);
/** You can use the signal_changed() signal of the property proxy instead.
*
* and we could not break the ABI by changing that function.
*/
sigc::connection connect_property_changed_with_return(
- const Glib::ustring& property_name, const sigc::slot<void>& slot);
+ const Glib::ustring& property_name, const sigc::slot<void()>& slot);
/** You can use the signal_changed() signal of the property proxy instead.
*
* @newin{2,48}
*/
sigc::connection connect_property_changed_with_return(
- const Glib::ustring& property_name, sigc::slot<void>&& slot);
+ const Glib::ustring& property_name, sigc::slot<void()>&& slot);
/** Increases the freeze count on object. If the freeze count is non-zero, the
* emission of "notify" signals on object is stopped. The signals are queued
if (pspec && data)
{
if (sigc::slot_base* const slot = SignalProxyBase::data_to_slot(data))
- (*static_cast<sigc::slot<void>*>(slot))();
+ (*static_cast<sigc::slot<void()>*>(slot))();
}
}
SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name);
~SignalProxyProperty() noexcept;
- using SlotType = sigc::slot<void>;
+ using SlotType = sigc::slot<void()>;
sigc::connection connect(const SlotType& slot);
/** @newin{2,48}
*/
try
{
if (sigc::slot_base* const slot = data_to_slot(data))
- (*static_cast<sigc::slot<void>*>(slot))();
+ (*static_cast<sigc::slot<void()>*>(slot))();
}
catch (...)
{
* to connect signal handlers to signals.
*/
template <class R, class... T>
-class SignalProxy : public SignalProxyNormal
+class SignalProxy;
+
+/** Proxy for signals with any number of arguments.
+ * Use the connect() or connect_notify() method, with sigc::mem_fun() or sigc::ptr_fun()
+ * to connect signal handlers to signals.
+ */
+template <class R, class... T>
+class SignalProxy<R(T...)> : public SignalProxyNormal
{
public:
- using SlotType = sigc::slot<R, T...>;
- using VoidSlotType = sigc::slot<void, T...>;
+ using SlotType = sigc::slot<R(T...)>;
+ using VoidSlotType = sigc::slot<void(T...)>;
SignalProxy(ObjectBase* obj, const SignalProxyInfo* info) : SignalProxyNormal(obj, info) {}
}
};
-/* Templates below has been added to avoid API break, and should not be
- * used in a newly created code. SignalProxy class should be used instead
- * of SignalProxy# class.
- */
-template <typename R>
-using SignalProxy0 = SignalProxy<R>;
-template <typename R, typename T1>
-using SignalProxy1 = SignalProxy<R, T1>;
-template <typename R, typename T1, typename T2>
-using SignalProxy2 = SignalProxy<R, T1, T2>;
-template <typename R, typename T1, typename T2, typename T3>
-using SignalProxy3 = SignalProxy<R, T1, T2, T3>;
-template <typename R, typename T1, typename T2, typename T3, typename T4>
-using SignalProxy4 = SignalProxy<R, T1, T2, T3, T4>;
-template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5>
-using SignalProxy5 = SignalProxy<R, T1, T2, T3, T4, T5>;
-template <typename R, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-using SignalProxy6 = SignalProxy<R, T1, T2, T3, T4, T5, T6>;
-
// TODO: When we can break ABI, consider renaming
// SignalProxyDetailed => SignalProxyDetailedBase
// SignalProxyDetailedAnyType => SignalProxyDetailed
* to connect signal handlers to signals.
*/
template <class R, class... T>
-class SignalProxyDetailedAnyType : public SignalProxyDetailed
+class SignalProxyDetailedAnyType;
+
+template <class R, class... T>
+class SignalProxyDetailedAnyType<R(T...)> : public SignalProxyDetailed
{
public:
- using SlotType = sigc::slot<R, T...>;
- using VoidSlotType = sigc::slot<void, T...>;
+ using SlotType = sigc::slot<R(T...)>;
+ using VoidSlotType = sigc::slot<void(T...)>;
SignalProxyDetailedAnyType(
ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name)
// notify is a message coming up from the slot to be passed back to Gtk+
// disconnect is a message coming up from the Gtk+ to be passed down to SigC++
// static
-void*
-SignalProxyConnectionNode::notify(void* data)
+void
+SignalProxyConnectionNode::notify(sigc::notifiable* data)
{
// notification from libsigc++.
SignalProxyConnectionNode* conn = static_cast<SignalProxyConnectionNode*>(data);
g_signal_handler_disconnect(o, connection_id);
}
}
-
- return nullptr; // apparently unused in libsigc++
}
// static
* It lives between the layer of Gtk+ and libsigc++.
* It is very much an internal class.
*/
-class SignalProxyConnectionNode
+class SignalProxyConnectionNode : public sigc::notifiable
{
public:
/** @param slot The signal handler for the glib signal.
* This callback is registered in the slot.
* @param data The SignalProxyConnectionNode object (@p this).
*/
- static void* notify(void* data);
+ static void notify(sigc::notifiable* data);
/** Callback that is executed when the glib closure is destroyed.
* @param data The SignalProxyConnectionNode object (@p this).
+++ /dev/null
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmmconfig.h>
-#ifndef GLIBMM_DISABLE_DEPRECATED
-
-#include <glibmm/threadpool.h>
-#include <glibmm/exceptionhandler.h>
-#include <glibmm/threads.h>
-#include <glib.h>
-#include <list>
-
-namespace Glib
-{
-
-// internal
-class ThreadPool::SlotList
-{
-public:
- SlotList();
- ~SlotList() noexcept;
-
- // noncopyable
- SlotList(const ThreadPool::SlotList&) = delete;
- ThreadPool::SlotList& operator=(const ThreadPool::SlotList&) = delete;
-
- sigc::slot<void>* push(const sigc::slot<void>& slot);
- sigc::slot<void> pop(sigc::slot<void>* slot_ptr);
-
- void lock_and_unlock();
-
-private:
- Glib::Threads::Mutex mutex_;
- std::list<sigc::slot<void>> list_;
-};
-
-ThreadPool::SlotList::SlotList()
-{
-}
-
-ThreadPool::SlotList::~SlotList() noexcept
-{
-}
-
-sigc::slot<void>*
-ThreadPool::SlotList::push(const sigc::slot<void>& slot)
-{
- Threads::Mutex::Lock lock(mutex_);
-
- list_.emplace_back(slot);
- return &list_.back();
-}
-
-sigc::slot<void>
-ThreadPool::SlotList::pop(sigc::slot<void>* slot_ptr)
-{
- sigc::slot<void> slot;
-
- {
- Threads::Mutex::Lock lock(mutex_);
-
- std::list<sigc::slot<void>>::iterator pslot = list_.begin();
- while (pslot != list_.end() && slot_ptr != &*pslot)
- ++pslot;
-
- if (pslot != list_.end())
- {
- slot = *pslot;
- list_.erase(pslot);
- }
- }
-
- return slot;
-}
-
-void
-ThreadPool::SlotList::lock_and_unlock()
-{
- mutex_.lock();
- mutex_.unlock();
-}
-
-} // namespace Glib
-
-namespace
-{
-
-static void
-call_thread_entry_slot(void* data, void* user_data)
-{
- try
- {
- Glib::ThreadPool::SlotList* const slot_list =
- static_cast<Glib::ThreadPool::SlotList*>(user_data);
-
- sigc::slot<void> slot(slot_list->pop(static_cast<sigc::slot<void>*>(data)));
-
- slot();
- }
- catch (Glib::Threads::Thread::Exit&)
- {
- // Just exit from the thread. The Thread::Exit exception
- // is our sane C++ replacement of g_thread_exit().
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-}
-
-} // anonymous namespace
-
-namespace Glib
-{
-
-ThreadPool::ThreadPool(int max_threads, bool exclusive)
-: gobject_(nullptr), slot_list_(new SlotList())
-{
- GError* error = nullptr;
-
- gobject_ = g_thread_pool_new(&call_thread_entry_slot, slot_list_, max_threads, exclusive, &error);
-
- if (error)
- {
- delete slot_list_;
- slot_list_ = nullptr;
- Glib::Error::throw_exception(error);
- }
-}
-
-ThreadPool::~ThreadPool() noexcept
-{
- if (gobject_)
- g_thread_pool_free(gobject_, 1, 1);
-
- if (slot_list_)
- {
- slot_list_->lock_and_unlock();
- delete slot_list_;
- }
-}
-
-void
-ThreadPool::push(const sigc::slot<void>& slot)
-{
- sigc::slot<void>* const slot_ptr = slot_list_->push(slot);
-
- GError* error = nullptr;
- g_thread_pool_push(gobject_, slot_ptr, &error);
-
- if (error)
- {
- slot_list_->pop(slot_ptr);
- Glib::Error::throw_exception(error);
- }
-}
-
-void
-ThreadPool::set_max_threads(int max_threads)
-{
- GError* error = nullptr;
- g_thread_pool_set_max_threads(gobject_, max_threads, &error);
-
- if (error)
- Glib::Error::throw_exception(error);
-}
-
-int
-ThreadPool::get_max_threads() const
-{
- return g_thread_pool_get_max_threads(gobject_);
-}
-
-unsigned int
-ThreadPool::get_num_threads() const
-{
- return g_thread_pool_get_num_threads(gobject_);
-}
-
-unsigned int
-ThreadPool::unprocessed() const
-{
- return g_thread_pool_unprocessed(gobject_);
-}
-
-bool
-ThreadPool::get_exclusive() const
-{
- g_return_val_if_fail(gobject_ != nullptr, false);
-
- return gobject_->exclusive;
-}
-
-void
-ThreadPool::shutdown(bool immediately)
-{
- if (gobject_)
- {
- g_thread_pool_free(gobject_, immediately, 1);
- gobject_ = nullptr;
- }
-
- if (slot_list_)
- {
- slot_list_->lock_and_unlock();
- delete slot_list_;
- slot_list_ = nullptr;
- }
-}
-
-// static
-void
-ThreadPool::set_max_unused_threads(int max_threads)
-{
- g_thread_pool_set_max_unused_threads(max_threads);
-}
-
-// static
-int
-ThreadPool::get_max_unused_threads()
-{
- return g_thread_pool_get_max_unused_threads();
-}
-
-// static
-unsigned int
-ThreadPool::get_num_unused_threads()
-{
- return g_thread_pool_get_num_unused_threads();
-}
-
-// static
-void
-ThreadPool::stop_unused_threads()
-{
- g_thread_pool_stop_unused_threads();
-}
-
-} // namespace Glib
-
-#endif // GLIBMM_DISABLE_DEPRECATED
+++ /dev/null
-#ifndef _GLIBMM_THREADPOOL_H
-#define _GLIBMM_THREADPOOL_H
-
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmmconfig.h>
-
-#ifndef GLIBMM_DISABLE_DEPRECATED
-
-#include <sigc++/sigc++.h>
-
-extern "C" {
-using GThreadPool = struct _GThreadPool;
-}
-
-namespace Glib
-{
-
-/** @defgroup ThreadPools Thread Pools
- * Pools of threads to execute work concurrently.
- *
- * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
- *
- * @{
- */
-
-// TODO: Is std::async() an appropriate replacement to mention for this deprecated API?
-
-/** A pool of threads to execute work concurrently.
- *
- * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
- */
-class ThreadPool
-{
-public:
- /** Constructs a new thread pool.
- * Whenever you call ThreadPool::push(), either a new thread is created or an
- * unused one is reused. At most @a max_threads threads are running
- * concurrently for this thread pool. @a max_threads = -1 allows
- * unlimited threads to be created for this thread pool.
- *
- * The parameter @a exclusive determines, whether the thread pool owns all
- * threads exclusive or whether the threads are shared globally. If @a
- * exclusive is <tt>true</tt>, @a max_threads threads are started immediately
- * and they will run exclusively for this thread pool until it is destroyed
- * by ~ThreadPool(). If @a exclusive is <tt>false</tt>, threads are created
- * when needed and shared between all non-exclusive thread pools. This
- * implies that @a max_threads may not be -1 for exclusive thread pools.
- *
- * @param max_threads The maximal number of threads to execute concurrently
- * in the new thread pool, -1 means no limit.
- * @param exclusive Should this thread pool be exclusive?
- * @throw Glib::ThreadError An error can only occur when @a exclusive is
- * set to <tt>true</tt> and not all @a max_threads threads could be created.
- */
- explicit ThreadPool(int max_threads = -1, bool exclusive = false);
- virtual ~ThreadPool() noexcept;
-
- // See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
- // TODO: At the next ABI break, consider changing const sigc::slot<void>& slot
- // to const std::function<void()>& func, if it can be assumed that all supported
- // compilers understand the C++11 template class std::function<>.
- /** Inserts @a slot into the list of tasks to be executed by the pool.
- * When the number of currently running threads is lower than the maximal
- * allowed number of threads, a new thread is started (or reused). Otherwise
- * @a slot stays in the queue until a thread in this pool finishes its
- * previous task and processes @a slot.
- *
- * Because sigc::trackable is not thread-safe, if the slot represents a
- * non-static class method and is created by sigc::mem_fun(), the class concerned
- * should not derive from sigc::trackable. You can use, say, boost::bind() or,
- * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun().
- *
- * @param slot A new task for the thread pool.
- * @throw Glib::ThreadError An error can only occur when a new thread
- * couldn't be created. In that case @a slot is simply appended to the
- * queue of work to do.
- */
- void push(const sigc::slot<void>& slot);
-
- /** Sets the maximal allowed number of threads for the pool.
- * A value of -1 means that the maximal number of threads is unlimited.
- * Setting @a max_threads to 0 means stopping all work for pool. It is
- * effectively frozen until @a max_threads is set to a non-zero value again.
- *
- * A thread is never terminated while it is still running. Instead the
- * maximal number of threads only has effect for the allocation of new
- * threads in ThreadPool::push(). A new thread is allocated whenever the
- * number of currently running threads in the pool is smaller than the
- * maximal number.
- *
- * @param max_threads A new maximal number of threads for the pool.
- * @throw Glib::ThreadError An error can only occur when a new thread
- * couldn't be created.
- */
- void set_max_threads(int max_threads);
-
- /** Returns the maximal number of threads for the pool.
- * @return The maximal number of threads.
- */
- int get_max_threads() const;
-
- /** Returns the number of threads currently running in the pool.
- * @return The number of threads currently running.
- */
- unsigned int get_num_threads() const;
-
- /** Returns the number of tasks still unprocessed in the pool.
- * @return The number of unprocessed tasks.
- */
- unsigned int unprocessed() const;
-
- /** Returns whether all threads are exclusive to this pool.
- * @return Whether all threads are exclusive to this pool.
- */
- bool get_exclusive() const;
-
- /** Frees all resources allocated for the pool.
- * If @a immediately is <tt>true</tt>, no new task is processed. Otherwise the
- * pool is not freed before the last task is processed. Note however, that no
- * thread of this pool is interrupted while processing a task. Instead at least
- * all still running threads can finish their tasks before the pool is freed.
- *
- * This method does not return before all tasks to be processed (dependent on
- * @a immediately, whether all or only the currently running) are ready.
- * After calling shutdown() the pool must not be used anymore.
- *
- * @param immediately Should the pool shut down immediately?
- */
- void shutdown(bool immediately = false);
-
- /** Sets the maximal number of unused threads to @a max_threads.
- * If @a max_threads is -1, no limit is imposed on the number of unused threads.
- * @param max_threads Maximal number of unused threads.
- */
- static void set_max_unused_threads(int max_threads);
-
- /** Returns the maximal allowed number of unused threads.
- * @return The maximal number of unused threads.
- */
- static int get_max_unused_threads();
-
- /** Returns the number of currently unused threads.
- * @return The number of currently unused threads.
- */
- static unsigned int get_num_unused_threads();
-
- /** Stops all currently unused threads.
- * This does not change the maximal number of unused threads. This function can
- * be used to regularly stop all unused threads e.g. from Glib::signal_timeout().
- */
- static void stop_unused_threads();
-
- GThreadPool* gobj() { return gobject_; }
- const GThreadPool* gobj() const { return gobject_; }
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- class SlotList;
-#endif
-
-private:
- GThreadPool* gobject_;
- SlotList* slot_list_;
-
- ThreadPool(const ThreadPool&);
- ThreadPool& operator=(const ThreadPool&);
-};
-
-/** @} group ThreadPools */
-
-/***************************************************************************/
-/* inline implementation */
-/***************************************************************************/
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-/**** Glib::Private ********************************************************/
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-} // namespace Glib
-
-#endif // GLIBMM_DISABLE_DEPRECATED
-
-#endif /* _GLIBMM_THREADPOOL_H */
return const_reverse_iterator(const_iterator(string_.begin()));
}
+ustring::const_iterator
+ustring::cbegin() const
+{
+ return const_iterator(string_.begin());
+}
+
+ustring::const_iterator
+ustring::cend() const
+{
+ return const_iterator(string_.end());
+}
+
/**** Glib::ustring::find() ************************************************/
ustring::size_type
const_reverse_iterator rbegin() const;
const_reverse_iterator rend() const;
+ /**
+ * @newin{2,52}
+ */
+ const_iterator cbegin() const;
+
+ /**
+ * @newin{2,52}
+ */
+ const_iterator cend() const;
+
//! @}
//! @name Find sub-strings.
//! @{
{
_CLASS_GENERIC(BalancedTree, GTree)
public:
- using TraverseFunc = sigc::slot<bool, const K&, const V&>;
- using CompareFunc = sigc::slot<int, const K&, const K&>;
+ using TraverseFunc = sigc::slot<bool(const K&, const V&)>;
+ using CompareFunc = sigc::slot<int(const K&, const K&)>;
protected:
BalancedTree() :
*/
V* search(const CompareFunc &search_func, const K& key)
{
- sigc::slot<int, const K&, const CompareFunc&, const K&> real_slot = sigc::ptr_fun(on_compare_key);
- sigc::slot<int, const K&> bound_slot = sigc::bind(real_slot, search_func, key);
+ sigc::slot<int(const K&, const CompareFunc&, const K&)> real_slot = sigc::ptr_fun(on_compare_key);
+ sigc::slot<int(const K&)> bound_slot = sigc::bind(real_slot, search_func, key);
gpointer value = g_tree_search(gobj(), c_callback_search, reinterpret_cast<gconstpointer>(&bound_slot));
return reinterpret_cast<V*>(value);
/// Wrapper for invoking GCompareFunc.
static gint c_callback_search(gconstpointer a, gconstpointer b)
{
- const sigc::slot<int, const K&>* slot = reinterpret_cast<const sigc::slot<int, const K&> *>(b);
+ const auto slot = reinterpret_cast<const sigc::slot<int(const K&)> *>(b);
return (*slot)(*reinterpret_cast<const K*>(a));
}
*
* @return <tt>true</tt> if the transformation was successful, and <tt>false</tt> otherwise.
*/
- using SlotTransform = sigc::slot<bool, const GValue*, GValue*>;
+ using SlotTransform = sigc::slot<bool(const GValue*, GValue*)>;
/** Creates a binding between @a source_property and @a target_property,
* allowing you to set the transformation functions to be used by the binding.
* stored in a Glib::Value<T_target> object.
* @tparam T_functor_to Type of functor that translates from the source to the target.
* Must be convertible to<br>
- * sigc::slot<bool, const T_source&, T_target&>.
+ * sigc::slot<bool(const T_source&, T_target&)>.
*
* @see bind_property_value()
*
BindingFlags flags,
const T_functor_to& transform_to)
{
- sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to;
+ sigc::slot<bool(const T_source&, T_target&)> slot_transform_to = transform_to;
return bind_property_value(source_property, target_property, flags,
slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to));
* stored in a Glib::Value<T_target> object.
* @tparam T_functor_to Type of functor that translates from the source to the target.
* Must be convertible to<br>
- * sigc::slot<bool, const T_source&, T_target&>.
+ * sigc::slot<bool(const T_source&, T_target&)>.
*
* @see bind_property_value()
*
BindingFlags flags,
const T_functor_to& transform_to)
{
- sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to;
+ sigc::slot<bool(const T_source&, T_target&)> slot_transform_to = transform_to;
return bind_property_value(source_property, target_property, flags,
slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to));
* stored in a Glib::Value<T_target> object.
* @tparam T_functor_to Type of functor that translates from the source to the target.
* Must be convertible to<br>
- * sigc::slot<bool, const T_source&, T_target&>.
+ * sigc::slot<bool(const T_source&, T_target&)>.
*
* @see bind_property_value()
*
BindingFlags flags,
const T_functor_to& transform_to)
{
- sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to;
+ sigc::slot<bool(const T_source&, T_target&)> slot_transform_to = transform_to;
return bind_property_value(source_property, target_property, flags,
slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to));
* stored in a Glib::Value<T_target> object.
* @tparam T_functor_to Type of functor that translates from the source to the target.
* Must be convertible to<br>
- * sigc::slot<bool, const T_source&, T_target&>.
+ * sigc::slot<bool(const T_source&, T_target&)>.
*
* @see bind_property_value()
*
BindingFlags flags,
const T_functor_to& transform_to)
{
- sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to;
+ sigc::slot<bool(const T_source&, T_target&)> slot_transform_to = transform_to;
return bind_property_value(source_property, target_property, flags,
slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to));
* stored in a Glib::Value<T_target> object.
* @tparam T_functor_to Type of functor that translates from the source to the target.
* Must be convertible to<br>
- * sigc::slot<bool, const T_source&, T_target&>.
+ * sigc::slot<bool(const T_source&, T_target&)>.
* @tparam T_functor_from Type of functor that translates from the target to the source.
* Must be convertible to<br>
- * sigc::slot<bool, const T_target&, T_source&>.
+ * sigc::slot<bool(const T_target&, T_source&)>.
*
* @see bind_property_value()
*
const T_functor_to& transform_to,
const T_functor_from& transform_from)
{
- sigc::slot<bool, const T_source&, T_target&> slot_transform_to = transform_to;
- sigc::slot<bool, const T_target&, T_source&> slot_transform_from = transform_from;
+ sigc::slot<bool(const T_source&, T_target&)> slot_transform_to = transform_to;
+ sigc::slot<bool(const T_target&, T_source&)> slot_transform_from = transform_from;
return bind_property_value(source_property, target_property, flags,
slot_transform_to.empty() ? SlotTransform() : TransformProp<T_source, T_target>(slot_transform_to),
// The functor TransformProp can be implicitly converted to a SlotTransform
// and used in a call to bind_property_value().
template <typename T_from, typename T_to>
- class TransformProp : public sigc::functor_base
+ class TransformProp
{
public:
- using result_type = bool;
- using SlotTypedTransform = sigc::slot<bool, const T_from&, T_to&>;
+ using SlotTypedTransform = sigc::slot<bool(const T_from&, T_to&)>;
TransformProp(const SlotTypedTransform& slot) : typed_transform(slot) {}
* int compare(const guint8* first, const guint8* second);
* </code>
*/
- using SlotCompare = sigc::slot<int, const guint8*, const guint8*>;
+ using SlotCompare = sigc::slot<int(const guint8*, const guint8*)>;
_WRAP_METHOD(static Glib::RefPtr<ByteArray> create(), g_byte_array_new)
g_date_set_parse(&gobject_, str.c_str());
}
-_DEPRECATE_IFDEF_START
-
-// Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32)
-// That would make the set_time() method overload impossible.
-#ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
-void
-Date::set_time(GTime time)
-{
- // This method, and the C function g_date_set_time() that it wraps, are deprecated.
- //(::time_t is used here instead of std::time_t, since the C function is declared
- // with ::time_t. It's not important. The C++ standard requires that ::time_t
- // and std::time_t shall be identical when both are defined.)
- g_date_set_time_t(&gobject_, static_cast<time_t>(time));
-}
-#endif // GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
-
-_DEPRECATE_IFDEF_END
-
void
Date::set_time(std::time_t timet)
{
*/
void set_parse (const Glib::ustring& str);
-
- _DEPRECATE_IFDEF_START
-
- //Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32)
- //That would make the set_time() method overload impossible.
- #ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
- /** Sets the value of a date from a GTime value.
- *
- * @param time GTime value to set.
- *
- * @deprecated Please use set_time(std::time_t) or set_time(const GTimeVal&).
- */
- void set_time(GTime time);
- #endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32
-
- _DEPRECATE_IFDEF_END
-
-
/** Sets the value of a date from a <type>std::time_t</type> value.
*
* @param timet std::time_t value to set
regex.hg \
shell.hg \
spawn.hg \
- thread.hg \
- threads.hg \
timezone.hg \
unicode.hg \
uriutils.hg \
- valuearray.hg \
variant.hg \
variantdict.hg \
variantiter.hg \
#m4 _CONVERSION(`const Glib::ArrayHandle<std::string>&', `const gchar**', `const_cast<const gchar**>($3.data())')
#m4 _CONVERSION(`Glib::ArrayHandle<std::string>&', `gchar**', `const_cast<gchar**>($3.data())')
- _WRAP_METHOD(bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs, Glib::ArrayHandle<std::string>& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE),
- g_key_file_load_from_dirs, errthrow, deprecated "Use the load_from_dirs() method that takes a std::string& full_path.")
+ _IGNORE(g_key_file_load_from_dirs)
_WRAP_METHOD_DOCS_ONLY(g_key_file_load_from_dirs)
bool load_from_dirs(const std::string& file, const Glib::ArrayHandle<std::string>& search_dirs, std::string& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE);
return convert_return_gchar_ptr_to_stdstring(g_get_current_dir());
}
-#ifndef GLIBMM_DISABLE_DEPRECATED
-std::string
-get_user_special_dir(GUserDirectory directory)
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir(directory));
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
-
std::string
get_user_special_dir(UserDirectory directory)
{
*/
std::string get_current_dir();
-#ifndef GLIBMM_DISABLE_DEPRECATED
-/** Returns the full path of a special directory using its logical id.
- *
- * On Unix this is done using the XDG special user directories.
- * For compatibility with existing practise, G_USER_DIRECTORY_DESKTOP
- * falls back to `$HOME/Desktop` when XDG special user directories have
- * not been set up.
- *
- * Depending on the platform, the user might be able to change the path
- * of the special directory without requiring the session to restart; GLib
- * will not reflect any change once the special directories are loaded.
- *
- * @param directory The logical id of special directory.
- * @return The path to the specified special directory, or an empty string
- * if the logical id was not found.
- *
- * @newin{2,14}
- * @deprecated Use get_user_special_dir(Glib::UserDirectory directory) instead.
- */
-std::string get_user_special_dir(GUserDirectory directory);
-#endif // GLIBMM_DISABLE_DEPRECATED
-
/** Returns the full path of a special directory using its logical id.
*
* On Unix this is done using the XDG special user directories.
{
_CLASS_GENERIC(NodeTree, GNode)
public:
- using TraverseFunc = sigc::slot<bool, NodeTree<T>&>;
- using ForeachFunc = sigc::slot<void, NodeTree<T>&>;
+ using TraverseFunc = sigc::slot<bool(NodeTree<T>&)>;
+ using ForeachFunc = sigc::slot<void(NodeTree<T>&)>;
private:
static NodeTree<T>* wrap(GNode* node)
*/
NodeTree<T>* find_child(const T& the_data, TraverseFlags flags = TRAVERSE_ALL)
{
- sigc::slot<void, GNode*, const T&, GNode**> real_slot = sigc::ptr_fun(on_compare_child);
+ sigc::slot<void(GNode*, const T&, GNode**)> real_slot = sigc::ptr_fun(on_compare_child);
GNode* child = nullptr;
- using type_foreach_gnode_slot = sigc::slot<void, GNode*>;
+ using type_foreach_gnode_slot = sigc::slot<void(GNode*)>;
type_foreach_gnode_slot bound_slot = sigc::bind(real_slot, the_data, &child);
g_node_children_foreach(gobj(), (GTraverseFlags)flags, c_callback_foreach_compare_child, reinterpret_cast<gpointer>(&bound_slot));
NodeTree<T>* find(const T& the_data, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL)
{
//We use a sigc::slot for the C callback, so we can bind some extra data.
- sigc::slot<gboolean, GNode*, const T&, GNode**> real_slot = sigc::ptr_fun(on_compare_node);
+ sigc::slot<gboolean(GNode*, const T&, GNode**)> real_slot = sigc::ptr_fun(on_compare_node);
GNode* child = nullptr;
- using type_traverse_gnode_slot = sigc::slot<gboolean, GNode*>;
+ using type_traverse_gnode_slot = sigc::slot<gboolean(GNode*)>;
type_traverse_gnode_slot bound_slot = sigc::bind(real_slot, the_data, &child);
g_node_traverse(const_cast<GNode*>(gobj()), (GTraverseType)order, (GTraverseFlags)flags, -1, c_callback_traverse_compare_node, reinterpret_cast<gpointer>(&bound_slot));
}
}
- /// Wrapper for invoking a sigc::slot<void,GNode*> (Internal use).
+ /// Wrapper for invoking a sigc::slot<void(GNode*)> (Internal use).
static void c_callback_foreach_compare_child(GNode* node, gpointer data)
{
const ForeachFunc* slot = reinterpret_cast<const ForeachFunc*>(data);
return FALSE;
}
- /// Wrapper for invoking a sigc::slot<gboolean,GNode*> (Internal use).
+ /// Wrapper for invoking a sigc::slot<gboolean(GNode*)> (Internal use).
static gboolean c_callback_traverse_compare_node(GNode* node, gpointer data)
{
const TraverseFunc* slot = reinterpret_cast<const TraverseFunc*>(data);
* This function is used to translate user-visible strings, for --help output.
* The function takes an untranslated string and returns a translated string
*/
- using SlotTranslate = sigc::slot<Glib::ustring, const Glib::ustring&>;
+ using SlotTranslate = sigc::slot<Glib::ustring(const Glib::ustring&)>;
/**
* Sets the function which is used to translate user-visible
public:
/** For example Glib::ustring on_translate(const Glib::ustring& original);.
*/
- using SlotTranslate = sigc::slot<Glib::ustring, const Glib::ustring&>;
+ using SlotTranslate = sigc::slot<Glib::ustring(const Glib::ustring&)>;
/** For example bool on_option_arg_string(const Glib::ustring& option_name,
* const Glib::ustring& value, bool has_value);.
*/
- using SlotOptionArgString = sigc::slot<bool, const Glib::ustring&, const Glib::ustring&, bool>;
+ using SlotOptionArgString = sigc::slot<bool(const Glib::ustring&, const Glib::ustring&, bool)>;
/** For example bool on_option_arg_filename(const Glib::ustring& option_name,
* const std::string& value, bool has_value);.
*/
- using SlotOptionArgFilename = sigc::slot<bool, const Glib::ustring&, const std::string&, bool>;
+ using SlotOptionArgFilename = sigc::slot<bool(const Glib::ustring&, const std::string&, bool)>;
OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description = Glib::ustring());
/** For instance,<br>
* void on_child_setup();
*/
-using SlotSpawnChildSetup = sigc::slot<void>;
+using SlotSpawnChildSetup = sigc::slot<void()>;
/** Executes a child program asynchronously (your program will not
* block waiting for the child to exit). The child program is
+++ /dev/null
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmm/exceptionhandler.h>
-#include <glib.h>
-
-namespace
-{
-
-extern "C" {
-
-static void*
-call_thread_entry_slot(void* data)
-{
- const auto slot = reinterpret_cast<sigc::slot_base*>(data);
-
- try
- {
- // Recreate the specific slot, and drop the reference obtained by create().
- (*static_cast<sigc::slot<void>*>(slot))();
- }
- catch (Glib::Thread::Exit&)
- {
- // Just exit from the thread. The Thread::Exit exception
- // is our sane C++ replacement of g_thread_exit().
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-
- delete slot;
- return nullptr;
-}
-
-} // extern "C"
-
-} // anonymous namespace
-
-namespace Glib
-{
-
-// This was always meant as an internal method. It is no longer called,
-// and no longer needs to be called. We are keeping it just to avoid
-// breaking ABI, though hopefully nobody is using it anyway.
-// TODO: Remove this when we can break ABI.
-void
-thread_init_impl()
-{
- // Make sure the exception map is initialized before creating any thread.
- Glib::Error::register_init();
-}
-
-/**** Glib::Thread *********************************************************/
-
-// static
-Thread*
-Thread::create(const sigc::slot<void>& slot, bool /* joinable */)
-{
- // Make a copy of slot on the heap
- const auto slot_copy = new sigc::slot<void>(slot);
-
- GError* error = nullptr;
-
- const auto thread = g_thread_try_new(nullptr, &call_thread_entry_slot, slot_copy, &error);
-
- if (error)
- {
- delete slot_copy;
- // Glib::Error::throw_exception() will probably wrap G_THREAD_ERROR in a
- // Glib::Threads::ThreadError instance, but we want a Glib::ThreadError.
- if (error->domain == G_THREAD_ERROR)
- throw Glib::ThreadError(error);
- else
- Glib::Error::throw_exception(error);
- }
-
- return reinterpret_cast<Thread*>(thread);
-}
-
-// static
-Thread*
-Thread::create(const sigc::slot<void>& slot, unsigned long stack_size, bool joinable, bool bound,
- ThreadPriority priority)
-{
- // Make a copy of slot on the heap
- const auto slot_copy = new sigc::slot<void>(slot);
-
- GError* error = nullptr;
-
- const auto thread = g_thread_create_full(&call_thread_entry_slot, slot_copy, stack_size, joinable,
- bound, (GThreadPriority)priority, &error);
-
- if (error)
- {
- delete slot_copy;
- // Glib::Error::throw_exception() will probably wrap G_THREAD_ERROR in a
- // Glib::Threads::ThreadError instance, but we want a Glib::ThreadError.
- if (error->domain == G_THREAD_ERROR)
- throw Glib::ThreadError(error);
- else
- Glib::Error::throw_exception(error);
- }
-
- return reinterpret_cast<Thread*>(thread);
-}
-
-// static
-Thread*
-Thread::self()
-{
- return reinterpret_cast<Thread*>(g_thread_self());
-}
-
-void
-Thread::join()
-{
- g_thread_join(&gobject_);
-}
-
-bool
-Thread::joinable() const
-{
- return true; // An appropriate result now that this is deprecated because all threads are now
- // joinable.
-}
-
-void
-Thread::set_priority(ThreadPriority priority)
-{
- g_thread_set_priority(&gobject_, (GThreadPriority)priority);
-}
-
-ThreadPriority
-Thread::get_priority() const
-{
- return THREAD_PRIORITY_NORMAL; // An appropriate result now that this is deprecated because the
- // priority concept has been removed.
-}
-
-void
-thread_init(GThreadFunctions* /* vtable */)
-{
- // g_thread_init() is deprecated and now does nothing,
- // so we do not even call it. That avoids a need to link to gthread-2.0,
- // which contains the empty g_thread_init() implementation.
- // g_thread_init(vtable);
-
- Glib::thread_init_impl();
-}
-
-bool
-thread_supported()
-{
- // MSVC++ needs the != 0 to avoid an int -> bool cast warning.
- return (g_thread_supported() != 0);
-}
-
-// static
-void
-Thread::yield()
-{
- g_thread_yield();
-}
-
-Thread*
-wrap(GThread* gobject)
-{
- return reinterpret_cast<Thread*>(gobject);
-}
-
-/**** Glib::StaticMutex ****************************************************/
-
-void
-StaticMutex::lock()
-{
- g_static_mutex_lock(&gobject_);
-}
-
-bool
-StaticMutex::trylock()
-{
- return g_static_mutex_trylock(&gobject_);
-}
-
-void
-StaticMutex::unlock()
-{
- g_static_mutex_unlock(&gobject_);
-}
-
-StaticMutex::operator Mutex&()
-{
- // If GStaticMutex is implemented as struct (e.g. on Linux), its first struct
- // member (runtime_mutex) is a GMutex pointer. If the gthread implementation
- // is native (i.e. the vtable pointer passed to g_thread_init() was 0), then
- // the runtime_mutex pointer is unused, and the rest of the GStaticMutex
- // struct resembles the mutex data.
- //
- // On Win32, GStaticMutex is just a typedef to struct _GMutex*. Either way,
- // the first sizeof(GMutex*) bytes of GStaticMutex always resemble a GMutex
- // pointer. The gthread implementation relies on that, and we'll also do so.
-
- GMutex*& runtime_mutex = reinterpret_cast<GMutex*&>(gobject_);
-
- // Fortunately, it cannot hurt if we set this to the GMutex pointer returned
- // by g_static_mutex_get_mutex(). Either we just overwrite it with the same
- // value, or it was unused anyway. Doing that allows casting the pointer
- // location to a Glib::Mutex reference (its only data member is a GMutex*).
-
- runtime_mutex = g_static_mutex_get_mutex(&gobject_);
-
- return reinterpret_cast<Mutex&>(runtime_mutex);
-}
-
-/**** Glib::Mutex **********************************************************/
-
-Mutex::Mutex()
-: gobject_(g_mutex_new()) // TODO: Use a statically-allocated GMutext instead, with g_mutex_init().
-{
-}
-
-Mutex::~Mutex()
-{
- g_mutex_free(gobject_);
-}
-
-void
-Mutex::lock()
-{
- g_mutex_lock(gobject_);
-}
-
-bool
-Mutex::trylock()
-{
- return g_mutex_trylock(gobject_);
-}
-
-void
-Mutex::unlock()
-{
- g_mutex_unlock(gobject_);
-}
-
-/**** Glib::StaticRecMutex *************************************************/
-
-void
-StaticRecMutex::lock()
-{
- g_static_rec_mutex_lock(&gobject_);
-}
-
-bool
-StaticRecMutex::trylock()
-{
- return g_static_rec_mutex_trylock(&gobject_);
-}
-
-void
-StaticRecMutex::unlock()
-{
- g_static_rec_mutex_unlock(&gobject_);
-}
-
-void
-StaticRecMutex::lock_full(unsigned int depth)
-{
- g_static_rec_mutex_lock_full(&gobject_, depth);
-}
-
-unsigned int
-StaticRecMutex::unlock_full()
-{
- return g_static_rec_mutex_unlock_full(&gobject_);
-}
-
-StaticRecMutex::operator RecMutex&()
-{
- return static_cast<RecMutex&>(*this);
-}
-
-/**** Glib::RecMutex *******************************************************/
-
-RecMutex::RecMutex()
-{
- g_static_rec_mutex_init(&gobject_);
-}
-
-RecMutex::~RecMutex()
-{
- g_static_rec_mutex_free(&gobject_);
-}
-
-/**** Glib::StaticRWLock ***************************************************/
-
-void
-StaticRWLock::reader_lock()
-{
- g_static_rw_lock_reader_lock(&gobject_);
-}
-
-bool
-StaticRWLock::reader_trylock()
-{
- return g_static_rw_lock_reader_trylock(&gobject_);
-}
-
-void
-StaticRWLock::reader_unlock()
-{
- g_static_rw_lock_reader_unlock(&gobject_);
-}
-
-void
-StaticRWLock::writer_lock()
-{
- g_static_rw_lock_writer_lock(&gobject_);
-}
-
-bool
-StaticRWLock::writer_trylock()
-{
- return g_static_rw_lock_writer_trylock(&gobject_);
-}
-
-void
-StaticRWLock::writer_unlock()
-{
- g_static_rw_lock_writer_unlock(&gobject_);
-}
-
-StaticRWLock::operator RWLock&()
-{
- return static_cast<RWLock&>(*this);
-}
-
-/**** Glib::RWLock *********************************************************/
-
-RWLock::RWLock()
-{
- g_static_rw_lock_init(&gobject_);
-
- // GLib doesn't have GRWLock, only GStaticRWLock. Force initialization
- // of the mutex and the condition variables now, to mimic the behaviour
- // of a (hypothetical) GRWLock.
-
- if (g_static_mutex_get_mutex(&gobject_.mutex))
- {
- gobject_.read_cond = g_cond_new();
- gobject_.write_cond = g_cond_new();
- }
-}
-
-RWLock::~RWLock()
-{
- g_static_rw_lock_free(&gobject_);
-}
-
-/**** Glib::Cond ***********************************************************/
-
-Cond::Cond() : gobject_(g_cond_new())
-{
-}
-
-Cond::~Cond()
-{
- g_cond_free(gobject_);
-}
-
-void
-Cond::signal()
-{
- g_cond_signal(gobject_);
-}
-
-void
-Cond::broadcast()
-{
- g_cond_broadcast(gobject_);
-}
-
-void
-Cond::wait(Mutex& mutex)
-{
- g_cond_wait(gobject_, mutex.gobj());
-}
-
-bool
-Cond::timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time)
-{
- return g_cond_timed_wait(gobject_, mutex.gobj(), const_cast<Glib::TimeVal*>(&abs_time));
-}
-
-void*
-StaticPrivate_get_helper(GStaticPrivate* private_key)
-{
- return g_static_private_get(private_key);
-}
-
-void
-StaticPrivate_set_helper(GStaticPrivate* private_key, gpointer data, GDestroyNotify notify)
-{
- return g_static_private_set(private_key, data, notify);
-}
-
-GPrivate*
-GPrivate_new_helper(GDestroyNotify notify)
-{
- return g_private_new(notify);
-}
-
-} // namespace Glib
+++ /dev/null
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-_DEFS(glibmm,glib)
-_CONFIGINCLUDE(glibmmconfig.h)
-
-_IS_DEPRECATED // This whole file is deprecated.
-
-#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
-//Stop the compiler warnings about using the deprecated API;
-#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
-#m4 _POP()
-
-// We use GThreadFunctions in the (deprecated) API, so we must temporarily undef G_DISABLE_DEPRECATED.
-// Temporarily undef G_DISABLE_DEPRECATED, redefining it later if appropriate.
-#if defined(G_DISABLE_DEPRECATED) && !defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED)
-//Stop the deprecation ifdef guards around the API declarations:
-#undef G_DISABLE_DEPRECATED
-#define GLIBMM_G_DISABLE_DEPRECATED_UNDEFED 1
-#endif
-
-#include <glib.h>
-
-// Redefine G_DISABLE_DEPRECATED if it was defined before we temporarily undefed it:
-#if defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED)
-#define G_DISABLE_DEPRECATED 1
-#undef GLIBMM_G_DISABLE_DEPRECATED_UNDEFED
-#endif
-
-
-#include <glibmm/error.h>
-#include <glibmm/timeval.h>
-#include <sigc++/sigc++.h>
-
-#include <cstddef>
-
-/* Shadow THREAD_PRIORITY_NORMAL macro (from winbase.h).
- */
-#if defined(THREAD_PRIORITY_NORMAL) && !defined(GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL)
-enum { GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL = THREAD_PRIORITY_NORMAL };
-#undef THREAD_PRIORITY_NORMAL
-enum { THREAD_PRIORITY_NORMAL = GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL };
-#define THREAD_PRIORITY_NORMAL THREAD_PRIORITY_NORMAL
-#define GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL 1
-#endif
-
-
-/** Initializer macro for Glib::StaticRecMutex.
- * @relates Glib::StaticRecMutex
- * @hideinitializer
- *
- * @deprecated Glib::StaticRecMutex is deprecated in favour of Glib::Threads::RecMutex, which can be used statically.
- */
-#define GLIBMM_STATIC_REC_MUTEX_INIT { G_STATIC_REC_MUTEX_INIT }
-
-/** Initializer macro for Glib::StaticRWLock.
- * @relates Glib::StaticRWLock
- * @hideinitializer
- *
- * @deprecated Glib::StaticRWLock is deprecated in favour of Glib::Threads::RWLock, which can be used statically.
- */
-#define GLIBMM_STATIC_RW_LOCK_INIT { G_STATIC_RW_LOCK_INIT }
-
-/** Initializer macro for Glib::StaticPrivate.
- * @relates Glib::StaticPrivate
- * @hideinitializer
- *
- * @deprecated Glib::StaticPrivate is deprecated in favour of Glib::Threads::Private, which can be used statically.
- */
-#define GLIBMM_STATIC_PRIVATE_INIT { G_STATIC_PRIVATE_INIT }
-
-namespace Glib
-{
-
-/** @deprecated Thread priorities no longer have any effect.
- */
-_WRAP_ENUM(ThreadPriority, GThreadPriority, NO_GTYPE)
-
-/*! @var ThreadPriority THREAD_PRIORITY_LOW
- * A priority lower than normal.
- */
-/*! @var ThreadPriority THREAD_PRIORITY_NORMAL
- * The default priority.
- */
-/*! @var ThreadPriority THREAD_PRIORITY_HIGH
- * A priority higher than normal.
- */
-/*! @var ThreadPriority THREAD_PRIORITY_URGENT
- * The highest priority.
- */
-
-/** Initializes the GLib thread system.
- * @deprecated Calling thread_init() is no longer necessary and no longer has any effect.
- */
-void thread_init(GThreadFunctions* vtable = nullptr);
-
-/** Returns whether the thread system is initialized.
- * @return @c true, if the thread system is initialized.
- * @deprecated This is no longer useful, because the thread system is always initialized.
- */
-bool thread_supported();
-
-/**
- * @deprecated Use Glib::Threads::NotLock instead.
- */
-enum NotLock { NOT_LOCK };
-
-/**
- * @deprecated Use Glib::Threads::TryLock instead.
- */
-enum TryLock { TRY_LOCK };
-
-class Mutex;
-class RecMutex;
-class RWLock;
-
-struct StaticRecMutex;
-struct StaticRWLock;
-
-
-/** Exception class for thread-related errors.
- * @deprecated Use Glib::Threads::ThreadError instead.
- */
-_WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE)
-
-
-/** Represents a running thread.
- * An instance of this class can only be obtained with create(), self(),
- * or wrap(GThread*). It's not possible to delete a Thread object. If the
- * thread is @em not joinable, its resources will be freed automatically
- * when it exits. Otherwise, if the thread @em is joinable, you must call
- * join() to avoid a memory leak.
- *
- * @note g_thread_exit() is not wrapped, because that function exits a thread
- * without any cleanup. That's especially dangerous in C++ code, since the
- * destructors of automatic objects won't be invoked. Instead, you can throw
- * a Thread::Exit exception, which will be caught by the internal thread
- * entry function.
- *
- * @note You might have noticed that the thread entry slot doesn't have the
- * usual void* return value. If you want to return any data from your thread
- * you can pass an additional output argument to the thread's entry slot.
- *
- * @deprecated Use Glib::Threads::Thread instead.
- */
-class Thread
-{
-public:
-
- Thread(const Thread&) = delete;
- Thread& operator=(const Thread&) = delete;
-
- class Exit;
-
- //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
- /** Creates a new thread with the priority <tt>THREAD_PRIORITY_NORMAL</tt>.
- * If @a joinable is @c true, you can wait for this thread's termination by
- * calling join(). Otherwise the thread will just disappear, when ready.
- *
- * The new thread executes the function or method @a slot points to. You can
- * pass additional arguments using sigc::bind(). If the thread was created
- * successfully, it is returned, otherwise a ThreadError exception is thrown.
- *
- * Because sigc::trackable is not thread safe, if the slot represents a
- * non-static class method (that is, it is created by sigc::mem_fun()), the
- * class concerned should not derive from sigc::trackable.
- *
- * @param slot A slot to execute in the new thread.
- * @param joinable This parameter is now ignored because Threads are now always joinable.
- * @return The new Thread* on success.
- * @throw Glib::ThreadError
- */
- static Thread* create(const sigc::slot<void>& slot, bool joinable = true);
-
- /** Returns the Thread* corresponding to the calling thread.
- * @return The current thread.
- */
- static Thread* self();
-
- /** Waits until the thread finishes.
- * Waits until the thread finishes, i.e. the slot, as given to create(),
- * returns or g_thread_exit() is called by the thread. (Calling
- * g_thread_exit() in a C++ program should be avoided.) All resources of
- * the thread including the Glib::Thread object are released. The thread
- * must have been created with <tt>joinable = true</tt>.
- */
- void join();
-
- //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
- /** Creates a new thread with the priority @a priority. The stack gets the
- * size @a stack_size or the default value for the current platform, if
- * @a stack_size is <tt>0</tt>.
- *
- * If @a joinable is @c true, you can wait for this thread's termination by
- * calling join(). Otherwise the thread will just disappear, when ready.
- * If @a bound is @c true, this thread will be scheduled in the system scope,
- * otherwise the implementation is free to do scheduling in the process
- * scope. The first variant is more expensive resource-wise, but generally
- * faster. On some systems (e.g. Linux) all threads are bound.
- *
- * The new thread executes the function or method @a slot points to. You can
- * pass additional arguments using sigc::bind(). If the thread was created
- * successfully, it is returned.
- *
- * Because sigc::trackable is not thread safe, if the slot represents a
- * non-static class method (that is, it is created by sigc::mem_fun()), the
- * class concerned should not derive from sigc::trackable.
- *
- * @note It is not guaranteed, that threads with different priorities really
- * behave accordingly. On some systems (e.g. Linux) only root can increase
- * priorities. On other systems (e.g. Solaris) there doesn't seem to be
- * different scheduling for different priorities. All in all try to avoid
- * being dependent on priorities. Use <tt>Glib::THREAD_PRIORITY_NORMAL</tt>
- * here as a default.
- *
- * @note Only use the extended
- * create(const sigc::slot<void>&, unsigned long, bool, bool, ThreadPriority)
- * function, when you really can't use the simple
- * create(const sigc::slot<void>&, bool)
- * instead. The latter overload does not take @a stack_size, @a bound and
- * @a priority as arguments, as they should only be used for cases, where
- * it is inevitable.
- *
- * @param slot A slot to execute in the new thread.
- * @param stack_size A stack size for the new thread, or <tt>0</tt>.
- * @param joinable Should this thread be joinable?
- * @param bound Should this thread be bound to a system thread?
- * @param priority A priority for the thread.
- * @return The new Thread* on success.
- * @throw Glib::ThreadError
- *
- * @deprecated Use the simpler create() method instead, because all Threads
- * are now joinable, and bounds and priority parameters now have no effect.
- */
- static Thread* create(const sigc::slot<void>& slot, unsigned long stack_size,
- bool joinable, bool bound, ThreadPriority priority);
-
- /** Returns whether the thread is joinable.
- * @return Whether the thread is joinable.
- *
- * @deprecated All threads are now joinable.
- */
- bool joinable() const;
-
- /** Changes the priority of the thread to @a priority.
- * @note It is not guaranteed, that threads with different priorities really
- * behave accordingly. On some systems (e.g. Linux) only @c root can
- * increase priorities. On other systems (e.g. Solaris) there doesn't seem
- * to be different scheduling for different priorities. All in all try to
- * avoid being dependent on priorities.
- * @param priority A new priority for the thread.
- *
- * @deprecated Thread priorities no longer have any effect.
- */
- void set_priority(ThreadPriority priority);
-
- /** Returns the priority of the thread.
- * @return The thread's priority.
- *
- * @deprecated Thread priorities no longer have any effect.
- */
- ThreadPriority get_priority() const;
-
- /** Gives way to other threads waiting to be scheduled.
- * This function is often used as a method to make busy wait less evil. But
- * in most cases, you will encounter, there are better methods to do that.
- * So in general you shouldn't use this function.
- */
- static void yield();
-
- GThread* gobj() { return &gobject_; }
- const GThread* gobj() const { return &gobject_; }
-
-private:
- GThread gobject_;
-
- // Glib::Thread can neither be constructed nor deleted.
- Thread();
- void operator delete(void*, std::size_t);
-};
-
-/** %Exception class used to exit from a thread.
- * @code
- * throw Glib::Thread::Exit();
- * @endcode
- * Write this if you want to exit from a thread created by Thread::create().
- * Of course you must make sure not to catch Thread::Exit by accident, i.e.
- * when using <tt>catch(...)</tt> somewhere in your code.
- *
- * @deprecated Use Glib::Threads::Thread::Exit instead.
- */
-class Thread::Exit
-{};
-
-
-//TODO: Make sure that Glib::wrap() uses Glib::Threads::wrap() instead.
-
-/** @relates Glib::Thread
- *
- * @deprecated Use Glib::Threads::wrap(GThread*) instead.
- */
-Thread* wrap(GThread* gobject);
-
-struct StaticMutex;
-
-/** Like Glib::Mutex, but can be defined at compile time.
- * Use @c GLIBMM_STATIC_MUTEX_INIT to initialize a StaticMutex:
- * @code
- * Glib::StaticMutex mutex = GLIBMM_STATIC_MUTEX_INIT;
- * @endcode
- *
- * A StaticMutex can be used without calling Glib::thread_init(), it will
- * silently do nothing then. That will also work when using the implicit
- * conversion to Mutex&, thus you can safely use Mutex::Lock with a
- * StaticMutex.
- *
- * @deprecated Use Glib::Threads::Mutex instead, which can be used statically.
- */
-struct StaticMutex
-{
- void lock();
- bool trylock();
- void unlock();
-
- operator Mutex&();
-
- GStaticMutex* gobj() { return &gobject_; }
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Must be public to allow initialization at compile time.
- GStaticMutex gobject_;
-#endif
-};
-
-/** Initializer macro for Glib::StaticMutex.
- * @relates Glib::StaticMutex
- * @hideinitializer
- *
- * @deprecated Glib::StaticMutex is deprecated in favour of Glib::Threads::Mutex, which can be used statically.
- */
-#define GLIBMM_STATIC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
-
-/** Represents a mutex (mutual exclusion).
- * It can be used to protect data against shared access. Try to use
- * Mutex::Lock instead of calling lock() and unlock() directly --
- * it will make your life much easier.
- *
- * @note Glib::Mutex is not recursive, i.e. a thread will deadlock, if it
- * already has locked the mutex while calling lock(). Use Glib::RecMutex
- * instead, if you need recursive mutexes.
- *
- * @deprecated Use Glib::Threads::Mutex instead.
- */
-class Mutex
-{
-public:
- class Lock;
-
- Mutex();
-
- Mutex(const Mutex&) = delete;
- Mutex& operator=(const Mutex&) = delete;
-
- ~Mutex();
-
- /** Locks the mutex.
- * If mutex is already locked by another thread, the current thread will
- * block until mutex is unlocked by the other thread.
- * @see Mutex::Lock
- */
- void lock();
-
- /** Tries to lock the mutex.
- * If the mutex is already locked by another thread, it immediately returns
- * @c false. Otherwise it locks the mutex and returns @c true.
- * @return Whether the mutex could be locked.
- * @see Mutex::Lock
- */
- bool trylock();
-
- /** Unlocks the mutex.
- * If another thread is blocked in a lock() call for this mutex, it will be
- * woken and can lock the mutex itself.
- * @see Mutex::Lock
- */
- void unlock();
-
- GMutex* gobj() { return gobject_; }
-
-private:
- GMutex* gobject_;
-};
-
-/** Utility class for exception-safe mutex locking.
- * @par Usage example:
- * @code
- * {
- * Glib::Mutex::Lock lock (mutex); // calls mutex.lock()
- * do_something();
- * } // the destructor calls mutex.unlock()
- * @endcode
- * As you can see, the compiler takes care of the unlocking. This is not
- * only exception safe but also much less error-prone. You could even
- * <tt>return</tt> while still holding the lock and it will be released
- * properly.
- *
- * @deprecated Use Glib::Threads::Mutex::Lock instead.
- */
-class Mutex::Lock
-{
-public:
- explicit inline Lock(Mutex& mutex);
- inline Lock(Mutex& mutex, NotLock);
- inline Lock(Mutex& mutex, TryLock);
- inline ~Lock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- Mutex& mutex_;
- bool locked_;
-
-
-};
-
-
-/** Like Glib::RecMutex, but can be defined at compile time.
- * Use @c GLIBMM_STATIC_REC_MUTEX_INIT to initialize a StaticRecMutex:
- * @code
- * Glib::StaticRecMutex mutex = GLIBMM_STATIC_REC_MUTEX_INIT;
- * @endcode
- * A StaticRecMutex can be used without calling Glib::thread_init(), it will
- * silently do nothing then. That will also work when using the implicit
- * conversion to RecMutex&, thus you can safely use RecMutex::Lock with a
- * StaticRecMutex.
- *
- * @deprecated Use Glib::Threads::RecMutex instead, which can be used statically.
- */
-struct StaticRecMutex
-{
- void lock();
- bool trylock();
- void unlock();
-
- void lock_full(unsigned int depth);
- unsigned int unlock_full();
-
- operator RecMutex&();
-
- GStaticRecMutex* gobj() { return &gobject_; }
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Must be public to allow initialization at compile time.
- GStaticRecMutex gobject_;
-#endif
-};
-
-/**
- *
- * @deprecated Use Glib::Threads::RecMutex instead.
- */
-class RecMutex : public StaticRecMutex
-{
-public:
- class Lock;
-
- RecMutex();
- ~RecMutex();
-
-private:
- // noncopyable
- RecMutex(const RecMutex&);
- RecMutex& operator=(const RecMutex&);
-};
-
-/** Utility class for exception-safe locking of recursive mutexes.
- *
- * @deprecated Use Glib::Threads::RecMutex instead.
- */
-class RecMutex::Lock
-{
-public:
- explicit inline Lock(RecMutex& mutex);
- inline Lock(RecMutex& mutex, NotLock);
- inline Lock(RecMutex& mutex, TryLock);
-
- Lock(const RecMutex::Lock&) = delete;
- RecMutex::Lock& operator=(const RecMutex::Lock&) = delete;
-
- inline ~Lock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RecMutex& mutex_;
- bool locked_;
-};
-
-
-/** Like Glib::RWLock, but can be defined at compile time.
- * Use @c GLIBMM_STATIC_RW_LOCK_INIT to initialize a StaticRWLock:
- * @code
- * Glib::StaticRWLock rw_lock = GLIBMM_STATIC_RW_LOCK_INIT;
- * @endcode
- * A StaticRWLock can be used without calling Glib::thread_init(), it will
- * silently do nothing then. That will also work when using the implicit
- * conversion to RWLock&, thus you can safely use RWLock::ReaderLock and
- * RWLock::WriterLock with a StaticRWLock.
- *
- * @deprecated Use Glib::Threads::RWLock instead, which can be used statically.
- */
-struct StaticRWLock
-{
- void reader_lock();
- bool reader_trylock();
- void reader_unlock();
-
- void writer_lock();
- bool writer_trylock();
- void writer_unlock();
-
- operator RWLock&();
-
- GStaticRWLock* gobj() { return &gobject_; }
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Must be public to allow initialization at compile time.
- GStaticRWLock gobject_;
-#endif
-};
-
-/**
- *
- * @deprecated Use Glib::Threads::RWLock instead.
- */
-class RWLock : public StaticRWLock
-{
-public:
- class ReaderLock;
- class WriterLock;
-
- RWLock();
-
- RWLock(const RWLock&) = delete;
- RWLock& operator=(const RWLock&) = delete;
-
- ~RWLock();
-};
-
-/** Utility class for exception-safe locking of read/write locks.
- *
- * @deprecated Use Glib::Threads::RWLock::ReaderLock instead.
- */
-class RWLock::ReaderLock
-{
-public:
- explicit inline ReaderLock(RWLock& rwlock);
- inline ReaderLock(RWLock& rwlock, NotLock);
- inline ReaderLock(RWLock& rwlock, TryLock);
-
- ReaderLock(const RWLock::ReaderLock&) = delete;
- RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete;
-
- inline ~ReaderLock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RWLock& rwlock_;
- bool locked_;
-};
-
-/** Utility class for exception-safe locking of read/write locks.
- *
- * @deprecated Use Glib::Threads::RWLock::WriterLock instead.
- */
-class RWLock::WriterLock
-{
-public:
- explicit inline WriterLock(RWLock& rwlock);
- inline WriterLock(RWLock& rwlock, NotLock);
- inline WriterLock(RWLock& rwlock, TryLock);
-
- WriterLock(const RWLock::WriterLock&) = delete;
- RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete;
-
- inline ~WriterLock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RWLock& rwlock_;
- bool locked_;
-};
-
-/** An opaque data structure to represent a condition.
- * A @a Cond is an object that threads can block on, if they find a certain
- * condition to be false. If other threads change the state of this condition
- * they can signal the @a Cond, such that the waiting thread is woken up.
- * @par Usage example:
- * @code
- * Glib::Cond data_cond;
- * Glib::Mutex data_mutex;
- * void* current_data = nullptr;
- *
- * void push_data(void* data)
- * {
- * Glib::Mutex::Lock lock (data_mutex);
- *
- * current_data = data;
- * data_cond.signal();
- * }
- *
- * void* pop_data()
- * {
- * Glib::Mutex::Lock lock (data_mutex);
- *
- * while (!current_data)
- * data_cond.wait(data_mutex);
- *
- * void *const data = current_data;
- * current_data = nullptr;
- *
- * return data;
- * }
- * @endcode
- *
- * @deprecated Use Glib::Threads::Cond instead.
- */
-class Cond
-{
-public:
- Cond();
-
- Cond(const Cond&) = delete;
- Cond& operator=(const Cond&) = delete;
-
- ~Cond();
-
- /** If threads are waiting for this @a Cond, exactly one of them is woken up.
- * It is good practice to hold the same lock as the waiting thread, while calling
- * this method, though not required.
- *
- */
- void signal();
-
- /** If threads are waiting for this @a Cond, all of them are woken up.
- * It is good practice to hold the same lock as the waiting thread, while calling
- * this method, though not required.
- */
- void broadcast();
-
- /** Waits until this thread is woken up on this @a Cond.
- * The mutex is unlocked before falling asleep and locked again before resuming.
- *
- * @param mutex a @a Mutex that is currently locked.
- *
- * @note It is important to use the @a wait() and @a timed_wait() methods
- * only inside a loop, which checks for the condition to be true as it is not
- * guaranteed that the waiting thread will find it fulfilled, even if the signaling
- * thread left the condition in that state. This is because another thread can have
- * altered the condition, before the waiting thread got the chance to be woken up,
- * even if the condition itself is protected by a @a Mutex.
- */
- void wait(Mutex& mutex);
-
- /** Waits until this thread is woken up on this @a Cond, but not longer than until the time, that is specified by @a abs_time.
- * The mutex is unlocked before falling asleep and locked again before resuming.
- *
- * @param mutex a @a Mutex that is currently locked.
- * @param abs_time a max time to wait.
- *
- * @note It is important to use the @a wait() and @a timed_wait() methods
- * only inside a loop, which checks for the condition to be true as it is not
- * guaranteed that the waiting thread will find it fulfilled, even if the signaling
- * thread left the condition in that state. This is because another thread can have
- * altered the condition, before the waiting thread got the chance to be woken up,
- * even if the condition itself is protected by a @a Mutex.
- */
- bool timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time);
-
- GCond* gobj() { return gobject_; }
-
-private:
- GCond* gobject_;
-};
-
-
-/** Thread-local data pointer.
- *
- * @deprecated Use Glib::Threads::Private instead, which can be used statically.
- */
-template <class T>
-struct StaticPrivate
-{
- using DestroyNotifyFunc = void (*) (void*);
-
- static void delete_ptr(void* data);
-
- inline T* get();
- inline void set(T* data, DestroyNotifyFunc notify_func = &StaticPrivate<T>::delete_ptr);
-
- GStaticPrivate* gobj() { return &gobject_; }
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
- // Must be public to allow initialization at compile time.
- GStaticPrivate gobject_;
-#endif
-};
-
-/** Thread-local data pointer.
- *
- * @deprecated Use Glib::Threads::Private instead.
- */
-template <class T>
-class Private
-{
-public:
-
- Private(const Private<T>&) = delete;
- Private<T>& operator=(const Private<T>&) = delete;
-
- using DestructorFunc = void (*) (void*);
-
- static void delete_ptr(void* data);
-
- explicit inline Private(DestructorFunc destructor_func = &Private<T>::delete_ptr);
- inline T* get();
- inline void set(T* data);
-
- GPrivate* gobj() { return gobject_; }
-
-private:
- GPrivate* gobject_;
-};
-
-/** @} group Threads */
-
-/*! A glibmm thread example.
- * @example thread/thread.cc
- */
-
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-/***************************************************************************/
-/* inline implementation */
-/***************************************************************************/
-
-// internal
-/** @deprecated This was always for internal glibmm use and is now unecessary even inside glibmm.
- */
-void thread_init_impl();
-
-/**** Glib::Mutex::Lock ****************************************************/
-
-inline
-Mutex::Lock::Lock(Mutex& mutex)
-:
- mutex_ (mutex),
- locked_ (true)
-{
- mutex_.lock();
-}
-
-inline
-Mutex::Lock::Lock(Mutex& mutex, NotLock)
-:
- mutex_ (mutex),
- locked_ (false)
-{}
-
-inline
-Mutex::Lock::Lock(Mutex& mutex, TryLock)
-:
- mutex_ (mutex),
- locked_ (mutex.trylock())
-{}
-
-inline
-Mutex::Lock::~Lock()
-{
- if(locked_)
- mutex_.unlock();
-}
-
-inline
-void Mutex::Lock::acquire()
-{
- mutex_.lock();
- locked_ = true;
-}
-
-inline
-bool Mutex::Lock::try_acquire()
-{
- locked_ = mutex_.trylock();
- return locked_;
-}
-
-inline
-void Mutex::Lock::release()
-{
- mutex_.unlock();
- locked_ = false;
-}
-
-inline
-bool Mutex::Lock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::RecMutex::Lock *************************************************/
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex)
-:
- mutex_ (mutex),
- locked_ (true)
-{
- mutex_.lock();
-}
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex, NotLock)
-:
- mutex_ (mutex),
- locked_ (false)
-{}
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex, TryLock)
-:
- mutex_ (mutex),
- locked_ (mutex.trylock())
-{}
-
-inline
-RecMutex::Lock::~Lock()
-{
- if(locked_)
- mutex_.unlock();
-}
-
-inline
-void RecMutex::Lock::acquire()
-{
- mutex_.lock();
- locked_ = true;
-}
-
-inline
-bool RecMutex::Lock::try_acquire()
-{
- locked_ = mutex_.trylock();
- return locked_;
-}
-
-inline
-void RecMutex::Lock::release()
-{
- mutex_.unlock();
- locked_ = false;
-}
-
-inline
-bool RecMutex::Lock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::RWLock::ReaderLock *********************************************/
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock)
-:
- rwlock_ (rwlock),
- locked_ (true)
-{
- rwlock_.reader_lock();
-}
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock, NotLock)
-:
- rwlock_ (rwlock),
- locked_ (false)
-{}
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock, TryLock)
-:
- rwlock_ (rwlock),
- locked_ (rwlock.reader_trylock())
-{}
-
-inline
-RWLock::ReaderLock::~ReaderLock()
-{
- if(locked_)
- rwlock_.reader_unlock();
-}
-
-inline
-void RWLock::ReaderLock::acquire()
-{
- rwlock_.reader_lock();
- locked_ = true;
-}
-
-inline
-bool RWLock::ReaderLock::try_acquire()
-{
- locked_ = rwlock_.reader_trylock();
- return locked_;
-}
-
-inline
-void RWLock::ReaderLock::release()
-{
- rwlock_.reader_unlock();
- locked_ = false;
-}
-
-inline
-bool RWLock::ReaderLock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::RWLock::WriterLock *********************************************/
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock)
-:
- rwlock_ (rwlock),
- locked_ (true)
-{
- rwlock_.writer_lock();
-}
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock, NotLock)
-:
- rwlock_ (rwlock),
- locked_ (false)
-{}
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock, TryLock)
-:
- rwlock_ (rwlock),
- locked_ (rwlock.writer_trylock())
-{}
-
-inline
-RWLock::WriterLock::~WriterLock()
-{
- if(locked_)
- rwlock_.writer_unlock();
-}
-
-inline
-void RWLock::WriterLock::acquire()
-{
- rwlock_.writer_lock();
- locked_ = true;
-}
-
-inline
-bool RWLock::WriterLock::try_acquire()
-{
- locked_ = rwlock_.writer_trylock();
- return locked_;
-}
-
-inline
-void RWLock::WriterLock::release()
-{
- rwlock_.writer_unlock();
- locked_ = false;
-}
-
-inline
-bool RWLock::WriterLock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::StaticPrivate **************************************************/
-
-// static
-template <class T>
-void StaticPrivate<T>::delete_ptr(void* data)
-{
- delete static_cast<T*>(data);
-}
-
-/** This is only for use by glibmm itself.
- */
-void* StaticPrivate_get_helper(GStaticPrivate *private_key);
-
-template <class T> inline
-T* StaticPrivate<T>::get()
-{
- return static_cast<T*>(StaticPrivate_get_helper(&gobject_));
-}
-
-/** This is only for use by glibmm itself.
- */
-void StaticPrivate_set_helper(GStaticPrivate *private_key, gpointer data, GDestroyNotify notify);
-
-template <class T> inline
-void StaticPrivate<T>::set(T* data, typename StaticPrivate<T>::DestroyNotifyFunc notify_func)
-{
- StaticPrivate_set_helper(&gobject_, data, notify_func);
-}
-
-
-/**** Glib::Private ********************************************************/
-
-// static
-template <class T>
-void Private<T>::delete_ptr(void* data)
-{
- delete static_cast<T*>(data);
-}
-
-/** This is only for use by glibmm itself.
- */
-GPrivate* GPrivate_new_helper(GDestroyNotify notify);
-
-template <class T> inline
-Private<T>::Private(typename Private<T>::DestructorFunc destructor_func)
-:
- gobject_ (GPrivate_new_helper(destructor_func))
-{}
-
-template <class T> inline
-T* Private<T>::get()
-{
- return static_cast<T*>(g_private_get(gobject_));
-}
-
-template <class T> inline
-void Private<T>::set(T* data)
-{
- g_private_set(gobject_, data);
-}
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-} // namespace Glib
-
+++ /dev/null
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmm/exceptionhandler.h>
-#include <glib.h>
-
-/* Why reinterpret_cast<Thread*>(gobject) is needed:
- *
- * A Thread instance is in fact always a GThread instance.
- * Unfortunately, GThread cannot be a member of Thread,
- * because it is an opaque struct. Also, the C interface does not provide
- * any hooks to install a destroy notification handler, thus we cannot
- * wrap it dynamically either.
- *
- * The cast works because Thread does not have any member data, and
- * it is impossible to derive from it. This is ensured by not implementing
- * the (private) default constructor.
- * This trick is used also in classes declared as _CLASS_OPAQUE_REFCOUNTED.
- */
-
-namespace
-{
-
-extern "C" {
-
-static void*
-call_thread_entry_slot(void* data)
-{
- const auto slot = reinterpret_cast<sigc::slot_base*>(data);
-
- try
- {
- // Recreate the specific slot.
- (*static_cast<sigc::slot<void>*>(slot))();
- }
- catch (Glib::Threads::Thread::Exit&)
- {
- // Just exit from the thread. The Threads::Thread::Exit exception
- // is our sane C++ replacement of g_thread_exit().
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-
- delete slot;
- return nullptr;
-}
-
-} // extern "C"
-
-} // anonymous namespace
-
-namespace Glib
-{
-
-namespace Threads
-{
-
-/**** Glib::Threads::Thread ************************************************/
-
-// static
-Thread*
-Thread::create(const sigc::slot<void>& slot, const std::string& name)
-{
- // Make a copy of slot on the heap.
- const auto slot_copy = new sigc::slot<void>(slot);
-
- GError* error = nullptr;
- auto thread = g_thread_try_new(
- name.empty() ? nullptr : name.c_str(), &call_thread_entry_slot, slot_copy, &error);
-
- if (error)
- {
- delete slot_copy;
- Glib::Error::throw_exception(error);
- }
- if (!thread)
- {
- delete slot_copy;
- }
- return reinterpret_cast<Thread*>(thread);
-}
-
-// static
-Thread*
-Thread::create(const sigc::slot<void>& slot)
-{
- return create(slot, std::string());
-}
-
-// static
-Thread*
-Thread::self()
-{
- return reinterpret_cast<Thread*>(g_thread_self());
-}
-
-void
-Thread::join()
-{
- g_thread_join(reinterpret_cast<GThread*>(this));
-}
-
-// static
-void
-Thread::yield()
-{
- g_thread_yield();
-}
-
-GThread*
-Thread::gobj()
-{
- return reinterpret_cast<GThread*>(this);
-}
-
-const GThread*
-Thread::gobj() const
-{
- return reinterpret_cast<const GThread*>(this);
-}
-
-Thread*
-wrap(GThread* gobject)
-{
- return reinterpret_cast<Thread*>(gobject);
-}
-
-/**** Glib::Threads::Mutex *************************************************/
-
-Mutex::Mutex()
-{
- g_mutex_init(&gobject_);
-}
-
-Mutex::~Mutex()
-{
- g_mutex_clear(&gobject_);
-}
-
-void
-Mutex::lock()
-{
- g_mutex_lock(&gobject_);
-}
-
-bool
-Mutex::trylock()
-{
- return g_mutex_trylock(&gobject_);
-}
-
-void
-Mutex::unlock()
-{
- g_mutex_unlock(&gobject_);
-}
-
-Mutex*
-wrap(GMutex* gobject)
-{
- return reinterpret_cast<Mutex*>(gobject);
-}
-
-/**** Glib::Threads::RecMutex **********************************************/
-
-RecMutex::RecMutex()
-{
- g_rec_mutex_init(&gobject_);
-}
-
-RecMutex::~RecMutex()
-{
- g_rec_mutex_clear(&gobject_);
-}
-
-void
-RecMutex::lock()
-{
- g_rec_mutex_lock(&gobject_);
-}
-
-bool
-RecMutex::trylock()
-{
- return g_rec_mutex_trylock(&gobject_);
-}
-
-void
-RecMutex::unlock()
-{
- g_rec_mutex_unlock(&gobject_);
-}
-
-RecMutex*
-wrap(GRecMutex* gobject)
-{
- return reinterpret_cast<RecMutex*>(gobject);
-}
-
-/**** Glib::Threads::RWLock ************************************************/
-
-void
-RWLock::reader_lock()
-{
- g_rw_lock_reader_lock(&gobject_);
-}
-
-bool
-RWLock::reader_trylock()
-{
- return g_rw_lock_reader_trylock(&gobject_);
-}
-
-void
-RWLock::reader_unlock()
-{
- g_rw_lock_reader_unlock(&gobject_);
-}
-
-void
-RWLock::writer_lock()
-{
- g_rw_lock_writer_lock(&gobject_);
-}
-
-bool
-RWLock::writer_trylock()
-{
- return g_rw_lock_writer_trylock(&gobject_);
-}
-
-void
-RWLock::writer_unlock()
-{
- g_rw_lock_writer_unlock(&gobject_);
-}
-
-RWLock::RWLock()
-{
- g_rw_lock_init(&gobject_);
-}
-
-RWLock::~RWLock()
-{
- g_rw_lock_clear(&gobject_);
-}
-
-/**** Glib::Threads::Cond **************************************************/
-
-Cond::Cond()
-{
- g_cond_init(&gobject_);
-}
-
-Cond::~Cond()
-{
- g_cond_clear(&gobject_);
-}
-
-void
-Cond::signal()
-{
- g_cond_signal(&gobject_);
-}
-
-void
-Cond::broadcast()
-{
- g_cond_broadcast(&gobject_);
-}
-
-void
-Cond::wait(Mutex& mutex)
-{
- g_cond_wait(&gobject_, mutex.gobj());
-}
-
-bool
-Cond::wait_until(Mutex& mutex, gint64 end_time)
-{
- return g_cond_wait_until(&gobject_, mutex.gobj(), end_time);
-}
-
-} // namespace Threads
-
-} // namespace Glib
+++ /dev/null
-/* Copyright (C) 2002 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-_DEFS(glibmm,glib)
-_CONFIGINCLUDE(glibmmconfig.h)
-
-_IS_DEPRECATED // This whole file is deprecated.
-
-#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
-// Don't let glibmm.h include thread.h. Pretend that it's already included.
-// glib.h can then be included with G_DISABLE_DEPRECATED defined, and
-// the compiler can react if deprecated glib functions are used.
-#define _GLIBMM_THREAD_H
-#m4 _POP()
-
-#include <glib.h>
-#include <glibmm/error.h>
-#include <sigc++/sigc++.h>
-#include <string>
-#include <cstddef>
-
-namespace Glib
-{
-
-/**
- * @deprecated The entire Glib::Threads API is deprecated in favor of the
- * standard C++ concurrency API in C++11 and C++14.
- */
-namespace Threads
-{
-//The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the Threads sub-namespace
-_GMMPROC_EXTRA_NAMESPACE(Threads)
-
-/** @defgroup Threads Threads
- * %Thread abstraction; including threads, different mutexes,
- * conditions and thread private data.
- *
- * @deprecated The entire Glib::Threads API is deprecated in favor of the
- * standard C++ concurrency API in C++11 and C++14.
- * @{
- */
-
-/// @deprecated Please use std::lock_guard or std::unique_lock instead.
-enum NotLock { NOT_LOCK };
-
-/// @deprecated Please use std::lock_guard or std::unique_lock instead.
-enum TryLock { TRY_LOCK };
-
-class Mutex;
-class RecMutex;
-class RWLock;
-
-/** %Exception class for thread-related errors.
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead.
- */
-_WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE)
-
-
-/** Represents a running thread.
- * An instance of this class can only be obtained with create(), self(),
- * or wrap(GThread*). It's not possible to delete a Thread object.
- * You must call join() to avoid a memory leak.
- *
- * @note g_thread_exit() is not wrapped, because that function exits a thread
- * without any cleanup. That's especially dangerous in C++ code, since the
- * destructors of automatic objects won't be invoked. Instead, you can throw
- * a Threads::Thread::Exit exception, which will be caught by the internal thread
- * entry function.
- *
- * @note The thread entry slot doesn't have the void* return value that a
- * GThreadFunc has. If you want to return any data from your thread,
- * you can pass an additional output argument to the thread's entry slot.
- *
- * @deprecated Please use std::thread instead.
- */
-class Thread
-{
-public:
-
- Thread(const Thread&) = delete;
- Thread& operator=(const Thread&) = delete;
-
- class Exit;
-
- //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
- // TODO: At the next ABI break, consider changing const sigc::slot<void>& slot
- // to const std::function<void()>& func, if it can be assumed that all supported
- // compilers understand the C++11 template class std::function<>.
- /** Creates a new thread.
- * You can wait for this thread's termination by calling join().
- *
- * The new thread executes the function or method @a slot points to. You can
- * pass additional arguments using sigc::bind(). If the thread was created
- * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown.
- *
- * Because sigc::trackable is not thread-safe, if the slot represents a
- * non-static class method and is created by sigc::mem_fun(), the class concerned
- * should not derive from sigc::trackable. You can use, say, boost::bind() or,
- * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun().
- *
- * @param slot A slot to execute in the new thread.
- * @return The new Thread* on success.
- * @throw Glib::Threads::ThreadError
- */
- static Thread* create(const sigc::slot<void>& slot);
-
- // TODO: At next ABI break, remove the single parameter create
- // method and default name to std::string()
-
- /** Creates a new named thread.
- * You can wait for this thread's termination by calling join().
- *
- * The new thread executes the function or method @a slot points to. You can
- * pass additional arguments using sigc::bind(). If the thread was created
- * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown.
- *
- * Because sigc::trackable is not thread-safe, if the slot represents a
- * non-static class method and is created by sigc::mem_fun(), the class concerned
- * should not derive from sigc::trackable. You can use, say, boost::bind() or,
- * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun().
- *
- * The @a name can be useful for discriminating threads in a debugger.
- * It is not used for other purposes and does not have to be unique.
- * Some systems restrict the length of @a name to 16 bytes.
- *
- * @param slot A slot to execute in the new thread.
- * @param name A name for the new thread.
- * @return The new Thread* on success.
- * @throw Glib::Threads::ThreadError
- *
- * @newin{2,36}
- */
- static Thread* create(const sigc::slot<void>& slot, const std::string& name);
-
- /** Returns the Thread* corresponding to the calling thread.
- * @return The current thread.
- */
- static Thread* self();
-
- /** Waits until the thread finishes.
- * Waits until the thread finishes, i.e. the slot, as given to create(),
- * returns or g_thread_exit() is called by the thread. (Calling
- * g_thread_exit() in a C++ program should be avoided.) All resources of
- * the thread including the Glib::Threads::Thread object are released.
- */
- void join();
-
- /** Gives way to other threads waiting to be scheduled.
- * This function is often used as a method to make busy wait less evil. But
- * in most cases, you will encounter, there are better methods to do that.
- * So in general you shouldn't use this function.
- */
- static void yield();
-
- GThread* gobj();
- const GThread* gobj() const;
-
-private:
- // Glib::Thread can neither be constructed nor deleted.
- Thread();
- void operator delete(void*, std::size_t);
-};
-
-/** %Exception class used to exit from a thread.
- * @code
- * throw Glib::Threads::Thread::Exit();
- * @endcode
- * Write this if you want to exit from a thread created by Threads::Thread::create().
- * Of course you must make sure not to catch Threads::Thread::Exit by accident, i.e.
- * when using <tt>catch(...)</tt> somewhere in your code.
- *
- * @deprecated Please use std::thread instead.
- */
-class Thread::Exit
-{};
-
-/** A C++ wrapper for the C object.
- *
- * @param gobject The C instance.
- * @return The C++ wrapper.
- *
- * @relates Glib::Threads::Thread
- *
- * @deprecated Please use std::thread instead.
- */
-Thread* wrap(GThread* gobject);
-
-/** Represents a mutex (mutual exclusion).
- * It can be used to protect data against shared access. Try to use
- * Mutex::Lock instead of calling lock() and unlock() directly --
- * it will make your life much easier.
- *
- * @note Glib::Threads::Mutex is not recursive, i.e. a thread will deadlock, if it
- * already has locked the mutex while calling lock(). Use Glib::Threads::RecMutex
- * instead, if you need recursive mutexes.
- *
- * @deprecated Please use std::mutex instead.
- */
-class Mutex
-{
-public:
- class Lock;
-
- Mutex();
-
- Mutex(const Mutex&) = delete;
- Mutex& operator=(const Mutex&) = delete;
-
- ~Mutex();
-
- /** Locks the mutex.
- * If mutex is already locked by another thread, the current thread will
- * block until mutex is unlocked by the other thread.
- * @see Mutex::Lock
- */
- void lock();
-
- /** Tries to lock the mutex.
- * If the mutex is already locked by another thread, it immediately returns
- * @c false. Otherwise it locks the mutex and returns @c true.
- * @return Whether the mutex could be locked.
- * @see Mutex::Lock
- */
- bool trylock();
-
- /** Unlocks the mutex.
- * If another thread is blocked in a lock() call for this mutex, it will be
- * woken and can lock the mutex itself.
- * @see Mutex::Lock
- */
- void unlock();
-
- GMutex* gobj() { return &gobject_; }
-
-private:
- GMutex gobject_;
-};
-
-/** Utility class for exception-safe mutex locking.
- * @par Usage example:
- * @code
- * {
- * Glib::Threads::Mutex::Lock lock(mutex); // calls mutex.lock()
- * do_something();
- * } // the destructor calls mutex.unlock()
- * @endcode
- * As you can see, the compiler takes care of the unlocking. This is not
- * only exception-safe but also much less error-prone. You could even
- * <tt>return</tt> while still holding the lock and it will be released
- * properly.
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead.
- */
-class Mutex::Lock
-{
-public:
- explicit inline Lock(Mutex& mutex);
- inline Lock(Mutex& mutex, NotLock);
- inline Lock(Mutex& mutex, TryLock);
-
- Lock(const Mutex::Lock&) = delete;
- Mutex::Lock& operator=(const Mutex::Lock&) = delete;
-
- inline ~Lock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- Mutex& mutex_;
- bool locked_;
-};
-
-/** A C++ wrapper for the C object.
- * Do not use operator delete on the returned pointer. If the caller owns the
- * GMutex object, the caller must destroy it in the same way as if this function
- * had not been called.
- *
- * @param gobject The C instance.
- * @result The GMutex* cast to a Glib::Threads::Mutex*.
- *
- * @relates Glib::Threads::Mutex
- */
-Mutex* wrap(GMutex* gobject);
-
-/** This represents a recursive mutex.
- * It is similar to a Mutex with the difference
- * that it is possible to lock a RecMutex multiple times in the same
- * thread without deadlock. When doing so, care has to be taken to
- * unlock the recursive mutex as often as it has been locked.
- *
- * @deprecated Please use std::recursive_mutex instead.
- */
-class RecMutex
-{
-public:
- class Lock;
-
- RecMutex();
-
- RecMutex(const RecMutex&) = delete;
- RecMutex& operator=(const RecMutex&) = delete;
-
- ~RecMutex();
-
- void lock();
- bool trylock();
- void unlock();
-
- GRecMutex* gobj() { return &gobject_; }
-
-private:
- GRecMutex gobject_;
-};
-
-/** Utility class for exception-safe locking of recursive mutexes.
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead.
- */
-class RecMutex::Lock
-{
-public:
- explicit inline Lock(RecMutex& mutex);
- inline Lock(RecMutex& mutex, NotLock);
- inline Lock(RecMutex& mutex, TryLock);
-
- Lock(const RecMutex::Lock&) = delete;
- RecMutex::Lock& operator=(const RecMutex::Lock&) = delete;
-
- inline ~Lock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RecMutex& mutex_;
- bool locked_;
-};
-
-/** A C++ wrapper for the C object.
- * Do not use operator delete on the returned pointer. If the caller owns the
- * GRecMutex object, the caller must destroy it in the same way as if this function
- * had not been called.
- *
- * @param gobject The C instance.
- * @result The GRecMutex* cast to a Glib::Threads::RecMutex*.
- *
- * @relates Glib::Threads::RecMutex
- */
-RecMutex* wrap(GRecMutex* gobject);
-
-/** This represents a reader-writer lock.
- * It is similar to a Mutex in that it allows
- * multiple threads to coordinate access to a shared resource.
- *
- * The difference to a mutex is that a reader-writer lock discriminates
- * between read-only ('reader') and full ('writer') access. While only
- * one thread at a time is allowed write access (by holding the 'writer'
- * lock via writer_lock()), multiple threads can gain
- * simultaneous read-only access (by holding the 'reader' lock via
- * reader_lock()).
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
- */
-class RWLock
-{
-public:
- class ReaderLock;
- class WriterLock;
-
- RWLock();
-
- RWLock(const RWLock&) = delete;
- RWLock& operator=(const RWLock&) = delete;
-
- ~RWLock();
-
- void reader_lock();
- bool reader_trylock();
- void reader_unlock();
-
- void writer_lock();
- bool writer_trylock();
- void writer_unlock();
-
- GRWLock* gobj() { return &gobject_; }
-
-private:
- GRWLock gobject_;
-};
-
-/** Utility class for exception-safe locking of read/write locks.
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
- */
-class RWLock::ReaderLock
-{
-public:
- explicit inline ReaderLock(RWLock& rwlock);
- inline ReaderLock(RWLock& rwlock, NotLock);
- inline ReaderLock(RWLock& rwlock, TryLock);
-
- ReaderLock(const RWLock::ReaderLock&) = delete;
- RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete;
-
- inline ~ReaderLock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RWLock& rwlock_;
- bool locked_;
-};
-
-/** Utility class for exception-safe locking of read/write locks.
- *
- * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
- */
-class RWLock::WriterLock
-{
-public:
- explicit inline WriterLock(RWLock& rwlock);
- inline WriterLock(RWLock& rwlock, NotLock);
- inline WriterLock(RWLock& rwlock, TryLock);
-
- WriterLock(const RWLock::WriterLock&) = delete;
- RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete;
-
- inline ~WriterLock();
-
- inline void acquire();
- inline bool try_acquire();
- inline void release();
- inline bool locked() const;
-
-private:
- RWLock& rwlock_;
- bool locked_;
-};
-
-/** An opaque data structure to represent a condition.
- * A @a Cond is an object that threads can block on, if they find a certain
- * condition to be false. If other threads change the state of this condition
- * they can signal the @a Cond, such that the waiting thread is woken up.
- *
- * @deprecated Please use std::condition_variable instead.
- *
- * @par Usage example:
- * @code
- * Glib::Threads::Cond data_cond;
- * Glib::Threads::Mutex data_mutex;
- * void* current_data = nullptr;
- *
- * void push_data(void* data)
- * {
- * Glib::Threads::Mutex::Lock lock(data_mutex);
- *
- * current_data = data;
- * data_cond.signal();
- * }
- *
- * void* pop_data()
- * {
- * Glib::Threads::Mutex::Lock lock(data_mutex);
- *
- * while (!current_data)
- * data_cond.wait(data_mutex);
- *
- * void* const data = current_data;
- * current_data = nullptr;
- *
- * return data;
- * }
- * @endcode
- */
-class Cond
-{
-public:
- Cond();
-
- Cond(const Cond&) = delete;
- Cond& operator=(const Cond&) = delete;
-
- ~Cond();
-
- /** If threads are waiting for this @a Cond, exactly one of them is woken up.
- * It is good practice to hold the same lock as the waiting thread, while calling
- * this method, though not required.
- */
- void signal();
-
- /** If threads are waiting for this @a Cond, all of them are woken up.
- * It is good practice to hold the same lock as the waiting threads, while calling
- * this method, though not required.
- */
- void broadcast();
-
- /** Waits until this thread is woken up on this @a Cond.
- * The mutex is unlocked before falling asleep and locked again before resuming.
- *
- * @param mutex A @a Mutex that is currently locked.
- *
- * @note It is important to use the @a wait() and @a wait_until() methods
- * only inside a loop, which checks for the condition to be true as it is not
- * guaranteed that the waiting thread will find it fulfilled, even if the signaling
- * thread left the condition in that state. This is because another thread can have
- * altered the condition, before the waiting thread got the chance to be woken up,
- * even if the condition itself is protected by a @a Mutex.
- */
- void wait(Mutex& mutex);
-
- /** Waits until this thread is woken up on this @a Cond, but not longer
- * than until the time specified by @a end_time.
- * The mutex is unlocked before falling asleep and locked again before resuming.
- *
- * @par Usage example:
- * Extending the example presented in the documentation of class Cond.
- * @code
- * void* pop_data_timed()
- * {
- * Glib::Threads::Mutex::Lock lock(data_mutex);
- *
- * // Wait at most 5 seconds.
- * const gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
- * while (!current_data)
- * if (!data_cond.wait_until(data_mutex, end_time)
- * return nullptr; // timeout
- *
- * void* const data = current_data;
- * current_data = nullptr;
- *
- * return data;
- * }
- * @endcode
- * The end time is calculated once, before entering the loop, and reused.
- * This is the motivation behind the use of absolute time. If a relative time
- * of 5 seconds were passed directly to the call and a spurious wakeup
- * occurred, the program would have to start over waiting again, which would
- * lead to a total wait time of more than 5 seconds.
- *
- * @param mutex A @a Mutex that is currently locked.
- * @param end_time The monotonic time to wait until, in microseconds.
- * See g_get_monotonic_time().
- * @return <tt>true</tt> if the condition variable was signalled (or in the case
- * of a spurious wakeup), <tt>false</tt> if @a end_time has passed.
- *
- * @note It is important to use the @a wait() and @a wait_until() methods
- * only inside a loop, which checks for the condition to be true as it is not
- * guaranteed that the waiting thread will find it fulfilled, even if the signaling
- * thread left the condition in that state. This is because another thread can have
- * altered the condition, before the waiting thread got the chance to be woken up,
- * even if the condition itself is protected by a @a Mutex.
- */
- bool wait_until(Mutex& mutex, gint64 end_time);
-
- GCond* gobj() { return &gobject_; }
-
-private:
- GCond gobject_;
-};
-
-/** Thread-local data pointer.
- *
- * It is recommended that all instances of this class are statically allocated.
- * The first time an instance is used (get(), set() or replace() is called)
- * glib allocates a scarce OS resource that cannot be deallocated.
- *
- * @deprecated Please use the thread_local keyword instead.
- */
-template <class T>
-class Private
-{
-public:
- Private(const Private<T>&) = delete;
- Private<T>& operator=(const Private<T>&) = delete;
-
- using DestructorFunc = void (*) (void*);
-
- /** Deletes static_cast<T*>(data)
- */
- static void delete_ptr(void* data);
-
- /** Constructor.
- *
- * @param destructor_func Function pointer, or <tt>nullptr</tt>. If @a destructor_func is not <tt>nullptr</tt>
- * and the stored data pointer is not <tt>nullptr</tt>, this function is called when replace()
- * is called and when the thread exits.
- */
- explicit inline Private(DestructorFunc destructor_func = &Private<T>::delete_ptr);
-
- /** Gets the pointer stored in the calling thread.
- *
- * @return If no value has yet been set in this thread, <tt>nullptr</tt> is returned.
- */
- inline T* get();
-
- /** Sets the pointer in the calling thread without calling <tt>destructor_func()</tt>.
- */
- inline void set(T* data);
-
- /** Sets the pointer in the calling thread and calls <tt>destructor_func()</tt>.
- * If a function pointer (and not <tt>nullptr</tt>) was specified in the constructor, and
- * the stored data pointer before the call to replace() is not <tt>nullptr</tt>, then
- * <tt>destructor_func()</tt> is called with this old pointer value.
- *
- * @newin{2,32}
- */
- inline void replace(T* data);
-
- GPrivate* gobj() { return gobject_; }
-
-private:
- GPrivate gobject_;
-};
-
-/** @} group Threads */
-
-/*! A glibmm thread example.
- * @example thread/thread.cc
- */
-
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-
-/***************************************************************************/
-/* inline implementation */
-/***************************************************************************/
-
-/**** Glib::Threads::Mutex::Lock *******************************************/
-
-inline
-Mutex::Lock::Lock(Mutex& mutex)
-:
- mutex_ (mutex),
- locked_ (true)
-{
- mutex_.lock();
-}
-
-inline
-Mutex::Lock::Lock(Mutex& mutex, NotLock)
-:
- mutex_ (mutex),
- locked_ (false)
-{}
-
-inline
-Mutex::Lock::Lock(Mutex& mutex, TryLock)
-:
- mutex_ (mutex),
- locked_ (mutex.trylock())
-{}
-
-inline
-Mutex::Lock::~Lock()
-{
- if(locked_)
- mutex_.unlock();
-}
-
-inline
-void Mutex::Lock::acquire()
-{
- mutex_.lock();
- locked_ = true;
-}
-
-inline
-bool Mutex::Lock::try_acquire()
-{
- locked_ = mutex_.trylock();
- return locked_;
-}
-
-inline
-void Mutex::Lock::release()
-{
- mutex_.unlock();
- locked_ = false;
-}
-
-inline
-bool Mutex::Lock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::Threads::RecMutex::Lock ****************************************/
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex)
-:
- mutex_ (mutex),
- locked_ (true)
-{
- mutex_.lock();
-}
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex, NotLock)
-:
- mutex_ (mutex),
- locked_ (false)
-{}
-
-inline
-RecMutex::Lock::Lock(RecMutex& mutex, TryLock)
-:
- mutex_ (mutex),
- locked_ (mutex.trylock())
-{}
-
-inline
-RecMutex::Lock::~Lock()
-{
- if(locked_)
- mutex_.unlock();
-}
-
-inline
-void RecMutex::Lock::acquire()
-{
- mutex_.lock();
- locked_ = true;
-}
-
-inline
-bool RecMutex::Lock::try_acquire()
-{
- locked_ = mutex_.trylock();
- return locked_;
-}
-
-inline
-void RecMutex::Lock::release()
-{
- mutex_.unlock();
- locked_ = false;
-}
-
-inline
-bool RecMutex::Lock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::Threads::RWLock::ReaderLock ************************************/
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock)
-:
- rwlock_ (rwlock),
- locked_ (true)
-{
- rwlock_.reader_lock();
-}
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock, NotLock)
-:
- rwlock_ (rwlock),
- locked_ (false)
-{}
-
-inline
-RWLock::ReaderLock::ReaderLock(RWLock& rwlock, TryLock)
-:
- rwlock_ (rwlock),
- locked_ (rwlock.reader_trylock())
-{}
-
-inline
-RWLock::ReaderLock::~ReaderLock()
-{
- if(locked_)
- rwlock_.reader_unlock();
-}
-
-inline
-void RWLock::ReaderLock::acquire()
-{
- rwlock_.reader_lock();
- locked_ = true;
-}
-
-inline
-bool RWLock::ReaderLock::try_acquire()
-{
- locked_ = rwlock_.reader_trylock();
- return locked_;
-}
-
-inline
-void RWLock::ReaderLock::release()
-{
- rwlock_.reader_unlock();
- locked_ = false;
-}
-
-inline
-bool RWLock::ReaderLock::locked() const
-{
- return locked_;
-}
-
-
-/**** Glib::Threads::RWLock::WriterLock ************************************/
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock)
-:
- rwlock_ (rwlock),
- locked_ (true)
-{
- rwlock_.writer_lock();
-}
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock, NotLock)
-:
- rwlock_ (rwlock),
- locked_ (false)
-{}
-
-inline
-RWLock::WriterLock::WriterLock(RWLock& rwlock, TryLock)
-:
- rwlock_ (rwlock),
- locked_ (rwlock.writer_trylock())
-{}
-
-inline
-RWLock::WriterLock::~WriterLock()
-{
- if(locked_)
- rwlock_.writer_unlock();
-}
-
-inline
-void RWLock::WriterLock::acquire()
-{
- rwlock_.writer_lock();
- locked_ = true;
-}
-
-inline
-bool RWLock::WriterLock::try_acquire()
-{
- locked_ = rwlock_.writer_trylock();
- return locked_;
-}
-
-inline
-void RWLock::WriterLock::release()
-{
- rwlock_.writer_unlock();
- locked_ = false;
-}
-
-inline
-bool RWLock::WriterLock::locked() const
-{
- return locked_;
-}
-
-/**** Glib::Threads::Private<T> ********************************************/
-
-// static
-template <class T>
-void Private<T>::delete_ptr(void* data)
-{
- delete static_cast<T*>(data);
-}
-
-template <class T> inline
-Private<T>::Private(typename Private<T>::DestructorFunc destructor_func)
-{
- // gobject_ = G_PRIVATE_INIT(destructor_func);
- // does not compile with --enable-warnings=fatal.
- // GPrivate is a struct, and G_PRIVATE_INIT is an initializer of type { ... }.
- // G_PRIVATE_INIT can be used only in initializations.
- const GPrivate temp = G_PRIVATE_INIT(destructor_func);
- gobject_ = temp;
-}
-
-template <class T> inline
-T* Private<T>::get()
-{
- return static_cast<T*>(g_private_get(&gobject_));
-}
-
-template <class T> inline
-void Private<T>::set(T* data)
-{
- g_private_set(&gobject_, data);
-}
-
-template <class T> inline
-void Private<T>::replace(T* data)
-{
- g_private_replace(&gobject_, data);
-}
-
-#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
-} //namespace Threads
-
-} // namespace Glib
+++ /dev/null
-/* Copyright (C) 2002-2009 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmm/exceptionhandler.h>
-
-static int
-ValueArray_Compare_glibmm_callback(gconstpointer a, gconstpointer b, gpointer user_data)
-{
- Glib::ValueArray::SlotCompare* the_slot = static_cast<Glib::ValueArray::SlotCompare*>(user_data);
-
- try
- {
- return (*the_slot)(
- *reinterpret_cast<const Glib::ValueBase*>(a), *reinterpret_cast<const Glib::ValueBase*>(b));
- }
- catch (...)
- {
- Glib::exception_handlers_invoke();
- }
-
- return 0;
-}
-
-namespace Glib
-{
-
-ValueArray::ValueArray() : gobject_(g_value_array_new(0))
-{
-}
-
-ValueArray::ValueArray(guint n_preallocated) : gobject_(g_value_array_new(n_preallocated))
-{
-}
-
-bool
-ValueArray::get_nth(guint index, Glib::ValueBase& value)
-{
- const auto g_value = g_value_array_get_nth(gobj(), index);
-
- if (g_value)
- {
- value.init(g_value);
- return true;
- }
- else
- return false;
-}
-
-Glib::ValueArray&
-ValueArray::append(const Glib::ValueBase& value)
-{
- g_value_array_append(gobj(), value.gobj());
- return *this;
-}
-
-Glib::ValueArray&
-ValueArray::prepend(const Glib::ValueBase& value)
-{
- g_value_array_prepend(gobj(), value.gobj());
- return *this;
-}
-
-Glib::ValueArray&
-ValueArray::insert(guint index, const Glib::ValueBase& value)
-{
- g_value_array_insert(gobj(), index, value.gobj());
- return *this;
-}
-
-Glib::ValueArray&
-ValueArray::remove(guint index)
-{
- g_value_array_remove(gobj(), index);
- return *this;
-}
-
-Glib::ValueArray&
-ValueArray::sort(const SlotCompare& compare_func)
-{
- SlotCompare slot_copy(compare_func);
- g_value_array_sort_with_data(gobj(), &ValueArray_Compare_glibmm_callback, &slot_copy);
- return *this;
-}
-
-} // Glib namespace
+++ /dev/null
-/* Copyright (C) 2002-2009 The gtkmm Development Team
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-_CONFIGINCLUDE(glibmmconfig.h)
-
-_DEFS(glibmm,glib)
-
-#include <glib-object.h>
-#include <glibmm/value.h>
-#include <sigc++/functors/slot.h>
-
-#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
-#undef G_DISABLE_DEPRECATED
-#define GLIB_DISABLE_DEPRECATION_WARNINGS 1
-#m4 _POP()
-
-_IS_DEPRECATED // This whole file is deprecated.
-
-namespace Glib
-{
-
-/** A container structure to maintain an array of generic values.
- * The prime purpose of a ValueArray is for it to be used as an object property
- * that holds an array of values. A ValueArray wraps an array of ValueBase
- * elements.
- *
- * @newin{2,22}
- *
- * @deprecated Use std::vector<Glib::ValueBase*> or std::vector< Glib::Value<> >
- * instead of Glib::ValueArray.
- */
-class ValueArray
-{
- _CLASS_BOXEDTYPE(ValueArray, GValueArray, NONE, g_value_array_copy, g_value_array_free)
- _IGNORE(g_value_array_copy, g_value_array_free)
- _CUSTOM_DEFAULT_CTOR
-
-public:
- /** For example,
- * int on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2);.
- * The compare function should return -1 if v1 < v2, 0 if v1 == v2, and 1 if
- * v1 > v2.
- */
- using SlotCompare = sigc::slot<int, const Glib::ValueBase&, const Glib::ValueBase&>;
-
- /** Default constructor. Constructs a new array with no pre-allocation.
- */
- ValueArray();
-
- /** Constructs a new array with pre-allocation.
- */
- ValueArray(guint n_preallocated);
-
- /** Return the value at @a index contained in the value array.
- * @param index Index of the value of interest.
- * @param value An uninitialized ValueBase in which to store the result. If
- * the get is successful, @a value will be valid, otherwise it will remain
- * uninitialized.
- * @return whether the get was successful or not.
- */
- bool get_nth(guint index, Glib::ValueBase& value);
- _IGNORE(g_value_array_get_nth)
-
- _WRAP_METHOD_DOCS_ONLY(g_value_array_append)
- Glib::ValueArray& append(const Glib::ValueBase& value);
-
- _WRAP_METHOD_DOCS_ONLY(g_value_array_prepend)
- Glib::ValueArray& prepend(const Glib::ValueBase& value);
-
- _WRAP_METHOD_DOCS_ONLY(g_value_array_insert)
- Glib::ValueArray& insert(guint index, const Glib::ValueBase& value);
-
- _WRAP_METHOD_DOCS_ONLY(g_value_array_remove)
- Glib::ValueArray& remove(guint index);
-
- _WRAP_METHOD_DOCS_ONLY(g_value_array_sort)
- Glib::ValueArray& sort(const SlotCompare& compare_func);
- _IGNORE(g_value_array_sort_with_data)
-};
-
-} //namespace Glib
if (castitem)
{
if (g_variant_is_floating(castitem))
+ {
g_variant_ref_sink(castitem);
-
+ }
if (make_a_copy)
+ {
g_variant_ref(castitem);
+ }
}
gobject_ = castitem;
var_ptr* const var_array = new var_ptr[children.size()];
for (std::vector<VariantBase>::size_type i = 0; i < children.size(); i++)
+ {
var_array[i] = const_cast<GVariant*>(children[i].gobj());
+ }
VariantContainerBase result =
VariantContainerBase(g_variant_new_tuple(var_array, children.size()));
// VariantContainerBase has no method variant_type()
template <>
VariantContainerBase
-VariantBase::cast_dynamic<VariantContainerBase>(const VariantBase& v) noexcept(false)
+VariantBase::cast_dynamic<VariantContainerBase>(const VariantBase& v) throw(std::bad_cast)
{
if (!v.gobj())
+ {
return VariantContainerBase();
-
+ }
if (v.get_type().is_container())
{
return VariantContainerBase(const_cast<GVariant*>(v.gobj()), true);
return true;
}
else
- {
return false;
- }
}
VariantIter
/****************** Specializations ***********************************/
-_DEPRECATE_IFDEF_START
-VariantBase::operator const void*() const
-{
- return gobj() ? GINT_TO_POINTER(1) : nullptr;
-}
-_DEPRECATE_IFDEF_END
-
VariantBase::operator bool() const
{
return gobj() ? GINT_TO_POINTER(1) : nullptr;
// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
template <>
Variant<Glib::ustring>
-VariantBase::cast_dynamic<Variant<Glib::ustring>>(const VariantBase& v) noexcept(false)
+VariantBase::cast_dynamic<Variant<Glib::ustring>>(const VariantBase& v) throw(std::bad_cast)
{
if (!v.gobj())
{
// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string
template <>
Variant<std::string>
-VariantBase::cast_dynamic<Variant<std::string>>(const VariantBase& v) noexcept(false)
+VariantBase::cast_dynamic<Variant<std::string>>(const VariantBase& v) throw(std::bad_cast)
{
if (!v.gobj())
{
// Add the elements of the vector into the builder.
for (const auto& str : data)
+ {
g_variant_builder_add(builder, element_variant_type.get_string().c_str(), str.c_str());
+ }
// Create the variant using the builder.
auto result =
for (gsize i = 0; i < n_children; i++)
{
GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
+
result.emplace_back(Glib::Variant<Glib::ustring>(gvariant).get());
}
// Add the elements of the vector into the string array.
for (type_vec_string::size_type i = 0; i < data.size(); i++)
+ {
str_array[i] = g_strdup(data[i].c_str());
+ }
// Terminate the string array.
str_array[data.size()] = nullptr;
// Add the elements of the vector into the string array.
for (type_vec_string::size_type i = 0; i < data.size(); i++)
+ {
str_array[i] = g_strdup(data[i].c_str());
+ }
// Terminate the string array.
str_array[data.size()] = nullptr;
for (gsize i = 0; i < n_children; i++)
{
GVariant* gvariant = g_variant_get_child_value(const_cast<GVariant*>(gobj()), i);
+
result.emplace_back(Glib::Variant<std::string>(gvariant).get());
}
g_variant_get, g_variant_get_va)
public:
-_DEPRECATE_IFDEF_START
- /** This typedef is just to make it more obvious that
- * our operator const void* should be used like operator bool().
- *
- * @deprecated Use the explicit operator bool() instead.
- */
- using BoolExpr = const void*;
-
- /** Test whether the Variant has an underlying instance.
- *
- * Mimics usage of pointers:
- * @code
- * if (variant)
- * do_something();
- * @endcode
- *
- * @deprecated Use the explicit operator bool() instead.
- *
- * @newin{2,36}
- */
- operator BoolExpr() const;
-_DEPRECATE_IFDEF_END
-
/** Test whether the Variant has an underlying instance.
*
* @newin{2,50}
_WRAP_METHOD(GVariantClass classify() const, g_variant_classify)
_WRAP_METHOD(gsize get_size() const, g_variant_get_size)
- _WRAP_METHOD(gconstpointer get_data(), g_variant_get_data, deprecated "Use the const version instead.")
_WRAP_METHOD(gconstpointer get_data() const, g_variant_get_data, newin "2,46")
_WRAP_METHOD(Glib::RefPtr<const Glib::Bytes> get_data_as_bytes() const, g_variant_get_data_as_bytes, newin "2,46")
_WRAP_METHOD(void store(gpointer data) const, g_variant_store)
* @throws std::bad_cast if the Variant was not of the expected type.
*/
template<class V_CastTo>
- static V_CastTo cast_dynamic(const VariantBase& v) noexcept(false);
+ static V_CastTo cast_dynamic(const VariantBase& v) throw(std::bad_cast);
_IGNORE(g_variant_dict_new)
template<class V_CastTo>
V_CastTo VariantBase::cast_dynamic(const VariantBase& v)
-noexcept(false)
+throw(std::bad_cast)
{
if(!(v.gobj()))
{
_WRAP_METHOD(static bool is_signature(const std::string& string), g_variant_is_signature)
};
-/** The base class for multiple-item Variants, such as Variants containing
- * tuples or arrays, and also for maybe-typed (i.e. nullable) Variant types.
+/** The base class from which multiple-item Variants derive, such as Variants
+ * containing tuples or arrays.
*
* @newin{2,28}
* @ingroup Variant
DataType get_child(gsize index = 0) const;
*/
- /** If this is a maybe-typed instance, try to extract its value. If there is
- * no value (the value is <tt>nothing</tt>), return <tt>false</tt. Otherwise,
- * the value is copied to the supplied Variant and <tt>true</tt> is returned.
+ /** If this is a maybe-typed instance, extract its value. If the value is
+ * Nothing, then this function returns <tt>false</tt>.
*
- * @param maybe A place in which to return the value, if it isn’t
- * <tt>nothing</tt>.
+ * @param maybe A place in which to return the value (the value may be
+ * <tt>0</tt>).
* @newin{2,28}
*/
bool get_maybe(VariantBase& maybe) const;
template<>
VariantContainerBase VariantBase::cast_dynamic<VariantContainerBase>(const VariantBase& v)
-noexcept(false);
+throw(std::bad_cast);
/** Template class used for the specialization of the Variant<> classes.
* @newin{2,28}
/****************** Specializations ***********************************/
/** Specialization of Variant containing a VariantBase.
- * Perhaps the main use of this is as a maybe-typed (i.e. nullable) Variant, as
- * it inherits methods create_maybe() and get_maybe() from VariantContainerBase.
- *
* @newin{2,28}
* @ingroup Variant
*/
//TODO: When we can break ABI, remove this template specialization.
template<>
Variant<Glib::ustring> VariantBase::cast_dynamic< Variant<Glib::ustring> >(const VariantBase& v)
-noexcept(false);
+throw(std::bad_cast);
/** Specialization of Variant containing a std::string, for variants of type
* bytestring, string, object path, or signature.
//TODO: When we can break ABI, remove this template specialization.
template<>
Variant<std::string> VariantBase::cast_dynamic< Variant<std::string> >(const VariantBase& v)
-noexcept(false);
+throw(std::bad_cast);
/** Specialization of Variant containing a dictionary entry. See also
* Variant< std::map<K, V> >.
_IGNORE(g_variant_get_fixed_array)
/** Gets a VariantIter of the Variant.
- * @return the VariantIter.
+ * @return the VaraintIter.
* @newin{2,28}
*/
VariantIter get_iter() const;
_IGNORE(g_variant_get_strv, g_variant_dup_strv)
/** Gets a VariantIter of the Variant.
- * @return the VariantIter.
+ * @return the VaraintIter.
* @newin{2,28}
*/
VariantIter get_iter() const;
_IGNORE(g_variant_get_objv, g_variant_dup_objv)
/** Gets a VariantIter of the Variant.
- * @return the VariantIter.
+ * @return the VaraintIter.
* @newin{2,28}
*/
VariantIter get_iter() const;
std::map<K, V> get() const;
/** Gets a VariantIter of the Variant.
- * @return the VariantIter.
+ * @return the VaraintIter.
* @newin{2,28}
*/
VariantIter get_iter() const;
giomm_ioerror_and_iodbuserror/test \
giomm_memoryinputstream/test \
giomm_simple/test \
+ giomm_stream_vfuncs/test \
giomm_asyncresult_sourceobject/test \
giomm_tls_client/test \
giomm_listmodel/test \
glibmm_ustring_compose/test \
glibmm_ustring_format/test \
glibmm_value/test \
- glibmm_valuearray/test \
glibmm_variant/test \
glibmm_vector/test \
glibmm_bool_vector/test \
giomm_includes = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio)
local_cppflags = -I$(top_builddir) $(glibmm_includes) $(giomm_includes)
+cxxflags_disable_deprecated = $(GLIBMM_WXXFLAGS) -DGLIBMM_DISABLE_DEPRECATED -DGIOMM_DISABLE_DEPRECATED
AM_CPPFLAGS = $(local_cppflags) $(GIOMM_CFLAGS)
-AM_CXXFLAGS = $(GLIBMM_WXXFLAGS) -DGLIBMM_DISABLE_DEPRECATED -DGIOMM_DISABLE_DEPRECATED
+AM_CXXFLAGS = $(GLIBMM_WXXFLAGS) $(cxxflags_disable_deprecated)
local_libglibmm = $(top_builddir)/glib/glibmm/libglibmm-$(GLIBMM_API_VERSION).la
giomm_simple_test_SOURCES = giomm_simple/main.cc
giomm_simple_test_LDADD = $(giomm_ldadd)
+giomm_stream_vfuncs_test_SOURCES = giomm_stream_vfuncs/main.cc
+giomm_stream_vfuncs_test_LDADD = $(giomm_ldadd)
+
giomm_asyncresult_sourceobject_test_SOURCES = giomm_asyncresult_sourceobject/main.cc
giomm_asyncresult_sourceobject_test_LDADD = $(giomm_ldadd)
glibmm_interface_implementation_test_LDADD = $(giomm_ldadd)
glibmm_interface_move_test_SOURCES = glibmm_interface_move/main.cc
+glibmm_interface_move_test_CXXFLAGS = $(GLIBMM_INTERFACE_TEST_WXXFLAGS) $(cxxflags_disable_deprecated)
+
glibmm_mainloop_test_SOURCES = glibmm_mainloop/main.cc
glibmm_nodetree_test_SOURCES = glibmm_nodetree/main.cc
glibmm_object_move_test_SOURCES = glibmm_object_move/main.cc
glibmm_ustring_compose_test_SOURCES = glibmm_ustring_compose/main.cc
glibmm_ustring_format_test_SOURCES = glibmm_ustring_format/main.cc
glibmm_value_test_SOURCES = glibmm_value/glibmm_value.cc glibmm_value/main.cc
-glibmm_valuearray_test_SOURCES = glibmm_valuearray/main.cc
glibmm_variant_test_SOURCES = glibmm_variant/main.cc
glibmm_vector_test_SOURCES = glibmm_vector/main.cc
glibmm_vector_test_LDADD = $(giomm_ldadd)
--- /dev/null
+/* Copyright (C) 2016 The giomm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <giomm.h>
+#include <iostream>
+#include <string>
+#include <cstdlib>
+
+// A simple custom stream that base64 encodes data.
+// Do not copy it to your code, because it's very slow.
+class Base64OutputStream : public Gio::FilterOutputStream
+{
+public:
+ unsigned get_column_width() const { return column_width; }
+ void set_column_width(unsigned cw) { column_width = cw; }
+ static Glib::RefPtr<Base64OutputStream> create(const Glib::RefPtr<OutputStream>& base_stream)
+ {
+ return Glib::RefPtr<Base64OutputStream>(new Base64OutputStream(base_stream));
+ }
+
+protected:
+ Base64OutputStream(const Glib::RefPtr<Gio::OutputStream>& base_stream)
+ : Gio::FilterOutputStream(base_stream), column(0), bit_count(0), bit_buffer(0), column_width(72) {}
+
+ gssize write_vfunc(const void* buffer, gsize count, const Glib::RefPtr<Gio::Cancellable>& cancellable) override
+ {
+ char const *byte = (char const *) buffer;
+ for (unsigned i = 0; i < count; ++i, ++byte)
+ {
+ // kindergarten implementation, because the object is not performance :)
+ bit_buffer <<= 8;
+ bit_buffer |= (*byte & 0xff);
+ bit_count += 8;
+
+ if (bit_count == 24)
+ {
+ clear_pending(); // TODO why is this necessary to avoid an outstanding op. exception?
+ flush(cancellable);
+ set_pending();
+ bit_count = 0;
+ }
+
+ if (cancellable && cancellable->is_cancelled())
+ throw Gio::Error(Gio::Error::CANCELLED, "Operation cancelled");
+ }
+ return count;
+ }
+
+ bool flush_vfunc(const Glib::RefPtr<Gio::Cancellable>& cancellable) override
+ {
+ if (bit_count != 24)
+ return true;
+ char to_write[5];
+ gsize len = 4;
+
+ for (unsigned i=0; i<4; ++i)
+ {
+ unsigned index = (bit_buffer & (0x3f<<(i*6))) >> (i*6);
+ to_write[3-i] = base64_encode_str[index];
+ }
+ column += 4;
+ // Yes, I know this is completely wrong.
+ if (column >= column_width)
+ {
+ column = 0;
+ to_write[4] = '\n';
+ ++len;
+ }
+
+ get_base_stream()->write(&to_write, len, cancellable);
+
+ bit_count = 0;
+ bit_buffer = 0;
+
+ return true;
+ }
+
+ bool close_vfunc(const Glib::RefPtr<Gio::Cancellable>& cancellable) override
+ {
+ char to_write[5] = "====";
+ //get any last bytes (1 or 2) out of the buffer
+ switch (bit_count)
+ {
+ case 16:
+ bit_buffer <<= 2; //pad to make 18 bits
+ to_write[0] = base64_encode_str[(bit_buffer & (0x3f << 12)) >> 12];
+ to_write[1] = base64_encode_str[(bit_buffer & (0x3f << 6)) >> 6];
+ to_write[2] = base64_encode_str[bit_buffer & 0x3f];
+ break;
+
+ case 8:
+ bit_buffer <<= 4; //pad to make 12 bits
+ to_write[0] = base64_encode_str[(bit_buffer & (0x3f << 6)) >> 6];
+ to_write[1] = base64_encode_str[bit_buffer & 0x3f];
+ break;
+ }
+
+ if (bit_count > 0)
+ {
+ get_base_stream()->write(&to_write, 5, cancellable);
+ }
+ else
+ {
+ // null terminate output
+ get_base_stream()->write("", 1, cancellable);
+ }
+ if (get_close_base_stream())
+ get_base_stream()->close(cancellable);
+
+ return true;
+ }
+
+private:
+ static char const *const base64_encode_str;
+ unsigned column;
+ unsigned bit_count;
+ unsigned bit_buffer;
+ unsigned column_width;
+};
+
+char const *const Base64OutputStream::base64_encode_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+int main(int, char**)
+{
+ Glib::init();
+ Gio::init();
+
+ try
+ {
+ char result[256];
+ Glib::RefPtr<Gio::MemoryOutputStream> memory_chunk = Gio::MemoryOutputStream::create(result, 256, nullptr, nullptr);
+ Glib::RefPtr<Base64OutputStream> base64 = Base64OutputStream::create(memory_chunk);
+
+ std::string data = "Custom GIO streams are cool!";
+
+ base64->set_close_base_stream(true);
+ base64->write(data);
+ base64->close();
+
+ const std::string base64_should_be("Q3VzdG9tIEdJTyBzdHJlYW1zIGFyZSBjb29sIQ==");
+ std::cout << "Original data: " << data << std::endl;
+ std::cout << "base64-encoded data: " << result << std::endl;
+ std::cout << "base64 should be: " << base64_should_be << std::endl;
+ if (base64_should_be != result)
+ {
+ std::cout << "Not correct!" << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+ catch (Gio::Error e)
+ {
+ std::cout << "Gio error: " << e.what() << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
+++ /dev/null
-// Glib::ValueArray is deprecated, but let's keep the test.
-// The recommended replacement is std::vector<> which requires no test here.
-#undef GLIBMM_DISABLE_DEPRECATED
-
-#include <glibmm.h>
-#include <iostream>
-
-#ifdef GLIBMM_DISABLE_DEPRECATED
-int
-main(int, char**)
-{
- // If glibmm is configured with --disable-deprecated-api, GLIBMM_DISABLE_DEPRECATED
- // is defined in glibmm.h (actually in glibmmconfig.h). The undef at the start of
- // this file has no effect.
- return 77; // Tell automake's test harness to skip this test.
-}
-
-#else
-
-// Use this line if you want debug output:
-// std::ostream& ostr = std::cout;
-
-// This seems nicer and more useful than putting an ifdef around the use of ostr:
-std::stringstream debug;
-std::ostream& ostr = debug;
-
-int
-on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2)
-{
- const Glib::Value<int>& intVal1 = static_cast<const Glib::Value<int>&>(v1);
- const Glib::Value<int>& intVal2 = static_cast<const Glib::Value<int>&>(v2);
-
- int int1 = intVal1.get();
- int int2 = intVal2.get();
-
- if (int1 < int2)
- return -1;
- else if (int1 == int2)
- return EXIT_SUCCESS;
- else
- return 1;
-}
-
-int
-main(int, char**)
-{
- const int VALUES_COUNT = 10;
-
- Glib::init();
-
- Glib::Value<int> values[VALUES_COUNT];
- Glib::ValueArray array;
-
- for (int i = 0; i < VALUES_COUNT; i++)
- {
- values[i].init(Glib::Value<int>::value_type());
- values[i].set(i + 1); // (i + 1) ==> Set to natural counting numbers.
- array.prepend(values[i]);
- }
-
- ostr << "Array members before sorting:" << std::endl;
-
- for (int i = 0; i < VALUES_COUNT; i++)
- {
- Glib::ValueBase value;
-
- if (!array.get_nth(i, value))
- {
- std::cerr << "Error getting element " << i << " of value array." << std::endl;
- return EXIT_FAILURE;
- break;
- }
-
- auto int_val = static_cast<Glib::Value<int>&>(value);
- ostr << int_val.get() << " ";
- }
- ostr << std::endl; // End of line for list of array elements.
-
- // Sort array and remove last element:
- array.sort(sigc::ptr_fun(&on_compare)).remove(VALUES_COUNT - 1);
-
- ostr << "Array members after sorting without last element:" << std::endl;
-
- for (int i = 0; i < VALUES_COUNT - 1; i++)
- {
- Glib::ValueBase value;
-
- if (!array.get_nth(i, value))
- {
- std::cerr << "Error getting element " << i << " of value array." << std::endl;
- return EXIT_FAILURE;
- break;
- }
-
- auto int_val = static_cast<Glib::Value<int>&>(value);
- ostr << int_val.get() << " ";
- }
- ostr << std::endl; // End of line for list of array elements.
-
- return EXIT_SUCCESS;
-}
-#endif // GLIBMM_DISABLE_DEPRECATED
dist_noinst_SCRIPTS = enum.pl
noinst_PROGRAMS = extra_defs_gen/generate_defs_glib extra_defs_gen/generate_defs_gio
-lib_LTLIBRARIES = extra_defs_gen/libglibmm_generate_extra_defs-2.4.la
+lib_LTLIBRARIES = extra_defs_gen/libglibmm_generate_extra_defs-2.52.la
extradefs_includedir = $(includedir)/$(GLIBMM_MODULE_NAME)/glibmm_generate_extra_defs
extradefs_include_HEADERS = extra_defs_gen/generate_extra_defs.h
extradefs_ldflags = -no-undefined -version-info $(LIBGLIBMM_SO_VERSION)
-extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_SOURCES = extra_defs_gen/generate_extra_defs.cc
-extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_LDFLAGS = $(extradefs_ldflags)
-extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_LIBADD = $(GLIBMM_LIBS)
+extra_defs_gen_libglibmm_generate_extra_defs_2_52_la_SOURCES = extra_defs_gen/generate_extra_defs.cc
+extra_defs_gen_libglibmm_generate_extra_defs_2_52_la_LDFLAGS = $(extradefs_ldflags)
+extra_defs_gen_libglibmm_generate_extra_defs_2_52_la_LIBADD = $(GLIBMM_LIBS)
extra_defs_gen_generate_defs_glib_SOURCES = extra_defs_gen/generate_defs_glib.cc
extra_defs_gen_generate_defs_glib_LDADD = $(GLIBMM_LIBS) $(lib_LTLIBRARIES)
')dnl
ifelse($13,,`dnl no detail_name
$10
- Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'();
+ Glib::SignalProxy<$5`'($6)> signal_$4`'();
',dnl detail_name
$14,0,`dnl
$10
- Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13 = Glib::ustring());
+ Glib::SignalProxyDetailedAnyType<$5`'($6)> signal_$4`'(const Glib::ustring& $13 = Glib::ustring());
',`dnl detail_name and two_signal_methods
$10
- Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'();
+ Glib::SignalProxy<$5`'($6)> signal_$4`'();
$10
- Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13);
+ Glib::SignalProxyDetailedAnyType<$5`'($6)> signal_$4`'(const Glib::ustring& $13);
')dnl end detail_name
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
')dnl
static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`'void* data)
{
using namespace __NAMESPACE__;
- using SlotType = sigc::slot< $5`'_COMMA_PREFIX($6) >;
+ using SlotType = sigc::slot<$5`'($6)>;
auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`' void* data)
{
using namespace __NAMESPACE__;
- using SlotType = sigc::slot< void`'_COMMA_PREFIX($6) >;
+ using SlotType = sigc::slot<void($6)>;
auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
')dnl
ifelse($13,,`dnl no detail_name
-Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
+Glib::SignalProxy<$5`'($6)> __CPPNAME__::signal_$4`'()
{
- return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
+ return Glib::SignalProxy<$5`'($6) >(this, &__CPPNAME__`'_signal_$4_info);
}
',dnl detail_name
$14,0,`dnl
-Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
+Glib::SignalProxyDetailedAnyType<$5`'($6)> __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
{
- return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
+ return Glib::SignalProxyDetailedAnyType<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info, $13);
}
',`dnl detail_name and two_signal_methods
-Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
+Glib::SignalProxy<$5`'($6)> __CPPNAME__::signal_$4`'()
{
- return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
+ return Glib::SignalProxy<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info);
}
-Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
+Glib::SignalProxyDetailedAnyType<$5`'($6)> __CPPNAME__::signal_$4`'(const Glib::ustring& $13)
{
- return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13);
+ return Glib::SignalProxyDetailedAnyType<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info, $13);
}
')dnl end detail_name
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
# files that it depends on.
# Example: In glibmm, go to directory glibmm, and run
-# tools/test_scripts/testheaders.sh -I glib glibmm-2.4 gio # compile glibmm/gio/giomm/*.h
-# tools/test_scripts/testheaders.sh glibmm-2.4 glib gio # compile glibmm/glib/glibmm/*.h and glibmm/gio/giomm/*.h
-# tools/test_scripts/testheaders.sh -I glib -I gio glibmm-2.4 glib/glibmm/ustring.h # compile glibmm/glib/glibmm/ustring.h
+# tools/test_scripts/testheaders.sh -I glib glibmm-2.52 gio # compile glibmm/gio/giomm/*.h
+# tools/test_scripts/testheaders.sh glibmm-2.52 glib gio # compile glibmm/glib/glibmm/*.h and glibmm/gio/giomm/*.h
+# tools/test_scripts/testheaders.sh -I glib -I gio glibmm-2.52 glib/glibmm/ustring.h # compile glibmm/glib/glibmm/ustring.h
# Usage: testheaders.sh [-I<dir>]... <pkg> [<dir> | <file>]...
# -I<dir> is added to the g++ command.