summaryrefslogtreecommitdiff
path: root/glib/glibmm/class.cc
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Class: A use of range-based for."Murray Cumming2017-02-231-3/+3
| | | | | | | Because the original code starts at 1, not 0, so this was not equivalent. This reverts commit b0a3e10d17f21254c15781bb7ff57736a9bea569.
* Class: A use of range-based for.Murray Cumming2017-02-231-3/+3
|
* Object construction: Add custom class init and instance init functionsKjell Ahlstedt2017-02-151-10/+42
| | | | | | | Make it possible for named custom types to register additions to the class init function and to register an instance init function. An extra class init function is useful in Gtk::WidgetCustomDraw and Gtk::WidgetCustomSnapshot. Bug 775348
* Glib::ObjectBase: Use std::forward_list for interface class pointersKjell Ahlstedt2016-11-251-3/+2
| | | | | | | std::forward_list is ideally suited for storing pointers to the interfaces of custom types. The list is often empty, never long. No need to use a pointer to a container in order to save storage space (as I did in the previous commit). An empty std::forward_list consists of nothing but a pointer.
* Glib::ObjectBase: Replace extra_object_base_data map by instance dataKjell Ahlstedt2016-11-241-6/+0
| | | | | | | | | | | | | | | | | | * glib/glibmm/class.[cc|h]: Remove the clone_custom_type() overload without an interface_class_vector_type argument. * glib/glibmm/interface.cc: * glib/glibmm/object.cc: * glib/glibmm/objectbase.[cc|h]: Replace the std::map containing ExtraObjectBaseData with instance data in ObjectBase. The map was just a way of avoiding an ABI break, but now we can break ABI. The new data is a std::unique_ptr<Class::interface_class_vector_type> rather than a Class::interface_class_vector_type. It's a vector which is used only during a short period during object construction, and only for custom objects. With a pointer to the vector, it need not be created for the majority of objects, and if it is created, it can be deleted when it's no longer needed. * gio/src/application.ccg: * glib/glibmm/main.cc: Add #include <mutex> that should have been there before, but now became necessary, when it was removed from objectbase.h.
* Re-run clang-format on some files.Murray Cumming2016-02-261-4/+4
| | | | | I need to make a subsequent commit to fix the now-unaligned trailing comments.
* Run clang-format on glib .cc files.Murray Cumming2016-02-261-50/+55
|
* C++11: Use emplace_back() instead of push_back().Murray Cumming2016-02-051-1/+1
|
* Glib: More nullptr instead of 0Kjell Ahlstedt2015-11-231-4/+1
|
* Glib: More nullptr instead of 0.Murray Cumming2015-11-201-10/+10
|
* More use of nullptr instead of 0.Murray Cumming2015-11-201-5/+5
|
* Make custom interface properties instance dataKjell Ahlstedt2014-07-211-0/+3
| | | | | | | | | * glib/glibmm/class.cc: Copy the default values of the interface properties to the class's iface_properties_quark. * glib/glibmm/property.cc: custom_set_property_callback(): Copy the default values to object-specific data. custom_get_property_callback(): Get object-specific value if it exists, else class-specific default value. Bug #732746.
* Rename ambiguously named overridden property variable and typePovilas Kanapickas2014-07-071-8/+9
| | | | | | | | | | | * glib/glibmm/class.[cc|h]: * glib/glibmm/interface.cc: * glib/glibmm/property.cc: Rename properties_quark and properties_type to iface_properties_quark and iface_properties_type. As custom_[set|get]_property_callback() in property.cc also sets and gets user-defined properties, this naming choice may be confusing. These names are intended for use by glibmm only. Renaming is not an ABI/API break. Bug #731484.
* Add interfaces to custom types before class_init.Kjell Ahlstedt2013-08-011-1/+62
| | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.[h|cc]: Add a clone_custom_type() overload that takes a vector of pointers to Interface_Class instances, so we can call their add_interface() functions on the GType just after registering it, but before instantiating the first GObject. custom_class_init_function(): Override properties of implemented interfaces that have not been overridden in a base class. * glib/glibmm/interface.cc: Interface::Interface(const Interface_Class& interface_class): If the GObject has not been instantiated yet, then add interface_class to the Class::custom_interface_classes vector. * glib/glibmm/objectbase.[h|cc]: Add extra_object_base_data and extra_object_base_data_mutex. * glib/glibmm/objectbase.cc: ~ObjectBase(): Erase 'this' from extra_object_base_data. * glib/glibmm/object.cc: Default constructor and Object::Object(const Glib::ConstructParams& construct_params): Pass the list of Interface_Class pointers to the new Class::clone_custom_type() method overload. Bug #697229.
* Custom Interface Properties: Use base finalize function to free data.José Alburquerque2013-05-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.cc (Class::clone_custom_type): Specify a custom base finalize function for the custom type which would free the properties data that might exist due to properties of implemented interfaces being overridden. This is better than having an interface finalize function because the custom type could implement several interfaces which would mean that the interface finalize function would execute more than once as opposed to just once for the base finalize function. * glib/glibmm/class.h (Class::interface_finalize_function): Replace with Class::custom_class_base_finalize_function(). * glib/glibmm/interface.cc (Interface_Class::add_interface): Do not specify a custom interface finalize function. (Interface::Interface(const Interface_Class&): Also initialize the property GValues using g_param_value_set_default() so that they are initialized with the default values of the properties and not just the default value of the GValue type. Bug #697229.
* Custom Interfaces: Implement derived interface properties in present.José Alburquerque2013-04-221-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.cc (Class::properties_quark): Initialize this GQuark which is used to store/get the data used for setting and getting the properties of the interfaces that a custom type overrides. (Class::interface_finalize_function): Add this function which once invoked frees the property data stored as gqata in the GType and allocated/appended to in the Glib::Interface constructor below. * glib/glibmm/class.h: Declare the interface_finalize_function above. Also declare the quark used to store/get the property data and the typedef data type of the property data. * glib/glibmm/interface.cc (Interface_Class::add_interface): Specify a custom interface finalize function when adding the interface so that the resources allocated for handling the derived interface properties can be freed if the type is a custom interface type. (Interface::Interface(const Interface_Class&)): Modify the constructor so that when dealing with a custom interface type, it gets a list of the properties of the interface to be added and overrides these by appending approperiate GValues to the data used to handle getting/setting properties that is stored as qdata in the GType. The constructor uses g_param_spec_overrided() to override the properties of the implemented interface and g_object_install_property() to install the properties. * glib/glibmm/property.cc (PropertyBase::install_property): Rewrite this method so that the acquired generated id's of custom implemented properties does not collide with the id's of properties of implemented interfaces that have been overridden in a custom type. This is done by offsetting the acquired generated id (by addition) with the number of already existing properties (the ones that have been overridden). (custom_get_property_callback): Rewrite this function (which gets properties for custom types) so that if the property id is less than or equal to the number of overridden interface properties (which would mean that an overridden interface property should be gotten) the correct overridden interface property is gotten. Otherwise, a custom property should be retrieved, in which case the id is offset (by subtraction) when the PropertyBase is retrieved from the id which would ensure getting the correct PropertyBase. (custom_set_property_callback): Rewrite this function as the above custom_get_property_callback was rewritten.
* Add a commentMurray Cumming2013-04-031-1/+1
|
* Strip trailing whitespace.Mark Vender2012-10-291-2/+2
| | | | | | | * gio/giomm/*.[h|cc]: * gio/src/*.[hg|ccg]: * glib/glibmm/*.[h|cc]: * glib/src/*.[hg|ccg]: Strip trailing whitespace. Bug #681072.
* Fix some warnings found by clang++.Murray Cumming2012-03-191-1/+1
| | | | | * glib/glibmm/class.cc: registered_derived_type(): Use (void*)0 instead of NULL to avoid a missing sentintel warning.
* class.cc: Avoid compiler warnings when using -std=c++0x with g++.Murray Cumming2011-11-231-4/+20
| | | | | | * glib/glibmm/class.cc: Add casts because GTypeQuery::class_size and instance_size are guint but GTypeInfo::class_size and instance_size are guint16.
* Remove the reduced API options and code, as discussed on mailing list.Murray Cumming2010-05-311-2/+0
| | | | | | | | | * configure.ac: Removed the --enable-api-exceptions, --enable-api-properties, --enable-api-vfuncs and --enable-api-default-signal-handlers options. * build/reduced.m4: Removed. * tools/m4/*.m4: * tools/pm/Output.pm: Remove any use of ifdefs and auto_ptr for reduced API. * *.[hg|ccg|h|cc]: Remove the idefed code.
* Increased versionglibmm-2.21.1-realMurray Cumming2009-06-291-1/+11
|
* Type registration: Ignore NULL GTypes, preventing crashes.Murray Cumming2009-05-141-3/+14
| | | | | | | | * glib/glibmm/wrap.cc: wrap_register(): Silently ignore NULL GTypes. * glib/glibmm/class.cc: register_derived_type(): Silently ignore NULL GTypes. Use g_strconcat() instead of ustring+= to maybe make it more efficient. This helps gstreamermm, which may try to use type names of plugins that are not actually available on the system.
* Change license header to mention Lesser General Public License version 2.1Deng Xiyue2009-01-191-4/+4
| | | | | | | | | | 2009-01-20 Deng Xiyue <manphiz@gmail.com> * Change license header to mention Lesser General Public License version 2.1 instead of Library General Public License, to be consistent with COPYING. svn path=/trunk/; revision=779
* Add a silly line to avoid unused parameters when GLIBMM_EXCEPTION_ENABLEDMurray Cumming2006-10-041-2/+1
| | | | | | | | | | | 2006-10-04 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/class.cc: * glib/src/iochannel.ccg: * glib/src/markup.ccg: Add a silly line to avoid unused parameters when GLIBMM_EXCEPTION_ENABLED is not set. * glib/glibmm/error.h: Do not use G_GNU_NO_RETURN on the version of throw_exception() that returns, to avoid a warning.
* Merged changes from glibmm-2-10 branch.Murray Cumming2006-05-121-0/+2
|
* Temporarily reverted some stuff. I will recommit some of it.Murray Cumming2005-01-211-13/+0
|
* #include glibmmconfig.h so thatMurray Cumming2005-01-211-1/+1
| | | | | | | | | | 2005-01-21 Murray Cumming <murrayc@localhost.localdomain> * glib/glibmm/class.h: #include glibmmconfig.h so that GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS can be defined. * glib/glibmm/class.cc: Use ifdef instead of ifndef where that is what I meant. Fixes the build.
* Fix the buildMurray Cumming2005-01-201-3/+0
|
* More use of exern C, with an intermediate callback, to satisfy the IRIXMurray Cumming2005-01-201-0/+16
| | | | | | | | | | 2005-01-20 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/class.h: More use of exern C, with an intermediate callback, to satisfy the IRIX MipsPro compiler. * glib/glibmm/container.h: #ifdef out a dynamic_cast that MipsPro does not allow, and which I can not think of a better place to put. See the comment in the code.
* Initial revisionMurray Cumming2003-01-071-0/+116