summaryrefslogtreecommitdiff
path: root/gio/src/asyncinitable.ccg
diff options
context:
space:
mode:
Diffstat (limited to 'gio/src/asyncinitable.ccg')
-rw-r--r--gio/src/asyncinitable.ccg32
1 files changed, 11 insertions, 21 deletions
diff --git a/gio/src/asyncinitable.ccg b/gio/src/asyncinitable.ccg
index 6a3c855a..df26f6f5 100644
--- a/gio/src/asyncinitable.ccg
+++ b/gio/src/asyncinitable.ccg
@@ -1,5 +1,3 @@
-// -*- 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
@@ -32,7 +30,7 @@ void AsyncInitable::init_async(const SlotAsyncReady& slot,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_async_initable_init_async(gobj(), io_priority, Glib::unwrap(cancellable),
&SignalProxy_async_callback, slot_copy);
@@ -43,7 +41,7 @@ void AsyncInitable::init_async(const SlotAsyncReady& slot, int io_priority)
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_async_initable_init_async(gobj(), io_priority, 0,
&SignalProxy_async_callback, slot_copy);
@@ -53,7 +51,7 @@ void AsyncInitable_Class::init_async_vfunc_callback(GAsyncInitable* self,
int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback,
gpointer user_data)
{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
@@ -63,13 +61,11 @@ void AsyncInitable_Class::init_async_vfunc_callback(GAsyncInitable* self,
// being overridden:
if(obj_base && obj_base->is_derived_())
{
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
// Get the slot.
Gio::SlotAsyncReady* the_slot =
static_cast<Gio::SlotAsyncReady*>(user_data);
@@ -78,17 +74,15 @@ void AsyncInitable_Class::init_async_vfunc_callback(GAsyncInitable* self,
obj->init_async_vfunc(*the_slot, Glib::wrap(cancellable, true),
io_priority);
return;
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
@@ -101,7 +95,7 @@ g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Ge
void Gio::AsyncInitable::init_async_vfunc(const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
@@ -116,7 +110,7 @@ g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) /
gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self,
GAsyncResult* res, GError** error)
{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
@@ -126,26 +120,22 @@ gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self,
// being overridden:
if(obj_base && obj_base->is_derived_())
{
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
- #endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
return static_cast<int>(obj->init_finish_vfunc(Glib::wrap(res, true)));
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
- #endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
@@ -160,14 +150,14 @@ g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Ge
}
bool Gio::AsyncInitable::init_finish_vfunc(const Glib::RefPtr<AsyncResult>& res)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->init_finish)
{
- GError* gerror = 0;
+ GError* gerror = nullptr;
bool const result = (*base->init_finish)(gobj(), Glib::unwrap(res),
&gerror);