From 218a9ca94adbff34d8d8fdcbb457f5b5d754481b Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 7 Sep 2020 00:11:43 -0700 Subject: [PATCH] Imported Upstream version 2.48.1 --- NEWS | 12 ++++ build/cxx.m4 | 21 +++++++ configure.ac | 3 +- examples/thread/dispatcher2.cc | 2 +- gio/giomm/socketsource.h | 2 +- gio/src/action.hg | 12 ++-- gio/src/actiongroup.hg | 4 +- gio/src/actionmap.hg | 2 +- gio/src/application.ccg | 6 +- gio/src/application.hg | 2 +- gio/src/asyncinitable.ccg | 4 +- gio/src/cancellable.hg | 2 +- gio/src/dbusauthobserver.ccg | 4 +- gio/src/dbusconnection.hg | 8 +-- gio/src/dbusinterfacevtable.hg | 12 ++-- gio/src/dbusmessage.ccg | 2 +- gio/src/dbusownname.hg | 6 +- gio/src/dbusproxy.ccg | 2 +- gio/src/dbusproxy.hg | 2 +- gio/src/dbussubtreevtable.hg | 12 ++-- gio/src/dbuswatchname.hg | 4 +- gio/src/drive.hg | 6 +- gio/src/file.ccg | 6 +- gio/src/file.hg | 6 +- gio/src/memoryinputstream.hg | 2 +- gio/src/mount.hg | 6 +- gio/src/notification.hg | 4 +- gio/src/simpleaction.hg | 2 +- gio/src/srvtarget.hg | 8 +-- gio/src/volume.hg | 6 +- glib/glibmm/arrayhandle.h | 58 +++++++++--------- glib/glibmm/class.h | 4 +- glib/glibmm/containerhandle_shared.h | 60 +++++++++---------- glib/glibmm/containers.h | 70 +++++++++++----------- glib/glibmm/dispatcher.cc | 29 +++++++++ glib/glibmm/error.cc | 2 +- glib/glibmm/error.h | 2 +- glib/glibmm/exceptionhandler.cc | 21 ++++++- glib/glibmm/helperlist.h | 20 +++---- glib/glibmm/interface.h | 6 +- glib/glibmm/listhandle.h | 28 ++++----- glib/glibmm/main.h | 18 +++--- glib/glibmm/object.h | 34 +++++------ glib/glibmm/objectbase.h | 4 +- glib/glibmm/pattern.h | 2 +- glib/glibmm/private/interface_p.h | 4 +- glib/glibmm/private/object_p.h | 6 +- glib/glibmm/property.h | 4 +- glib/glibmm/propertyproxy.h | 6 +- glib/glibmm/propertyproxy_base.h | 2 +- glib/glibmm/random.h | 2 +- glib/glibmm/refptr.h | 2 +- glib/glibmm/sarray.h | 2 +- glib/glibmm/signalproxy.h | 8 +-- glib/glibmm/signalproxy_connectionnode.h | 4 +- glib/glibmm/slisthandle.h | 28 ++++----- glib/glibmm/threadpool.h | 2 +- glib/glibmm/timer.h | 2 +- glib/glibmm/ustring.h | 62 +++++++++---------- glib/glibmm/value.h | 26 ++++---- glib/glibmm/value_custom.h | 8 +-- glib/glibmm/vectorutils.h | 96 +++++++++++++++--------------- glib/glibmm/wrap.cc | 2 +- glib/glibmm/wrap.h | 2 +- glib/src/balancedtree.hg | 4 +- glib/src/binding.hg | 6 +- glib/src/date.hg | 4 +- glib/src/datetime.hg | 2 +- glib/src/fileutils.hg | 4 +- glib/src/markup.hg | 6 +- glib/src/nodetree.hg | 8 +-- glib/src/optiongroup.hg | 4 +- glib/src/spawn.hg | 4 +- glib/src/thread.hg | 4 +- glib/src/threads.hg | 2 +- glib/src/value_basictypes.h.m4 | 4 +- glib/src/valuearray.hg | 2 +- glib/src/variant.ccg | 6 +- glib/src/variant.hg | 52 ++++++++-------- glib/src/variant_basictypes.h.m4 | 2 +- glib/src/variantdict.hg | 4 +- glib/src/varianttype.ccg | 2 +- tests/glibmm_btree/main.cc | 4 +- tests/glibmm_interface_move/main.cc | 10 ++-- tests/glibmm_nodetree/main.cc | 2 +- tests/glibmm_null_containerhandle/main.cc | 2 +- tests/glibmm_null_vectorutils/main.cc | 2 +- tests/glibmm_variant/main.cc | 14 ++--- tools/extra_defs_gen/generate_extra_defs.h | 2 +- tools/m4/class_boxedtype.m4 | 4 +- tools/m4/class_boxedtype_static.m4 | 4 +- tools/m4/class_generic.m4 | 4 +- tools/m4/class_gobject.m4 | 8 +-- tools/m4/class_interface.m4 | 16 ++--- tools/m4/class_opaque_copyable.m4 | 4 +- tools/m4/class_opaque_refcounted.m4 | 4 +- tools/m4/class_shared.m4 | 16 ++--- tools/m4/signal.m4 | 12 ++-- tools/m4/vfunc.m4 | 4 +- 99 files changed, 555 insertions(+), 473 deletions(-) diff --git a/NEWS b/NEWS index 7639ae1..73fdf0c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +2.48.1: + +Build: +* MacOS X: Add alternative #ifdefed code when thread_local + is not supported by the compiler. + (Tom Schoonjans) Bug #759791 +* Replace most typedefs with the C++11 using keyword. + +2.48.0: + +* No major changes compared to 2.47.92. + 2.47.92: * Adapt to libsigc++-2.0 2.8: diff --git a/build/cxx.m4 b/build/cxx.m4 index 22d2435..58e4f85 100644 --- a/build/cxx.m4 +++ b/build/cxx.m4 @@ -236,3 +236,24 @@ AS_VAR_IF([glibmm_cv_cxx_can_use_namespaces_inside_externc], ['yes'], [AC_DEFINE([GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC], [1], [Define if the compiler honors namespaces inside extern "C" blocks.])])[]dnl ]) + +## GLIBMM_CXX_CAN_USE_THREAD_LOCAL +## +## Check for thread_local support +## +AC_DEFUN([GLIBMM_CXX_CAN_USE_THREAD_LOCAL], +[dnl +AC_CACHE_CHECK( + [whether the thread_local keyword is supported], + [glibmm_cv_cxx_can_use_thread_local], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[ +thread_local int i=0; +]], [])], + [glibmm_cv_cxx_can_use_thread_local=yes], + [glibmm_cv_cxx_can_use_thread_local=no])]) + +AS_VAR_IF([glibmm_cv_cxx_can_use_thread_local], ['yes'], + [AC_DEFINE([GLIBMM_CAN_USE_THREAD_LOCAL], [1], + [Define if the thread_local keyword is supported.])])[]dnl +]) diff --git a/configure.ac b/configure.ac index 52a001e..7245404 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([glibmm], [2.48.0], +AC_INIT([glibmm], [2.48.1], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -104,6 +104,7 @@ GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS +GLIBMM_CXX_CAN_USE_THREAD_LOCAL GLIBMM_C_STD_TIME_T_IS_NOT_INT32 MM_ARG_ENABLE_DOCUMENTATION diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc index 2891293..dbe176c 100644 --- a/examples/thread/dispatcher2.cc +++ b/examples/thread/dispatcher2.cc @@ -41,7 +41,7 @@ public: void signal_finished_emit(); void print() const; - typedef sigc::signal type_signal_end; + using type_signal_end = sigc::signal; static type_signal_end& signal_end(); private: diff --git a/gio/giomm/socketsource.h b/gio/giomm/socketsource.h index 2096816..c1345c6 100644 --- a/gio/giomm/socketsource.h +++ b/gio/giomm/socketsource.h @@ -100,7 +100,7 @@ SignalSocket signal_socket( class SocketSource : public Glib::IOSource { public: - typedef Gio::SocketSource CppObjectType; + using CppObjectType = Gio::SocketSource; static Glib::RefPtr create(const Glib::RefPtr& socket, Glib::IOCondition condition, diff --git a/gio/src/action.hg b/gio/src/action.hg index 8788da3..5f5e864 100644 --- a/gio/src/action.hg +++ b/gio/src/action.hg @@ -240,7 +240,7 @@ void Action::get_state(T_Value& value) const { value = T_Value(); //Make sure that it is initialized. - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; g_return_if_fail( g_variant_type_equal(g_action_get_state_type(const_cast(gobj())), type_glib_variant::variant_type().gobj())); @@ -255,7 +255,7 @@ void Action::get_state_hint(T_Value& value) const { value = T_Value(); //Make sure that it is initialized. - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; const auto variantBase = get_state_hint_variant(); @@ -276,7 +276,7 @@ void Action::parse_detailed_name(const Glib::ustring& detailed_name, Glib::ustri action_name.clear(); //Make sure the output arguments are initialized. target_value = T_Value(); - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; Glib::VariantBase target_value_variantBase; parse_detailed_name_variant(detailed_name, action_name, target_value_variantBase); @@ -300,7 +300,7 @@ void Action::parse_detailed_name(const Glib::ustring& detailed_name, Glib::ustri template Glib::ustring Action::print_detailed_name(const T_Value& target_value) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; g_return_val_if_fail( g_variant_type_equal(g_action_get_parameter_type(const_cast(gobj())), type_glib_variant::variant_type().gobj()), @@ -311,7 +311,7 @@ Glib::ustring Action::print_detailed_name(const T_Value& target_value) template void Action::change_state(const T_Value& value) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; g_return_if_fail( g_variant_type_equal(g_action_get_state_type(const_cast(gobj())), type_glib_variant::variant_type().gobj())); @@ -328,7 +328,7 @@ void Action::change_state(const Glib::Variant& value) template void Action::activate(const T_Value& parameter) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; g_return_if_fail( g_variant_type_equal(g_action_get_parameter_type(const_cast(gobj())), type_glib_variant::variant_type().gobj())); diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg index 3e42368..d8f9c10 100644 --- a/gio/src/actiongroup.hg +++ b/gio/src/actiongroup.hg @@ -166,7 +166,7 @@ void ActionGroup::get_action_state(const Glib::ustring& action_name, T_Value& va { value = T_Value(); //Make sure that it is initialized. - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; g_return_if_fail( g_variant_type_equal(g_action_group_get_action_state_type(const_cast(gobj()), action_name.c_str()), type_glib_variant::variant_type().gobj())); @@ -183,7 +183,7 @@ void ActionGroup::get_action_state_hint(const Glib::ustring& action_name, T_Valu { value = T_Value(); //Make sure that it is initialized. - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; const auto variantBase = get_action_state_hint_variant(action_name); diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index 6f32fdb..e401fc8 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -88,7 +88,7 @@ public: * For instance, * void on_slot_activated(); */ - typedef sigc::slot ActivateSlot; + using ActivateSlot = sigc::slot; /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. diff --git a/gio/src/application.ccg b/gio/src/application.ccg index 7b80eed..7b53edf 100644 --- a/gio/src/application.ccg +++ b/gio/src/application.ccg @@ -57,7 +57,7 @@ static void Application_signal_open_callback( GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data) { - typedef sigc::slot SlotType; + using SlotType = sigc::slot; Gio::Application::type_vec_files vec_files(n_files); for (int i = 0; i < n_files; ++i) @@ -92,7 +92,7 @@ Application_signal_open_notify_callback( GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data) { using namespace Gio; - typedef sigc::slot SlotType; + using SlotType = sigc::slot; Application::type_vec_files vec_files(n_files); for (int i = 0; i < n_files; i++) @@ -186,7 +186,7 @@ private: OptionArgCallbackData& operator=(const OptionArgCallbackData&); }; -typedef std::map OptionArgCallbackDataMap; +using OptionArgCallbackDataMap = std::map; OptionArgCallbackDataMap option_arg_callback_data; // Gio::Application instances may be used in different threads. diff --git a/gio/src/application.hg b/gio/src/application.hg index a72ba68..0545516 100644 --- a/gio/src/application.hg +++ b/gio/src/application.hg @@ -295,7 +295,7 @@ public: _WRAP_METHOD(void release(), g_application_release) _WRAP_METHOD(void activate(), g_application_activate) - typedef std::vector< Glib::RefPtr > type_vec_files; + using type_vec_files = std::vector< Glib::RefPtr >; /* Opens the given files. * diff --git a/gio/src/asyncinitable.ccg b/gio/src/asyncinitable.ccg index 7996070..e91c984 100644 --- a/gio/src/asyncinitable.ccg +++ b/gio/src/asyncinitable.ccg @@ -149,7 +149,7 @@ AsyncInitable_Class::init_finish_vfunc_callback( if (base && base->init_finish) return (*base->init_finish)(self, res, error); - typedef gboolean RType; + using RType = gboolean; return RType(); } bool @@ -174,7 +174,7 @@ Gio::AsyncInitable::init_finish_vfunc(const Glib::RefPtr& res) return result; } - typedef bool RType; + using RType = bool; return RType(); } diff --git a/gio/src/cancellable.hg b/gio/src/cancellable.hg index 886dc27..47196c0 100644 --- a/gio/src/cancellable.hg +++ b/gio/src/cancellable.hg @@ -37,7 +37,7 @@ protected: _CTOR_DEFAULT public: - typedef sigc::slot SlotCancelledCallback; + using SlotCancelledCallback = sigc::slot; _WRAP_CREATE() diff --git a/gio/src/dbusauthobserver.ccg b/gio/src/dbusauthobserver.ccg index 7ca00c7..8c30743 100644 --- a/gio/src/dbusauthobserver.ccg +++ b/gio/src/dbusauthobserver.ccg @@ -22,8 +22,8 @@ #include // To help the generated code: -typedef Gio::Credentials Credentials; -typedef Gio::IOStream IOStream; +using Credentials = Gio::Credentials; +using IOStream = Gio::IOStream; namespace Gio { diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg index ff226fd..6b0e558 100644 --- a/gio/src/dbusconnection.hg +++ b/gio/src/dbusconnection.hg @@ -173,9 +173,9 @@ public: * Glib::ustring& signal_name, const Glib::VariantContainerBase& parameters);. * @endcode */ - typedef sigc::slot&, + using SlotSignal = sigc::slot&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, - const Glib::ustring&, const Glib::VariantContainerBase&> SlotSignal; + const Glib::ustring&, const Glib::VariantContainerBase&>; /** Signature for slot used in add_filter(). * For example, @@ -191,9 +191,9 @@ public: * drop a message can simply return 0. And filter function may * modify a message by copying it and return the copy. */ - typedef sigc::slot, + using SlotMessageFilter = sigc::slot, const Glib::RefPtr&, - const Glib::RefPtr&, bool> SlotMessageFilter; + const Glib::RefPtr&, bool>; /** Asynchronously connects to the message bus specified by @a bus_type. * diff --git a/gio/src/dbusinterfacevtable.hg b/gio/src/dbusinterfacevtable.hg index 87aeee0..caf181a 100644 --- a/gio/src/dbusinterfacevtable.hg +++ b/gio/src/dbusinterfacevtable.hg @@ -62,7 +62,7 @@ public: * Glib::RefPtr& invocation); * @endcode */ - typedef sigc::slot< + using SlotInterfaceMethodCall = sigc::slot< void, const Glib::RefPtr&, const Glib::ustring&, @@ -71,7 +71,7 @@ public: const Glib::ustring&, const Glib::VariantContainerBase&, const Glib::RefPtr& - > SlotInterfaceMethodCall; + >; /** The type for a slot which handles getting a property for a D-Bus * interface. @@ -84,7 +84,7 @@ public: * @endcode * @throw Glib::Error. */ - typedef sigc::slot< + using SlotInterfaceGetProperty = sigc::slot< void, Glib::VariantBase&, const Glib::RefPtr&, @@ -92,7 +92,7 @@ public: const Glib::ustring&, const Glib::ustring&, const Glib::ustring& - > SlotInterfaceGetProperty; + >; /** The type for a slot which handles setting a property for a D-Bus * interface. @@ -105,7 +105,7 @@ public: * @endcode * @throw Glib::Error. */ - typedef sigc::slot< + using SlotInterfaceSetProperty = sigc::slot< bool, const Glib::RefPtr&, const Glib::ustring&, @@ -113,7 +113,7 @@ public: const Glib::ustring&, const Glib::ustring&, const Glib::VariantBase& - > SlotInterfaceSetProperty; + >; /** Constructs a new InterfaceVTable using the specified slots. * @param slot_method_call The slot for handling incoming method calls. diff --git a/gio/src/dbusmessage.ccg b/gio/src/dbusmessage.ccg index fb2cd8a..751fbfd 100644 --- a/gio/src/dbusmessage.ccg +++ b/gio/src/dbusmessage.ccg @@ -30,7 +30,7 @@ namespace Gio namespace DBus { -typedef Message::ByteOrder ByteOrder; +using ByteOrder = Message::ByteOrder; void Message::get_body(Glib::VariantBase& value) const diff --git a/gio/src/dbusownname.hg b/gio/src/dbusownname.hg index 6613b70..8690d10 100644 --- a/gio/src/dbusownname.hg +++ b/gio/src/dbusownname.hg @@ -35,21 +35,21 @@ _WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags, s#^DBUS_##) * @newin{2,28} * @ingroup DBus */ -typedef sigc::slot&, Glib::ustring> SlotBusAcquired; +using SlotBusAcquired = sigc::slot&, Glib::ustring>; /** For example, * void on_name_acquired(const Glib::RefPtr& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot&, Glib::ustring> SlotNameAcquired; +using SlotNameAcquired = sigc::slot&, Glib::ustring>; /** For example, * void on_name_lost(const Glib::RefPtr& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot&, Glib::ustring> SlotNameLost; +using SlotNameLost = sigc::slot&, 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. diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg index a818573..b13f92f 100644 --- a/gio/src/dbusproxy.ccg +++ b/gio/src/dbusproxy.ccg @@ -31,7 +31,7 @@ namespace DBus { // Help the generate code: -typedef Proxy::MapChangedProperties MapChangedProperties; +using MapChangedProperties = Proxy::MapChangedProperties; Proxy::Proxy(const Glib::RefPtr& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg index 0f79156..c015e77 100644 --- a/gio/src/dbusproxy.hg +++ b/gio/src/dbusproxy.hg @@ -401,7 +401,7 @@ public: _WRAP_PROPERTY("g-name-owner", Glib::ustring) _WRAP_PROPERTY("g-object-path", Glib::ustring) - typedef std::map MapChangedProperties; + using MapChangedProperties = std::map; // TODO: Should the signal names match the C API names (ie. the C API names // are g_signal_name while these are just signal_name). diff --git a/gio/src/dbussubtreevtable.hg b/gio/src/dbussubtreevtable.hg index b5e921b..ead80ee 100644 --- a/gio/src/dbussubtreevtable.hg +++ b/gio/src/dbussubtreevtable.hg @@ -66,12 +66,12 @@ public: * sender, const Glib::ustring& object_path); * @endcode */ - typedef sigc::slot< + using SlotSubtreeEnumerate = sigc::slot< std::vector, const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring& - > SlotSubtreeEnumerate; + >; /** The type for a slot which handles introspecting a child node. * @@ -93,13 +93,13 @@ public: * object_path, const Glib::ustring& node); * @endcode */ - typedef sigc::slot< + using SlotSubtreeIntrospect = sigc::slot< std::vector< Glib::RefPtr >, const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring& - > SlotSubtreeIntrospect; + >; /** The type for a slot which handles dispatching a remote call on a child * node. @@ -115,14 +115,14 @@ public: * interface_name, const Glib::ustring& node); * @endcode */ - typedef sigc::slot< + using SlotSubtreeDispatch = sigc::slot< const InterfaceVTable*, const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring& - > SlotSubtreeDispatch; + >; /** Constructs a new SubtreeVTable using specified slots. * @param slot_enumerate The slot for handling incoming method calls. diff --git a/gio/src/dbuswatchname.hg b/gio/src/dbuswatchname.hg index ef555b7..dd697ce 100644 --- a/gio/src/dbuswatchname.hg +++ b/gio/src/dbuswatchname.hg @@ -34,14 +34,14 @@ _WRAP_ENUM(BusNameWatcherFlags, GBusNameWatcherFlags, s#^DBUS_##, NO_GTYPE) * const Glib::ustring& name, const Glib::ustring& name_owner); * @ingroup DBus */ -typedef sigc::slot&, Glib::ustring, const Glib::ustring&> SlotNameAppeared; +using SlotNameAppeared = sigc::slot&, Glib::ustring, const Glib::ustring&>; /** For example, * void on_name_vanished(const Glib::RefPtr& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot&, Glib::ustring> SlotNameVanished; +using SlotNameVanished = sigc::slot&, 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 diff --git a/gio/src/drive.hg b/gio/src/drive.hg index 30ab250..59c5fff 100644 --- a/gio/src/drive.hg +++ b/gio/src/drive.hg @@ -189,9 +189,9 @@ namespace Container_Helpers template <> struct TypeTraits< Glib::RefPtr > { - typedef Glib::RefPtr CppType; - typedef GDrive* CType; - typedef GDrive* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = GDrive*; + using CTypeNonConst = GDrive*; static CType to_c_type (const CppType& item) { return Glib::unwrap (item); } diff --git a/gio/src/file.ccg b/gio/src/file.ccg index b9b8771..9190f43 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -25,9 +25,9 @@ namespace { -typedef std::pair CopySlots; -typedef std::pair MeasureSlots; -typedef std::pair LoadPartialSlots; +using CopySlots = std::pair; +using MeasureSlots = std::pair; +using LoadPartialSlots = std::pair; static void SignalProxy_file_progress_callback( diff --git a/gio/src/file.hg b/gio/src/file.hg index da1ba6a..859cf25 100644 --- a/gio/src/file.hg +++ b/gio/src/file.hg @@ -2455,9 +2455,9 @@ namespace Container_Helpers template <> struct TypeTraits< Glib::RefPtr > { - typedef Glib::RefPtr CppType; - typedef GFile* CType; - typedef GFile* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = GFile*; + using CTypeNonConst = GFile*; static CType to_c_type (const CppType& item) { return Glib::unwrap (item); } diff --git a/gio/src/memoryinputstream.hg b/gio/src/memoryinputstream.hg index 9ac5f9a..0fc03f4 100644 --- a/gio/src/memoryinputstream.hg +++ b/gio/src/memoryinputstream.hg @@ -76,7 +76,7 @@ _DEPRECATE_IFDEF_END * * @newin{2,40} */ - typedef sigc::slot SlotDestroyData; + using SlotDestroyData = sigc::slot; /** Appends to data that can be read from the input stream. * diff --git a/gio/src/mount.hg b/gio/src/mount.hg index 07ae84e..2e91bea 100644 --- a/gio/src/mount.hg +++ b/gio/src/mount.hg @@ -256,9 +256,9 @@ namespace Container_Helpers template <> struct TypeTraits< Glib::RefPtr > { - typedef Glib::RefPtr CppType; - typedef GMount* CType; - typedef GMount* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = GMount*; + using CTypeNonConst = GMount*; static CType to_c_type (const CppType& item) { return Glib::unwrap (item); } diff --git a/gio/src/notification.hg b/gio/src/notification.hg index 02ff5e8..df9a7ee 100644 --- a/gio/src/notification.hg +++ b/gio/src/notification.hg @@ -120,7 +120,7 @@ public: template void Notification::add_button(const Glib::ustring& label, const Glib::ustring& action, const T_Value& target) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; add_button_variant(label, action, type_glib_variant::create(target)); } @@ -128,7 +128,7 @@ void Notification::add_button(const Glib::ustring& label, const Glib::ustring& a template void Notification::set_default_action(const Glib::ustring& action, const T_Value& target) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; set_default_action_variant(action, type_glib_variant::create(target)); } diff --git a/gio/src/simpleaction.hg b/gio/src/simpleaction.hg index 253b46f..9a32819 100644 --- a/gio/src/simpleaction.hg +++ b/gio/src/simpleaction.hg @@ -23,7 +23,7 @@ _PINCLUDE(glibmm/private/object_p.h) #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GSimpleAction GSimpleAction; -typedef GObjectClass GSimpleActionClass; +using GSimpleActionClass = GObjectClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ namespace Gio diff --git a/gio/src/srvtarget.hg b/gio/src/srvtarget.hg index 8700892..edaf02f 100644 --- a/gio/src/srvtarget.hg +++ b/gio/src/srvtarget.hg @@ -63,9 +63,9 @@ public: struct SrvTargetListTraits { - typedef Gio::SrvTarget CppType; - typedef const GSrvTarget* CType; - typedef GSrvTarget* CTypeNonConst; + using CppType = Gio::SrvTarget; + using CType = const GSrvTarget*; + using CTypeNonConst = GSrvTarget*; static CType to_c_type(const CppType& item) { return item.gobj(); } static CType to_c_type(CType ptr) { return ptr; } @@ -75,7 +75,7 @@ struct SrvTargetListTraits #endif // DOXYGEN_SHOULD_SKIP_THIS -typedef Glib::ListHandle ListHandle_SrvTarget; +using ListHandle_SrvTarget = Glib::ListHandle; } // namespace Gio diff --git a/gio/src/volume.hg b/gio/src/volume.hg index 6d54bd8..47ffa57 100644 --- a/gio/src/volume.hg +++ b/gio/src/volume.hg @@ -201,9 +201,9 @@ namespace Container_Helpers template <> struct TypeTraits< Glib::RefPtr > { - typedef Glib::RefPtr CppType; - typedef GVolume* CType; - typedef GVolume* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = GVolume*; + using CTypeNonConst = GVolume*; static CType to_c_type (const CppType& item) { return Glib::unwrap (item); } diff --git a/glib/glibmm/arrayhandle.h b/glib/glibmm/arrayhandle.h index 19454cb..02ec243 100644 --- a/glib/glibmm/arrayhandle.h +++ b/glib/glibmm/arrayhandle.h @@ -51,7 +51,7 @@ template typename Tr::CType* create_array(For pbegin, std::size_t size, Tr) { - typedef typename Tr::CType CType; + using CType = typename Tr::CType; CType* const array = static_cast(g_malloc((size + 1) * sizeof(CType))); CType* const array_end = array + size; @@ -90,7 +90,7 @@ create_bool_array(For pbegin, std::size_t size) template struct ArraySourceTraits { - typedef typename Tr::CType CType; + using CType = typename Tr::CType; static std::size_t get_size(const Cont& cont) { return cont.size(); } @@ -106,7 +106,7 @@ struct ArraySourceTraits template struct BoolArraySourceTraits { - typedef gboolean CType; + using CType = gboolean; static std::size_t get_size(const Cont& cont) { return cont.size(); } @@ -123,7 +123,7 @@ struct BoolArraySourceTraits template struct ArraySourceTraits { - typedef typename Tr::CType CType; + using CType = typename Tr::CType; static std::size_t get_size(const CType* array) { @@ -148,7 +148,7 @@ struct ArraySourceTraits : ArraySourceTraits template struct ArraySourceTraits { - typedef typename Tr::CType CType; + using CType = typename Tr::CType; static std::size_t get_size(const CType*) { return (N - 1); } @@ -171,14 +171,14 @@ template class ArrayHandleIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::random_access_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::random_access_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline ArrayHandleIterator(const CType* pos); @@ -231,15 +231,15 @@ template > class ArrayHandle { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef CppType value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = CppType; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef Glib::Container_Helpers::ArrayHandleIterator const_iterator; - typedef Glib::Container_Helpers::ArrayHandleIterator iterator; + using const_iterator = Glib::Container_Helpers::ArrayHandleIterator; + using iterator = Glib::Container_Helpers::ArrayHandleIterator; template inline ArrayHandle(const Cont& container); @@ -286,18 +286,18 @@ template <> class ArrayHandle> { public: - typedef ArrayHandle> Me; - typedef Container_Helpers::TypeTraits Tr; + using Me = ArrayHandle>; + using Tr = Container_Helpers::TypeTraits; - typedef Tr::CppType CppType; - typedef Tr::CType CType; + using CppType = Tr::CppType; + using CType = Tr::CType; - typedef CppType value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = CppType; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef Glib::Container_Helpers::ArrayHandleIterator const_iterator; - typedef Glib::Container_Helpers::ArrayHandleIterator iterator; + using const_iterator = Glib::Container_Helpers::ArrayHandleIterator; + using iterator = Glib::Container_Helpers::ArrayHandleIterator; template inline ArrayHandle(const Cont& container); @@ -383,7 +383,7 @@ private: * * @ingroup ContHandles */ -typedef ArrayHandle StringArrayHandle; +using StringArrayHandle = ArrayHandle; /***************************************************************************/ /* Inline implementation */ diff --git a/glib/glibmm/class.h b/glib/glibmm/class.h index 691c1bf..bc5a06a 100644 --- a/glib/glibmm/class.h +++ b/glib/glibmm/class.h @@ -67,7 +67,7 @@ public: GType clone_custom_type(const char* custom_type_name) const; /// The type that holds pointers to the interfaces of custom types. - typedef std::vector interface_class_vector_type; + using interface_class_vector_type = std::vector; /** Register a static custom GType, derived from the parent of this class's type. * The parent type of the registered custom type is the same C class as the parent @@ -103,7 +103,7 @@ private: public: #ifndef DOXYGEN_SHOULD_SKIP_THIS // The type that holds the values of the interface properties of custom types. - typedef std::vector iface_properties_type; + using iface_properties_type = std::vector; // The quark used for storing/getting the interface properties of custom types. static GQuark iface_properties_quark; #endif diff --git a/glib/glibmm/containerhandle_shared.h b/glib/glibmm/containerhandle_shared.h index 7084e9b..dffce99 100644 --- a/glib/glibmm/containerhandle_shared.h +++ b/glib/glibmm/containerhandle_shared.h @@ -107,9 +107,9 @@ namespace Container_Helpers template struct TypeTraits { - typedef T CppType; - typedef T CType; - typedef T CTypeNonConst; + using CppType = T; + using CType = T; + using CTypeNonConst = T; static CType to_c_type(const CppType& item) { return item; } static CppType to_cpp_type(const CType& item) { return item; } @@ -128,9 +128,9 @@ struct TypeTraits template struct TypeTraits { - typedef T* CppType; - typedef typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = T*; + using CType = typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(CppType ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -160,9 +160,9 @@ struct TypeTraits template struct TypeTraits { - typedef const T* CppType; - typedef const typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = const T*; + using CType = const typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(CppType ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -191,9 +191,9 @@ struct TypeTraits template struct TypeTraits> { - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(const CppType& ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -227,9 +227,9 @@ struct TypeTraits> template struct TypeTraits> { - typedef Glib::RefPtr CppType; - typedef const typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = const typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(const CppType& ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -267,9 +267,9 @@ struct TypeTraits> template <> struct TypeTraits { - typedef Glib::ustring CppType; - typedef const char* CType; - typedef char* CTypeNonConst; + using CppType = Glib::ustring; + using CType = const char*; + using CTypeNonConst = char*; static CType to_c_type(const Glib::ustring& str) { return str.c_str(); } static CType to_c_type(const std::string& str) { return str.c_str(); } @@ -289,9 +289,9 @@ struct TypeTraits template <> struct TypeTraits { - typedef std::string CppType; - typedef const char* CType; - typedef char* CTypeNonConst; + using CppType = std::string; + using CType = const char*; + using CTypeNonConst = char*; static CType to_c_type(const std::string& str) { return str.c_str(); } static CType to_c_type(const Glib::ustring& str) { return str.c_str(); } @@ -308,9 +308,9 @@ struct TypeTraits template <> struct TypeTraits { - typedef bool CppType; - typedef gboolean CType; - typedef gboolean CTypeNonConst; + using CppType = bool; + using CType = gboolean; + using CTypeNonConst = gboolean; static CType to_c_type(CppType item) { return static_cast(item); } static CType to_c_type(CType item) { return item; } @@ -324,9 +324,9 @@ struct TypeTraits template <> struct TypeTraits { - typedef Glib::VariantBase CppType; - typedef GVariant* CType; - typedef GVariant* CTypeNonConst; + using CppType = Glib::VariantBase; + using CType = GVariant*; + using CTypeNonConst = GVariant*; static CType to_c_type(const Glib::VariantBase& v) { return const_cast(v.gobj()); } @@ -343,9 +343,9 @@ struct TypeTraits template <> struct TypeTraits { - typedef Glib::VariantContainerBase CppType; - typedef GVariant* CType; - typedef GVariant* CTypeNonConst; + using CppType = Glib::VariantContainerBase; + using CType = GVariant*; + using CTypeNonConst = GVariant*; static CType to_c_type(const Glib::VariantContainerBase& v) { diff --git a/glib/glibmm/containers.h b/glib/glibmm/containers.h index 46b87d0..2382b3c 100644 --- a/glib/glibmm/containers.h +++ b/glib/glibmm/containers.h @@ -50,9 +50,9 @@ template class List_Iterator_Base { public: - typedef T value_type; - typedef T* pointer; - typedef T& reference; + using value_type = T; + using pointer = T*; + using reference = T&; }; /// For instance, List_Iterator< Gtk::Widget > @@ -60,17 +60,17 @@ template class List_Iterator : public List_Iterator_Base { public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using iterator_category = std::bidirectional_iterator_tag; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef typename List_Iterator_Base::pointer pointer; - typedef typename List_Iterator_Base::reference reference; + using pointer = typename List_Iterator_Base::pointer; + using reference = typename List_Iterator_Base::reference; GList* const* head_; GList* node_; - typedef List_Iterator Self; + using Self = List_Iterator; List_Iterator(GList* const& head, GList* node) : head_(&head), node_(node) {} @@ -124,15 +124,15 @@ template class SList_Iterator : public List_Iterator_Base { public: - typedef std::forward_iterator_tag iterator_category; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using iterator_category = std::forward_iterator_tag; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef typename List_Iterator_Base::pointer pointer; - typedef typename List_Iterator_Base::reference reference; + using pointer = typename List_Iterator_Base::pointer; + using reference = typename List_Iterator_Base::reference; GSList* node_; - typedef SList_Iterator Self; + using Self = SList_Iterator; SList_Iterator(GSList* node) : node_(node) {} @@ -171,14 +171,14 @@ template class List_Cpp_Iterator : public List_Iterator_Base { public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using iterator_category = std::bidirectional_iterator_tag; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef typename List_Iterator_Base::pointer pointer; - typedef typename List_Iterator_Base::reference reference; + using pointer = typename List_Iterator_Base::pointer; + using reference = typename List_Iterator_Base::reference; - typedef List_Cpp_Iterator Self; + using Self = List_Cpp_Iterator; GList** head_; GList* node_; @@ -254,15 +254,15 @@ template class List_ReverseIterator : private T_Base { public: - typedef typename T_Base::iterator_category iterator_category; - typedef typename T_Base::size_type size_type; - typedef typename T_Base::difference_type difference_type; + using iterator_category = typename T_Base::iterator_category; + using size_type = typename T_Base::size_type; + using difference_type = typename T_Base::difference_type; - typedef typename T_Base::value_type value_type; - typedef typename T_Base::pointer pointer; - typedef typename T_Base::reference reference; + using value_type = typename T_Base::value_type; + using pointer = typename T_Base::pointer; + using reference = typename T_Base::reference; - typedef List_ReverseIterator Self; + using Self = List_ReverseIterator; bool operator==(const Self& src) const { return T_Base::operator==(src); } bool operator!=(const Self& src) const { return T_Base::operator!=(src); } @@ -306,15 +306,15 @@ template class List_ConstIterator : public T_Base { public: - typedef typename T_Base::iterator_category iterator_category; - typedef typename T_Base::size_type size_type; - typedef typename T_Base::difference_type difference_type; + using iterator_category = typename T_Base::iterator_category; + using size_type = typename T_Base::size_type; + using difference_type = typename T_Base::difference_type; - typedef const typename T_Base::value_type value_type; - typedef const typename T_Base::pointer pointer; - typedef const typename T_Base::reference reference; + using value_type = const typename T_Base::value_type; + using pointer = const typename T_Base::pointer; + using reference = const typename T_Base::reference; - typedef List_ConstIterator Self; + using Self = List_ConstIterator; bool operator==(const Self& src) const { return T_Base::operator==(src); } bool operator!=(const Self& src) const { return T_Base::operator!=(src); } diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index 8525fbe..e21914a 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -15,6 +15,10 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef GLIBMM_CAN_USE_THREAD_LOCAL +#include +#endif + #include #include #include @@ -143,7 +147,11 @@ protected: explicit DispatchNotifier(const Glib::RefPtr& context); private: +#ifdef GLIBMM_CAN_USE_THREAD_LOCAL static thread_local DispatchNotifier* thread_specific_instance_; +#else + static Glib::Threads::Private thread_specific_instance_; +#endif std::set deleted_dispatchers_; @@ -166,7 +174,12 @@ private: /**** Glib::DispatchNotifier ***********************************************/ // static + +#ifdef GLIBMM_CAN_USE_THREAD_LOCAL thread_local DispatchNotifier* DispatchNotifier::thread_specific_instance_ = nullptr; +#else +Glib::Threads::Private DispatchNotifier::thread_specific_instance_; +#endif DispatchNotifier::DispatchNotifier(const Glib::RefPtr& context) : deleted_dispatchers_(), @@ -269,12 +282,20 @@ DispatchNotifier* DispatchNotifier::reference_instance( const Glib::RefPtr& 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 { @@ -302,7 +323,11 @@ DispatchNotifier::reference_instance( 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); @@ -319,8 +344,12 @@ DispatchNotifier::unreference_instance(DispatchNotifier* notifier, const Dispatc { 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 } } diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc index 34ea87a..0906336 100644 --- a/glib/glibmm/error.cc +++ b/glib/glibmm/error.cc @@ -27,7 +27,7 @@ namespace { -typedef std::map ThrowFuncTable; +using ThrowFuncTable = std::map; static ThrowFuncTable* throw_func_table = nullptr; diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h index 941dc9d..eb61b4e 100644 --- a/glib/glibmm/error.h +++ b/glib/glibmm/error.h @@ -51,7 +51,7 @@ public: void propagate(GError** dest); - typedef void (*ThrowFunc)(GError*); + using ThrowFunc = void(*)(GError*); static void register_init(); static void register_cleanup(); diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc index c12e199..31ddb39 100644 --- a/glib/glibmm/exceptionhandler.cc +++ b/glib/glibmm/exceptionhandler.cc @@ -19,6 +19,9 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef GLIBMM_CAN_USE_THREAD_LOCAL +#include +#endif #include #include #include @@ -29,11 +32,15 @@ namespace { -typedef sigc::signal HandlerList; +using HandlerList = sigc::signal; // 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 thread_specific_handler_list; +#endif static void glibmm_exception_warning(const GError* error) @@ -85,12 +92,20 @@ namespace Glib sigc::connection add_exception_handler(const sigc::slot& 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->slots().push_front(slot); @@ -114,7 +129,11 @@ exception_handlers_invoke() noexcept // 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->slots().begin(); diff --git a/glib/glibmm/helperlist.h b/glib/glibmm/helperlist.h index 41f1074..ac0c2a5 100644 --- a/glib/glibmm/helperlist.h +++ b/glib/glibmm/helperlist.h @@ -51,19 +51,19 @@ public: virtual ~HelperList() noexcept {} - typedef T_Child value_type; - typedef value_type& reference; - typedef const value_type& const_reference; + using value_type = T_Child; + using reference = value_type&; + using const_reference = const value_type&; - typedef T_Iterator iterator; - typedef List_ConstIterator const_iterator; - typedef List_ReverseIterator reverse_iterator; - typedef List_ConstIterator const_reverse_iterator; + using iterator = T_Iterator; + using const_iterator = List_ConstIterator; + using reverse_iterator = List_ReverseIterator; + using const_reverse_iterator = List_ConstIterator; - typedef T_CppElement element_type; + using element_type = T_CppElement; - typedef std::size_t difference_type; // TODO Why not std::ptrdiff_t? - typedef std::size_t size_type; + using difference_type = std::size_t; // TODO Why not std::ptrdiff_t? + using size_type = std::size_t; // These are implemented differently for each Helper List. virtual iterator erase(iterator) = 0; diff --git a/glib/glibmm/interface.h b/glib/glibmm/interface.h index c737639..0b27914 100644 --- a/glib/glibmm/interface.h +++ b/glib/glibmm/interface.h @@ -35,9 +35,9 @@ class GLIBMM_API Interface : virtual public Glib::ObjectBase { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef Interface CppObjectType; - typedef Interface_Class CppClassType; - typedef GTypeInterface BaseClassType; + using CppObjectType = Interface; + using CppClassType = Interface_Class; + using BaseClassType = GTypeInterface; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ /** A Default constructor. diff --git a/glib/glibmm/listhandle.h b/glib/glibmm/listhandle.h index 92f9bec..985f978 100644 --- a/glib/glibmm/listhandle.h +++ b/glib/glibmm/listhandle.h @@ -131,14 +131,14 @@ template class ListHandleIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::forward_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::forward_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline ListHandleIterator(const GList* node); @@ -169,15 +169,15 @@ template > class ListHandle { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef CppType value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = CppType; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef Glib::Container_Helpers::ListHandleIterator const_iterator; - typedef Glib::Container_Helpers::ListHandleIterator iterator; + using const_iterator = Glib::Container_Helpers::ListHandleIterator; + using iterator = Glib::Container_Helpers::ListHandleIterator; template inline ListHandle(const Cont& container); diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h index 5bfacbe..f60cc8f 100644 --- a/glib/glibmm/main.h +++ b/glib/glibmm/main.h @@ -400,8 +400,8 @@ SignalChildWatch signal_child_watch(); class MainContext { public: - typedef Glib::MainContext CppObjectType; - typedef GMainContext BaseObjectType; + using CppObjectType = Glib::MainContext; + using BaseObjectType = GMainContext; // noncopyable MainContext(const MainContext& other) = delete; @@ -624,8 +624,8 @@ Glib::RefPtr wrap(GMainContext* gobject, bool take_copy = false); class MainLoop { public: - typedef Glib::MainLoop CppObjectType; - typedef GMainLoop BaseObjectType; + using CppObjectType = Glib::MainLoop; + using BaseObjectType = GMainLoop; static Glib::RefPtr create(bool is_running = false); static Glib::RefPtr create( @@ -682,8 +682,8 @@ Glib::RefPtr wrap(GMainLoop* gobject, bool take_copy = false); class Source { public: - typedef Glib::Source CppObjectType; - typedef GSource BaseObjectType; + using CppObjectType = Glib::Source; + using BaseObjectType = GSource; // noncopyable Source(const Source&) = delete; @@ -845,7 +845,7 @@ public: class TimeoutSource : public Glib::Source { public: - typedef Glib::TimeoutSource CppObjectType; + using CppObjectType = Glib::TimeoutSource; static Glib::RefPtr create(unsigned int interval); sigc::connection connect(const sigc::slot& slot); @@ -868,7 +868,7 @@ private: class IdleSource : public Glib::Source { public: - typedef Glib::IdleSource CppObjectType; + using CppObjectType = Glib::IdleSource; static Glib::RefPtr create(); sigc::connection connect(const sigc::slot& slot); @@ -885,7 +885,7 @@ protected: class IOSource : public Glib::Source { public: - typedef Glib::IOSource CppObjectType; + using CppObjectType = Glib::IOSource; static Glib::RefPtr create(int fd, IOCondition condition); static Glib::RefPtr create( diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h index 522f84a..3ff39b0 100644 --- a/glib/glibmm/object.h +++ b/glib/glibmm/object.h @@ -38,8 +38,8 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { -typedef struct _GObject GObject; -typedef struct _GObjectClass GObjectClass; +using GObject = struct _GObject; +using GObjectClass = struct _GObjectClass; } #endif /* DOXYGEN_SHOULD_SKIP_THIS */ @@ -95,10 +95,10 @@ class GLIBMM_API Object : virtual public ObjectBase { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef Object CppObjectType; - typedef Object_Class CppClassType; - typedef GObject BaseObjectType; - typedef GObjectClass BaseClassType; + using CppObjectType = Object; + using CppClassType = Object_Class; + using BaseObjectType = GObject; + using BaseClassType = GObjectClass; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ // noncopyable @@ -129,7 +129,7 @@ public: // TODO: Use slots instead: void* get_data(const QueryQuark& key); void set_data(const Quark& key, void* data); - typedef void (*DestroyNotify)(gpointer data); + using DestroyNotify = void (*)(gpointer data); void set_data(const Quark& key, void* data, DestroyNotify notify); void remove_data(const QueryQuark& quark); // same as remove without notifying @@ -171,9 +171,9 @@ namespace Container_Helpers template struct TypeTraits> { - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(const CppType& ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -207,9 +207,9 @@ struct TypeTraits> template struct TypeTraits> { - typedef Glib::RefPtr CppType; - typedef const typename T::BaseObjectType* CType; - typedef typename T::BaseObjectType* CTypeNonConst; + using CppType = Glib::RefPtr; + using CType = const typename T::BaseObjectType*; + using CTypeNonConst = typename T::BaseObjectType*; static CType to_c_type(const CppType& ptr) { return Glib::unwrap(ptr); } static CType to_c_type(CType ptr) { return ptr; } @@ -252,8 +252,8 @@ template class Value> : public ValueBase_Object { public: - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } @@ -271,8 +271,8 @@ template class Value> : public ValueBase_Object { public: - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h index 7d34bea..cf6a4a0 100644 --- a/glib/glibmm/objectbase.h +++ b/glib/glibmm/objectbase.h @@ -34,7 +34,7 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { -typedef struct _GObject GObject; +using GObject = struct _GObject; } #endif @@ -229,7 +229,7 @@ protected: Class::interface_class_vector_type custom_interface_classes; }; - typedef std::map extra_object_base_data_type; + using extra_object_base_data_type = std::map; static extra_object_base_data_type extra_object_base_data; // ObjectBase instances may be used in different threads. // Accesses to extra_object_base_data must be thread-safe. diff --git a/glib/glibmm/pattern.h b/glib/glibmm/pattern.h index d588f08..fddec5c 100644 --- a/glib/glibmm/pattern.h +++ b/glib/glibmm/pattern.h @@ -24,7 +24,7 @@ */ extern "C" { -typedef struct _GPatternSpec GPatternSpec; +using GPatternSpec = struct _GPatternSpec; } #include diff --git a/glib/glibmm/private/interface_p.h b/glib/glibmm/private/interface_p.h index 3596315..a116e0e 100644 --- a/glib/glibmm/private/interface_p.h +++ b/glib/glibmm/private/interface_p.h @@ -11,8 +11,8 @@ namespace Glib class Interface_Class : public Glib::Class { public: - typedef Interface CppObjectType; - typedef GTypeInterface BaseClassType; + using CppObjectType = Interface; + using BaseClassType = GTypeInterface; void add_interface(GType instance_type) const; }; diff --git a/glib/glibmm/private/object_p.h b/glib/glibmm/private/object_p.h index bcac44d..98ee09b 100644 --- a/glib/glibmm/private/object_p.h +++ b/glib/glibmm/private/object_p.h @@ -11,9 +11,9 @@ namespace Glib class Object_Class : public Glib::Class { public: - typedef Object CppObjectType; - typedef GObject BaseObjectType; - typedef GObjectClass BaseClassType; + using CppObjectType = Object; + using BaseObjectType = GObject; + using BaseClassType = GObjectClass; static void class_init_function(void* g_class, void* class_data); diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h index 3242bbd..1076989 100644 --- a/glib/glibmm/property.h +++ b/glib/glibmm/property.h @@ -171,8 +171,8 @@ template class Property : public PropertyBase { public: - typedef T PropertyType; - typedef Glib::Value ValueType; + using PropertyType = T; + using ValueType = Glib::Value; /** Constructs a property of the @a object with the specified @a name. * For each instance of the object, the same property must be constructed with the same name. diff --git a/glib/glibmm/propertyproxy.h b/glib/glibmm/propertyproxy.h index 1d47b3c..bc27409 100644 --- a/glib/glibmm/propertyproxy.h +++ b/glib/glibmm/propertyproxy.h @@ -44,7 +44,7 @@ template class PropertyProxy : public PropertyProxy_Base { public: - typedef T PropertyType; + using PropertyType = T; PropertyProxy(ObjectBase* obj, const char* name) : PropertyProxy_Base(obj, name) {} @@ -78,7 +78,7 @@ template class PropertyProxy_WriteOnly : public PropertyProxy_Base { public: - typedef T PropertyType; + using PropertyType = T; PropertyProxy_WriteOnly(ObjectBase* obj, const char* name) : PropertyProxy_Base(obj, name) {} @@ -105,7 +105,7 @@ template class PropertyProxy_ReadOnly : public PropertyProxy_Base { public: - typedef T PropertyType; + using PropertyType = T; // obj is const, because this should be returned by const accessors. PropertyProxy_ReadOnly(const ObjectBase* obj, const char* name) diff --git a/glib/glibmm/propertyproxy_base.h b/glib/glibmm/propertyproxy_base.h index e8d6290..fdfb237 100644 --- a/glib/glibmm/propertyproxy_base.h +++ b/glib/glibmm/propertyproxy_base.h @@ -39,7 +39,7 @@ public: SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name); ~SignalProxyProperty() noexcept; - typedef sigc::slot SlotType; + using SlotType = sigc::slot; sigc::connection connect(const SlotType& slot); /** @newin{2,48} */ diff --git a/glib/glibmm/random.h b/glib/glibmm/random.h index d39660f..d934044 100644 --- a/glib/glibmm/random.h +++ b/glib/glibmm/random.h @@ -26,7 +26,7 @@ #include extern "C" { -typedef struct _GRand GRand; +using GRand = struct _GRand; } namespace Glib diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h index c9acef2..4d8a9c6 100644 --- a/glib/glibmm/refptr.h +++ b/glib/glibmm/refptr.h @@ -60,7 +60,7 @@ private: * T:dont_allow_use_in_glib_refptr_ is a public type, else it's true. * Example: * @code - * typedef int dont_allow_use_in_glib_refptr_; + * using dont_allow_use_in_glib_refptr_ = int; * @endcode */ class is_allowed_type diff --git a/glib/glibmm/sarray.h b/glib/glibmm/sarray.h index 31f139b..95e2f08 100644 --- a/glib/glibmm/sarray.h +++ b/glib/glibmm/sarray.h @@ -32,7 +32,7 @@ namespace Glib /** * @deprecated Use a std::vector instead. */ -typedef Glib::ArrayHandle SArray; +using SArray = Glib::ArrayHandle; } #endif // GLIBMM_DISABLE_DEPRECATED diff --git a/glib/glibmm/signalproxy.h b/glib/glibmm/signalproxy.h index 7237be0..458e6b1 100644 --- a/glib/glibmm/signalproxy.h +++ b/glib/glibmm/signalproxy.h @@ -153,8 +153,8 @@ template class SignalProxy : public SignalProxyNormal { public: - typedef sigc::slot SlotType; - typedef sigc::slot VoidSlotType; + using SlotType = sigc::slot; + using VoidSlotType = sigc::slot; SignalProxy(ObjectBase* obj, const SignalProxyInfo* info) : SignalProxyNormal(obj, info) {} @@ -303,8 +303,8 @@ template class SignalProxyDetailedAnyType : public SignalProxyDetailed { public: - typedef sigc::slot SlotType; - typedef sigc::slot VoidSlotType; + using SlotType = sigc::slot; + using VoidSlotType = sigc::slot; SignalProxyDetailedAnyType( ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name) diff --git a/glib/glibmm/signalproxy_connectionnode.h b/glib/glibmm/signalproxy_connectionnode.h index 1b226ed..88e98ee 100644 --- a/glib/glibmm/signalproxy_connectionnode.h +++ b/glib/glibmm/signalproxy_connectionnode.h @@ -24,8 +24,8 @@ #include #ifndef DOXYGEN_SHOULD_SKIP_THIS -typedef struct _GObject GObject; -typedef struct _GClosure GClosure; +using GObject = struct _GObject; +using GClosure = struct _GClosure; #endif // DOXYGEN_SHOULD_SKIP_THIS namespace Glib diff --git a/glib/glibmm/slisthandle.h b/glib/glibmm/slisthandle.h index a952562..7bf1a9d 100644 --- a/glib/glibmm/slisthandle.h +++ b/glib/glibmm/slisthandle.h @@ -131,14 +131,14 @@ template class SListHandleIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::forward_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::forward_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline SListHandleIterator(const GSList* node); @@ -168,15 +168,15 @@ template > class SListHandle { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef CppType value_type; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; + using value_type = CppType; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; - typedef Glib::Container_Helpers::SListHandleIterator const_iterator; - typedef Glib::Container_Helpers::SListHandleIterator iterator; + using const_iterator = Glib::Container_Helpers::SListHandleIterator; + using iterator = Glib::Container_Helpers::SListHandleIterator; template inline SListHandle(const Cont& container); diff --git a/glib/glibmm/threadpool.h b/glib/glibmm/threadpool.h index 6bf4aec..f75f34d 100644 --- a/glib/glibmm/threadpool.h +++ b/glib/glibmm/threadpool.h @@ -25,7 +25,7 @@ #include extern "C" { -typedef struct _GThreadPool GThreadPool; +using GThreadPool = struct _GThreadPool; } namespace Glib diff --git a/glib/glibmm/timer.h b/glib/glibmm/timer.h index c99c602..2559ffa 100644 --- a/glib/glibmm/timer.h +++ b/glib/glibmm/timer.h @@ -24,7 +24,7 @@ */ extern "C" { -typedef struct _GTimer GTimer; +using GTimer = struct _GTimer; } namespace Glib diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h index a207611..cf2ac0d 100644 --- a/glib/glibmm/ustring.h +++ b/glib/glibmm/ustring.h @@ -39,31 +39,31 @@ namespace Glib template struct IteratorTraits { - typedef typename T::iterator_category iterator_category; - typedef typename T::value_type value_type; - typedef typename T::difference_type difference_type; - typedef typename T::pointer pointer; - typedef typename T::reference reference; + using iterator_category = typename T::iterator_category; + using value_type = typename T::value_type; + using difference_type = typename T::difference_type; + using pointer = typename T::pointer; + using reference = typename T::reference; }; template struct IteratorTraits { - typedef std::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef std::ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using reference = T&; }; template struct IteratorTraits { - typedef std::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef std::ptrdiff_t difference_type; - typedef const T* pointer; - typedef const T& reference; + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = std::ptrdiff_t; + using pointer = const T*; + using reference = const T&; }; #endif /* GLIBMM_HAVE_STD_ITERATOR_TRAITS */ @@ -99,11 +99,11 @@ template class ustring_Iterator { public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef gunichar value_type; - typedef std::string::difference_type difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::bidirectional_iterator_tag; + using value_type = gunichar; + using difference_type = std::string::difference_type; + using reference = value_type; + using pointer = void; inline ustring_Iterator(); inline ustring_Iterator(const ustring_Iterator& other); @@ -214,20 +214,20 @@ gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_P class ustring { public: - typedef std::string::size_type size_type; - typedef std::string::difference_type difference_type; + using size_type = std::string::size_type; + using difference_type = std::string::difference_type; - typedef gunichar value_type; - typedef gunichar& reference; - typedef const gunichar& const_reference; + using value_type = gunichar; + using reference = gunichar&; + using const_reference = const gunichar&; - typedef ustring_Iterator iterator; - typedef ustring_Iterator const_iterator; + using iterator = ustring_Iterator; + using const_iterator = ustring_Iterator; #ifndef GLIBMM_HAVE_SUN_REVERSE_ITERATOR - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; + using reverse_iterator = std::reverse_iterator; + using const_reverse_iterator = std::reverse_iterator; #else @@ -863,9 +863,9 @@ public: private: #ifdef GLIBMM_HAVE_WIDE_STREAM - typedef std::wostringstream StreamType; + using StreamType = std::wostringstream; #else - typedef std::ostringstream StreamType; + using StreamType = std::ostringstream; #endif StreamType stream_; diff --git a/glib/glibmm/value.h b/glib/glibmm/value.h index 3a51628..c7f61af 100644 --- a/glib/glibmm/value.h +++ b/glib/glibmm/value.h @@ -134,7 +134,7 @@ protected: class ValueBase_Enum : public ValueBase { public: - typedef gint CType; + using CType = gint; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -152,7 +152,7 @@ protected: class ValueBase_Flags : public ValueBase { public: - typedef guint CType; + using CType = guint; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -170,7 +170,7 @@ protected: class ValueBase_String : public ValueBase { public: - typedef const gchar* CType; + using CType = const gchar*; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -200,8 +200,8 @@ template class Value_Boxed : public ValueBase_Boxed { public: - typedef T CppType; - typedef typename T::BaseObjectType* CType; + using CppType = T; + using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_type(); } @@ -219,8 +219,8 @@ template class Value> : public ValueBase_Object { public: - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } @@ -238,8 +238,8 @@ template class Value> : public ValueBase_Object { public: - typedef Glib::RefPtr CppType; - typedef typename T::BaseObjectType* CType; + using CppType = Glib::RefPtr; + using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } @@ -268,7 +268,7 @@ template <> class Value : public ValueBase_String { public: - typedef std::string CppType; + using CppType = std::string; void set(const std::string& data); std::string get() const { return get_cstring(); } @@ -281,7 +281,7 @@ template <> class Value : public ValueBase_String { public: - typedef Glib::ustring CppType; + using CppType = Glib::ustring; void set(const Glib::ustring& data); Glib::ustring get() const { return get_cstring(); } @@ -294,7 +294,7 @@ template class Value_Enum : public ValueBase_Enum { public: - typedef T CppType; + using CppType = T; void set(CppType data) { set_enum(data); } CppType get() const { return CppType(get_enum()); } @@ -307,7 +307,7 @@ template class Value_Flags : public ValueBase_Flags { public: - typedef T CppType; + using CppType = T; void set(CppType data) { set_flags(data); } CppType get() const { return CppType(get_flags()); } diff --git a/glib/glibmm/value_custom.h b/glib/glibmm/value_custom.h index f94bf1b..d3ebfee 100644 --- a/glib/glibmm/value_custom.h +++ b/glib/glibmm/value_custom.h @@ -61,8 +61,8 @@ template class Value_Pointer : public ValueBase_Object { public: - typedef PtrT CppType; - typedef void* CType; + using CppType = PtrT; + using CType = void*; static inline GType value_type() G_GNUC_CONST; @@ -100,8 +100,8 @@ template class Value : public ValueBase_Boxed { public: - typedef T CppType; - typedef T* CType; + using CppType = T; + using CType = T*; static GType value_type() G_GNUC_CONST; diff --git a/glib/glibmm/vectorutils.h b/glib/glibmm/vectorutils.h index 40231db..6ea434a 100644 --- a/glib/glibmm/vectorutils.h +++ b/glib/glibmm/vectorutils.h @@ -93,7 +93,7 @@ template typename Tr::CType* create_array(typename std::vector::const_iterator pbegin, std::size_t size) { - typedef typename Tr::CType CType; + using CType = typename Tr::CType; CType* const array(static_cast(g_malloc((size + 1) * sizeof(CType)))); CType* const array_end(array + size); @@ -160,14 +160,14 @@ template class ArrayIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::random_access_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::random_access_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline ArrayIterator(const CType* pos); @@ -201,14 +201,14 @@ template class ListIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::forward_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::forward_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline ListIterator(const GList* node); @@ -227,14 +227,14 @@ template class SListIterator { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; - typedef std::forward_iterator_tag iterator_category; - typedef CppType value_type; - typedef std::ptrdiff_t difference_type; - typedef value_type reference; - typedef void pointer; + using iterator_category = std::forward_iterator_tag; + using value_type = CppType; + using difference_type = std::ptrdiff_t; + using reference = value_type; + using pointer = void; explicit inline SListIterator(const GSList* node); @@ -275,8 +275,8 @@ template class ArrayKeeper { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; /** Constructs an ArrayKeeper holding @a array of size @a array_size. * @a ownership tells what should be destroyed with keeper destruction: @@ -335,8 +335,8 @@ template class GListKeeper { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; /** Constructs an GListKeeper holding @a glist. * @a ownership tells what should be destroyed with keeper destruction: @@ -392,8 +392,8 @@ template class GSListKeeper { public: - typedef typename Tr::CppType CppType; - typedef typename Tr::CType CType; + using CppType = typename Tr::CppType; + using CType = typename Tr::CType; /** Constructs an GSListKeeper holding @a gslist. * @a ownership tells what should be destroyed with keeper destruction: @@ -467,11 +467,11 @@ template > class ArrayHandler { public: - typedef typename Tr::CType CType; - typedef T CppType; - typedef std::vector VectorType; - typedef typename Glib::Container_Helpers::ArrayKeeper ArrayKeeperType; - typedef typename Glib::Container_Helpers::ArrayIterator ArrayIteratorType; + using CType = typename Tr::CType; + using CppType = T; + using VectorType = std::vector; + using ArrayKeeperType = typename Glib::Container_Helpers::ArrayKeeper; + using ArrayIteratorType = typename Glib::Container_Helpers::ArrayIterator; // maybe think about using C++0x move constructors? static VectorType array_to_vector( @@ -484,9 +484,9 @@ template <> class ArrayHandler { public: - typedef gboolean CType; - typedef bool CppType; - typedef std::vector VectorType; + using CType = gboolean; + using CppType = bool; + using VectorType = std::vector; typedef Glib::Container_Helpers::ArrayKeeper> ArrayKeeperType; typedef Glib::Container_Helpers::ArrayIterator> @@ -530,11 +530,11 @@ template > class ListHandler { public: - typedef typename Tr::CType CType; - typedef T CppType; - typedef std::vector VectorType; - typedef typename Glib::Container_Helpers::GListKeeper GListKeeperType; - typedef typename Glib::Container_Helpers::ListIterator ListIteratorType; + using CType = typename Tr::CType; + using CppType = T; + using VectorType = std::vector; + using GListKeeperType = typename Glib::Container_Helpers::GListKeeper; + using ListIteratorType = typename Glib::Container_Helpers::ListIterator; // maybe think about using C++0x move constructors? static VectorType list_to_vector(GList* glist, Glib::OwnershipType ownership); @@ -571,11 +571,11 @@ template > class SListHandler { public: - typedef typename Tr::CType CType; - typedef T CppType; - typedef std::vector VectorType; - typedef typename Glib::Container_Helpers::GSListKeeper GSListKeeperType; - typedef typename Glib::Container_Helpers::SListIterator SListIteratorType; + using CType = typename Tr::CType; + using CppType = T; + using VectorType = std::vector; + using GSListKeeperType = typename Glib::Container_Helpers::GSListKeeper; + using SListIteratorType = typename Glib::Container_Helpers::SListIterator; // maybe think about using C++0x move constructors? static VectorType slist_to_vector(GSList* gslist, Glib::OwnershipType ownership); @@ -847,7 +847,7 @@ inline GListKeeper::GListKeeper(const GListKeeper& keeper) template GListKeeper::~GListKeeper() noexcept { - typedef typename Tr::CTypeNonConst CTypeNonConst; + using CTypeNonConst = typename Tr::CTypeNonConst; if (glist_ && ownership_ != Glib::OWNERSHIP_NONE) { @@ -888,7 +888,7 @@ inline GSListKeeper::GSListKeeper(const GSListKeeper& keeper) template GSListKeeper::~GSListKeeper() noexcept { - typedef typename Tr::CTypeNonConst CTypeNonConst; + using CTypeNonConst = typename Tr::CTypeNonConst; if (gslist_ && ownership_ != Glib::OWNERSHIP_NONE) { if (ownership_ != Glib::OWNERSHIP_SHALLOW) diff --git a/glib/glibmm/wrap.cc b/glib/glibmm/wrap.cc index 67861d6..f30fea9 100644 --- a/glib/glibmm/wrap.cc +++ b/glib/glibmm/wrap.cc @@ -36,7 +36,7 @@ namespace // on any platform. Nevertheless, indexing a vector costs almost nothing // compared to a map lookup. -typedef std::vector WrapFuncTable; +using WrapFuncTable = std::vector; static WrapFuncTable* wrap_func_table = nullptr; diff --git a/glib/glibmm/wrap.h b/glib/glibmm/wrap.h index 36dff85..eec39bb 100644 --- a/glib/glibmm/wrap.h +++ b/glib/glibmm/wrap.h @@ -31,7 +31,7 @@ class ObjectBase; class Object; // Type of the per-class wrap_new() functions. -typedef Glib::ObjectBase* (*WrapNewFunction)(GObject*); +using WrapNewFunction = Glib::ObjectBase*(*)(GObject*); // Setup and free the structures used by wrap_register(). // Both functions might be called more than once. diff --git a/glib/src/balancedtree.hg b/glib/src/balancedtree.hg index f9190e5..4707320 100644 --- a/glib/src/balancedtree.hg +++ b/glib/src/balancedtree.hg @@ -57,8 +57,8 @@ class BalancedTree { _CLASS_GENERIC(BalancedTree, GTree) public: - typedef sigc::slot TraverseFunc; - typedef sigc::slot CompareFunc; + using TraverseFunc = sigc::slot; + using CompareFunc = sigc::slot; protected: BalancedTree() : diff --git a/glib/src/binding.hg b/glib/src/binding.hg index bc8cc36..b30cba1 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -106,7 +106,7 @@ public: * * @return true if the transformation was successful, and false otherwise. */ - typedef sigc::slot SlotTransform; + using SlotTransform = sigc::slot; /** Creates a binding between @a source_property and @a target_property, * allowing you to set the transformation functions to be used by the binding. @@ -394,8 +394,8 @@ private: class TransformProp : public sigc::functor_base { public: - typedef bool result_type; - typedef sigc::slot SlotTypedTransform; + using result_type = bool; + using SlotTypedTransform = sigc::slot; TransformProp(const SlotTypedTransform& slot) : typed_transform(slot) {} diff --git a/glib/src/date.hg b/glib/src/date.hg index 5a307e6..228272a 100644 --- a/glib/src/date.hg +++ b/glib/src/date.hg @@ -34,8 +34,8 @@ namespace Glib class Date { public: - typedef guint8 Day; - typedef guint16 Year; + using Day = guint8 ; + using Year = guint16; _WRAP_ENUM(Month, GDateMonth, s#^DATE_##, NO_GTYPE, get_type_func=) _WRAP_ENUM(Weekday, GDateWeekday, s#^DATE_##, NO_GTYPE) diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg index 82bcd56..023cca3 100644 --- a/glib/src/datetime.hg +++ b/glib/src/datetime.hg @@ -35,7 +35,7 @@ class TimeZone; /** A value representing an interval of time, in microseconds. As GTimeSpan, * its underlying type is gint64. */ -typedef GTimeSpan TimeSpan; +using TimeSpan = GTimeSpan; /** DateTime - A structure representing Date and Time. * DateTime is a structure that combines a Gregorian date and time into a diff --git a/glib/src/fileutils.hg b/glib/src/fileutils.hg index 4320c42..b8792b6 100644 --- a/glib/src/fileutils.hg +++ b/glib/src/fileutils.hg @@ -257,8 +257,8 @@ private: class Dir { public: - typedef DirIterator iterator; - typedef DirIterator const_iterator; + using iterator = DirIterator; + using const_iterator = DirIterator; /** Opens a directory for reading. The names of the files in the * directory can then be retrieved using read_name(). diff --git a/glib/src/markup.hg b/glib/src/markup.hg index 14c4163..1075f69 100644 --- a/glib/src/markup.hg +++ b/glib/src/markup.hg @@ -97,7 +97,7 @@ namespace Markup class ParseContext; /** @ingroup Markup */ -typedef Glib::MarkupError Error; +using Error = Glib::MarkupError; /** Escapes text so that the markup parser will parse it verbatim. @@ -132,8 +132,8 @@ _WRAP_ENUM(ParseFlags, GMarkupParseFlags, NO_GTYPE, s#^MARKUP_##) class AttributeKeyLess { public: - typedef Glib::ustring first_argument_type; - typedef Glib::ustring second_argument_type; + using first_argument_type = Glib::ustring; + using second_argument_type = Glib::ustring; typedef bool result_type; bool operator()(const Glib::ustring& lhs, const Glib::ustring& rhs) const; diff --git a/glib/src/nodetree.hg b/glib/src/nodetree.hg index ec6a545..75b63c0 100644 --- a/glib/src/nodetree.hg +++ b/glib/src/nodetree.hg @@ -69,8 +69,8 @@ class NodeTree { _CLASS_GENERIC(NodeTree, GNode) public: - typedef sigc::slot&> TraverseFunc; - typedef sigc::slot&> ForeachFunc; + using TraverseFunc = sigc::slot&>; + using ForeachFunc = sigc::slot&>; private: static NodeTree* wrap(GNode* node) @@ -340,7 +340,7 @@ public: sigc::slot real_slot = sigc::ptr_fun(on_compare_child); GNode* child = nullptr; - typedef sigc::slot type_foreach_gnode_slot; + using type_foreach_gnode_slot = sigc::slot; 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(&bound_slot)); @@ -374,7 +374,7 @@ public: sigc::slot real_slot = sigc::ptr_fun(on_compare_node); GNode* child = nullptr; - typedef sigc::slot type_traverse_gnode_slot; + using type_traverse_gnode_slot = sigc::slot; type_traverse_gnode_slot bound_slot = sigc::bind(real_slot, the_data, &child); g_node_traverse(const_cast(gobj()), (GTraverseType)order, (GTraverseFlags)flags, -1, c_callback_traverse_compare_node, reinterpret_cast(&bound_slot)); diff --git a/glib/src/optiongroup.hg b/glib/src/optiongroup.hg index 5cfe0e5..b4e0846 100644 --- a/glib/src/optiongroup.hg +++ b/glib/src/optiongroup.hg @@ -85,8 +85,8 @@ public: _IGNORE(g_option_group_add_entries) - typedef std::vector vecustrings; - typedef std::vector vecstrings; + using vecustrings = std::vector; + using vecstrings = std::vector; /** Add a boolean option @a entry. * The @arg parameter will be set to the option's extra argument diff --git a/glib/src/spawn.hg b/glib/src/spawn.hg index 830ad9e..0949048 100644 --- a/glib/src/spawn.hg +++ b/glib/src/spawn.hg @@ -26,7 +26,7 @@ _DEFS(glibmm,glib) namespace Glib { -typedef GPid Pid; +using Pid = GPid; _WRAP_ENUM(SpawnFlags, GSpawnFlags, NO_GTYPE) @@ -42,7 +42,7 @@ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#) /** For instance,
* void on_child_setup(); */ -typedef sigc::slot SlotSpawnChildSetup; +using SlotSpawnChildSetup = sigc::slot; /** Executes a child program asynchronously (your program will not * block waiting for the child to exit). The child program is diff --git a/glib/src/thread.hg b/glib/src/thread.hg index 24df5de..57b940f 100644 --- a/glib/src/thread.hg +++ b/glib/src/thread.hg @@ -719,7 +719,7 @@ private: template struct StaticPrivate { - typedef void (*DestroyNotifyFunc) (void*); + using DestroyNotifyFunc = void (*) (void*); static void delete_ptr(void* data); @@ -746,7 +746,7 @@ public: Private(const Private&) = delete; Private& operator=(const Private&) = delete; - typedef void (*DestructorFunc) (void*); + using DestructorFunc = void (*) (void*); static void delete_ptr(void* data); diff --git a/glib/src/threads.hg b/glib/src/threads.hg index 51decfc..6340f45 100644 --- a/glib/src/threads.hg +++ b/glib/src/threads.hg @@ -596,7 +596,7 @@ public: Private(const Private&) = delete; Private& operator=(const Private&) = delete; - typedef void (*DestructorFunc) (void*); + using DestructorFunc = void (*) (void*); /** Deletes static_cast(data) */ diff --git a/glib/src/value_basictypes.h.m4 b/glib/src/value_basictypes.h.m4 index f9648c0..06320cf 100644 --- a/glib/src/value_basictypes.h.m4 +++ b/glib/src/value_basictypes.h.m4 @@ -33,8 +33,8 @@ template <> class Value<$1> : public ValueBase { public: - typedef $1 CppType; - typedef g$2 CType; + using CppType = $1; + using CType = g$2; static GType value_type() G_GNUC_CONST; diff --git a/glib/src/valuearray.hg b/glib/src/valuearray.hg index 518123f..c1b5638 100644 --- a/glib/src/valuearray.hg +++ b/glib/src/valuearray.hg @@ -55,7 +55,7 @@ public: * The compare function should return -1 if v1 < v2, 0 if v1 == v2, and 1 if * v1 > v2. */ - typedef sigc::slot SlotCompare; + using SlotCompare = sigc::slot; /** Default constructor. Constructs a new array with no pre-allocation. */ diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index 3093dfa..bde8b4b 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -154,7 +154,7 @@ VariantContainerBase::VariantContainerBase(GVariant* castitem, bool take_a_refer VariantContainerBase VariantContainerBase::create_tuple(const std::vector& children) { - typedef GVariant* var_ptr; + using var_ptr = GVariant*; var_ptr* const var_array = new var_ptr[children.size()]; for (std::vector::size_type i = 0; i < children.size(); i++) @@ -417,7 +417,7 @@ Variant::get() const /*--------------------Variant< std::vector >---------------------*/ -typedef std::vector type_vec_ustring; +using type_vec_ustring = std::vector; Variant::Variant() : VariantContainerBase() { @@ -501,7 +501,7 @@ Variant::get_iter() const /*--------------------Variant< std::vector >---------------------*/ -typedef std::vector type_vec_string; +using type_vec_string = std::vector; Variant::Variant() : VariantContainerBase() { diff --git a/glib/src/variant.hg b/glib/src/variant.hg index c73fc8e..c90fa55 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -98,7 +98,7 @@ public: /** This typedef is just to make it more obvious that * our operator const void* should be used like operator bool(). */ - typedef const void* BoolExpr; + using BoolExpr = const void*; /** Test whether the Variant has an underlying instance. * @@ -285,8 +285,8 @@ class VariantStringBase : public VariantBase _CLASS_GENERIC(VariantStringBase, GVariant) public: - typedef GVariant* CType; - typedef VariantStringBase CppType; + using CType = GVariant*; + using CppType = VariantStringBase; /// Default constructor. VariantStringBase(); @@ -340,8 +340,8 @@ class VariantContainerBase : public VariantBase _CLASS_GENERIC(VariantContainerBase, GVariant) public: - typedef GVariant* CType; - typedef VariantContainerBase CppType; + using CType = GVariant*; + using CppType = VariantContainerBase; /// Default constructor. VariantContainerBase(); @@ -430,7 +430,7 @@ template class Variant : public VariantBase { public: - typedef T CppType; + using CppType = T; }; /****************** Specializations ***********************************/ @@ -446,9 +446,9 @@ class Variant : public VariantContainerBase _CLASS_GENERIC(Variant, GVariant) public: - typedef GVariant* CType; - typedef VariantBase CppType; - typedef Variant CppContainerType; + using CType = GVariant*; + using CppType = VariantBase; + using CppContainerType = Variant; /// Default constructor. Variant(); @@ -492,9 +492,9 @@ template class Variant< Variant > : public VariantContainerBase { public: - typedef GVariant* CType; - typedef Variant CppType; - typedef Variant CppContainerType; + using CType = GVariant*; + using CppType = Variant; + using CppContainerType = Variant; /// Default constructor. Variant< Variant >(); @@ -539,8 +539,8 @@ class Variant : public VariantStringBase // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(Variant, GVariant) public: - typedef char* CType; - typedef Glib::ustring CppType; + using CType = char*; + using CppType = Glib::ustring; /// Default constructor. Variant(); @@ -592,8 +592,8 @@ class Variant : public VariantStringBase // Trick gmmproc into thinking this is derived from GVariant to wrap some methods. _CLASS_GENERIC(Variant, GVariant) public: - typedef char* CType; - typedef std::string CppType; + using CType = char* ; + using CppType = std::string; /// Default constructor. Variant(); @@ -638,8 +638,8 @@ template class Variant< std::pair > : public VariantContainerBase { public: - typedef std::pair CppType; - typedef Variant CppContainerType; + using CppType = std::pair; + using CppContainerType = Variant; /// Default constructor. Variant< std::pair >() @@ -687,8 +687,8 @@ template class Variant< std::vector > : public VariantContainerBase { public: - typedef T CppType; - typedef std::vector CppContainerType; + using CppType = T ; + using CppContainerType = std::vector; /// Default constructor. Variant< std::vector >() @@ -756,8 +756,8 @@ template<> class Variant< std::vector > : public VariantContainerBase { public: - typedef Glib::ustring CppType; - typedef std::vector CppContainerType; + using CppType = Glib::ustring ; + using CppContainerType = std::vector; /// Default constructor. Variant< std::vector >(); @@ -820,8 +820,8 @@ template<> class Variant< std::vector > : public VariantContainerBase { public: - typedef std::string CppType; - typedef std::vector CppContainerType; + using CppType = std::string ; + using CppContainerType = std::vector; /// Default constructor. Variant< std::vector >(); @@ -896,8 +896,8 @@ template class Variant< std::map >: public VariantContainerBase { public: - typedef std::pair CppType; - typedef std::map CppContainerType; + using CppType = std::pair; + using CppContainerType = std::map; /// Default constructor. Variant< std::map >() diff --git a/glib/src/variant_basictypes.h.m4 b/glib/src/variant_basictypes.h.m4 index a6b6ec0..959a8e5 100644 --- a/glib/src/variant_basictypes.h.m4 +++ b/glib/src/variant_basictypes.h.m4 @@ -43,7 +43,7 @@ template <> class Variant<$1> : public VariantBase { public: - typedef $2 CType; + using CType = $2; /// Default constructor. Variant<$1>() diff --git a/glib/src/variantdict.hg b/glib/src/variantdict.hg index 7b66869..296f1e2 100644 --- a/glib/src/variantdict.hg +++ b/glib/src/variantdict.hg @@ -102,7 +102,7 @@ public: template void VariantDict::insert_value(const Glib::ustring& key, const T_Value& value) { - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; //TODO: Can we do any check like this here, before glib does? //g_return_val_if_fail( @@ -116,7 +116,7 @@ bool VariantDict::lookup_value(const Glib::ustring& key, T_Value& value) const { value = T_Value(); //Make sure that it is initialized. - typedef Glib::Variant type_glib_variant; + using type_glib_variant = Glib::Variant; //TODO: Can we do any check like this here, before glib does? //g_variant_type_equal(g_action_group_get_action_state_type(const_cast(gobj()), action_name.c_str()), type_glib_variant::variant_type().gobj())); diff --git a/glib/src/varianttype.ccg b/glib/src/varianttype.ccg index 4f43b56..8274c93 100644 --- a/glib/src/varianttype.ccg +++ b/glib/src/varianttype.ccg @@ -54,7 +54,7 @@ VariantType::operator=(const GVariantType* castitem) VariantType VariantType::create_tuple(const std::vector& items) { - typedef GVariantType* var_ptr; + using var_ptr = GVariantType*; const auto var_array = new var_ptr[items.size()]; for (std::vector::size_type i = 0; i < items.size(); i++) diff --git a/tests/glibmm_btree/main.cc b/tests/glibmm_btree/main.cc index 647542b..dbe0f85 100644 --- a/tests/glibmm_btree/main.cc +++ b/tests/glibmm_btree/main.cc @@ -1,7 +1,7 @@ #include -typedef Glib::ustring type_key_value; -typedef type_key_value* type_p_key_value; +using type_key_value = Glib::ustring; +using type_p_key_value = type_key_value*; static int my_search(const type_key_value& key_a, const type_key_value& key_b) diff --git a/tests/glibmm_interface_move/main.cc b/tests/glibmm_interface_move/main.cc index 99dbd58..c097cbb 100644 --- a/tests/glibmm_interface_move/main.cc +++ b/tests/glibmm_interface_move/main.cc @@ -80,7 +80,7 @@ class TestInterface; class TestInterface_Class : public Glib::Interface_Class { public: - typedef TestInterface BaseClassType; + using BaseClassType = TestInterface; friend class TestInterface; @@ -107,7 +107,7 @@ public: class TestInterface : public Glib::Interface { protected: - typedef TestInterface_Class CppClassType; + using CppClassType = TestInterface_Class; TestInterface() : Glib::Interface(derived_interface_class_.init()) {} @@ -147,8 +147,8 @@ private: class DerivedObject_Class : public Glib::Class { public: - typedef GObjectClass BaseClassType; - typedef Glib::Object_Class CppClassParent; + using BaseClassType = GObjectClass; + using CppClassParent = Glib::Object_Class; static void class_init_function(void* g_class, void* class_data) { @@ -183,7 +183,7 @@ TestInterface::CppClassType TestInterface::derived_interface_class_; // initiali class DerivedObject : public Glib::Object, public TestInterface { public: - typedef DerivedObject_Class CppClassType; + using CppClassType = DerivedObject_Class; // A real application would never make the constructor public. // It would instead have a protected constructor and a public create() method. diff --git a/tests/glibmm_nodetree/main.cc b/tests/glibmm_nodetree/main.cc index fffdafa..0554c48 100644 --- a/tests/glibmm_nodetree/main.cc +++ b/tests/glibmm_nodetree/main.cc @@ -1,7 +1,7 @@ #include #include -typedef Glib::NodeTree type_nodetree_string; +using type_nodetree_string = Glib::NodeTree; static bool node_build_string(type_nodetree_string& node, std::string& string) diff --git a/tests/glibmm_null_containerhandle/main.cc b/tests/glibmm_null_containerhandle/main.cc index 3353370..80d8350 100644 --- a/tests/glibmm_null_containerhandle/main.cc +++ b/tests/glibmm_null_containerhandle/main.cc @@ -26,7 +26,7 @@ int main() { Gio::init(); - typedef Glib::RefPtr CrePtr; + using CrePtr = Glib::RefPtr; std::vector v1(Glib::ArrayHandle(nullptr, Glib::OWNERSHIP_DEEP)); std::vector v2(Glib::ArrayHandle(nullptr, 5, Glib::OWNERSHIP_DEEP)); diff --git a/tests/glibmm_null_vectorutils/main.cc b/tests/glibmm_null_vectorutils/main.cc index a686ade..b658b39 100644 --- a/tests/glibmm_null_vectorutils/main.cc +++ b/tests/glibmm_null_vectorutils/main.cc @@ -24,7 +24,7 @@ int main() { Gio::init(); - typedef Glib::RefPtr CrePtr; + using CrePtr = Glib::RefPtr; std::vector v1( Glib::ArrayHandler::array_to_vector(nullptr, Glib::OWNERSHIP_DEEP)); diff --git a/tests/glibmm_variant/main.cc b/tests/glibmm_variant/main.cc index e5877a8..8ac5d50 100644 --- a/tests/glibmm_variant/main.cc +++ b/tests/glibmm_variant/main.cc @@ -52,7 +52,7 @@ main(int, char**) // Dict: - typedef std::pair TypeDictEntry; + using TypeDictEntry = std::pair; TypeDictEntry dict_entry("A key", "A value"); @@ -68,7 +68,7 @@ main(int, char**) ostr << std::endl; - typedef std::map TypeDict; + using TypeDict = std::map; TypeDict orig_dict; @@ -112,7 +112,7 @@ main(int, char**) } // std::vector< std::map< Glib::ustring, Glib::Variant > > - typedef std::map> ComplexDictType; + using ComplexDictType = std::map>; ComplexDictType complex_dict1; ComplexDictType complex_dict2; @@ -132,7 +132,7 @@ main(int, char**) complex_dict2.insert(std::pair>("Map 2 " + s, v)); } - typedef std::vector>> ComplexVecType; + using ComplexVecType = std::vector>>; ComplexVecType complex_vector = { complex_dict1, complex_dict2 }; @@ -275,7 +275,7 @@ test_dynamic_cast_composite_types() try { - typedef std::map> composite_type; + using composite_type = std::map>; auto derived = Glib::VariantBase::cast_dynamic>(cppdict); ostr << "Cast composite type (get_type_string()=" << derived.get_type_string() @@ -352,8 +352,8 @@ test_dynamic_cast() } // A variant of type a{sv} - typedef std::map type_map_sv; - typedef Glib::Variant type_dict_sv; + using type_map_sv = std::map; + using type_dict_sv = Glib::Variant; g_assert((type_dict_sv::variant_type().get_string()) == "a{sv}"); type_dict_sv var_map; diff --git a/tools/extra_defs_gen/generate_extra_defs.h b/tools/extra_defs_gen/generate_extra_defs.h index dc95262..9d960e3 100644 --- a/tools/extra_defs_gen/generate_extra_defs.h +++ b/tools/extra_defs_gen/generate_extra_defs.h @@ -26,7 +26,7 @@ /** Function pointer type for functions that determine if a GType is a pointer * type. */ -typedef bool (*GTypeIsAPointerFunc)(GType gtype); +using GTypeIsAPointerFunc = bool(*)(GType gtype); /** Default extra defs utility function to determine if a GType is a pointer * type. diff --git a/tools/m4/class_boxedtype.m4 b/tools/m4/class_boxedtype.m4 index 32b42ad..ed8a481 100644 --- a/tools/m4/class_boxedtype.m4 +++ b/tools/m4/class_boxedtype.m4 @@ -202,8 +202,8 @@ dnl _IMPORT(SECTION_CLASS1) public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ /** Get the GType for this class, for use with the underlying GObject type system. diff --git a/tools/m4/class_boxedtype_static.m4 b/tools/m4/class_boxedtype_static.m4 index 9624257..926ac49 100644 --- a/tools/m4/class_boxedtype_static.m4 +++ b/tools/m4/class_boxedtype_static.m4 @@ -168,8 +168,8 @@ dnl _IMPORT(SECTION_CLASS1) public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ __CPPNAME__`'(const __CPPNAME__& other) noexcept; diff --git a/tools/m4/class_generic.m4 b/tools/m4/class_generic.m4 index 590e81b..6395946 100644 --- a/tools/m4/class_generic.m4 +++ b/tools/m4/class_generic.m4 @@ -44,8 +44,8 @@ dnl _IMPORT(SECTION_CLASS1) public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ private: diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4 index 77943ef..dd9c173 100644 --- a/tools/m4/class_gobject.m4 +++ b/tools/m4/class_gobject.m4 @@ -249,10 +249,10 @@ _IMPORT(SECTION_CLASS1) #ifndef DOXYGEN_SHOULD_SKIP_THIS public: - typedef __CPPNAME__ CppObjectType; - typedef __CPPNAME__`'_Class CppClassType; - typedef __CNAME__ BaseObjectType; - typedef __REAL_CNAME__`'Class BaseClassType; + using CppObjectType = __CPPNAME__; + using CppClassType = __CPPNAME__`'_Class; + using BaseObjectType = __CNAME__; + using BaseClassType = __REAL_CNAME__`'Class; // noncopyable __CPPNAME__`'(const __CPPNAME__&) = delete; diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4 index e3c3230..0116045 100644 --- a/tools/m4/class_interface.m4 +++ b/tools/m4/class_interface.m4 @@ -45,10 +45,10 @@ define(`_PH_CLASS_DECLARATION_INTERFACE',`dnl class __CPPNAME__`'_Class : public __CPPPARENT__`'_Class { public: - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; - typedef __CCLASS__ BaseClassType; - typedef __CPPPARENT__`'_Class CppClassParent; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; + using BaseClassType = __CCLASS__; + using CppClassParent = __CPPPARENT__`'_Class; friend class __CPPNAME__; @@ -239,10 +239,10 @@ _IMPORT(SECTION_CLASS1) #ifndef DOXYGEN_SHOULD_SKIP_THIS public: - typedef __CPPNAME__ CppObjectType; - typedef __CPPNAME__`'_Class CppClassType; - typedef __CNAME__ BaseObjectType; - typedef __CCLASS__ BaseClassType; + using CppObjectType = __CPPNAME__; + using CppClassType = __CPPNAME__`'_Class; + using BaseObjectType = __CNAME__; + using BaseClassType = __CCLASS__; // noncopyable __CPPNAME__`'(const __CPPNAME__&) = delete; diff --git a/tools/m4/class_opaque_copyable.m4 b/tools/m4/class_opaque_copyable.m4 index 4fdab1e..0e17919 100644 --- a/tools/m4/class_opaque_copyable.m4 +++ b/tools/m4/class_opaque_copyable.m4 @@ -193,8 +193,8 @@ dnl _IMPORT(SECTION_CLASS1) public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4 index e33cf52..e8d645b 100644 --- a/tools/m4/class_opaque_refcounted.m4 +++ b/tools/m4/class_opaque_refcounted.m4 @@ -137,8 +137,8 @@ dnl _IMPORT(SECTION_CLASS1) public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __CNAME__; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4 index 7a3e0fb..6880412 100644 --- a/tools/m4/class_shared.m4 +++ b/tools/m4/class_shared.m4 @@ -105,14 +105,14 @@ class __CPPNAME__`'_Class : public Glib::Class { public: #ifndef DOXYGEN_SHOULD_SKIP_THIS - typedef __CPPNAME__ CppObjectType; - typedef __REAL_CNAME__ BaseObjectType; + using CppObjectType = __CPPNAME__; + using BaseObjectType = __REAL_CNAME__; ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl - typedef __CPPPARENT__`'_Class CppClassParent; + using CppClassParent = __CPPPARENT__`'_Class; ',`dnl - typedef __REAL_CNAME__`'Class BaseClassType; - typedef __CPPPARENT__`'_Class CppClassParent; - typedef __REAL_CPARENT__`'Class BaseClassParent; + using BaseClassType = __REAL_CNAME__`'Class; + using CppClassParent = __CPPPARENT__`'_Class; + using BaseClassParent = __REAL_CPARENT__`'Class; ')dnl friend class __CPPNAME__; @@ -286,8 +286,8 @@ define(`_STRUCT_PROTOTYPE',`dnl #ifndef DOXYGEN_SHOULD_SKIP_THIS ifdef(`__BOOL_STRUCT_NOT_HIDDEN__',`dnl ',`dnl -typedef struct _`'__CNAME__ __CNAME__; -typedef struct _`'__CNAME__`'Class __CNAME__`'Class; +using __CNAME__ = struct _`'__CNAME__; +using __CNAME__`'Class = struct _`'__CNAME__`'Class; ')dnl #endif /* DOXYGEN_SHOULD_SKIP_THIS */ undefine(`__BOOL_STRUCT_NOT_HIDDEN__')dnl diff --git a/tools/m4/signal.m4 b/tools/m4/signal.m4 index f62e316..5b680f4 100644 --- a/tools/m4/signal.m4 +++ b/tools/m4/signal.m4 @@ -65,7 +65,7 @@ ifelse($8,`1',,`dnl Do not generate the implementation if it should be custom: static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`'void* data) { using namespace __NAMESPACE__; - typedef sigc::slot< $5`'_COMMA_PREFIX($6) > SlotType; + using SlotType = sigc::slot< $5`'_COMMA_PREFIX($6) >; auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. @@ -98,7 +98,7 @@ ifelse($12, `', `dnl } ifelse($2,void,,`dnl else - typedef $2 RType; + using RType = $2; return RType`'(); ')dnl } @@ -107,7 +107,7 @@ ifelse($2,void,,`dnl else static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`' void* data) { using namespace __NAMESPACE__; - typedef sigc::slot< void`'_COMMA_PREFIX($6) > SlotType; + using SlotType = sigc::slot< void`'_COMMA_PREFIX($6) >; auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. @@ -135,7 +135,7 @@ ifelse($12, `', `dnl } } - typedef $2 RType; + using RType = $2; return RType`'(); } ')dnl endif @@ -292,7 +292,7 @@ dnl g_assert(base != nullptr); ifelse($4,void,,`return ')(*base->$2)`'($6); ifelse($4,void,,`dnl - typedef $4 RType; + using RType = $4; return RType`'(); ')dnl } @@ -343,7 +343,7 @@ ifelse($8,refreturn,`dnl Assume Glib::wrap() is correct if refreturn is requeste return _CONVERT($4,$3,`(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6))'); ')dnl - typedef $3 RType; + using RType = $3; return RType`'(); ')dnl } diff --git a/tools/m4/vfunc.m4 b/tools/m4/vfunc.m4 index 7819d3e..5b6f114 100644 --- a/tools/m4/vfunc.m4 +++ b/tools/m4/vfunc.m4 @@ -141,7 +141,7 @@ dnl g_assert(base != nullptr); ifelse($4,void,,`dnl ifelse(`$15', `',`dnl - typedef $4 RType; + using RType = $4; return RType`'(); ',`dnl return _CONVERT($3,$4,`$15'); @@ -202,7 +202,7 @@ ifelse($10,errthrow,`dnl } ifelse(`$14', `',`dnl - typedef $3 RType; + using RType = $3; return RType`'(); ',`dnl return $14; -- 2.7.4