From 7ba4814e555124566866376942db7e063979d41f Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 7 Sep 2020 00:20:49 -0700 Subject: [PATCH] Imported Upstream version 2.55.1 --- .gitignore | 12 +- COPYING | 9 +- {MSVC_Net2013 => MSVC_Net2017}/compose.vcxproj | 8 +- .../compose.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/dispatcher.vcxproj | 8 +- .../dispatcher.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/dispatcher2.vcxproj | 8 +- .../dispatcher2.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/filelist.am | 2 +- {MSVC_Net2013 => MSVC_Net2017}/gendef.vcxproj | 8 +- .../gendef.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/gendef/gendef.cc | 0 {MSVC_Net2013 => MSVC_Net2017}/giomm.vcxproj | 10 +- .../giomm.vcxproj.filters | 2 + {MSVC_Net2013 => MSVC_Net2017}/giomm/giomm.rc.in | 0 .../giomm_simple.vcxproj | 8 +- .../giomm_simple.vcxproj.filters | 0 .../glibmm-build-defines.props | 6 +- .../glibmm-install.props | 17 +- .../glibmm-version-paths.props | 8 +- {MSVC_Net2013 => MSVC_Net2017}/glibmm.sln | 24 +- {MSVC_Net2013 => MSVC_Net2017}/glibmm.vcxproj | 29 +- .../glibmm.vcxproj.filters | 21 +- {MSVC_Net2013 => MSVC_Net2017}/glibmm/glibmm.rc.in | 0 .../glibmm_value.vcxproj | 8 +- .../glibmm_value.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/install.vcxproj | 8 +- {MSVC_Net2013 => MSVC_Net2017}/keyfile.vcxproj | 8 +- .../keyfile.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/markup.vcxproj | 8 +- .../markup.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/options.vcxproj | 8 +- .../options.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/properties.vcxproj | 8 +- .../properties.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/regex.vcxproj | 8 +- .../regex.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/resolver.vcxproj | 8 +- .../resolver.vcxproj.filters | 0 .../socket-client.vcxproj | 8 +- .../socket-client.vcxproj.filters | 0 .../socket-server.vcxproj | 8 +- .../socket-server.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/thread.vcxproj | 8 +- .../thread.vcxproj.filters | 0 {MSVC_Net2013 => MSVC_Net2017}/threadpool.vcxproj | 8 +- .../threadpool.vcxproj.filters | 0 Makefile.am | 4 +- NEWS | 444 ++++++-- README.win32 | 116 +-- build/dk-feature.m4 | 3 +- configure.ac | 32 +- docs/Makefile_web.am_fragment | 6 +- examples/Makefile.am | 15 +- examples/child_watch/main.cc | 5 +- examples/compose/main.cc | 3 +- examples/dbus/client_bus_listnames.cc | 5 +- examples/dbus/server_without_bus.cc | 8 +- examples/dbus/session_bus_service.cc | 5 +- examples/iochannel_stream/fdstream.cc | 3 +- examples/iochannel_stream/fdstream.h | 3 +- examples/iochannel_stream/main.cc | 7 +- examples/keyfile/main.cc | 3 +- examples/markup/parser.cc | 3 +- examples/network/resolver.cc | 18 +- examples/network/socket-client.cc | 16 +- examples/network/socket-server.cc | 16 +- examples/options/main.cc | 19 +- examples/properties/properties_example.cc | 3 +- examples/regex/main.cc | 3 +- examples/thread/thread.cc | 126 --- examples/thread/threadpool.cc | 68 -- gio/giomm.h | 7 +- gio/giomm/contenttype.cc | 14 +- gio/giomm/contenttype.h | 10 +- gio/giomm/init.cc | 3 +- gio/giomm/init.h | 4 +- gio/giomm/slot_async.cc | 5 +- gio/giomm/slot_async.h | 5 +- gio/giomm/socketsource.cc | 22 +- gio/giomm/socketsource.h | 19 +- gio/giomm/wrap_init.h | 4 +- gio/src/action.ccg | 5 +- gio/src/action.hg | 12 +- gio/src/actiongroup.ccg | 5 +- gio/src/actiongroup.hg | 18 +- gio/src/actionmap.ccg | 16 +- gio/src/actionmap.hg | 40 +- gio/src/appinfo.ccg | 8 +- gio/src/appinfo.hg | 32 +- gio/src/applaunchcontext.ccg | 3 +- gio/src/applaunchcontext.hg | 10 +- gio/src/application.ccg | 177 ++-- gio/src/application.hg | 111 +- gio/src/applicationcommandline.ccg | 3 +- gio/src/applicationcommandline.hg | 3 +- gio/src/asyncinitable.ccg | 3 +- gio/src/asyncinitable.hg | 5 +- gio/src/asyncresult.ccg | 7 +- gio/src/asyncresult.hg | 24 +- gio/src/bufferedinputstream.ccg | 7 +- gio/src/bufferedinputstream.hg | 11 +- gio/src/bufferedoutputstream.ccg | 7 +- gio/src/bufferedoutputstream.hg | 10 +- gio/src/cancellable.ccg | 5 +- gio/src/cancellable.hg | 5 +- gio/src/charsetconverter.ccg | 4 +- gio/src/charsetconverter.hg | 15 +- gio/src/converter.ccg | 8 +- gio/src/converter.hg | 14 +- gio/src/converterinputstream.ccg | 3 +- gio/src/converterinputstream.hg | 3 +- gio/src/converteroutputstream.ccg | 3 +- gio/src/converteroutputstream.hg | 3 +- gio/src/credentials.ccg | 5 +- gio/src/credentials.hg | 12 +- gio/src/datainputstream.ccg | 5 +- gio/src/datainputstream.hg | 5 +- gio/src/dataoutputstream.ccg | 5 +- gio/src/dataoutputstream.hg | 16 +- gio/src/dbusactiongroup.ccg | 3 +- gio/src/dbusactiongroup.hg | 9 +- gio/src/dbusaddress.ccg | 5 +- gio/src/dbusaddress.hg | 5 +- gio/src/dbusauthobserver.ccg | 5 +- gio/src/dbusauthobserver.hg | 5 +- gio/src/dbusconnection.ccg | 19 +- gio/src/dbusconnection.hg | 83 +- gio/src/dbuserror.ccg | 5 +- gio/src/dbuserror.hg | 5 +- gio/src/dbuserrorutils.ccg | 5 +- gio/src/dbuserrorutils.hg | 5 +- gio/src/dbusinterface.ccg | 5 +- gio/src/dbusinterface.hg | 7 +- gio/src/dbusinterfaceskeleton.ccg | 5 +- gio/src/dbusinterfaceskeleton.hg | 13 +- gio/src/dbusinterfacevtable.ccg | 5 +- gio/src/dbusinterfacevtable.hg | 17 +- gio/src/dbusintrospection.ccg | 5 +- gio/src/dbusintrospection.hg | 12 +- gio/src/dbusmenumodel.ccg | 3 +- gio/src/dbusmenumodel.hg | 3 +- gio/src/dbusmessage.ccg | 5 +- gio/src/dbusmessage.hg | 31 +- gio/src/dbusmethodinvocation.ccg | 5 +- gio/src/dbusmethodinvocation.hg | 5 +- gio/src/dbusobject.ccg | 5 +- gio/src/dbusobject.hg | 3 +- gio/src/dbusownname.ccg | 5 +- gio/src/dbusownname.hg | 15 +- gio/src/dbusproxy.ccg | 11 +- gio/src/dbusproxy.hg | 54 +- gio/src/dbusserver.ccg | 29 +- gio/src/dbusserver.hg | 31 +- gio/src/dbussubtreevtable.ccg | 5 +- gio/src/dbussubtreevtable.hg | 17 +- gio/src/dbusutils.ccg | 5 +- gio/src/dbusutils.hg | 5 +- gio/src/dbuswatchname.ccg | 5 +- gio/src/dbuswatchname.hg | 15 +- gio/src/desktopappinfo.ccg | 5 +- gio/src/desktopappinfo.hg | 7 +- gio/src/drive.ccg | 27 +- gio/src/drive.hg | 56 +- gio/src/emblem.ccg | 7 +- gio/src/emblem.hg | 20 +- gio/src/emblemedicon.ccg | 5 +- gio/src/emblemedicon.hg | 14 +- gio/src/enums.ccg | 5 +- gio/src/enums.hg | 10 +- gio/src/error.ccg | 5 +- gio/src/error.hg | 5 +- gio/src/file.ccg | 139 +-- gio/src/file.hg | 319 +++--- gio/src/fileattributeinfo.ccg | 9 +- gio/src/fileattributeinfo.hg | 12 +- gio/src/fileattributeinfolist.ccg | 5 +- gio/src/fileattributeinfolist.hg | 9 +- .../sarray.cc => gio/src/filedescriptorbased.ccg | 9 +- gio/src/filedescriptorbased.hg | 50 + gio/src/fileenumerator.ccg | 5 +- gio/src/fileenumerator.hg | 11 +- gio/src/fileicon.ccg | 5 +- gio/src/fileicon.hg | 8 +- gio/src/fileinfo.ccg | 5 +- gio/src/fileinfo.hg | 47 +- gio/src/fileinputstream.ccg | 5 +- gio/src/fileinputstream.hg | 3 +- gio/src/fileiostream.ccg | 5 +- gio/src/fileiostream.hg | 7 +- gio/src/filelist.am | 2 + gio/src/filemonitor.ccg | 7 +- gio/src/filemonitor.hg | 10 +- gio/src/filenamecompleter.ccg | 5 +- gio/src/filenamecompleter.hg | 10 +- gio/src/fileoutputstream.ccg | 5 +- gio/src/fileoutputstream.hg | 5 +- gio/src/filterinputstream.ccg | 3 +- gio/src/filterinputstream.hg | 3 +- gio/src/filteroutputstream.ccg | 3 +- gio/src/filteroutputstream.hg | 3 +- gio/src/gio_docs_override.xml | 79 ++ gio/src/gio_enums.defs | 12 +- gio/src/gio_enums.defs.patch | 2 +- gio/src/gio_signals.defs | 320 ++---- gio/src/gio_signals.defs.patch | 100 +- gio/src/gio_vfuncs.defs | 31 +- gio/src/icon.ccg | 5 +- gio/src/icon.hg | 3 +- gio/src/inetaddress.ccg | 5 +- gio/src/inetaddress.hg | 3 +- gio/src/inetsocketaddress.ccg | 5 +- gio/src/inetsocketaddress.hg | 5 +- gio/src/initable.ccg | 5 +- gio/src/initable.hg | 5 +- gio/src/inputstream.ccg | 5 +- gio/src/inputstream.hg | 10 +- gio/src/iostream.ccg | 9 +- gio/src/iostream.hg | 15 +- gio/src/listmodel.ccg | 3 +- gio/src/listmodel.hg | 3 +- gio/src/liststore.ccg | 3 +- gio/src/liststore.hg | 15 +- gio/src/loadableicon.ccg | 6 +- gio/src/loadableicon.hg | 12 +- gio/src/memoryinputstream.ccg | 31 +- gio/src/memoryinputstream.hg | 31 +- gio/src/memoryoutputstream.ccg | 3 +- gio/src/memoryoutputstream.hg | 8 +- gio/src/menu.ccg | 3 +- gio/src/menu.hg | 11 +- gio/src/menuattributeiter.ccg | 3 +- gio/src/menuattributeiter.hg | 8 +- gio/src/menuitem.ccg | 11 +- gio/src/menuitem.hg | 12 +- gio/src/menulinkiter.ccg | 3 +- gio/src/menulinkiter.hg | 3 +- gio/src/menumodel.ccg | 3 +- gio/src/menumodel.hg | 8 +- gio/src/mount.ccg | 37 +- gio/src/mount.hg | 45 +- gio/src/mountoperation.ccg | 5 +- gio/src/mountoperation.hg | 20 +- gio/src/networkaddress.ccg | 5 +- gio/src/networkaddress.hg | 5 +- gio/src/networkmonitor.ccg | 3 +- gio/src/networkmonitor.hg | 3 +- gio/src/networkservice.ccg | 5 +- gio/src/networkservice.hg | 5 +- gio/src/notification.hg | 7 +- gio/src/outputstream.ccg | 15 +- gio/src/outputstream.hg | 30 +- gio/src/permission.ccg | 3 +- gio/src/permission.hg | 3 +- gio/src/pollableinputstream.ccg | 5 +- gio/src/pollableinputstream.hg | 12 +- gio/src/pollableoutputstream.ccg | 5 +- gio/src/pollableoutputstream.hg | 12 +- glib/glibmm/sarray.h => gio/src/propertyaction.ccg | 32 +- gio/src/propertyaction.hg | 121 +++ gio/src/proxy.ccg | 5 +- gio/src/proxy.hg | 5 +- gio/src/proxyaddress.ccg | 5 +- gio/src/proxyaddress.hg | 5 +- gio/src/proxyresolver.ccg | 5 +- gio/src/proxyresolver.hg | 7 +- gio/src/remoteactiongroup.ccg | 5 +- gio/src/remoteactiongroup.hg | 15 +- gio/src/resolver.ccg | 23 +- gio/src/resolver.hg | 28 +- gio/src/resource.ccg | 25 +- gio/src/resource.hg | 45 +- gio/src/seekable.ccg | 5 +- gio/src/seekable.hg | 5 +- gio/src/settings.ccg | 16 +- gio/src/settings.hg | 52 +- gio/src/settingsschema.ccg | 3 +- gio/src/settingsschema.hg | 4 +- gio/src/settingsschemakey.ccg | 3 +- gio/src/settingsschemakey.hg | 3 +- gio/src/settingsschemasource.ccg | 3 +- gio/src/settingsschemasource.hg | 3 +- gio/src/simpleaction.ccg | 3 +- gio/src/simpleaction.hg | 3 +- gio/src/simpleactiongroup.ccg | 3 +- gio/src/simpleactiongroup.hg | 9 +- gio/src/simplepermission.ccg | 3 +- gio/src/simplepermission.hg | 3 +- gio/src/socket.ccg | 21 +- gio/src/socket.hg | 23 +- gio/src/socketaddress.ccg | 5 +- gio/src/socketaddress.hg | 5 +- gio/src/socketaddressenumerator.ccg | 5 +- gio/src/socketaddressenumerator.hg | 5 +- gio/src/socketclient.ccg | 5 +- gio/src/socketclient.hg | 19 +- gio/src/socketconnectable.ccg | 5 +- gio/src/socketconnectable.hg | 3 +- gio/src/socketconnection.ccg | 5 +- gio/src/socketconnection.hg | 3 +- gio/src/socketcontrolmessage.ccg | 5 +- gio/src/socketcontrolmessage.hg | 5 +- gio/src/socketlistener.ccg | 13 +- gio/src/socketlistener.hg | 9 +- gio/src/socketservice.ccg | 5 +- gio/src/socketservice.hg | 3 +- gio/src/srvtarget.ccg | 5 +- gio/src/srvtarget.hg | 26 +- gio/src/tcpconnection.ccg | 5 +- gio/src/tcpconnection.hg | 5 +- gio/src/tcpwrapperconnection.ccg | 3 +- gio/src/tcpwrapperconnection.hg | 3 +- gio/src/themedicon.ccg | 3 +- gio/src/themedicon.hg | 7 +- gio/src/threadedsocketservice.ccg | 5 +- gio/src/threadedsocketservice.hg | 5 +- gio/src/tlscertificate.ccg | 5 +- gio/src/tlscertificate.hg | 3 +- gio/src/tlsclientconnection.ccg | 3 +- gio/src/tlsclientconnection.hg | 3 +- gio/src/tlsconnection.ccg | 3 +- gio/src/tlsconnection.hg | 10 +- gio/src/tlsdatabase.ccg | 7 +- gio/src/tlsdatabase.hg | 50 +- gio/src/tlsfiledatabase.ccg | 3 +- gio/src/tlsfiledatabase.hg | 3 +- gio/src/tlsinteraction.ccg | 4 +- gio/src/tlsinteraction.hg | 3 +- gio/src/tlspassword.ccg | 5 +- gio/src/tlspassword.hg | 17 +- gio/src/tlsserverconnection.ccg | 3 +- gio/src/tlsserverconnection.hg | 3 +- gio/src/unixconnection.ccg | 5 +- gio/src/unixconnection.hg | 5 +- gio/src/unixcredentialsmessage.ccg | 5 +- gio/src/unixcredentialsmessage.hg | 5 +- gio/src/unixfdlist.ccg | 19 +- gio/src/unixfdlist.hg | 16 +- gio/src/unixfdmessage.ccg | 7 +- gio/src/unixfdmessage.hg | 6 +- gio/src/unixinputstream.ccg | 5 +- gio/src/unixinputstream.hg | 12 +- gio/src/unixmount.ccg | 5 +- gio/src/unixmount.hg | 5 +- gio/src/unixoutputstream.ccg | 5 +- gio/src/unixoutputstream.hg | 12 +- gio/src/unixsocketaddress.ccg | 9 +- gio/src/unixsocketaddress.hg | 20 +- gio/src/volume.ccg | 25 +- gio/src/volume.hg | 27 +- gio/src/volumemonitor.ccg | 5 +- gio/src/volumemonitor.hg | 23 +- gio/src/zlibcompressor.ccg | 3 +- gio/src/zlibcompressor.hg | 3 +- gio/src/zlibdecompressor.ccg | 3 +- gio/src/zlibdecompressor.hg | 3 +- glib/glibmm.h | 21 +- glib/glibmm.pc.in | 2 +- glib/glibmm/arrayhandle.cc | 37 - glib/glibmm/arrayhandle.h | 754 -------------- glib/glibmm/base64.cc | 3 +- glib/glibmm/base64.h | 3 +- glib/glibmm/class.cc | 62 +- glib/glibmm/class.h | 35 +- glib/glibmm/containerhandle_shared.h | 44 +- glib/glibmm/containers.h | 360 ------- glib/glibmm/debug.cc | 5 +- glib/glibmm/debug.h | 4 +- glib/glibmm/dispatcher.cc | 189 ++-- glib/glibmm/dispatcher.h | 24 +- glib/glibmm/error.cc | 3 +- glib/glibmm/error.h | 3 +- glib/glibmm/exception.cc | 6 +- glib/glibmm/exception.h | 5 +- glib/glibmm/exceptionhandler.cc | 26 +- glib/glibmm/exceptionhandler.h | 6 +- glib/glibmm/{containers.cc => extraclassinit.cc} | 18 +- glib/glibmm/extraclassinit.h | 97 ++ glib/glibmm/filelist.am | 16 +- glib/glibmm/helperlist.h | 151 --- glib/glibmm/i18n-lib.h | 6 +- glib/glibmm/i18n.h | 6 +- glib/glibmm/init.cc | 59 +- glib/glibmm/init.h | 50 +- glib/glibmm/interface.cc | 12 +- glib/glibmm/interface.h | 6 +- glib/glibmm/listhandle.h | 412 -------- glib/glibmm/main.cc | 234 ++--- glib/glibmm/main.h | 103 +- glib/glibmm/object.cc | 129 +-- glib/glibmm/object.h | 38 +- glib/glibmm/objectbase.cc | 94 +- glib/glibmm/objectbase.h | 74 +- glib/glibmm/pattern.cc | 6 +- glib/glibmm/pattern.h | 6 +- glib/glibmm/priorities.h | 6 +- glib/glibmm/property.cc | 3 +- glib/glibmm/property.h | 41 +- glib/glibmm/propertyproxy.cc | 6 +- glib/glibmm/propertyproxy.h | 4 +- glib/glibmm/propertyproxy_base.cc | 5 +- glib/glibmm/propertyproxy_base.h | 5 +- glib/glibmm/quark.cc | 5 +- glib/glibmm/quark.h | 4 +- glib/glibmm/random.cc | 6 +- glib/glibmm/random.h | 6 +- glib/glibmm/refptr.h | 496 +-------- glib/glibmm/signalproxy.cc | 36 +- glib/glibmm/signalproxy.h | 269 +++-- glib/glibmm/signalproxy_connectionnode.cc | 9 +- glib/glibmm/signalproxy_connectionnode.h | 7 +- glib/glibmm/slisthandle.h | 410 -------- glib/glibmm/streamiochannel.cc | 207 ---- glib/glibmm/streamiochannel.h | 60 -- glib/glibmm/stringutils.cc | 6 +- glib/glibmm/stringutils.h | 6 +- glib/glibmm/threadpool.cc | 254 ----- glib/glibmm/threadpool.h | 199 ---- glib/glibmm/timer.cc | 3 +- glib/glibmm/timer.h | 6 +- glib/glibmm/timeval.cc | 6 +- glib/glibmm/timeval.h | 6 +- glib/glibmm/ustring.cc | 9 +- glib/glibmm/ustring.h | 15 +- glib/glibmm/utility.cc | 7 +- glib/glibmm/utility.h | 68 +- glib/glibmm/value.cc | 8 +- glib/glibmm/value.h | 53 +- glib/glibmm/value_custom.cc | 6 +- glib/glibmm/value_custom.h | 88 +- glib/glibmm/vectorutils.cc | 3 +- glib/glibmm/vectorutils.h | 4 +- glib/glibmm/weakref.h | 465 --------- glib/glibmm/wrap.cc | 8 +- glib/glibmm/wrap.h | 3 +- glib/glibmm/wrap_init.h | 6 +- glib/src/balancedtree.hg | 22 +- glib/src/binding.ccg | 6 +- glib/src/binding.hg | 54 +- glib/src/bytearray.ccg | 3 +- glib/src/bytearray.hg | 7 +- glib/src/bytes.ccg | 3 +- glib/src/bytes.hg | 4 +- glib/src/checksum.ccg | 9 +- glib/src/checksum.hg | 24 +- glib/src/convert.ccg | 5 +- glib/src/convert.hg | 3 +- glib/src/date.ccg | 31 +- glib/src/date.hg | 37 +- glib/src/datetime.ccg | 3 +- glib/src/datetime.hg | 3 +- glib/src/enums.ccg | 3 +- glib/src/enums.hg | 3 +- glib/src/filelist.am | 3 - glib/src/fileutils.ccg | 3 +- glib/src/fileutils.hg | 214 ++-- glib/src/glib_docs_override.xml | 17 +- glib/src/glib_extra_objects.defs | 10 + glib/src/glib_signals.defs | 3 - glib/src/iochannel.ccg | 291 +----- glib/src/iochannel.hg | 87 +- glib/src/keyfile.ccg | 61 +- glib/src/keyfile.hg | 49 +- glib/src/markup.ccg | 3 +- glib/src/markup.hg | 15 +- glib/src/miscutils.ccg | 23 +- glib/src/miscutils.hg | 39 +- glib/src/module.ccg | 5 +- glib/src/module.hg | 9 +- glib/src/nodetree.hg | 76 +- glib/src/optioncontext.ccg | 11 +- glib/src/optioncontext.hg | 5 +- glib/src/optionentry.ccg | 5 +- glib/src/optionentry.hg | 23 +- glib/src/optiongroup.ccg | 85 +- glib/src/optiongroup.hg | 47 +- glib/src/regex.ccg | 66 +- glib/src/regex.hg | 72 +- glib/src/shell.ccg | 7 +- glib/src/shell.hg | 7 +- glib/src/spawn.ccg | 35 +- glib/src/spawn.hg | 73 +- glib/src/template.macros.m4 | 3 +- glib/src/thread.ccg | 426 -------- glib/src/thread.hg | 1084 -------------------- glib/src/threads.ccg | 301 ------ glib/src/threads.hg | 931 ----------------- glib/src/timezone.ccg | 3 +- glib/src/timezone.hg | 3 +- glib/src/unicode.ccg | 3 +- glib/src/unicode.hg | 3 +- glib/src/uriutils.ccg | 3 +- glib/src/uriutils.hg | 3 +- glib/src/value_basictypes.cc.m4 | 8 +- glib/src/value_basictypes.h.m4 | 8 +- glib/src/valuearray.ccg | 98 -- glib/src/valuearray.hg | 94 -- glib/src/variant.ccg | 60 +- glib/src/variant.hg | 126 +-- glib/src/variant_basictypes.cc.m4 | 3 +- glib/src/variant_basictypes.h.m4 | 3 +- glib/src/variantdict.ccg | 3 +- glib/src/variantdict.hg | 11 +- glib/src/variantiter.ccg | 13 +- glib/src/variantiter.hg | 16 +- glib/src/varianttype.ccg | 3 +- glib/src/varianttype.hg | 6 +- tests/Makefile.am | 39 +- tests/giomm_listmodel/main.cc | 38 +- tests/giomm_stream_vfuncs/main.cc | 170 +++ tests/giomm_tls_client/main.cc | 6 +- tests/glibmm_bool_arrayhandle/main.cc | 96 -- tests/glibmm_bool_vector/main.cc | 3 +- tests/glibmm_date/main.cc | 4 +- tests/glibmm_interface_move/main.cc | 11 +- tests/glibmm_nodetree/main.cc | 37 +- tests/glibmm_null_containerhandle/main.cc | 42 - tests/glibmm_null_vectorutils/main.cc | 3 +- tests/glibmm_object/main.cc | 23 + tests/glibmm_object/test_derived_object.h | 60 ++ tests/glibmm_object_move/main.cc | 55 +- tests/glibmm_objectbase/main.cc | 24 + tests/glibmm_objectbase/test_derived_objectbase.h | 36 + tests/glibmm_objectbase_move/main.cc | 61 +- tests/glibmm_refptr/main.cc | 40 +- tests/glibmm_ustring_make_valid/main.cc | 58 ++ tests/glibmm_value/glibmm_value.cc | 32 - tests/glibmm_value/main.cc | 154 ++- tests/glibmm_valuearray/main.cc | 102 -- tests/glibmm_variant/main.cc | 2 +- tests/glibmm_vector/main.cc | 3 +- tests/glibmm_weakref/main.cc | 174 ---- tools/Makefile.am | 8 +- tools/defs_fixer.pl | 3 +- tools/extra_defs_gen/generate_defs_gio.cc | 3 +- tools/extra_defs_gen/generate_defs_glib.cc | 3 +- tools/extra_defs_gen/generate_extra_defs.cc | 102 +- tools/extra_defs_gen/generate_extra_defs.h | 5 +- tools/gmmproc.in | 3 +- tools/m4/class_gobject.m4 | 4 +- tools/m4/class_interface.m4 | 2 +- tools/m4/class_opaque_refcounted.m4 | 4 +- tools/m4/convert_base.m4 | 28 +- tools/m4/convert_gio.m4 | 145 +-- tools/m4/convert_glib.m4 | 23 +- tools/m4/enum.m4 | 131 ++- tools/m4/method.m4 | 8 +- tools/m4/signal.m4 | 28 +- tools/pm/DocsParser.pm | 34 +- tools/pm/Enum.pm | 42 +- tools/pm/Function.pm | 13 +- tools/pm/GtkDefs.pm | 37 +- tools/pm/Output.pm | 111 +- tools/pm/Property.pm | 18 +- tools/pm/Util.pm | 3 +- tools/pm/WrapParser.pm | 114 +- tools/test_scripts/testheaders.sh | 13 +- 557 files changed, 5770 insertions(+), 12416 deletions(-) rename {MSVC_Net2013 => MSVC_Net2017}/compose.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/compose.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/dispatcher.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/dispatcher.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/dispatcher2.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/dispatcher2.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/filelist.am (98%) rename {MSVC_Net2013 => MSVC_Net2017}/gendef.vcxproj (97%) rename {MSVC_Net2013 => MSVC_Net2017}/gendef.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/gendef/gendef.cc (100%) rename {MSVC_Net2013 => MSVC_Net2017}/giomm.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/giomm.vcxproj.filters (99%) rename {MSVC_Net2013 => MSVC_Net2017}/giomm/giomm.rc.in (100%) rename {MSVC_Net2013 => MSVC_Net2017}/giomm_simple.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/giomm_simple.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm-build-defines.props (78%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm-install.props (96%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm-version-paths.props (88%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm.sln (88%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm.vcxproj (93%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm.vcxproj.filters (87%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm/glibmm.rc.in (100%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm_value.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/glibmm_value.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/install.vcxproj (97%) rename {MSVC_Net2013 => MSVC_Net2017}/keyfile.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/keyfile.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/markup.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/markup.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/options.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/options.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/properties.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/properties.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/regex.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/regex.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/resolver.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/resolver.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/socket-client.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/socket-client.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/socket-server.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/socket-server.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/thread.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/thread.vcxproj.filters (100%) rename {MSVC_Net2013 => MSVC_Net2017}/threadpool.vcxproj (98%) rename {MSVC_Net2013 => MSVC_Net2017}/threadpool.vcxproj.filters (100%) delete mode 100644 examples/thread/thread.cc delete mode 100644 examples/thread/threadpool.cc rename glib/glibmm/sarray.cc => gio/src/filedescriptorbased.ccg (76%) create mode 100644 gio/src/filedescriptorbased.hg rename glib/glibmm/sarray.h => gio/src/propertyaction.ccg (54%) create mode 100644 gio/src/propertyaction.hg delete mode 100644 glib/glibmm/arrayhandle.cc delete mode 100644 glib/glibmm/arrayhandle.h delete mode 100644 glib/glibmm/containers.h rename glib/glibmm/{containers.cc => extraclassinit.cc} (57%) create mode 100644 glib/glibmm/extraclassinit.h delete mode 100644 glib/glibmm/helperlist.h delete mode 100644 glib/glibmm/listhandle.h delete mode 100644 glib/glibmm/slisthandle.h delete mode 100644 glib/glibmm/streamiochannel.cc delete mode 100644 glib/glibmm/streamiochannel.h delete mode 100644 glib/glibmm/threadpool.cc delete mode 100644 glib/glibmm/threadpool.h delete mode 100644 glib/glibmm/weakref.h delete mode 100644 glib/src/thread.ccg delete mode 100644 glib/src/thread.hg delete mode 100644 glib/src/threads.ccg delete mode 100644 glib/src/threads.hg delete mode 100644 glib/src/valuearray.ccg delete mode 100644 glib/src/valuearray.hg create mode 100644 tests/giomm_stream_vfuncs/main.cc delete mode 100644 tests/glibmm_bool_arrayhandle/main.cc delete mode 100644 tests/glibmm_null_containerhandle/main.cc create mode 100644 tests/glibmm_object/main.cc create mode 100644 tests/glibmm_object/test_derived_object.h create mode 100644 tests/glibmm_objectbase/main.cc create mode 100644 tests/glibmm_objectbase/test_derived_objectbase.h create mode 100644 tests/glibmm_ustring_make_valid/main.cc delete mode 100644 tests/glibmm_value/glibmm_value.cc delete mode 100644 tests/glibmm_valuearray/main.cc delete mode 100644 tests/glibmm_weakref/main.cc diff --git a/.gitignore b/.gitignore index f66dece..434a9a8 100644 --- a/.gitignore +++ b/.gitignore @@ -52,8 +52,8 @@ giommconfig.h /docs/reference/Doxyfile /docs/reference/doxygen.log /docs/reference/doxygen*.db -/docs/reference/glibmm-2.4.devhelp2 -/docs/reference/glibmm-2.4.tag +/docs/reference/glibmm-*.devhelp2 +/docs/reference/glibmm-*.tag /docs/reference/html/ # examples/ @@ -75,8 +75,6 @@ giommconfig.h /examples/settings/gschemas.compiled /examples/thread/dispatcher /examples/thread/dispatcher2 -/examples/thread/thread -/examples/thread/threadpool # gio/ /gio/giomm-*.pc @@ -139,10 +137,6 @@ giommconfig.h /glib/glibmm/shell.h /glib/glibmm/spawn.cc /glib/glibmm/spawn.h -/glib/glibmm/thread.cc -/glib/glibmm/thread.h -/glib/glibmm/threads.cc -/glib/glibmm/threads.h /glib/glibmm/timezone.cc /glib/glibmm/timezone.h /glib/glibmm/unicode.cc @@ -151,8 +145,6 @@ giommconfig.h /glib/glibmm/uriutils.h /glib/glibmm/value_basictypes.cc /glib/glibmm/value_basictypes.h -/glib/glibmm/valuearray.cc -/glib/glibmm/valuearray.h /glib/glibmm/variant.cc /glib/glibmm/variant.h /glib/glibmm/variant_basictypes.cc diff --git a/COPYING b/COPYING index 5e1f37e..c4792dd 100644 --- a/COPYING +++ b/COPYING @@ -3,7 +3,7 @@ Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -477,13 +477,14 @@ have at least the "copyright" line and a pointer to where the full notice is found. - + Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -492,7 +493,7 @@ notice is found. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. diff --git a/MSVC_Net2013/compose.vcxproj b/MSVC_Net2017/compose.vcxproj similarity index 98% rename from MSVC_Net2013/compose.vcxproj rename to MSVC_Net2017/compose.vcxproj index 4775af3..38cb404 100644 --- a/MSVC_Net2013/compose.vcxproj +++ b/MSVC_Net2017/compose.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/compose.vcxproj.filters b/MSVC_Net2017/compose.vcxproj.filters similarity index 100% rename from MSVC_Net2013/compose.vcxproj.filters rename to MSVC_Net2017/compose.vcxproj.filters diff --git a/MSVC_Net2013/dispatcher.vcxproj b/MSVC_Net2017/dispatcher.vcxproj similarity index 98% rename from MSVC_Net2013/dispatcher.vcxproj rename to MSVC_Net2017/dispatcher.vcxproj index 6c403c0..2e79b92 100644 --- a/MSVC_Net2013/dispatcher.vcxproj +++ b/MSVC_Net2017/dispatcher.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/dispatcher.vcxproj.filters b/MSVC_Net2017/dispatcher.vcxproj.filters similarity index 100% rename from MSVC_Net2013/dispatcher.vcxproj.filters rename to MSVC_Net2017/dispatcher.vcxproj.filters diff --git a/MSVC_Net2013/dispatcher2.vcxproj b/MSVC_Net2017/dispatcher2.vcxproj similarity index 98% rename from MSVC_Net2013/dispatcher2.vcxproj rename to MSVC_Net2017/dispatcher2.vcxproj index db6a5fd..a9f8e25 100644 --- a/MSVC_Net2013/dispatcher2.vcxproj +++ b/MSVC_Net2017/dispatcher2.vcxproj @@ -27,22 +27,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/dispatcher2.vcxproj.filters b/MSVC_Net2017/dispatcher2.vcxproj.filters similarity index 100% rename from MSVC_Net2013/dispatcher2.vcxproj.filters rename to MSVC_Net2017/dispatcher2.vcxproj.filters diff --git a/MSVC_Net2013/filelist.am b/MSVC_Net2017/filelist.am similarity index 98% rename from MSVC_Net2013/filelist.am rename to MSVC_Net2017/filelist.am index a70124a..e22b371 100644 --- a/MSVC_Net2013/filelist.am +++ b/MSVC_Net2017/filelist.am @@ -1,6 +1,6 @@ ## This file is part of glibmm. -msvc_net2013_data = \ +msvc_net2017_data = \ glibmm.sln \ glibmm-build-defines.props \ glibmm-install.props \ diff --git a/MSVC_Net2013/gendef.vcxproj b/MSVC_Net2017/gendef.vcxproj similarity index 97% rename from MSVC_Net2013/gendef.vcxproj rename to MSVC_Net2017/gendef.vcxproj index 62dbcc8..bfc870b 100644 --- a/MSVC_Net2013/gendef.vcxproj +++ b/MSVC_Net2017/gendef.vcxproj @@ -26,22 +26,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/gendef.vcxproj.filters b/MSVC_Net2017/gendef.vcxproj.filters similarity index 100% rename from MSVC_Net2013/gendef.vcxproj.filters rename to MSVC_Net2017/gendef.vcxproj.filters diff --git a/MSVC_Net2013/gendef/gendef.cc b/MSVC_Net2017/gendef/gendef.cc similarity index 100% rename from MSVC_Net2013/gendef/gendef.cc rename to MSVC_Net2017/gendef/gendef.cc diff --git a/MSVC_Net2013/giomm.vcxproj b/MSVC_Net2017/giomm.vcxproj similarity index 98% rename from MSVC_Net2013/giomm.vcxproj rename to MSVC_Net2017/giomm.vcxproj index bc4fc3d..419673a 100644 --- a/MSVC_Net2013/giomm.vcxproj +++ b/MSVC_Net2017/giomm.vcxproj @@ -26,22 +26,22 @@ DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 @@ -269,6 +269,7 @@ + @@ -399,6 +400,7 @@ + diff --git a/MSVC_Net2013/giomm.vcxproj.filters b/MSVC_Net2017/giomm.vcxproj.filters similarity index 99% rename from MSVC_Net2013/giomm.vcxproj.filters rename to MSVC_Net2017/giomm.vcxproj.filters index 4f01b13..5ed29e3 100644 --- a/MSVC_Net2013/giomm.vcxproj.filters +++ b/MSVC_Net2017/giomm.vcxproj.filters @@ -100,6 +100,7 @@ Source Files Source Files Source Files + Source Files Source Files Source Files Source Files @@ -229,6 +230,7 @@ Source Files Header Files Header Files + Header Files Header Files Header Files Header Files diff --git a/MSVC_Net2013/giomm/giomm.rc.in b/MSVC_Net2017/giomm/giomm.rc.in similarity index 100% rename from MSVC_Net2013/giomm/giomm.rc.in rename to MSVC_Net2017/giomm/giomm.rc.in diff --git a/MSVC_Net2013/giomm_simple.vcxproj b/MSVC_Net2017/giomm_simple.vcxproj similarity index 98% rename from MSVC_Net2013/giomm_simple.vcxproj rename to MSVC_Net2017/giomm_simple.vcxproj index 1eb6124..bb945b4 100644 --- a/MSVC_Net2013/giomm_simple.vcxproj +++ b/MSVC_Net2017/giomm_simple.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/giomm_simple.vcxproj.filters b/MSVC_Net2017/giomm_simple.vcxproj.filters similarity index 100% rename from MSVC_Net2013/giomm_simple.vcxproj.filters rename to MSVC_Net2017/giomm_simple.vcxproj.filters diff --git a/MSVC_Net2013/glibmm-build-defines.props b/MSVC_Net2017/glibmm-build-defines.props similarity index 78% rename from MSVC_Net2013/glibmm-build-defines.props rename to MSVC_Net2017/glibmm-build-defines.props index 5cbde3c..91d6088 100644 --- a/MSVC_Net2013/glibmm-build-defines.props +++ b/MSVC_Net2017/glibmm-build-defines.props @@ -6,8 +6,8 @@ SIZEOF_WCHAR_T=2;GLIBMM_BUILD GIOMM_BUILD - sigc-vc$(VSVer)0-2_0.lib - sigc-vc$(VSVer)0-d-2_0.lib + sigc-vc$(VSVer)0-$(SigCMajorVersion)_0.lib + sigc-vc$(VSVer)0-d-$(SigCMajorVersion)_0.lib <_PropertySheetDisplayName>glibmmbuilddefinesprops @@ -16,7 +16,7 @@ - .\glibmm;..;..\glib;$(GlibEtcInstallRoot)\include\sigc++-2.0;$(GlibEtcInstallRoot)\lib\sigc++-2.0\include;$(GlibEtcInstallRoot)\include\gio-win32-2.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories) + .\glibmm;..;..\glib;$(GlibEtcInstallRoot)\include\sigc++-$(SigCMajorVersion).0;$(GlibEtcInstallRoot)\lib\sigc++-$(SigCMajorVersion).0\include;$(GlibEtcInstallRoot)\include\gio-win32-2.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories) msvc_recommended_pragmas.h;%(ForcedIncludeFiles) true /d2Zi+ %(AdditionalOptions) diff --git a/MSVC_Net2013/glibmm-install.props b/MSVC_Net2017/glibmm-install.props similarity index 96% rename from MSVC_Net2013/glibmm-install.props rename to MSVC_Net2017/glibmm-install.props index f28a0c8..e4f6339 100644 --- a/MSVC_Net2013/glibmm-install.props +++ b/MSVC_Net2017/glibmm-install.props @@ -25,7 +25,6 @@ mkdir $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\priva copy ..\glib\glibmm.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion) copy ..\gio\giomm.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion) -copy ..\glib\glibmm\arrayhandle.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\balancedtree.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\base64.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\binding.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -34,7 +33,6 @@ copy ..\glib\glibmm\bytearray.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(A copy ..\glib\glibmm\checksum.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\class.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\containerhandle_shared.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\containers.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\convert.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\date.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\datetime.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -44,15 +42,14 @@ copy ..\glib\glibmm\dispatcher.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$( copy ..\glib\glibmm\error.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\exception.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\exceptionhandler.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm +copy ..\glib\glibmm\extraclassinit.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\fileutils.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\helperlist.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\i18n-lib.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\i18n.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\init.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\interface.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\iochannel.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\keyfile.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\listhandle.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\main.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\markup.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\miscutils.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -72,16 +69,11 @@ copy ..\glib\glibmm\quark.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMi copy ..\glib\glibmm\random.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\refptr.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\regex.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\sarray.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\shell.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\signalproxy.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\signalproxy_connectionnode.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\slisthandle.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\spawn.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\streamiochannel.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\stringutils.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\threadpool.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\threads.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\timer.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\timeval.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\timezone.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -94,9 +86,7 @@ copy ..\glib\glibmm\variantdict.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$ copy ..\glib\glibmm\variantiter.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\varianttype.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\variant_basictypes.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\thread.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\value.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm -copy ..\glib\glibmm\valuearray.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\value_basictypes.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\value_custom.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm copy ..\glib\glibmm\vectorutils.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm @@ -128,7 +118,6 @@ copy ..\glib\glibmm\private\optiongroup_p.h $(CopyDir)\include\glibmm-$(ApiMajor copy ..\glib\glibmm\private\regex_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\shell_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\spawn_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private -copy ..\glib\glibmm\private\threads_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\timezone_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\unicode_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\uriutils_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private @@ -136,8 +125,6 @@ copy ..\glib\glibmm\private\variant_p.h $(CopyDir)\include\glibmm-$(ApiMajorVers copy ..\glib\glibmm\private\variantdict_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\variantiter_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\glib\glibmm\private\varianttype_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private -copy ..\glib\glibmm\private\thread_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private -copy ..\glib\glibmm\private\valuearray_p.h $(CopyDir)\include\glibmm-$(ApiMajorVersion).$(ApiMinorVersion)\glibmm\private copy ..\gio\giomm\action.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\actiongroup.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm @@ -224,6 +211,7 @@ copy ..\gio\giomm\outputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(A copy ..\gio\giomm\permission.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\pollableinputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\pollableoutputstream.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm +copy ..\gio\giomm\propertyaction.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\proxy.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\proxyaddress.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm copy ..\gio\giomm\proxyresolver.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm @@ -349,6 +337,7 @@ copy ..\gio\giomm\private\notification_p.h $(CopyDir)\include\giomm-$(ApiMajorVe copy ..\gio\giomm\private\outputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\pollableinputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\pollableoutputstream_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private +copy ..\gio\giomm\private\propertyaction_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\proxy_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\proxyaddress_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private copy ..\gio\giomm\private\proxyresolver_p.h $(CopyDir)\include\giomm-$(ApiMajorVersion).$(ApiMinorVersion)\giomm\private diff --git a/MSVC_Net2013/glibmm-version-paths.props b/MSVC_Net2017/glibmm-version-paths.props similarity index 88% rename from MSVC_Net2013/glibmm-version-paths.props rename to MSVC_Net2017/glibmm-version-paths.props index 216731b..28b8cb9 100644 --- a/MSVC_Net2013/glibmm-version-paths.props +++ b/MSVC_Net2017/glibmm-version-paths.props @@ -1,14 +1,15 @@  - 12 + 15 $(SolutionDir)\..\..\vs$(VSVer)\$(Platform) $(GlibEtcInstallRoot) $(SolutionDir)$(Configuration)\$(Platform)\obj\$(ProjectName)\ 2 - 4 + 54 -vc$(VSVer)0-$(ApiMajorVersion)_$(ApiMinorVersion) -vc$(VSVer)0-d-$(ApiMajorVersion)_$(ApiMinorVersion) + 3 <_PropertySheetDisplayName>glibmmversionpathsprops @@ -38,5 +39,8 @@ $(DebugDllSuffix) + + $(SigCMajorVersion) + diff --git a/MSVC_Net2013/glibmm.sln b/MSVC_Net2017/glibmm.sln similarity index 88% rename from MSVC_Net2013/glibmm.sln rename to MSVC_Net2017/glibmm.sln index d71dbc1..4467ac1 100644 --- a/MSVC_Net2013/glibmm.sln +++ b/MSVC_Net2017/glibmm.sln @@ -1,5 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 13.00 -# Visual Studio 2013 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glibmm", "glibmm.vcxproj", "{58B2B53C-C4FF-47FD-817B-095E45B7F7D4}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gendef", "gendef.vcxproj", "{07324745-C9BE-4D65-B08A-9C88188C0C28}" @@ -8,10 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "markup", "markup.vcxproj", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glibmm_value", "glibmm_value.vcxproj", "{22277003-3228-486E-A6A8-994B8B13AF30}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thread", "thread.vcxproj", "{5357AB2B-A5F9-463C-92D8-00357CCC3ECE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "threadpool", "threadpool.vcxproj", "{962484DB-2111-48A4-BEF0-194433719D0D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dispatcher", "dispatcher.vcxproj", "{129ECC08-6D30-4884-B824-4AF96EF0A45C}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dispatcher2", "dispatcher2.vcxproj", "{18A82706-B645-4DF5-AB09-06B90128BAC5}" @@ -78,22 +74,6 @@ Global {22277003-3228-486E-A6A8-994B8B13AF30}.Release|Win32.Build.0 = Release|Win32 {22277003-3228-486E-A6A8-994B8B13AF30}.Release|x64.ActiveCfg = Release|x64 {22277003-3228-486E-A6A8-994B8B13AF30}.Release|x64.Build.0 = Release|x64 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Debug|Win32.ActiveCfg = Debug|Win32 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Debug|Win32.Build.0 = Debug|Win32 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Debug|x64.ActiveCfg = Debug|x64 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Debug|x64.Build.0 = Debug|x64 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Release|Win32.ActiveCfg = Release|Win32 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Release|Win32.Build.0 = Release|Win32 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Release|x64.ActiveCfg = Release|x64 - {5357AB2B-A5F9-463C-92D8-00357CCC3ECE}.Release|x64.Build.0 = Release|x64 - {962484DB-2111-48A4-BEF0-194433719D0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {962484DB-2111-48A4-BEF0-194433719D0D}.Debug|Win32.Build.0 = Debug|Win32 - {962484DB-2111-48A4-BEF0-194433719D0D}.Debug|x64.ActiveCfg = Debug|x64 - {962484DB-2111-48A4-BEF0-194433719D0D}.Debug|x64.Build.0 = Debug|x64 - {962484DB-2111-48A4-BEF0-194433719D0D}.Release|Win32.ActiveCfg = Release|Win32 - {962484DB-2111-48A4-BEF0-194433719D0D}.Release|Win32.Build.0 = Release|Win32 - {962484DB-2111-48A4-BEF0-194433719D0D}.Release|x64.ActiveCfg = Release|x64 - {962484DB-2111-48A4-BEF0-194433719D0D}.Release|x64.Build.0 = Release|x64 {129ECC08-6D30-4884-B824-4AF96EF0A45C}.Debug|Win32.ActiveCfg = Debug|Win32 {129ECC08-6D30-4884-B824-4AF96EF0A45C}.Debug|Win32.Build.0 = Debug|Win32 {129ECC08-6D30-4884-B824-4AF96EF0A45C}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/MSVC_Net2013/glibmm.vcxproj b/MSVC_Net2017/glibmm.vcxproj similarity index 93% rename from MSVC_Net2013/glibmm.vcxproj rename to MSVC_Net2017/glibmm.vcxproj index 6594edc..e9eb058 100644 --- a/MSVC_Net2013/glibmm.vcxproj +++ b/MSVC_Net2017/glibmm.vcxproj @@ -28,22 +28,22 @@ DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 DynamicLibrary MultiByte - v120 + v141 @@ -198,7 +198,6 @@ - @@ -206,7 +205,6 @@ - @@ -216,6 +214,7 @@ + @@ -238,16 +237,11 @@ - - - - - @@ -258,7 +252,6 @@ - @@ -269,7 +262,6 @@ - @@ -278,7 +270,6 @@ - @@ -288,15 +279,14 @@ + - - @@ -315,17 +305,11 @@ - - - - - - @@ -336,7 +320,6 @@ - diff --git a/MSVC_Net2013/glibmm.vcxproj.filters b/MSVC_Net2017/glibmm.vcxproj.filters similarity index 87% rename from MSVC_Net2013/glibmm.vcxproj.filters rename to MSVC_Net2017/glibmm.vcxproj.filters index 578c253..f8e2680 100644 --- a/MSVC_Net2013/glibmm.vcxproj.filters +++ b/MSVC_Net2017/glibmm.vcxproj.filters @@ -15,7 +15,6 @@ - Source Files Source Files Source Files Source Files @@ -23,7 +22,6 @@ Source Files Source Files Source Files - Source Files Source Files Source Files Source Files @@ -33,6 +31,7 @@ Source Files Source Files Source Files + Source Files Source Files Source Files Source Files @@ -55,16 +54,11 @@ Source Files Source Files Source Files - Source Files Source Files Source Files Source Files Source Files - Source Files Source Files - Source Files - Source Files - Source Files Source Files Source Files Source Files @@ -75,7 +69,6 @@ Source Files Source Files Source Files - Source Files Source Files Source Files Source Files @@ -86,7 +79,6 @@ Source Files - Header Files Header Files Header Files Header Files @@ -95,7 +87,6 @@ Header Files Header Files Header Files - Header Files Header Files Header Files Header Files @@ -105,15 +96,14 @@ Header Files Header Files Header Files + Header Files Header Files - Header Files Header Files Header Files Header Files Header Files Header Files Header Files - Header Files Header Files Header Files Header Files @@ -132,17 +122,11 @@ Header Files Header Files Header Files - Header Files Header Files Header Files Header Files - Header Files Header Files - Header Files Header Files - Header Files - Header Files - Header Files Header Files Header Files Header Files @@ -153,7 +137,6 @@ Header Files Header Files Header Files - Header Files Header Files Header Files Header Files diff --git a/MSVC_Net2013/glibmm/glibmm.rc.in b/MSVC_Net2017/glibmm/glibmm.rc.in similarity index 100% rename from MSVC_Net2013/glibmm/glibmm.rc.in rename to MSVC_Net2017/glibmm/glibmm.rc.in diff --git a/MSVC_Net2013/glibmm_value.vcxproj b/MSVC_Net2017/glibmm_value.vcxproj similarity index 98% rename from MSVC_Net2013/glibmm_value.vcxproj rename to MSVC_Net2017/glibmm_value.vcxproj index 9639003..e191a1c 100644 --- a/MSVC_Net2013/glibmm_value.vcxproj +++ b/MSVC_Net2017/glibmm_value.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/glibmm_value.vcxproj.filters b/MSVC_Net2017/glibmm_value.vcxproj.filters similarity index 100% rename from MSVC_Net2013/glibmm_value.vcxproj.filters rename to MSVC_Net2017/glibmm_value.vcxproj.filters diff --git a/MSVC_Net2013/install.vcxproj b/MSVC_Net2017/install.vcxproj similarity index 97% rename from MSVC_Net2013/install.vcxproj rename to MSVC_Net2017/install.vcxproj index 059ceec..4b18af2 100644 --- a/MSVC_Net2013/install.vcxproj +++ b/MSVC_Net2017/install.vcxproj @@ -28,23 +28,23 @@ Utility MultiByte true - v120 + v141 Utility MultiByte - v120 + v141 Utility MultiByte true - v120 + v141 Utility MultiByte - v120 + v141 diff --git a/MSVC_Net2013/keyfile.vcxproj b/MSVC_Net2017/keyfile.vcxproj similarity index 98% rename from MSVC_Net2013/keyfile.vcxproj rename to MSVC_Net2017/keyfile.vcxproj index 0993e6a..ed71d95 100644 --- a/MSVC_Net2013/keyfile.vcxproj +++ b/MSVC_Net2017/keyfile.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/keyfile.vcxproj.filters b/MSVC_Net2017/keyfile.vcxproj.filters similarity index 100% rename from MSVC_Net2013/keyfile.vcxproj.filters rename to MSVC_Net2017/keyfile.vcxproj.filters diff --git a/MSVC_Net2013/markup.vcxproj b/MSVC_Net2017/markup.vcxproj similarity index 98% rename from MSVC_Net2013/markup.vcxproj rename to MSVC_Net2017/markup.vcxproj index 03b3295..60fb2c4 100644 --- a/MSVC_Net2013/markup.vcxproj +++ b/MSVC_Net2017/markup.vcxproj @@ -27,22 +27,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/markup.vcxproj.filters b/MSVC_Net2017/markup.vcxproj.filters similarity index 100% rename from MSVC_Net2013/markup.vcxproj.filters rename to MSVC_Net2017/markup.vcxproj.filters diff --git a/MSVC_Net2013/options.vcxproj b/MSVC_Net2017/options.vcxproj similarity index 98% rename from MSVC_Net2013/options.vcxproj rename to MSVC_Net2017/options.vcxproj index f627c4e..3ba9d67 100644 --- a/MSVC_Net2013/options.vcxproj +++ b/MSVC_Net2017/options.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/options.vcxproj.filters b/MSVC_Net2017/options.vcxproj.filters similarity index 100% rename from MSVC_Net2013/options.vcxproj.filters rename to MSVC_Net2017/options.vcxproj.filters diff --git a/MSVC_Net2013/properties.vcxproj b/MSVC_Net2017/properties.vcxproj similarity index 98% rename from MSVC_Net2013/properties.vcxproj rename to MSVC_Net2017/properties.vcxproj index 6858140..aafebf5 100644 --- a/MSVC_Net2013/properties.vcxproj +++ b/MSVC_Net2017/properties.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/properties.vcxproj.filters b/MSVC_Net2017/properties.vcxproj.filters similarity index 100% rename from MSVC_Net2013/properties.vcxproj.filters rename to MSVC_Net2017/properties.vcxproj.filters diff --git a/MSVC_Net2013/regex.vcxproj b/MSVC_Net2017/regex.vcxproj similarity index 98% rename from MSVC_Net2013/regex.vcxproj rename to MSVC_Net2017/regex.vcxproj index 84418df..490b1b6 100644 --- a/MSVC_Net2013/regex.vcxproj +++ b/MSVC_Net2017/regex.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/regex.vcxproj.filters b/MSVC_Net2017/regex.vcxproj.filters similarity index 100% rename from MSVC_Net2013/regex.vcxproj.filters rename to MSVC_Net2017/regex.vcxproj.filters diff --git a/MSVC_Net2013/resolver.vcxproj b/MSVC_Net2017/resolver.vcxproj similarity index 98% rename from MSVC_Net2013/resolver.vcxproj rename to MSVC_Net2017/resolver.vcxproj index 113d86a..b6461be 100644 --- a/MSVC_Net2013/resolver.vcxproj +++ b/MSVC_Net2017/resolver.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/resolver.vcxproj.filters b/MSVC_Net2017/resolver.vcxproj.filters similarity index 100% rename from MSVC_Net2013/resolver.vcxproj.filters rename to MSVC_Net2017/resolver.vcxproj.filters diff --git a/MSVC_Net2013/socket-client.vcxproj b/MSVC_Net2017/socket-client.vcxproj similarity index 98% rename from MSVC_Net2013/socket-client.vcxproj rename to MSVC_Net2017/socket-client.vcxproj index 3743708..5058f19 100644 --- a/MSVC_Net2013/socket-client.vcxproj +++ b/MSVC_Net2017/socket-client.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/socket-client.vcxproj.filters b/MSVC_Net2017/socket-client.vcxproj.filters similarity index 100% rename from MSVC_Net2013/socket-client.vcxproj.filters rename to MSVC_Net2017/socket-client.vcxproj.filters diff --git a/MSVC_Net2013/socket-server.vcxproj b/MSVC_Net2017/socket-server.vcxproj similarity index 98% rename from MSVC_Net2013/socket-server.vcxproj rename to MSVC_Net2017/socket-server.vcxproj index 4116263..b925f87 100644 --- a/MSVC_Net2013/socket-server.vcxproj +++ b/MSVC_Net2017/socket-server.vcxproj @@ -28,22 +28,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/socket-server.vcxproj.filters b/MSVC_Net2017/socket-server.vcxproj.filters similarity index 100% rename from MSVC_Net2013/socket-server.vcxproj.filters rename to MSVC_Net2017/socket-server.vcxproj.filters diff --git a/MSVC_Net2013/thread.vcxproj b/MSVC_Net2017/thread.vcxproj similarity index 98% rename from MSVC_Net2013/thread.vcxproj rename to MSVC_Net2017/thread.vcxproj index 9950bbb..24e9b3b 100644 --- a/MSVC_Net2013/thread.vcxproj +++ b/MSVC_Net2017/thread.vcxproj @@ -27,22 +27,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/thread.vcxproj.filters b/MSVC_Net2017/thread.vcxproj.filters similarity index 100% rename from MSVC_Net2013/thread.vcxproj.filters rename to MSVC_Net2017/thread.vcxproj.filters diff --git a/MSVC_Net2013/threadpool.vcxproj b/MSVC_Net2017/threadpool.vcxproj similarity index 98% rename from MSVC_Net2013/threadpool.vcxproj rename to MSVC_Net2017/threadpool.vcxproj index 9ab9748..4ff8ebe 100644 --- a/MSVC_Net2013/threadpool.vcxproj +++ b/MSVC_Net2017/threadpool.vcxproj @@ -27,22 +27,22 @@ Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 Application MultiByte - v120 + v141 diff --git a/MSVC_Net2013/threadpool.vcxproj.filters b/MSVC_Net2017/threadpool.vcxproj.filters similarity index 100% rename from MSVC_Net2013/threadpool.vcxproj.filters rename to MSVC_Net2017/threadpool.vcxproj.filters diff --git a/Makefile.am b/Makefile.am index a0df8af..7cda466 100644 --- a/Makefile.am +++ b/Makefile.am @@ -43,10 +43,10 @@ nodist_giomm_libinclude_HEADERS = gio/giommconfig.h pkgconfigdir = $(libdir)/pkgconfig nodist_pkgconfig_DATA = glib/$(GLIBMM_MODULE_NAME).pc gio/$(GIOMM_MODULE_NAME).pc -include $(srcdir)/MSVC_Net2013/filelist.am +include $(srcdir)/MSVC_Net2017/filelist.am text_files = COPYING.tools README.SUN README.win32 -msvc_files = $(addprefix MSVC_Net2013/,$(msvc_net2013_data)) +msvc_files = $(addprefix MSVC_Net2017/,$(msvc_net2017_data)) dist_noinst_DATA = $(text_files) $(msvc_files) dist_noinst_SCRIPTS = autogen.sh diff --git a/NEWS b/NEWS index 3676dc0..e2a8c01 100644 --- a/NEWS +++ b/NEWS @@ -1,146 +1,402 @@ -2.54.1 (stable): +2.55.1: (unstable): +Distro packagers should probably not package this yet. Glib: -* Variant: Don't use std::index_sequence from C++14. - (Kjell Ahlstedt, Jonathan Wakely) Bug #787648 (Armin K.) +* Object: Value_Pointer class should take only one template argument. + (Marcin Kolny) +* Variant: Improved support for D-Bus object paths and signatures. + (Kjell Ahlstedt) Bug #785700 (Johannes Dohmen) +* Glib::Value_Flags<>: static_cast to correct type. + (Kjell Ahlstedt) -Documentation: -* Note that Gio::Application::property_resource_base_path() shall not - be used. It has a bug that's hard to fix without breaking ABI. - (Kjell Ahlstedt) Bug #787496 (Daniel Boles) +Gio: +* Derive all interfaces directly from Glib::Interface + (Kjell Ahltedt) Bug #776537 +* Application: OptionType: Make this an enum class. + (Kjell Ahlstedt) +* BufferedInputStream, BufferedOutputStream, DataOutputStream: + Implement Seekable. +* CharsetConverter: Implement the Gio::Initable interface. + and call Initable::init() from CharsetConverter's constructor. + (Kjell Ahlstedt) Bug #776537 +* Add FileDescriptorBased interface and make GUnixInputStream and + GUnixOutputStream implement it. +* MemoryInputStream, UnixInputStream: Implement PollableInputStream. + (Kjell Ahlstedt) +* MemoryOutputStream, UnixOutputStream: Implement PollableOutputStream. + (Kjell Ahlstedt) +* TlsDatabase: create_certificate_handle_vfunc(): + Fix memory leak, and correctly return nulltpr. + (Kjell Ahlstedt) Bug #783360 gmmproc: -* Convert all property documentation to C++. - (Kjell Ahlstedt) Bug #787698 (Daniel Boles) +* Accept curly braces in default values in _WRAP macros + (Khell Ahlstedt) Bug #783216 comment 13 +* Don't accept unpaired double quotes. + (Khell Ahlstedt) +* gmmproc: Fix _WRAP_ENUM for enumerators with apostrophes. + (Khell Ahlstedt) +* gmmproc, _WRAP_ENUM: Add optional CONV_TO_INT parameter. + (Khell Ahlstedt) + +Build: +* Change the ABI to glibmm-2.56. + (Murray Cumming) +* Really exclude DesktopAppInfo from wrap_init.cc on MacOS. + (Kjell Ahlstedt) Bug #781947 + +Documentation: +* miscutils: Update docs of get_*_name() from GLib. + (Daniel Boles) +* Fix documentation of enum Glib::IOCondition. + (Khell Ahlstedt) -2.54.0 (stable): + +2.53.2 (unstable): +Distro packagers should probably not package this yet. Glib: -* Added DBusObjectPathString and DBusSignatureString, for Variants with D-Bus object paths or D-Bus signatures, - and add Variant specializations for Variant, - Variant and Variant>. - (Kjell Ahlstedt) Bug #785700 -* Variant: Add template specialization for std::tuple. - (Alexander Rössler) Bug #777791 +* ConstructParams: Do not increment allocation size twice + (Daniel Elstner) Gio: -* ActionGroup: Add optional action_name parameters to some signals. - (Kjell Ahlstedt) -* Settings: Add optional key parameter to the writable_changed signal. - (Kjell Ahlstedt) +* ActionMap: Really fix add_action_with_parameter(). + (Daniel Boles) Bug 774444#c31 +* UnixSocketAddress::create(): Remove a default value to avoid ambiguity. + (Kjell Ahlstedt) Bug #782592 + +Gio::DBus +* Proxy: Wrap call() and call_sync() methods. + (Vyacheslav Yurkov) Bug #781818 gmmproc: -* Write signal flags to generated documentation - (Kjell Ahlstedt) Bug #785895 (Daniel Boles) -* Write default values of properties to generated documentation - (Kjell Ahlstedt) Bug #785895 (Daniel Boles) -* Warn for unmatched deprecations in signals and properties. +* Use of static_cast<> instead of C-style casts. + (Murray Cumming) + +Build: +* Fix the build on MacOS, where glib doesn't have gdesktopinfo. + (John Ralls) Bug #781947 +* Really use desktopappinfo.hg to fix the build. + (Murray Cumming) + +Documentation: +* Glib, Gio: Update documentation of in-class enums. (Kjell Ahlstedt) -* Accept curly braces in default values in _WRAP macros. - (Kjell Ahlstedt) Bug #783216 comment #13 (Daniel Boles) -* Fix _WRAP_ENUM for enumerators with apostrophes. +* ActionMap: Improve add_action_with_parameter docs + (Daniel Boles) + + +2.53.1.1 (unstable): + +Glib: +* Use C++11 enum classes instead of old-style enums, and put many enums + inside relevant class declarations: + - Glib::NodeTree: Move enums into class. + - Glib::BindingFlags is now Glib::Binding::Flags. + - Glib::KeyfileFlags is now Glib::Keyfile::Flags. + - Glib::ModuleFlags is now Glib::Module::Flags. + - Glib::ChecksumType is now Glib::Checksum::Type. + - Glib::Regex: Move enums inside class. + - Glib::Resource: Move enums into class. + (Murray Cumming, Kjell Ahlstedt) +* RefPtr: Make this an alias for std::shared_ptr<> instead. + - Use std::dynamic_pointer_cast<>() instead of RefPtr<>::cast_dynamic(). + - Use std::static_pointer_cast<>() instead of RefPtr<>::cast_static(). + - Use std::const_pointer_cast<>() instead of RefPtr<>::cast_const(). + - When creating RefPtr directly, instead of using create() methods, + use Glib::make_refptr_for_instance() so the std::shared_ptr<> has the + necessary Deleter. + (Murray Cumming) Bug #755037 +* Remove Glib::WeakRef. Use std::weak_ref<> instead. + (Murray Cumming) Bug #755037 +* Object: Use g_object_new_with_properties() instead of (deprecated) + g_object_newv() and (deprecated) GParameter. + (Murray Cumming) +* IOChannel: Avoid creating a RefPtr to this. + (Murray Cumming) Bug #755037 +* SignalProxy: + connect(): Signals with non-void return values now have no default value + for the "after" parameter, forcing application developers to think about + whether they should connect before or after already-connected signal + handlers, and default signal handlers. This is awkward but necessary. + Just provide "true" to get the previous behaviour, or use connect_notify(). + connect_notify(): Signals with void return values have no connect_notify(), + because it is not useful with those signals. + (Kjell Ahlstedt) Bug #126213. + +Gio: +* Use C++11 enum classes instead of old-style enums, and put many enums + inside relevant class declarations: + - Gio::Drive: Move enums into class. + - Gio::TlsDatabase: Move enums into class. + - Gio::UnixSocketAddressType is now Gio::UnixSocketAddress::Type. + - Gio::Mount: Move enums into class. + - Gio::TlsPasswordFlags is now Gio::TlsPassword::Flags. + - Gio::IOStreamSpliceFlags is now Gio::IOStream::SpliceFlags. + - Gio::SettingsBindFlags is now Gio::Settings::BindFlags. + - Gio::ResolverRecordType is now Gio::Resolver::RecordType. + - Gio::Socket: Move enums into class. + - Gio::File: Move some flags enums into the class. + - Gio::OutputStreamSpliceFlags is now Gio::OuputStream::SpliceFlags. + - Gio::CredentialsType is now Gio::Credentials::Type. + - Gio::NotificationPriority is now Gio::Notification::Priority. + - Gio::FileMonitorEvent is now Gio::FileMonitor::Event. + - Gio::FileAttributeInfoFlags is now Gio::FileAttributeInfo::Flags. + - Gio::EmblemOrigin is now Gio::Emblem::Origin. + - Gio::Converter: Put enums inside class. + - Gio::ConverterFlags is now Gio::Converter::Flags. + - Gio::ConverterResult is now Gio::Converter::Result. + - Gio::AppInfoCreateFlags is now Gio::AppInfo::CreateFlags. + - Gio::ApplicationFlags is now Gio::Application::Flags. + (Murray Cumming, Kjell Ahlstedt) +* Remove duplicate ErrorEnum declaration. (Kjell Ahlstedt) -* Add new elements types for the docs_override: - substitute_type_name and substitute_enumerator_name. +* ConstructParams: + - Remove (hopefully really unnecessary) copy constructor. + - C++11: =delete the operator=, instead of making it private. + (Murray Cumming) +* Value: + - Remove the CType alias, which should be unnecessary. + - value_custom: Replace a template parameter with C++11 type traits. + - Value>: Only use this specialization if T has get_base_type(). + (Murray Cumming) Bug #755037 +* Variant: + - operator bool(): Simplify to avoid clang++ warnings. + - C++11: Variant: Replace throw(std::bad_cast) with noexcept(false). + See https://bugzilla.redhat.com/show_bug.cgi?id=1438766 + (Murray Cumming) +* Socket: Avoid creating a RefPtr to this. + (Murray Cumming) Bug #755037 + +Gio:DBus: +* Use C++11 enum classes instead of old-style enums, and put many enums + inside relevant class declarations: + - Gio::DBus::InterfaceSkeletonFlags is now Gio::DBus::InterfaceSkeleton::Flags. + - Gio::DBus::ServerFlags is now Gio::DBus::Server::Flags. + (Murray Cumming, Kjell Ahlstedt) + +gmmproc: +* _WRAP_ENUM(): Generate C++ enum classes instead of enums, and let the enums + be inside class declarations. (Kjell Ahlstedt) Bug #86864 +Build +* Windows: Visual Studio builds: Update ABI version + (Chun-wei Fan) -2.52.1 (stable): -Gio: -* TlsDatabase: Fix memory leak in a vfunc. - (Kjell Ahlstedt) Bug #783360 +2.53.1 (unstable): -Documentation: -* Update docs of get_*_name(). - (Daniel Boles) +Glib: +* OptionGroup: + - Don't allow copy or move. + - Remove the OptionGroup& parameter in on_pre_parse(), on_post_parse() and + on_error(). + (Kjell Ahlstedt) +* IOChannel, StreamIOChannel: Remove deprecated parts. + (Kjell Ahlstedt) +* ustring: Add make_valid(). + (Krzysztof Piecuch) Bug #780075 +* Remove (unused) Sequence and sequence(). + (Murray Cumming) +* Remove ListHandle, SListHandle, ArrayHandle, SArrayHandle, and + StringArrayHandle, replacing them with std::vector in API. + (Murray Cumming) + +gmmproc: +* _WRAP_METHOD(): Some more use of auto in generated code. + (Murray Cumming) Build: -* MacOS: Really correct build without gdesktopinfo. - (Kjell Ahlstedt) Bug #781947 +* Change the ABI to glibmm-2.54. + (Murray Cumming) +* Add some #include directives. + (Kjell Ahlstedt) +* Visual Studio: Require Visual Studio 2017 and update the glibmm project. + (Chu-wei Fan) + -2.52.0 (stable): +2.51.5 Gio: -* UnixSocketAddress::create(): Remove the default value for the type - parameter to avoid ambiguity. - (Kjell Ahlstedt) Bug #782592 +* Application: get_default(): Correct the reference counting. + (KJell Ahlstedt) Bug #779936 (James Legg) +* Add PropertyAction. + (Kjell Ahlstedt) + +Glib: +* Remove Glib::unconst() because it is unused and unnecessary. + (Kjell Ahlstedt) +* Variant: Add template specialization for std::tuple, + and a test. + (Alexander Rössler, Kjell Ahlstedt) Bug #777791 -Gio::DBus -* Proxy: Wrap call() and call_sync() methods. - (Vyacheslav Yurkov) Bug #781818 + +2.51.2 (unstable): +Distro packagers should probably not package this yet. + +Glib: +* Object construction: Add custom class init and instance init functions + An extra class init function is useful in Gtk::WidgetCustomDraw and + Gtk::WidgetCustomSnapshot. + (Kjell Ahlstedt) Bug #775348 + +Gio: +* Action: #include , for convenience. + (Daniel Boles) Bug #777953 +* SimpleAction: Make set_state() public. + (Daniel Boles) Bug #777953 Documentation: -* RefPtr: Clarify comment about undefined behaviour. - (Daniel Boles) +* Glib::Variant: Explain how to create "maybe" type. + (Daniel Boles) Bug #778219 -2.51.7 (unstable): + +2.51.1.2 (unstable): +Distro packagers should probably not package this yet. Glib: -* SettingsSchemaKey: Add missing value/range methods. - (Daniel Boles) Bug #774903 -* Variant: Replace throw(std::bad_cast) with noexcept(false), - to fix the build with C++17. - See https://bugzilla.redhat.com/show_bug.cgi?id=1438766 - (Murray Cumming) -* VariantType: Deprecate first() and next(). Add get_item_types() +* Remove some deprecated API + (Kjell Ahlstedt) +* Variant: Remove the string specializations of cast_dynamic. + (Kjell Ahlstedt) +* Glib::VariantType: Add get_item_types(), removing first() and + next(). (Kjell Ahlstedt) Bug #775741 + Gio: -* ActionMap: Add add_action_with_parameter() that takes a parameter type, - and deprecated the existing method, because it cannot work. +* init(): Set the global locale. + (Kjell Ahlstedt) Bug #661588 +* ActionBase: get_state_hint_variant() now returns VariantContainerBase. + (Kjell Ahlstedt) +* ActionMap: add_action_with_parameter(): Register the parameter type, + to make this work. + (Daniel Boles) Bug #774444 +* ActionResult: Add is_tagged_vfunc(). + (Kjell Ahlstedt) +* Glib::Dispatcher: Implement the pimpl idiom + (Kjell Ahlstedt) Bug #651942 +* File, FileInfo, FileIOStream, FileOutputStream: Use Glib::ustring for + (UTF-8) file attributes of string type. + (Kjell Ahlstedt) Bug #615950 +* NetworkMonitor: Derive from Gio::Initable. + (Kjell Ahlstedt) +* RemoteActionGroup: Rename some vfuncs to add _full(). + (Murray Cumming) + +Documentation: +* ActionMap: + - ActivateSlot: Mention add_action_bool(). + - ActivateWithParameterSlot: Be more specific. (Daniel Boles) Bug #774444 -* SimpleAction: Make set_state() public. - (Daniel Boles) Bug #777953 Build: -* MacOS: Correct build without gdesktopinfo. - (John Ralls) Bug #781947 -* Glib::Object: Suppress deprecation warning for g_object_newv() with glib 2.54. - (Kjell Ahlstedt) +* Update the Visual Studio project files. + (Chun-wei Fan) +* Some minor cppcheck fixes. + (Murray Cumming) -2.51.6 (unstable): +2.51.1.1 (unstable): -This is version 2.51.6 of glibmm-2.24. Ignore versions 2.51.1 to 2.51.5 of -unstable glibmm-2.52. Unstable glibmm-2.52 is now unstable glibmm-2.54, -leaving the 2.51/52 version numbers again for use by stable glibmm-2.52. +General: +* Remove no_default_handler in some _WRAP_SIGNAL()s + This allows application developers to simply override + the default on_*() signal handlers for these signals too, + as they can already with most other signals. + If you are using, for instance, the -Wsuggest-override + compiler option, watch out for new compiler warnings suggesting + that your existing signal handler should now be marked with the + override keyword - that means you should do so but you should + also stop connecting the signal handler in your code. + (Kjell Ahlstedt) +* Build: examples/Makefile.am: Re-insert the dispatcher examples + (Kjell Ahlstedt) Glib: -* Dispatcher: - - autodeduce the type of the fd field. - (Marcin Kolny) Bug #772074 - - Don't cast a HANDLE to an int on Windows. +* Dispatcher: Don't cast a HANDLE to an int on Windows. (Kjell Ahlstedt) Bug #772074 -* ustring: Add cbegin() and cend(). - (Murray Cumming) +* ObjectBase: + - Remove connect_property_changed_with_return() + and let connect_property_changed() return a sigc::connection. + (Kjell Ahlstedt) + - Use std::forward_list for interface class pointers. + (Kjell Ahlstedt) + - Replace extra_object_base_data map by instance data. + (Kjell Ahlstedt) +* ObjectBase: overload get_property(). + (Marcin Kolny) +* Main, IOSource: autodeduce type of fd field. + (Marcin Kolny) Bug #770274 +* Settings: Add property_settings_schema(), and update + signal_changed(). + (Kjell Ahlstedt) +* Settings: Make set_enum() + set_flags() usable + (djb) Bug #774647 +* SettingsSchemaKey: Add missing value/range methods + (Daniel Boles) Bug #774903 +* SignalProxyNormal: Remove connect_() and connect_notify_(), + adding connect_impl(). + (Kjell Ahlstedt) +* Rename SignalProxyDetailed to SignalProxyDetailedBase, and + SignalProxyDetailedAnyType to SignalProxyDetailed. + Remove SignalProxyDetailed# aliases (# = 0..6). + (Kjell Ahlstedt) +* Source: Replace extra_source_data by instance data. + (Kjell Ahlstedt) Bug #561885 Gio: -* Action: Include variant.h in the heaer. - (Daniel Boles) Bug #777953 -* Application: get_default(): Correct the reference counting. - (Kjell Ahlstedt) Bug #779936 -* Settings: - - Really add set_enum() and set_flags(). - (djb) Bug #774647 - - Writable-change-event signal: Correct the type of the key parameter. - (Marcin Kolny) Bug #773977 -* SettingsSchemaSource: get_default(): Correct the refcounting. - (Marcin Kolny) Bug #774593 +* ActionMap::add_action_vfunc(): Const correction. + (Murray Cumming) +* Application: Add dbus_register/unregister_vfunc. + (Ritesh Khadgaray, Kjell Ahlstedt) Bug #762191 +* Menu: insert/prepend/add_item(): Const correction. + (Murray Cumming) +* MenuAttributeIter: get_value(): Const correction. + (Murray Cumming) +* MenuModel: get_item_atribute(): const correction. + (Murray Cumming) +* RemoteActionGroup: Derive from Gio::ActionGroup. + (Murray Cumming) -Gio::DBus: +Gio::Dbus: * Proxy: Fix memory leak in get_cached_property_names(). (Kjell Ahlstedt) Bug #775210 +* Proxy: Derive from (and implement) Gio::DBus::Interface. + (Murray Cumming) -Documentation: -* Glib::Variant: Improve documentation of maybe types. - (Daniel Boles) Bug #778219 -* Gio::ActionMap: Clarify doc of ActivateWithParameterSlot - (Daniel Boles) + +2.51.1 (unstable): + +This is the first release of the glibmm-2.52 API/ABI. +It installs in parallel with the gtkmm-2.4 API/ABI, of which +the most recent version is glibmm 2.50. We know that is a bit +confusing. We are taking the opportunity to do this glibmm ABI +break while GTK+ (and therefore gtkmm) is also doing an ABI +break. But we cannot call this glibmm-3.0 because there is no +glib 3.0. Build: -* Visual Studio builds: "Install" the .pdb files - (Chun-wei Fan) +* Require C++14. + (Murray Cumming) +* Use libsigc++-3.0 instead of libsigc++-2.0. + https://www.murrayc.com/permalink/2016/03/07/libsigc-3-0-very-variadic/ + (Murray Cumming) +* Remove lots of deprecated API. + (Kjell Ahlstedt) + +Gio: +* BufferedInputStream, InputStream, OutputStream: Add vfuncs, + allowing implementation in C++. + (Krzysztof Kosiński, Kjell Ahlstedt) Bug #572471 +* SettingsSchemaSource::get_default(): Correct the reference count. + (Marcin Kolny) Bug #774593 +* Settings: Fix type of 'key' parameter of writable-change-event signal + (Marcin Kolny) Bug #773977 + +Glib: +* ustring: Add cbegin() and cend(). 2.50.0: @@ -183,7 +439,7 @@ gmmproc: * Remove DocsParser::non_object_method_name() (Kjell Ahlstedt) * swap() implementations: Use std::swap(). - (Murray Cumming + (Murray Cumming) Documentation: * Gio::SocketService: Update the class documentation diff --git a/README.win32 b/README.win32 index 71d7285..0094f74 100644 --- a/README.win32 +++ b/README.win32 @@ -1,58 +1,58 @@ -Building glibmm on Win32 -=========================== - -Currently, both the mingw (native win32) gcc compiler and MS Visual -Studio 2013 are supported. glibmm can be built with mingw32-gcc using -the gnu autotools (automake, autoconf, libtool). As explicitly stated -in the gtk+ for win32 distribution (http://www.gimp.org/win32/), the -gcc compiler provided by the cygwin distribution should not be used to -build glib/glibmm libraries and/or applications (see the README.win32 -that comes with the gtk+ DLLs). This MIGHT cause conflicts between the -cygwin and msvcrt runtime environments. - -1. Mingw - -The mingw distribution which has been tested with this release is the -following : - -* MinGW-4.1 as the base distribution. - -The bare mingw distribution does not provide the necessary tools (sh, perl, m4 -, autoconf, automake, ..) to run the provided configure script "as is". One -(currently non supported) solution is to use mingw in conjunction with msys, -which is readily available on the mingw website (http://www.mingw.org/). - -The preferred method is to combine the cygwin distribution (for the unix tools -that were mentioned above) with mingw by making sure that the mingw -tools (gcc, ld, dlltool, ..) are called first. - -First, make sure that you have working distribution of the native port -of both libsigc++-2.0.x and glib-2.0 on win32 (see -http://www.gimp.org/win32). If you can't compile a simple glib example -using gcc and `pkg-config --cflags --libs`, you should not even think -about trying to compile glibmm, let alone using precompiled libglibmm -DLLs to port your glibmm application ! - -The configure script can then be called using (as an example) the -following options - -./configure --prefix=/target --build=i386-pc-mingw32 --disable-static - -then - -make -make check -make install - -2. MS Visual Studio 2013 - -Open the glibmm.sln solution file in the MSVC_Net2013 directory. In -the Tools/Options panel, add the appropriate GTK+ include and lib -directories to the Projects and Solutions/VC++ directories, if they -are not in the locations specified by the property sheets, i.e. -$(srcroot)\..\vs12\$(Platform). Build the solution. - -3. Glibmm methods and signals not available on win32 - -All glibmm methods and signals are available on win32. - +Building glibmm on Win32 +=========================== + +Currently, both the mingw (native win32) gcc compiler and MS Visual +Studio 2017 are supported. glibmm can be built with mingw32-gcc using +the gnu autotools (automake, autoconf, libtool). As explicitly stated +in the gtk+ for win32 distribution (http://www.gimp.org/win32/), the +gcc compiler provided by the cygwin distribution should not be used to +build glib/glibmm libraries and/or applications (see the README.win32 +that comes with the gtk+ DLLs). This MIGHT cause conflicts between the +cygwin and msvcrt runtime environments. + +1. Mingw + +The mingw distribution which has been tested with this release is the +following : + +* MinGW-4.1 as the base distribution. + +The bare mingw distribution does not provide the necessary tools (sh, perl, m4 +, autoconf, automake, ..) to run the provided configure script "as is". One +(currently non supported) solution is to use mingw in conjunction with msys, +which is readily available on the mingw website (http://www.mingw.org/). + +The preferred method is to combine the cygwin distribution (for the unix tools +that were mentioned above) with mingw by making sure that the mingw +tools (gcc, ld, dlltool, ..) are called first. + +First, make sure that you have working distribution of the native port +of both libsigc++-3.0.x and glib-2.0 on win32 (see +http://www.gimp.org/win32). If you can't compile a simple glib example +using gcc and `pkg-config --cflags --libs`, you should not even think +about trying to compile glibmm, let alone using precompiled libglibmm +DLLs to port your glibmm application ! + +The configure script can then be called using (as an example) the +following options + +./configure --prefix=/target --build=i386-pc-mingw32 --disable-static + +then + +make +make check +make install + +2. MS Visual Studio 2017 + +Open the glibmm.sln solution file in the MSVC_Net2017 directory. In +the Tools/Options panel, add the appropriate GTK+ include and lib +directories to the Projects and Solutions/VC++ directories, if they +are not in the locations specified by the property sheets, i.e. +$(srcroot)\..\vs15\$(Platform). Build the solution. + +3. Glibmm methods and signals not available on win32 + +All glibmm methods and signals are available on win32. + diff --git a/build/dk-feature.m4 b/build/dk-feature.m4 index 5a36b10..8065441 100644 --- a/build/dk-feature.m4 +++ b/build/dk-feature.m4 @@ -13,7 +13,8 @@ ## for more details. ## ## You should have received a copy of the GNU General Public License along -## with danielk's Autostuff. If not, see . +## with danielk's Autostuff; if not, write to the Free Software Foundation, +## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #serial 20110910 diff --git a/configure.ac b/configure.ac index c20e778..1e1598c 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.54.1], +AC_INIT([glibmm], [2.55.1], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -31,8 +31,8 @@ AM_MAINTAINER_MODE AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I ]) MM_PREREQ([0.9.10]) -MM_INIT_MODULE([glibmm-2.4]) -MM_INIT_MODULE([giomm-2.4]) +MM_INIT_MODULE([glibmm-2.56]) +MM_INIT_MODULE([giomm-2.56]) # Copy the mm-common .pl scripts into docs/, # and use them from there, @@ -43,7 +43,7 @@ MM_CONFIG_DOCTOOL_DIR([docs]) AC_SUBST([LIBGLIBMM_SO_VERSION], [4:0:3]) AC_PROG_CXX -MM_AX_CXX_COMPILE_STDCXX([11], [noext],[mandatory]) +MM_AX_CXX_COMPILE_STDCXX([14], [noext],[mandatory]) AC_DISABLE_STATIC LT_INIT([win32-dll]) @@ -82,9 +82,9 @@ AS_IF([test "x$enable_static" = xyes], AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library]) ]) -glibreq='2.0 >= 2.50.0' +glibreq='2.0 >= 2.53.2' -GLIBMM_MODULES="sigc++-2.0 >= 2.9.1 glib-$glibreq gobject-$glibreq gmodule-$glibreq" +GLIBMM_MODULES="sigc++-3.0 >= 2.99.5 glib-$glibreq gobject-$glibreq gmodule-$glibreq" GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq" test "x$glibmm_host_windows" = xyes || GIOMM_MODULES="$GIOMM_MODULES gio-unix-$glibreq" @@ -134,10 +134,16 @@ MM_ARG_WITH_TAGFILE_DOC([libsigc++-2.0.tag], [sigc++-2.0]) # Check whether --enable-debug-refcounting was given. GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING +glibmm_warnings_fatal='-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow -Wno-long-long' # Evaluate the --enable-warnings=level option. MM_ARG_ENABLE_WARNINGS([GLIBMM_WXXFLAGS], [-Wall], - [-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow -Wno-long-long], + [$glibmm_warnings_fatal], + [G SIGCXX]) + +MM_ARG_ENABLE_WARNINGS([GLIBMM_INTERFACE_TEST_WXXFLAGS], + [-Wall], + [$glibmm_warnings_fatal -Wno-unused-function], [G SIGCXX]) # Offer the ability to omit some API from the library, @@ -169,12 +175,12 @@ AC_CONFIG_FILES([Makefile examples/Makefile docs/Makefile docs/reference/Doxyfile - MSVC_Net2013/glibmm/glibmm.rc - MSVC_Net2013/giomm/giomm.rc]) + MSVC_Net2017/glibmm/glibmm.rc + MSVC_Net2017/giomm/giomm.rc]) # Copy the generated configuration headers into the MSVC project directories. -AC_CONFIG_COMMANDS([MSVC_Net2013/glibmm/glibmmconfig.h], - [cp -f glib/glibmmconfig.h MSVC_Net2013/glibmm/glibmmconfig.h]) -AC_CONFIG_COMMANDS([MSVC_Net2013/giomm/giommconfig.h], - [cp -f gio/giommconfig.h MSVC_Net2013/giomm/giommconfig.h]) +AC_CONFIG_COMMANDS([MSVC_Net2017/glibmm/glibmmconfig.h], + [cp -f glib/glibmmconfig.h MSVC_Net2017/glibmm/glibmmconfig.h]) +AC_CONFIG_COMMANDS([MSVC_Net2017/giomm/giommconfig.h], + [cp -f gio/giommconfig.h MSVC_Net2017/giomm/giommconfig.h]) AC_OUTPUT diff --git a/docs/Makefile_web.am_fragment b/docs/Makefile_web.am_fragment index 9ac3ad8..dd59ab9 100644 --- a/docs/Makefile_web.am_fragment +++ b/docs/Makefile_web.am_fragment @@ -1,8 +1,8 @@ web_host = gtkmm.org -web_path_gtkmm = /home/murrayc/gtkmm.org/docs/glibmm-2.4/ -#web_path_gtkmm = /home/groups/g/gt/gtkmm/htdocs/docs/glibmm-2.4/ +web_path_gtkmm = /home/murrayc/gtkmm.org/docs/glibmm-2.56/ +#web_path_gtkmm = /home/groups/g/gt/gtkmm/htdocs/docs/glibmm-2.56/ web_path_docs = $(web_path_gtkmm)docs/ rsync_args = -vz --rsh ssh -gtkmm_docdir = $(datadir)/doc/glibmm-2.4/docs +gtkmm_docdir = $(datadir)/doc/glibmm-2.56/docs diff --git a/examples/Makefile.am b/examples/Makefile.am index 0de871a..a32cfb8 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -32,11 +32,9 @@ check_PROGRAMS = \ options/example \ properties/example \ regex/example \ - settings/settings \ - thread/dispatcher \ - thread/dispatcher2 \ - thread/thread \ - thread/threadpool + settings/settings \ + thread/dispatcher \ + thread/dispatcher2 glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib) giomm_includes = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio) @@ -51,7 +49,6 @@ local_libgiomm = $(top_builddir)/gio/giomm/libgiomm-$(GIOMM_API_VERSION).la LDADD = $(GLIBMM_LIBS) $(local_libglibmm) giomm_ldadd = $(GIOMM_LIBS) $(local_libglibmm) $(local_libgiomm) -thread_ldadd = $(GLIBMM_LIBS) $(local_libglibmm) child_watch_child_watch_SOURCES = child_watch/main.cc iochannel_stream_example_SOURCES = \ @@ -68,13 +65,7 @@ properties_example_SOURCES = properties/properties_example.cc regex_example_SOURCES = regex/main.cc thread_dispatcher_SOURCES = thread/dispatcher.cc -thread_dispatcher_LDADD = $(thread_ldadd) thread_dispatcher2_SOURCES = thread/dispatcher2.cc -thread_dispatcher2_LDADD = $(thread_ldadd) -thread_thread_SOURCES = thread/thread.cc -thread_thread_LDADD = $(thread_ldadd) -thread_threadpool_SOURCES = thread/threadpool.cc -thread_threadpool_LDADD = $(thread_ldadd) # giomm examples dbus_session_bus_service_SOURCES = dbus/session_bus_service.cc diff --git a/examples/child_watch/main.cc b/examples/child_watch/main.cc index 8051db3..a995f5a 100644 --- a/examples/child_watch/main.cc +++ b/examples/child_watch/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,7 +25,7 @@ using namespace std; class ChildWatch : public sigc::trackable { public: - ChildWatch(const Glib::RefPtr& mainLoop) : m_mainLoop(mainLoop) {} + explicit ChildWatch(const Glib::RefPtr& mainLoop) : m_mainLoop(mainLoop) {} void on_child_exited(GPid pid, int status); void run(); // fork a child and call signal_child_watch diff --git a/examples/compose/main.cc b/examples/compose/main.cc index 48aa8d9..79952bb 100644 --- a/examples/compose/main.cc +++ b/examples/compose/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/examples/dbus/client_bus_listnames.cc b/examples/dbus/client_bus_listnames.cc index 9b7bd95..a0d22fb 100644 --- a/examples/dbus/client_bus_listnames.cc +++ b/examples/dbus/client_bus_listnames.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -84,7 +85,7 @@ main(int, char**) loop = Glib::MainLoop::create(); // Get the user session bus connection. - auto connection = Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION); + auto connection = Gio::DBus::Connection::get_sync(Gio::DBus::BusType::SESSION); // Check for an unavailable connection. if (!connection) diff --git a/examples/dbus/server_without_bus.cc b/examples/dbus/server_without_bus.cc index 6474133..a4a99bb 100644 --- a/examples/dbus/server_without_bus.cc +++ b/examples/dbus/server_without_bus.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This is a basic server providing a clock like functionality. Clients can @@ -123,7 +124,8 @@ on_server_new_connection(const Glib::RefPtr& connection) std::cout << "Client connected." << std::endl << "Peer credentials: " << credentials_str << std::endl << "Negotiated capabilities: unix-fd-passing=" - << (connection->get_capabilities() & Gio::DBus::CAPABILITY_FLAGS_UNIX_FD_PASSING) + << ((connection->get_capabilities() & Gio::DBus::CapabilityFlags::UNIX_FD_PASSING) + == Gio::DBus::CapabilityFlags::UNIX_FD_PASSING) << std::endl; // If there is already an active connection, do not accept this new one. @@ -192,7 +194,7 @@ main(int, char**) std::cout << "Server is listening at: " << server->get_client_address() << "." << std::endl; - server->signal_new_connection().connect(sigc::ptr_fun(&on_server_new_connection)); + server->signal_new_connection().connect(sigc::ptr_fun(&on_server_new_connection), false); // Keep the server running until the process is killed: auto loop = Glib::MainLoop::create(); diff --git a/examples/dbus/session_bus_service.cc b/examples/dbus/session_bus_service.cc index 444b6e6..1c137a0 100644 --- a/examples/dbus/session_bus_service.cc +++ b/examples/dbus/session_bus_service.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This is a basic server providing a clock like functionality. Clients can @@ -156,7 +157,7 @@ main(int, char**) return 1; } - const auto id = Gio::DBus::own_name(Gio::DBus::BUS_TYPE_SESSION, "org.glibmm.DBusExample", + const auto id = Gio::DBus::own_name(Gio::DBus::BusType::SESSION, "org.glibmm.DBusExample", sigc::ptr_fun(&on_bus_acquired), sigc::ptr_fun(&on_name_acquired), sigc::ptr_fun(&on_name_lost)); diff --git a/examples/iochannel_stream/fdstream.cc b/examples/iochannel_stream/fdstream.cc index d3e5647..51b6c3e 100644 --- a/examples/iochannel_stream/fdstream.cc +++ b/examples/iochannel_stream/fdstream.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "fdstream.h" diff --git a/examples/iochannel_stream/fdstream.h b/examples/iochannel_stream/fdstream.h index fdfd3f3..1928344 100644 --- a/examples/iochannel_stream/fdstream.h +++ b/examples/iochannel_stream/fdstream.h @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* diff --git a/examples/iochannel_stream/main.cc b/examples/iochannel_stream/main.cc index d9f8944..8234ccd 100644 --- a/examples/iochannel_stream/main.cc +++ b/examples/iochannel_stream/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -43,7 +44,7 @@ Glib::RefPtr mainloop; bool MyCallback(Glib::IOCondition io_condition) { - if ((io_condition & Glib::IO_IN) == 0) + if ((io_condition & Glib::IOCondition::IN) != Glib::IOCondition::IN) { std::cerr << "Invalid fifo response" << std::endl; } @@ -88,7 +89,7 @@ int main(/* int argc, char *argv[] */) } input_stream.attach(read_fd); - input_stream.connect(sigc::ptr_fun(MyCallback), Glib::IO_IN); + input_stream.connect(sigc::ptr_fun(MyCallback), Glib::IOCondition::IN); // and last but not least - run the application main loop mainloop->run(); diff --git a/examples/keyfile/main.cc b/examples/keyfile/main.cc index c75719d..e4ddae7 100644 --- a/examples/keyfile/main.cc +++ b/examples/keyfile/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/examples/markup/parser.cc b/examples/markup/parser.cc index 7cd5b94..9caaaf8 100644 --- a/examples/markup/parser.cc +++ b/examples/markup/parser.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/examples/network/resolver.cc b/examples/network/resolver.cc index 5aedb63..d838213 100644 --- a/examples/network/resolver.cc +++ b/examples/network/resolver.cc @@ -13,8 +13,10 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. */ #ifndef _WIN32 @@ -87,7 +89,7 @@ print_resolved_name(const Glib::ustring& phys, const Glib::ustring& name) static void print_resolved_addresses( - const Glib::ustring& name, const std::list>& addresses) + const Glib::ustring& name, const std::vector>& addresses) { std::lock_guard lock_guard(response_mutex); std::cout << Glib::ustring::compose("Name: %1\n", name); @@ -101,7 +103,7 @@ print_resolved_addresses( } static void -print_resolved_service(const Glib::ustring& service, const std::list& targets) +print_resolved_service(const Glib::ustring& service, const std::vector& targets) { std::lock_guard lock_guard(response_mutex); std::cout << Glib::ustring::compose("Service: %1\n", service); @@ -172,11 +174,9 @@ lookup_one_sync(const Glib::ustring& arg) } else { - std::list> addresses; - try { - addresses = resolver->lookup_by_name(arg, cancellable); + const auto addresses = resolver->lookup_by_name(arg, cancellable); print_resolved_addresses(arg, addresses); } catch (const Gio::ResolverError& err) @@ -287,7 +287,7 @@ static void print_connectable_sockaddr(Glib::RefPtr sockaddr) { Glib::ustring phys; - auto isa = Glib::RefPtr::cast_dynamic(sockaddr); + auto isa = std::dynamic_pointer_cast(sockaddr); if (!isa) { @@ -466,7 +466,7 @@ main(int argc, char** argv) signal(SIGINT, interrupted); chan = Glib::IOChannel::create_from_fd(cancel_fds[0]); - const auto source = chan->create_watch(Glib::IO_IN); + const auto source = chan->create_watch(Glib::IOCondition::IN); watch_conn = source->connect(sigc::bind(sigc::ptr_fun(async_cancel), cancellable)); #endif diff --git a/examples/network/socket-client.cc b/examples/network/socket-client.cc index c364d9b..aacbd6b 100644 --- a/examples/network/socket-client.cc +++ b/examples/network/socket-client.cc @@ -68,7 +68,7 @@ socket_address_to_string(const Glib::RefPtr& address) Glib::ustring str, res; int port; - auto isockaddr = Glib::RefPtr::cast_dynamic(address); + auto isockaddr = std::dynamic_pointer_cast(address); if (!isockaddr) return Glib::ustring(); inet_address = isockaddr->get_address(); @@ -128,7 +128,7 @@ cancel_thread(Glib::RefPtr cancellable) class JoinAndDelete { public: - void operator()(std::thread* thread) + void operator()(std::thread* thread) const { stop_thread = true; cond_thread.notify_all(); @@ -145,7 +145,7 @@ main(int argc, char* argv[]) Glib::RefPtr socket; Glib::RefPtr src_address; Glib::RefPtr address; - Gio::SocketType socket_type; + Gio::Socket::Type socket_type; Gio::SocketFamily socket_family; Glib::RefPtr cancellable; Glib::RefPtr enumerator; @@ -188,12 +188,12 @@ main(int argc, char* argv[]) loop = Glib::MainLoop::create(); - socket_type = use_udp ? Gio::SOCKET_TYPE_DATAGRAM : Gio::SOCKET_TYPE_STREAM; - socket_family = use_ipv6 ? Gio::SOCKET_FAMILY_IPV6 : Gio::SOCKET_FAMILY_IPV4; + socket_type = use_udp ? Gio::Socket::Type::DATAGRAM : Gio::Socket::Type::STREAM; + socket_family = use_ipv6 ? Gio::SocketFamily::IPV6 : Gio::SocketFamily::IPV4; try { - socket = Gio::Socket::create(socket_family, socket_type, Gio::SOCKET_PROTOCOL_DEFAULT); + socket = Gio::Socket::create(socket_family, socket_type, Gio::Socket::Protocol::DEFAULT); } catch (const Gio::Error& error) { @@ -272,7 +272,7 @@ main(int argc, char* argv[]) buffer[to_send] = '\0'; while (to_send > 0) { - ensure_condition(socket, "send", cancellable, Glib::IO_OUT); + ensure_condition(socket, "send", cancellable, Glib::IOCondition::OUT); try { if (use_udp) @@ -305,7 +305,7 @@ main(int argc, char* argv[]) to_send -= size; } - ensure_condition(socket, "receive", cancellable, Glib::IO_IN); + ensure_condition(socket, "receive", cancellable, Glib::IOCondition::IN); try { if (use_udp) diff --git a/examples/network/socket-server.cc b/examples/network/socket-server.cc index fb9d6ea..59dd115 100644 --- a/examples/network/socket-server.cc +++ b/examples/network/socket-server.cc @@ -75,7 +75,7 @@ public: Glib::ustring socket_address_to_string(const Glib::RefPtr& address) { - auto isockaddr = Glib::RefPtr::cast_dynamic(address); + auto isockaddr = std::dynamic_pointer_cast(address); if (!isockaddr) return Glib::ustring(); @@ -134,7 +134,7 @@ cancel_thread(Glib::RefPtr cancellable) class JoinAndDelete { public: - void operator()(std::thread* thread) + void operator()(std::thread* thread) const { stop_thread = true; cond_thread.notify_all(); @@ -176,12 +176,12 @@ main(int argc, char* argv[]) loop = Glib::MainLoop::create(); - auto socket_type = use_udp ? Gio::SOCKET_TYPE_DATAGRAM : Gio::SOCKET_TYPE_STREAM; - auto socket_family = use_ipv6 ? Gio::SOCKET_FAMILY_IPV6 : Gio::SOCKET_FAMILY_IPV4; + auto socket_type = use_udp ? Gio::Socket::Type::DATAGRAM : Gio::Socket::Type::STREAM; + auto socket_family = use_ipv6 ? Gio::SocketFamily::IPV6 : Gio::SocketFamily::IPV4; try { - socket = Gio::Socket::create(socket_family, socket_type, Gio::SOCKET_PROTOCOL_DEFAULT); + socket = Gio::Socket::create(socket_family, socket_type, Gio::Socket::Protocol::DEFAULT); } catch (const Gio::Error& error) { @@ -218,7 +218,7 @@ main(int argc, char* argv[]) std::cout << Glib::ustring::compose("listening on port %1...\n", port); - ensure_condition(socket, "accept", cancellable, Glib::IO_IN); + ensure_condition(socket, "accept", cancellable, Glib::IOCondition::IN); try { new_socket = socket->accept(cancellable); @@ -257,7 +257,7 @@ main(int argc, char* argv[]) gchar buffer[4096] = {}; gssize size; - ensure_condition(recv_socket, "receive", cancellable, Glib::IO_IN); + ensure_condition(recv_socket, "receive", cancellable, Glib::IOCondition::IN); try { if (use_udp) @@ -289,7 +289,7 @@ main(int argc, char* argv[]) while (to_send > 0) { - ensure_condition(recv_socket, "send", cancellable, Glib::IO_OUT); + ensure_condition(recv_socket, "send", cancellable, Glib::IOCondition::OUT); try { if (use_udp) diff --git a/examples/options/main.cc b/examples/options/main.cc index c4536cd..c0973ad 100644 --- a/examples/options/main.cc +++ b/examples/options/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,9 +25,9 @@ public: ExampleOptionGroup(); private: - bool on_pre_parse(Glib::OptionContext& context, Glib::OptionGroup& group) override; - bool on_post_parse(Glib::OptionContext& context, Glib::OptionGroup& group) override; - void on_error(Glib::OptionContext& context, Glib::OptionGroup& group) override; + bool on_pre_parse(Glib::OptionContext& context) override; + bool on_post_parse(Glib::OptionContext& context) override; + void on_error(Glib::OptionContext& context, const Glib::Error& error) override; bool on_option_arg_string( const Glib::ustring& option_name, const Glib::ustring& value, bool has_value); @@ -88,7 +89,7 @@ ExampleOptionGroup::ExampleOptionGroup() entry6.set_long_name("x-string"); entry6.set_short_name('x'); entry6.set_description("A string with custom parsing"); - entry6.set_flags(Glib::OptionEntry::FLAG_OPTIONAL_ARG); + entry6.set_flags(Glib::OptionEntry::Flags::OPTIONAL_ARG); m_arg_x_string = "not specified"; add_entry(entry6, sigc::mem_fun(*this, &ExampleOptionGroup::on_option_arg_string)); @@ -96,7 +97,7 @@ ExampleOptionGroup::ExampleOptionGroup() entry7.set_long_name("x-filename"); entry7.set_short_name('X'); entry7.set_description("A filename with custom parsing"); - entry7.set_flags(Glib::OptionEntry::FLAG_OPTIONAL_ARG); + entry7.set_flags(Glib::OptionEntry::Flags::OPTIONAL_ARG); m_arg_x_filename = "not specified"; add_entry_filename(entry7, sigc::mem_fun(*this, &ExampleOptionGroup::on_option_arg_filename)); @@ -107,7 +108,7 @@ ExampleOptionGroup::ExampleOptionGroup() } bool -ExampleOptionGroup::on_pre_parse(Glib::OptionContext& /* context */, Glib::OptionGroup& /* group */) +ExampleOptionGroup::on_pre_parse(Glib::OptionContext& /* context */) { // This is called before the m_arg_* instances are given their values. // You do not need to override this method. This is just here to show you how, @@ -118,7 +119,7 @@ ExampleOptionGroup::on_pre_parse(Glib::OptionContext& /* context */, Glib::Optio bool ExampleOptionGroup::on_post_parse( - Glib::OptionContext& /* context */, Glib::OptionGroup& /* group */) + Glib::OptionContext& /* context */) { // This is called after the m_arg_* instances are given their values. // You do not need to override this method. This is just here to show you how, @@ -128,7 +129,7 @@ ExampleOptionGroup::on_post_parse( } void -ExampleOptionGroup::on_error(Glib::OptionContext& /* context */, Glib::OptionGroup& /* group */) +ExampleOptionGroup::on_error(Glib::OptionContext& /* context */, const Glib::Error& /* error */) { std::cout << "on_error called" << std::endl; } diff --git a/examples/properties/properties_example.cc b/examples/properties/properties_example.cc index 0d6c336..98ef1ee 100644 --- a/examples/properties/properties_example.cc +++ b/examples/properties/properties_example.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/examples/regex/main.cc b/examples/regex/main.cc index 94fd059..e634fe5 100644 --- a/examples/regex/main.cc +++ b/examples/regex/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/examples/thread/thread.cc b/examples/thread/thread.cc deleted file mode 100644 index 7af2735..0000000 --- a/examples/thread/thread.cc +++ /dev/null @@ -1,126 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) && (_MSC_VER < 1900) -/* For using noexcept on Visual Studio 2013 */ -#include -#endif -#include -#include -#include - -namespace -{ - -class MessageQueue -{ -public: - MessageQueue(); - ~MessageQueue(); - - void producer(); - void consumer(); - -private: - std::mutex mutex_; - std::condition_variable cond_push_; - std::condition_variable cond_pop_; - std::queue queue_; -}; - -MessageQueue::MessageQueue() -{ -} - -MessageQueue::~MessageQueue() -{ -} - -void -MessageQueue::producer() -{ - Glib::Rand rand(1234); - - for (auto i = 0; i < 200; ++i) - { - { - std::unique_lock lock(mutex_); - - cond_pop_.wait(lock, [this]() -> bool { return queue_.size() < 64; }); - - queue_.push(i); - std::cout << '*'; - std::cout.flush(); - - // We unlock before notifying, because that is what the documentation suggests: - // http://en.cppreference.com/w/cpp/thread/condition_variable - lock.unlock(); - cond_push_.notify_one(); - } - - if (rand.get_bool()) - continue; - - Glib::usleep(rand.get_int_range(0, 100000)); - } -} - -void -MessageQueue::consumer() -{ - Glib::Rand rand(4567); - - for (;;) - { - { - std::unique_lock lock(mutex_); - - cond_push_.wait(lock, [this]() -> bool { return !queue_.empty(); }); - - const int i = queue_.front(); - queue_.pop(); - std::cout << "\x08 \x08"; - std::cout.flush(); - - // We unlock before notifying, because that is what the documentation suggests: - // http://en.cppreference.com/w/cpp/thread/condition_variable - lock.unlock(); - cond_pop_.notify_one(); - - if (i >= 199) - break; - } - - if (rand.get_bool()) - continue; - - Glib::usleep(rand.get_int_range(10000, 200000)); - } -} -} - -int -main(int, char**) -{ - Glib::init(); - - MessageQueue queue; - - // TODO: Use std::make_unique() when we use C++14: - const auto producer = - std::unique_ptr(new std::thread(&MessageQueue::producer, &queue)); - - const auto consumer = - std::unique_ptr(new std::thread(&MessageQueue::consumer, &queue)); - - producer->join(); - consumer->join(); - - std::cout << std::endl; - - return 0; -} diff --git a/examples/thread/threadpool.cc b/examples/thread/threadpool.cc deleted file mode 100644 index 885962b..0000000 --- a/examples/thread/threadpool.cc +++ /dev/null @@ -1,68 +0,0 @@ - -#include -#include -#include - -// TODO: Remove this example sometime. Glib::ThreadPool is deprecated. -// TODO: Maybe use std::async() instead? -#undef GLIBMM_DISABLE_DEPRECATED - -#include - -#ifdef GLIBMM_DISABLE_DEPRECATED -int -main(int, char**) -{ - // If glibmm is configured with --disable-deprecated-api, - // GLIBMM_DISABLE_DEPRECATED is defined in glibmmconfig.h. - std::cout << "Glib::ThreadPool not available because deprecated API has been disabled." - << std::endl; - return 77; // Tell automake's test harness to skip this test. -} - -#else - -#include -#include -#include - -namespace -{ - -std::mutex mutex; - -void -print_char(char c) -{ - Glib::Rand rand; - - for (auto i = 0; i < 100; ++i) - { - { - std::lock_guard lock(mutex); - std::cout << c; - std::cout.flush(); - } - Glib::usleep(rand.get_int_range(10000, 100000)); - } -} - -} // anonymous namespace - -int -main(int, char**) -{ - Glib::ThreadPool pool(10); - - for (auto c = 'a'; c <= 'z'; ++c) - { - pool.push(sigc::bind(sigc::ptr_fun(&print_char), c)); - } - - pool.shutdown(); - - std::cout << std::endl; - - return 0; -} -#endif // GLIBMM_DISABLE_DEPRECATED diff --git a/gio/giomm.h b/gio/giomm.h index 0787057..d39df60 100644 --- a/gio/giomm.h +++ b/gio/giomm.h @@ -16,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -71,6 +72,9 @@ #include #include #include +#ifndef G_OS_WIN32 +#include +#endif #include #include #include @@ -107,6 +111,7 @@ #include #include #include +#include #include #include #include diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc index cf37c46..816f5b9 100644 --- a/gio/giomm/contenttype.cc +++ b/gio/giomm/contenttype.cc @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,10 +13,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include #include namespace Gio @@ -116,17 +120,17 @@ content_type_guess(const std::string& filename, const std::string& data, bool& r return Glib::convert_return_gchar_ptr_to_ustring(cresult); } -Glib::StringArrayHandle +std::vector content_type_guess_for_tree(const Glib::RefPtr& root) { - return Glib::StringArrayHandle( + return Glib::ArrayHandler::array_to_vector( g_content_type_guess_for_tree(const_cast(root->gobj())), Glib::OWNERSHIP_DEEP); } -Glib::ListHandle +std::vector content_types_get_registered() { - return Glib::ListHandle(g_content_types_get_registered(), Glib::OWNERSHIP_DEEP); + return Glib::ListHandler::list_to_vector(g_content_types_get_registered(), Glib::OWNERSHIP_DEEP); } } // namespace Gio diff --git a/gio/giomm/contenttype.h b/gio/giomm/contenttype.h index de1821b..c9516a6 100644 --- a/gio/giomm/contenttype.h +++ b/gio/giomm/contenttype.h @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,13 +13,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GIOMM_CONTENTTYPE_H #define _GIOMM_CONTENTTYPE_H #include -#include #include #include #include @@ -169,7 +171,7 @@ Glib::ustring content_type_guess( * * @newin{2,18} */ -Glib::StringArrayHandle content_type_guess_for_tree(const Glib::RefPtr& root); +std::vector content_type_guess_for_tree(const Glib::RefPtr& root); /** * Gets a list of strings containing all the registered content types @@ -177,7 +179,7 @@ Glib::StringArrayHandle content_type_guess_for_tree(const Glib::RefPtr content_types_get_registered(); +std::vector content_types_get_registered(); /** @} group giommContentType */ diff --git a/gio/giomm/init.cc b/gio/giomm/init.cc index 32c2892..a00c3b4 100644 --- a/gio/giomm/init.cc +++ b/gio/giomm/init.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "init.h" diff --git a/gio/giomm/init.h b/gio/giomm/init.h index 345e819..a7e69e2 100644 --- a/gio/giomm/init.h +++ b/gio/giomm/init.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GIOMM_INIT_H #define _GIOMM_INIT_H @@ -18,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Gio diff --git a/gio/giomm/slot_async.cc b/gio/giomm/slot_async.cc index 4f2b6e2..06dc7c5 100644 --- a/gio/giomm/slot_async.cc +++ b/gio/giomm/slot_async.cc @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "slot_async.h" diff --git a/gio/giomm/slot_async.h b/gio/giomm/slot_async.h index 228e1c9..ba840e1 100644 --- a/gio/giomm/slot_async.h +++ b/gio/giomm/slot_async.h @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/giomm/socketsource.cc b/gio/giomm/socketsource.cc index af1e974..7624913 100644 --- a/gio/giomm/socketsource.cc +++ b/gio/giomm/socketsource.cc @@ -31,7 +31,7 @@ giomm_generic_socket_callback(sigc::slot_base* slot, GIOCondition condition) try { // Recreate the specific slot from the generic slot node. - return (*static_cast*>(slot))((Glib::IOCondition)condition); + return (*static_cast*>(slot))((Glib::IOCondition)condition); } catch (...) { @@ -66,7 +66,7 @@ inline SignalSocket::SignalSocket(GMainContext* context) : context_(context) } sigc::connection -SignalSocket::connect(const sigc::slot& slot, +SignalSocket::connect(const sigc::slot& slot, const Glib::RefPtr& socket, Glib::IOCondition condition, const Glib::RefPtr& cancellable, int priority) { @@ -89,7 +89,15 @@ Glib::RefPtr SocketSource::create(const Glib::RefPtr& socket, Glib::IOCondition condition, const Glib::RefPtr& cancellable) { - return Glib::RefPtr(new SocketSource(socket, condition, cancellable)); + return Glib::make_refptr_for_instance(new SocketSource(socket, condition, cancellable)); +} + +// static +Glib::RefPtr +SocketSource::create(GSocket* socket, Glib::IOCondition condition, + const Glib::RefPtr& cancellable) +{ + return Glib::make_refptr_for_instance(new SocketSource(socket, condition, cancellable)); } SocketSource::SocketSource(const Glib::RefPtr& socket, Glib::IOCondition condition, @@ -100,6 +108,14 @@ SocketSource::SocketSource(const Glib::RefPtr& socket, Glib::IOCondition { } +SocketSource::SocketSource(GSocket* socket, Glib::IOCondition condition, + const Glib::RefPtr& cancellable) +: IOSource( + g_socket_create_source(socket, (GIOCondition)condition, Glib::unwrap(cancellable)), + (GSourceFunc)&giomm_socketsource_callback) +{ +} + SocketSource::~SocketSource() noexcept { } diff --git a/gio/giomm/socketsource.h b/gio/giomm/socketsource.h index c1345c6..2b371c6 100644 --- a/gio/giomm/socketsource.h +++ b/gio/giomm/socketsource.h @@ -23,6 +23,10 @@ #include #include +#ifndef DOXYGEN_SHOULD_SKIP_THIS +using GSocket = struct _GSocket; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + namespace Gio { class Socket; @@ -69,7 +73,7 @@ public: * @param priority The priority of the new event source. * @return A connection handle, which can be used to disconnect the handler. */ - sigc::connection connect(const sigc::slot& slot, + sigc::connection connect(const sigc::slot& slot, const Glib::RefPtr& socket, Glib::IOCondition condition, const Glib::RefPtr& cancellable = Glib::RefPtr(), int priority = Glib::PRIORITY_DEFAULT); @@ -106,10 +110,23 @@ public: Glib::IOCondition condition, const Glib::RefPtr& cancellable = Glib::RefPtr()); + protected: SocketSource(const Glib::RefPtr& socket, Glib::IOCondition condition, const Glib::RefPtr& cancellable); ~SocketSource() noexcept override; + +private: + friend Socket; + + // This is just to avoid the need for Gio::Socket to create a RefPtr<> to itself. + static Glib::RefPtr create(GSocket* socket, + Glib::IOCondition condition, + const Glib::RefPtr& cancellable = Glib::RefPtr()); + + // This is just to avoid the need for Gio::Socket to create a RefPtr<> to itself. + SocketSource(GSocket* socket, Glib::IOCondition condition, + const Glib::RefPtr& cancellable); }; } // namespace Gio diff --git a/gio/giomm/wrap_init.h b/gio/giomm/wrap_init.h index cb7d947..cb9de97 100644 --- a/gio/giomm/wrap_init.h +++ b/gio/giomm/wrap_init.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GIOMM_WRAP_INIT_H #define _GIOMM_WRAP_INIT_H @@ -16,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Gio diff --git a/gio/src/action.ccg b/gio/src/action.ccg index 71715d3..c5a1735 100644 --- a/gio/src/action.ccg +++ b/gio/src/action.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2011 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/action.hg b/gio/src/action.hg index 206f26f..067a230 100644 --- a/gio/src/action.hg +++ b/gio/src/action.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -95,10 +96,7 @@ public: template void get_state_hint(T_Value& value) const; - //TODO: When we can break ABI, Return a Glib::VariantContainerBase, - // as we already do for ActionGroup::get_action_state_hint(), - // because that is what this returns (to specify a range). - _WRAP_METHOD(Glib::VariantBase get_state_hint_variant() const, g_action_get_state_hint) + _WRAP_METHOD(Glib::VariantContainerBase get_state_hint_variant() const, g_action_get_state_hint) _WRAP_METHOD(bool get_enabled() const, g_action_get_enabled) @@ -127,8 +125,6 @@ public: _WRAP_METHOD(void change_state_variant(const Glib::VariantBase& value), g_action_change_state) - _WRAP_METHOD(void change_state(const Glib::VariantBase& value), g_action_change_state, deprecated "Use the templated method instead, passing a normal C++ type.") - /** Queries the current state of the action. * * If the action is not stateful then a null Variant will be returned. If the @@ -165,8 +161,6 @@ public: _WRAP_METHOD(void activate_variant(const Glib::VariantBase& parameter), g_action_activate) - _WRAP_METHOD(void activate(const Glib::VariantBase& parameter), g_action_activate, deprecated "Use the templated method instead, passing a normal C++ type.") - _WRAP_METHOD(static bool name_is_valid(const Glib::ustring& action_name), g_action_name_is_valid ) /** Parses a detailed action name into its separate name and target components. diff --git a/gio/src/actiongroup.ccg b/gio/src/actiongroup.ccg index 63caf51..35feb3a 100644 --- a/gio/src/actiongroup.ccg +++ b/gio/src/actiongroup.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/actiongroup.hg b/gio/src/actiongroup.hg index 2c40a16..6d250ba 100644 --- a/gio/src/actiongroup.hg +++ b/gio/src/actiongroup.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -74,9 +75,6 @@ public: _WRAP_METHOD(Glib::VariantType get_action_parameter_type(const Glib::ustring& action_name) const, g_action_group_get_action_parameter_type) _WRAP_METHOD(Glib::VariantType get_action_state_type(const Glib::ustring& action_name) const, g_action_group_get_action_state_type) - - _WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint(const Glib::ustring& action_name) const, g_action_group_get_action_state_hint, deprecated "Use the get_action_state() method that takes an output parameter instead.") - //TODO: How do we check for a nullptr Variant? /** * Requests a hint about the valid range of values for the state of the @@ -103,9 +101,6 @@ public: _WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint_variant(const Glib::ustring& action_name) const, g_action_group_get_action_state_hint) - - _WRAP_METHOD(Glib::VariantBase get_action_state(const Glib::ustring& action_name) const, g_action_group_get_action_state, deprecated "Use the get_action_state() method that takes an output parameter instead.") - //TODO: How do we check for a nullptr Variant? /** Queries the current state of the named action within the action group. * @@ -134,14 +129,13 @@ public: //TODO: Add templated method, renaming this to action_state_changed_variant). _WRAP_METHOD(void action_state_changed (const Glib::ustring& action_name, const Glib::VariantBase& state), g_action_group_action_state_changed) - //TODO: Remove two_signal_methods when we can break ABI. - _WRAP_SIGNAL(void action_added(const Glib::ustring& action_name), "action-added", detail_name action_name, two_signal_methods) - _WRAP_SIGNAL(void action_enabled_changed(const Glib::ustring& action_name, bool enabled), "action-enabled-changed", detail_name action_name, two_signal_methods) - _WRAP_SIGNAL(void action_removed(const Glib::ustring& action_name), "action-removed", detail_name action_name, two_signal_methods) + _WRAP_SIGNAL(void action_added(const Glib::ustring& action_name), "action-added") + _WRAP_SIGNAL(void action_enabled_changed(const Glib::ustring& action_name, bool enabled), "action-enabled-changed") + _WRAP_SIGNAL(void action_removed(const Glib::ustring& action_name), "action-removed") #m4 _CONVERSION(`GVariant*', `const Glib::VariantBase&', `Glib::wrap($3, true)') - _WRAP_SIGNAL(void action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value), "action-state-changed", detail_name action_name, two_signal_methods) + _WRAP_SIGNAL(void action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value), "action-state-changed") _WRAP_VFUNC(bool has_action(const Glib::ustring& name) const, "has_action") diff --git a/gio/src/actionmap.ccg b/gio/src/actionmap.ccg index 01a8d37..2907721 100644 --- a/gio/src/actionmap.ccg +++ b/gio/src/actionmap.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -36,17 +39,6 @@ ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot) return action; } -_DEPRECATE_IFDEF_START -Glib::RefPtr -ActionMap::add_action_with_parameter( - const Glib::ustring& name, const ActivateWithParameterSlot& slot) -{ - auto action = add_action(name); - action->signal_activate().connect(slot); - return action; -} -_DEPRECATE_IFDEF_END - Glib::RefPtr ActionMap::add_action_with_parameter( const Glib::ustring& name, const Glib::VariantType& parameter_type, const ActivateWithParameterSlot& slot) diff --git a/gio/src/actionmap.hg b/gio/src/actionmap.hg index 74b3dd6..871be0e 100644 --- a/gio/src/actionmap.hg +++ b/gio/src/actionmap.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -30,10 +31,6 @@ namespace Gio class Action; -//TODO: Instead derive from ActionGroup, when we can break ABI, -//because the GActionMap interface requires the GActionGroup interface. -//LoadableIcon does a similar thing correctly, for instance. - /** ActionMap - Interface for action containers. * The ActionMap interface is implemented by ActionGroup implementations that * operate by containing a number of named Action instances, such as @@ -58,6 +55,7 @@ public: _WRAP_METHOD(Glib::RefPtr lookup_action(const Glib::ustring& action_name), g_action_map_lookup_action, refreturn) _WRAP_METHOD(Glib::RefPtr lookup_action(const Glib::ustring& action_name) const, g_action_map_lookup_action, constversion, refreturn) + /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. * @@ -73,7 +71,7 @@ public: * For instance, * void on_slot_activated(); */ - using ActivateSlot = sigc::slot; + using ActivateSlot = sigc::slot; /** A convenience method for creating a SimpleAction instance * and adding it to the ActionMap. @@ -92,22 +90,7 @@ public: * For instance, * void on_slot_activated(const Glib::VariantBase& parameter); */ - using ActivateWithParameterSlot = sigc::slot; - -_DEPRECATE_IFDEF_START - /** A convenience method for creating a SimpleAction instance - * and adding it to the ActionMap. - * - * @param name The name of the Action. - * @param slot The callback method to be called when the action is activated. - * @return The Action. - * - * @deprecated This overload does not work as it does not set a parameter - * type on the Action, so activating it with a parameter cannot work. Use the - * other add_action_with_parameter() overload, which takes a parameter type. - */ - Glib::RefPtr add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot); -_DEPRECATE_IFDEF_END + using ActivateWithParameterSlot = sigc::slot; /** A convenience method for creating a SimpleAction instance, which when * activated will call a slot receiving a given type of parameter, and adding @@ -157,7 +140,7 @@ _DEPRECATE_IFDEF_END * For instance, * void on_slot_activated(const Glib::ustring& parameter); */ - using ActivateWithStringParameterSlot = sigc::slot; + using ActivateWithStringParameterSlot = sigc::slot; //TODO: Docs: Add hints about how to specify the various possible states in the GtkBuilder XML. /** A convenience method for creating a string-based radio SimpleAction instance @@ -187,8 +170,8 @@ _DEPRECATE_IFDEF_END * For instance, * void on_slot_activated(int parameter); */ - using ActivateWithIntParameterSlot = sigc::slot; - + using ActivateWithIntParameterSlot = sigc::slot; + //TODO: Docs: Add hints about how to specify the various possible states in the GtkBuilder XML. /** A convenience method for creating an integer-based radio SimpleAction instance * and adding it to the ActionMap. @@ -204,10 +187,9 @@ _DEPRECATE_IFDEF_END #m4 _CONVERSION(`Glib::RefPtr', `GAction*', `Glib::unwrap($3)') _WRAP_VFUNC(Glib::RefPtr lookup_action(const Glib::ustring& name) const, "lookup_action", refreturn) - //TODO: Change this to use const & when we can break ABI. - // ( Changing it causes a symbol lookup error when trying to run already-built applications. ) -#m4 _CONVERSION(`GAction*', `Glib::RefPtr', `Glib::wrap($3, true)') - _WRAP_VFUNC(void add_action(Glib::RefPtr action) const, "add_action") +#m4 _CONVERSION(`GAction*', `const Glib::RefPtr&', `Glib::wrap($3, true)') + _WRAP_VFUNC(void add_action(const Glib::RefPtr& action) const, "add_action") + _WRAP_VFUNC(void remove_action(const Glib::ustring& name), "remove_action") }; diff --git a/gio/src/appinfo.ccg b/gio/src/appinfo.ccg index 35bec45..dc01c85 100644 --- a/gio/src/appinfo.ccg +++ b/gio/src/appinfo.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,11 +13,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include #include #include "slot_async.h" #include @@ -25,7 +27,7 @@ namespace Gio Glib::RefPtr AppInfo::create_from_commandline( - const std::string& commandline, const std::string& application_name, AppInfoCreateFlags flags) + const std::string& commandline, const std::string& application_name, CreateFlags flags) { GAppInfo* capp_info = nullptr; GError* gerror = nullptr; diff --git a/gio/src/appinfo.hg b/gio/src/appinfo.hg index 01d7bcd..ef6c288 100644 --- a/gio/src/appinfo.hg +++ b/gio/src/appinfo.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -25,8 +26,6 @@ _CONFIGINCLUDE(giommconfig.h) #include #include -#include -#include #include //#include #include @@ -42,7 +41,6 @@ typedef struct _GAppInfoIface GAppInfoIface; namespace Gio { -_WRAP_ENUM(AppInfoCreateFlags, GAppInfoCreateFlags, NO_GTYPE) class File; @@ -57,9 +55,11 @@ class AppInfo : public Glib::Interface _CLASS_INTERFACE(AppInfo, GAppInfo, G_APP_INFO, GAppInfoIface) public: + _WRAP_ENUM(CreateFlags, GAppInfoCreateFlags, NO_GTYPE) + static Glib::RefPtr create_from_commandline(const std::string& commandline, const std::string& application_name, - AppInfoCreateFlags flags); + CreateFlags flags); /** Creates a duplicate of this AppInfo. * @return A duplicate of this AppInfo. @@ -155,14 +155,10 @@ public: _WRAP_METHOD(bool supports_uris() const, g_app_info_supports_uris) _WRAP_METHOD(bool supports_files() const, g_app_info_supports_files) -#m4 _CONVERSION(`const Glib::ListHandle&',`GList*',`$3.data()') - _WRAP_METHOD(bool launch_uris(const Glib::ListHandle& uris, - GAppLaunchContext* launch_context), - g_app_info_launch_uris, - errthrow, deprecated "Use the method that takes an AppLaunchContext") + #m4 _CONVERSION(`const std::vector&',`GList*',`Glib::ListHandler::vector_to_list($3).data()') //TODO: I think we use Glib::ustring elsewhere for URIs: - _WRAP_METHOD(bool launch_uris(const Glib::ListHandle& uris, + _WRAP_METHOD(bool launch_uris(const std::vector& uris, const Glib::RefPtr& launch_context{?}), g_app_info_launch_uris, errthrow) @@ -208,15 +204,15 @@ public: g_app_info_remove_supports_type, errthrow) -#m4 _CONVERSION(`const char**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3, Glib::OWNERSHIP_NONE)') - _WRAP_METHOD(Glib::StringArrayHandle get_supported_types() const, g_app_info_get_supported_types) +#m4 _CONVERSION(`const char**', `std::vector', `Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_NONE)') + _WRAP_METHOD(std::vector get_supported_types() const, g_app_info_get_supported_types) _WRAP_METHOD(bool set_as_last_used_for_type(const std::string& content_type), g_app_info_set_as_last_used_for_type, errthrow) -#m4 _CONVERSION(`GList*',`Glib::ListHandle >',`Glib::ListHandle >($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(static Glib::ListHandle > get_all(), g_app_info_get_all) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(static std::vector> get_all(), g_app_info_get_all) - _WRAP_METHOD(static Glib::ListHandle > get_all_for_type(const std::string& content_type), g_app_info_get_all_for_type) + _WRAP_METHOD(static std::vector> get_all_for_type(const std::string& content_type), g_app_info_get_all_for_type) _WRAP_METHOD(static Glib::RefPtr get_default_for_type(const std::string& content_type, bool must_support_uris = true), g_app_info_get_default_for_type) _WRAP_METHOD(static Glib::RefPtr get_default_for_uri_scheme(const std::string& uri_scheme), g_app_info_get_default_for_uri_scheme) _WRAP_METHOD(static void reset_type_associations(const std::string& content_type), g_app_info_reset_type_associations) @@ -235,12 +231,10 @@ protected: //_WRAP_VFUNC(std::string get_description() const, "get_description") //_WRAP_VFUNC(std::string get_executable() const, "get_executable") //_WRAP_VFUNC(Glib::RefPtr get_icon() const, "get_icon") -//#m4 _CONVERSION(`const Glib::ListHandle&',`GList*',`$3.data()') -//#m4 _CONVERSION(`GList*',`const Glib::ListHandle&',`Glib::ListHandle($3, Glib::OWNERSHIP_NONE)') //_WRAP_VFUNC(bool launch(const std::vector& filenames, const Glib::RefPtr& launch_context, GError** error), "launch") //_WRAP_VFUNC(bool supports_uris() const, "supports_uris") //_WRAP_VFUNC(bool supports_files() const, "supports_files") - //_WRAP_VFUNC(bool launch_uris(const Glib::ListHandle& uris, const Glib::RefPtr& launch_context, GError** error), "launch_uris") + //_WRAP_VFUNC(bool launch_uris(const std::vector& uris, const Glib::RefPtr& launch_context, GError** error), "launch_uris") //_WRAP_VFUNC(bool should_show() const, "should_show") //_WRAP_VFUNC(bool set_as_default_for_type(const std::string& content_type, GError** error), "set_as_default_for_type") //_WRAP_VFUNC(bool set_as_default_for_extension(const std::string& extension, GError** error), "set_as_default_for_extension") diff --git a/gio/src/applaunchcontext.ccg b/gio/src/applaunchcontext.ccg index be56159..d0fa26a 100644 --- a/gio/src/applaunchcontext.ccg +++ b/gio/src/applaunchcontext.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/applaunchcontext.hg b/gio/src/applaunchcontext.hg index 3096e8e..cd75aed 100644 --- a/gio/src/applaunchcontext.hg +++ b/gio/src/applaunchcontext.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -19,7 +20,6 @@ #include #include -#include #include //#include #include @@ -54,11 +54,11 @@ public: #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(std::vector get_environment() const, g_app_launch_context_get_environment) -#m4 _CONVERSION(`const Glib::ListHandle&',`GList*',`$3.data()') - _WRAP_METHOD(std::string get_display(const Glib::RefPtr& info, const Glib::ListHandle< Glib::RefPtr >& files), +#m4 _CONVERSION(`const std::vector&',`GList*',`Glib::ListHandler::vector_to_list$3.data()') + _WRAP_METHOD(std::string get_display(const Glib::RefPtr& info, const std::vector>& files), g_app_launch_context_get_display) - _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr& info, const Glib::ListHandle< Glib::RefPtr >& files), + _WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr& info, const std::vector>& files), g_app_launch_context_get_startup_notify_id) _WRAP_METHOD(void launch_failed(const std::string& startup_notify_id), g_app_launch_context_launch_failed) diff --git a/gio/src/application.ccg b/gio/src/application.ccg index 310ada6..b344c29 100644 --- a/gio/src/application.ccg +++ b/gio/src/application.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,43 +21,19 @@ #include #include // std::memset() #include +#include #include -namespace // anonymous -{ -// TODO: At the next ABI break, implement the pimpl idiom. Then we need not use -// a GQuark for ExtraApplicationData, which should be renamed to -// struct Gio::Application::Impl. -// These are new data members that can't be added to Gio::Application now, -// because it would break ABI. -struct ExtraApplicationData -{ - std::vector option_entry_strings; - - ~ExtraApplicationData() - { - for (auto str : option_entry_strings) - { - g_free(str); - } - } -}; - -GQuark quark_extra_application_data = - g_quark_from_static_string("glibmm__Gio::Application::quark_extra_application_data"); +using Flags = Gio::Application::Flags; -void -Application_delete_extra_application_data(gpointer data) +namespace // anonymous { - ExtraApplicationData* extra_application_data = static_cast(data); - delete extra_application_data; -} static void Application_signal_open_callback( GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data) { - using SlotType = sigc::slot; + using SlotType = sigc::slot; Gio::Application::type_vec_files vec_files(n_files); for (int i = 0; i < n_files; ++i) @@ -91,7 +68,7 @@ Application_signal_open_notify_callback( GApplication* self, GFile** files, gint n_files, const gchar* hint, void* data) { using namespace Gio; - using SlotType = sigc::slot; + using SlotType = sigc::slot; Application::type_vec_files vec_files(n_files); for (int i = 0; i < n_files; i++) @@ -137,26 +114,41 @@ static const Glib::SignalProxyInfo Application_signal_open_info = { "open", class OptionArgCallbackData { public: - explicit OptionArgCallbackData(const Gio::Application* application, gchar short_name, + explicit OptionArgCallbackData(const Gio::Application* application, + const Glib::ustring& long_name, gchar short_name, + const Glib::ustring& description, const Glib::ustring& arg_description, const Glib::OptionGroup::SlotOptionArgString& slot) - : application_(application), + : + application_(application), + long_name_(g_strdup(long_name.c_str())), // must not be nullptr short_name_(short_name), + description_(g_strdup(Glib::c_str_or_nullptr(description))), + arg_description_(g_strdup(Glib::c_str_or_nullptr(arg_description))), slot_string_(new Glib::OptionGroup::SlotOptionArgString(slot)), slot_filename_(nullptr) { } - explicit OptionArgCallbackData(const Gio::Application* application, gchar short_name, + explicit OptionArgCallbackData(const Gio::Application* application, + const Glib::ustring& long_name, gchar short_name, + const Glib::ustring& description, const Glib::ustring& arg_description, const Glib::OptionGroup::SlotOptionArgFilename& slot) - : application_(application), + : + application_(application), + long_name_(g_strdup(long_name.c_str())), // must not be nullptr short_name_(short_name), + description_(g_strdup(Glib::c_str_or_nullptr(description))), + arg_description_(g_strdup(Glib::c_str_or_nullptr(arg_description))), slot_string_(nullptr), slot_filename_(new Glib::OptionGroup::SlotOptionArgFilename(slot)) { } const Gio::Application* get_application() const { return application_; } + const gchar* get_long_name() const { return long_name_; } gchar get_short_name() const { return short_name_; } + const gchar* get_description() const { return description_; } + const gchar* get_arg_description() const { return arg_description_; } bool is_filename_option() const { return slot_filename_ != nullptr; } const Glib::OptionGroup::SlotOptionArgString* get_slot_string() const { return slot_string_; } @@ -168,6 +160,9 @@ public: ~OptionArgCallbackData() { + g_free(long_name_); + g_free(description_); + g_free(arg_description_); delete slot_string_; delete slot_filename_; // Don't delete application_. It's not owned by this class. @@ -175,15 +170,19 @@ public: private: const Gio::Application* application_; + gchar* long_name_; gchar short_name_; + gchar* description_; + gchar* arg_description_; // One of these slot pointers is nullptr and the other one points to a slot. Glib::OptionGroup::SlotOptionArgString* slot_string_; Glib::OptionGroup::SlotOptionArgFilename* slot_filename_; // Not copyable - OptionArgCallbackData(const OptionArgCallbackData&); - OptionArgCallbackData& operator=(const OptionArgCallbackData&); -}; + OptionArgCallbackData(const OptionArgCallbackData&) = delete; + OptionArgCallbackData& operator=(const OptionArgCallbackData&) = delete; + +}; // end class OptionArgCallbackData using OptionArgCallbackDataMap = std::map; OptionArgCallbackDataMap option_arg_callback_data; @@ -272,7 +271,7 @@ Application::custom_class_init() return application_class_.init(); } -Application::Application(const Glib::ustring& application_id, ApplicationFlags flags) +Application::Application(const Glib::ustring& application_id, Flags flags) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id", @@ -351,10 +350,10 @@ Application_Class::open_callback(GApplication* self, GFile** files, gint n_files (*base->open)(self, files, n_files, hint); } -Glib::SignalProxy +Glib::SignalProxy Application::signal_open() { - return Glib::SignalProxy( + return Glib::SignalProxy( this, &Application_signal_open_info); } @@ -392,55 +391,67 @@ Application::open(const Glib::RefPtr& file, const Glib::ustring& hint void Application::add_main_option_entry(OptionType arg_type, const Glib::ustring& long_name, gchar short_name, const Glib::ustring& description, const Glib::ustring& arg_description, - int flags) + Glib::OptionEntry::Flags flags) { - add_main_option_entry_private( - (GOptionArg)arg_type, long_name, short_name, description, arg_description, flags); + // g_application_add_main_option() saves copies of the strings. + // No need to keep copies in Gio::Application. + g_application_add_main_option(gobj(), long_name.c_str(), short_name, + static_cast(flags), static_cast(arg_type), + description.c_str(), Glib::c_str_or_nullptr(arg_description)); } void Application::add_main_option_entry(const Glib::OptionGroup::SlotOptionArgString& slot, const Glib::ustring& long_name, gchar short_name, const Glib::ustring& description, - const Glib::ustring& arg_description, int flags) + const Glib::ustring& arg_description, Glib::OptionEntry::Flags flags) { + OptionArgCallbackData* callback_data = nullptr; { std::lock_guard lock(option_arg_callback_data_mutex); OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name); if (iterFind != option_arg_callback_data.end()) return; // Ignore duplicates - auto callback_data = new OptionArgCallbackData(this, short_name, slot); + callback_data = new OptionArgCallbackData( + this, long_name, short_name, description, arg_description, slot); option_arg_callback_data[long_name] = callback_data; } // option_arg_callback_data_mutex.unlock() - add_main_option_entry_private(G_OPTION_ARG_CALLBACK, long_name, short_name, description, - arg_description, flags & ~Glib::OptionEntry::FLAG_FILENAME); + add_main_option_entry_private(callback_data->get_long_name(), short_name, + callback_data->get_description(), callback_data->get_arg_description(), + flags & ~Glib::OptionEntry::Flags::FILENAME); } void Application::add_main_option_entry_filename(const Glib::OptionGroup::SlotOptionArgFilename& slot, const Glib::ustring& long_name, gchar short_name, const Glib::ustring& description, - const Glib::ustring& arg_description, int flags) + const Glib::ustring& arg_description, Glib::OptionEntry::Flags flags) { + OptionArgCallbackData* callback_data = nullptr; { std::lock_guard lock(option_arg_callback_data_mutex); OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name); if (iterFind != option_arg_callback_data.end()) return; // Ignore duplicates - auto callback_data = new OptionArgCallbackData(this, short_name, slot); + callback_data = new OptionArgCallbackData( + this, long_name, short_name, description, arg_description, slot); option_arg_callback_data[long_name] = callback_data; } // option_arg_callback_data_mutex.unlock() - add_main_option_entry_private(G_OPTION_ARG_CALLBACK, long_name, short_name, description, - arg_description, flags | Glib::OptionEntry::FLAG_FILENAME); + add_main_option_entry_private(callback_data->get_long_name(), short_name, + callback_data->get_description(), callback_data->get_arg_description(), + flags | Glib::OptionEntry::Flags::FILENAME); } void -Application::add_main_option_entry_private(GOptionArg arg, const Glib::ustring& long_name, - gchar short_name, const Glib::ustring& description, const Glib::ustring& arg_description, - int flags) +Application::add_main_option_entry_private(const gchar* long_name, + gchar short_name, const gchar* description, + const gchar* arg_description, Glib::OptionEntry::Flags flags) { + // g_application_add_main_option() can't be used for options with + // a callback slot, because GOptionEntry.arg_data must be non-null. + // Create a temporary array, just so we can give the correct thing to // g_application_add_main_option_entries(): GOptionEntry array[2]; @@ -449,51 +460,25 @@ Application::add_main_option_entry_private(GOptionArg arg, const Glib::ustring& // g_application_add_main_option_entries() does not take its own copy // of the strings. We must keep them alive, and keep pointers to them, // so we can delete them when the Application instance is deleted. - - // GOptionEntry.long_name must be set, even if it's an empty string. - gchar* lname = g_strdup(long_name.c_str()); - gchar* desc = description.empty() ? nullptr : g_strdup(description.c_str()); - gchar* arg_desc = arg_description.empty() ? nullptr : g_strdup(arg_description.c_str()); - - ExtraApplicationData* extra_application_data = - static_cast(g_object_get_qdata(gobject_, quark_extra_application_data)); - if (!extra_application_data) - { - extra_application_data = new ExtraApplicationData(); - g_object_set_qdata_full(gobject_, quark_extra_application_data, extra_application_data, - Application_delete_extra_application_data); - } - - extra_application_data->option_entry_strings.emplace_back(lname); - if (desc) - extra_application_data->option_entry_strings.emplace_back(desc); - if (arg_desc) - extra_application_data->option_entry_strings.emplace_back(arg_desc); + // This is handled in OptionArgCallbackData. // Fill in array[0]. - array[0].arg = arg; - array[0].long_name = lname; + array[0].arg = G_OPTION_ARG_CALLBACK; + array[0].long_name = long_name; array[0].short_name = short_name; - array[0].description = desc; - array[0].arg_description = arg_desc; - array[0].flags = flags; - - if (arg == G_OPTION_ARG_CALLBACK) - { - // GoptionEntry.arg_data is a function pointer, cast to void*. - // See Glib::OptionGroup::CppOptionEntry::allocate_c_arg() for a discussion - // of this hack. - union { - void* dp; - GOptionArgFunc fp; - } u; - u.fp = &Application_option_arg_callback; - array[0].arg_data = u.dp; - } - else - // We ensure that this is null to ensure that it is not used, - // telling GApplication to put the parsed value in the options VariantDict instead. - array[0].arg_data = nullptr; + array[0].description = description; + array[0].arg_description = arg_description; + array[0].flags = static_cast(flags); + + // GoptionEntry.arg_data is a function pointer, cast to void*. + // See Glib::OptionGroup::CppOptionEntry::allocate_c_arg() for a discussion + // of this hack. + union { + void* dp; + GOptionArgFunc fp; + } u; + u.fp = &Application_option_arg_callback; + array[0].arg_data = u.dp; g_application_add_main_option_entries(gobj(), array); } diff --git a/gio/src/application.hg b/gio/src/application.hg index 4faa475..3042a79 100644 --- a/gio/src/application.hg +++ b/gio/src/application.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -34,7 +35,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(ApplicationFlags, GApplicationFlags, NO_GTYPE) /** Application - Core application class. * An Application is the foundation of an application, unique for a given @@ -89,6 +89,9 @@ class Application : public Glib::Object, public ActionGroup, public ActionMap _IMPLEMENTS_INTERFACE(ActionGroup) _IMPLEMENTS_INTERFACE(ActionMap) +public: + _WRAP_ENUM(Flags, GApplicationFlags, NO_GTYPE, s#^FLAGS_##) + protected: /** Constructs an application instance. * If no application ID is given then some features (most notably application uniqueness) will be disabled. @@ -96,18 +99,20 @@ protected: * @param application_id The application ID. * @param flags The application flags. */ - explicit Application(const Glib::ustring& application_id = Glib::ustring(), ApplicationFlags flags = APPLICATION_FLAGS_NONE); + explicit Application(const Glib::ustring& application_id = Glib::ustring(), Flags flags = Flags::NONE); _IGNORE(g_application_new) public: _CUSTOM_DTOR() + // Application::OptionType wraps GOptionArg, but _WRAP_ENUM can't be used here. + // GOptionArg is defined in glib_enums.defs, not in gio_enums.defs. /** The OptionType enum values determine the expected type of a command line option. * If an option expects an extra argument, it can be specified in several ways; * with a short option: "-x arg", with a long option: "--name arg" or combined - * in a single argument: "--name=arg". All option types except OPTION_TYPE_BOOL - * expect an extra argument. OPTION_TYPE_STRING_VECTOR and - * OPTION_TYPE_FILENAME_VECTOR accept more than one extra argument. + * in a single argument: "--name=arg". All option types except OptionType::BOOL + * expect an extra argument. OptionType::STRING_VECTOR and + * OptionType::FILENAME_VECTOR accept more than one extra argument. * * The descriptions of the enum values show what type of Glib::Variant<> * is stored in a Glib::VariantDict. @@ -116,17 +121,17 @@ public: * * @ingroup glibmmEnums */ - enum OptionType + enum class OptionType { - OPTION_TYPE_BOOL, ///< bool - OPTION_TYPE_STRING, ///< Glib::ustring - OPTION_TYPE_INT, ///< gint32 - //OPTION_TYPE_CALLBACK, - OPTION_TYPE_FILENAME = OPTION_TYPE_INT+2, ///< std::string - OPTION_TYPE_STRING_VECTOR, ///< std::vector - OPTION_TYPE_FILENAME_VECTOR, ///< std::vector - OPTION_TYPE_DOUBLE, ///< double - OPTION_TYPE_INT64 ///< gint64 + BOOL, ///< bool + STRING, ///< Glib::ustring + INT, ///< gint32 + // CALLBACK, + FILENAME = INT+2, ///< std::string + STRING_VECTOR, ///< std::vector + FILENAME_VECTOR, ///< std::vector + DOUBLE, ///< double + INT64 ///< gint64 }; /** Creates an application instance. @@ -135,7 +140,7 @@ public: * @param application_id The application ID. * @param flags The application flags. */ - _WRAP_CREATE(const Glib::ustring& application_id = Glib::ustring(), ApplicationFlags flags = APPLICATION_FLAGS_NONE) + _WRAP_CREATE(const Glib::ustring& application_id = Glib::ustring(), Flags flags = Flags::NONE) _WRAP_METHOD(static bool id_is_valid(const Glib::ustring& application_id), g_application_id_is_valid) @@ -151,8 +156,8 @@ public: _WRAP_METHOD(guint get_inactivity_timeout() const, g_application_get_inactivity_timeout) _WRAP_METHOD(void set_inactivity_timeout(guint inactivity_timeout), g_application_set_inactivity_timeout) - _WRAP_METHOD(ApplicationFlags get_flags() const, g_application_get_flags) - _WRAP_METHOD(void set_flags(ApplicationFlags flags), g_application_set_flags) + _WRAP_METHOD(Flags get_flags() const, g_application_get_flags) + _WRAP_METHOD(void set_flags(Flags flags), g_application_set_flags) _WRAP_METHOD(std::string get_resource_base_path() const, g_application_get_resource_base_path, newin "2,44") _WRAP_METHOD(void set_resource_base_path(const std::string& resource_path), g_application_set_resource_base_path, newin "2,44") @@ -163,8 +168,7 @@ public: */ void unset_resource_base_path(); - _WRAP_METHOD(void set_action_group(const Glib::RefPtr& action_group), g_application_set_action_group, - deprecated "Use the Gio::ActionMap interface instead.") + _IGNORE(g_application_set_action_group) //Note: We would like to add a group, not just some entries, //so we can do pre and post parsing. See https://bugzilla.gnome.org/show_bug.cgi?id=727602 @@ -183,7 +187,7 @@ public: * Unlike OptionGroup + OptionContext, Application packs the arguments * into a Glib::VariantDict which is passed to the * signal_handle_local_options() handler, where it can be - * inspected and modified. If Gio::APPLICATION_HANDLES_COMMAND_LINE is + * inspected and modified. If Gio::Application::Flags::HANDLES_COMMAND_LINE is * set, then the resulting dictionary is sent to the primary instance, * where Gio::ApplicationCommandLine::get_options_dict() will return it. * This "packing" is done according to the type of the argument -- @@ -203,7 +207,7 @@ public: * on the local side. Calling this function "opts in" to the new * behaviour, and in particular, means that unrecognised options will be * treated as errors. Unrecognised options have never been ignored when - * Gio::APPLICATION_HANDLES_COMMAND_LINE is unset. + * Gio::Application::Flags::HANDLES_COMMAND_LINE is unset. * * If signal_handle_local_options() needs to see the list of * filenames, then the use of G_OPTION_REMAINING as @a long_name is recommended. @@ -226,17 +230,14 @@ public: * @param description The description for the option in `--help` output. * @param arg_description The placeholder to use for the extra argument parsed * by the option in `--help` output. - * @param flags Flags from Glib::OptionEntry::Flags. Do not set FLAG_FILENAME. + * @param flags Flags from Glib::OptionEntry::Flags. Do not set OptionEntry::Flags::FILENAME. * Character encoding is chosen with @a arg_type. */ void add_main_option_entry(OptionType arg_type, const Glib::ustring& long_name, gchar short_name = '\0', const Glib::ustring& description = Glib::ustring(), - const Glib::ustring& arg_description = Glib::ustring(), int flags = 0); - _IGNORE(g_application_add_main_option_entries) - - //g_application_add_main_option() seems to be just a new convenience function, - //TODO: Use it for some of our add_main_option_entry(without slot) implementation. - _IGNORE(g_application_add_main_option) + const Glib::ustring& arg_description = Glib::ustring(), + Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE); + _IGNORE(g_application_add_main_option_entries, g_application_add_main_option) /** Adds a main option entry to be handled by the Application. * @@ -251,12 +252,13 @@ public: * @newin{2,42} * * @see add_main_option_entry(OptionType, const Glib::ustring&, - * gchar, const Glib::ustring&, const Glib::ustring&, int) + * gchar, const Glib::ustring&, const Glib::ustring&, Glib::OptionEntry::Flags) */ void add_main_option_entry(const Glib::OptionGroup::SlotOptionArgString& slot, const Glib::ustring& long_name, gchar short_name = '\0', const Glib::ustring& description = Glib::ustring(), - const Glib::ustring& arg_description = Glib::ustring(), int flags = 0); + const Glib::ustring& arg_description = Glib::ustring(), + Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE); /** Adds a main option entry to be handled by the Application. * @@ -271,12 +273,13 @@ public: * @newin{2,42} * * @see add_main_option_entry(OptionType, const Glib::ustring&, - * gchar, const Glib::ustring&, const Glib::ustring&, int) + * gchar, const Glib::ustring&, const Glib::ustring&, Glib::OptionEntry::Flags) */ void add_main_option_entry_filename(const Glib::OptionGroup::SlotOptionArgFilename& slot, const Glib::ustring& long_name, gchar short_name = '\0', const Glib::ustring& description = Glib::ustring(), - const Glib::ustring& arg_description = Glib::ustring(), int flags = 0); + const Glib::ustring& arg_description = Glib::ustring(), + Glib::OptionEntry::Flags flags = Glib::OptionEntry::Flags::NONE); // _WRAP_METHOD(void add_option_group(Glib::OptionGroup& group), g_application_add_option_group) // add_option_group() is probably not very useful. If implemented, it must probably @@ -306,7 +309,7 @@ public: * opening files (eg: "view" vs "edit", etc). * * The application must be registered before calling this method - * and it must have the APPLICATION_HANDLES_OPEN flag set. + * and it must have the Application::Flags::HANDLES_OPEN flag set. * * @param files The files to open. This must be non-empty. * @param hint A hint. @@ -326,7 +329,7 @@ public: * opening files (eg: "view" vs "edit", etc). * * The application must be registered before calling this method - * and it must have the APPLICATION_HANDLES_OPEN flag set. + * and it must have the Application::Flags::HANDLES_OPEN flag set. * * @param file The file to open. This must be non-empty. * @param hint A hint. @@ -358,46 +361,35 @@ public: // _WRAP_METHOD(void bind_busy_property(const Glib::RefPtr& object, const Glib::ustring& property), g_application_bind_busy_property) // _WRAP_METHOD(void unbind_busy_property(const Glib::RefPtr& object, const Glib::ustring& property), g_application_unbind_busy_property) - _WRAP_PROPERTY("action-group", Glib::RefPtr, deprecated "Use the Gio::ActionMap interface instead.") + _IGNORE_PROPERTY("action-group") _WRAP_PROPERTY("application-id", Glib::ustring) - _WRAP_PROPERTY("flags", ApplicationFlags) + _WRAP_PROPERTY("flags", Flags) _WRAP_PROPERTY("inactivity-timeout", guint) _WRAP_PROPERTY("is-registered", bool) _WRAP_PROPERTY("is-remote", bool) - //TODO: Change bool to std::string when we can break API/ABI. - /** @note - * Don't use %property_resource_base_path(). Use set_resource_base_path() or - * get_resource_base_path() instead. - * %property_resource_base_path() has got the wrong type. - * This bug will be fixed at the next API/ABI break. - */ _WRAP_PROPERTY("resource-base-path", bool, newin "2,44") _WRAP_PROPERTY("is-busy", bool) -//#m4 _CONVERSION(`const gchar*', `const Glib::ustring&', `Glib::ustring($3)') -//#m4 _CONVERSION(`GVariant*', `const Glib::VariantBase&', `Glib::wrap($3, true)') - _WRAP_SIGNAL(void startup(), "startup") - //TODO: Remove no_default_handler when we can break ABI - _WRAP_SIGNAL(void shutdown(), "shutdown", no_default_handler, newin "2,46") + _WRAP_SIGNAL(void shutdown(), "shutdown", newin "2,46") _WRAP_SIGNAL(void activate(), "activate") //We wrap the open signal without _WRAP_SIGNAL(), because we need to change its parameters. //See bug https://bugzilla.gnome.org/show_bug.cgi?id=637457 - Glib::SignalProxy< void, const type_vec_files&, const Glib::ustring& > signal_open(); + Glib::SignalProxy signal_open(); _IGNORE_SIGNAL(open) #m4 _CONVERSION(`GApplicationCommandLine*', `const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(int command_line(const Glib::RefPtr& command_line), "command-line") - //TODO: Remove no_default_handler when we can break ABI //TODO: Avoid the use of the Variants in the VariantDict? //options must be non-const. The handler is meant to modify it. See the description //of add_main_option_entry(OptionType, ...). #m4 _CONVERSION(`GVariantDict*',`const Glib::RefPtr&',`Glib::wrap($3, true)') - _WRAP_SIGNAL(int handle_local_options(const Glib::RefPtr& options), "handle-local-options", no_default_handler) +#m4 _CONVERSION(`const Glib::RefPtr&',`GVariantDict*',__CONVERT_REFPTR_TO_P) + _WRAP_SIGNAL(int handle_local_options(const Glib::RefPtr& options), "handle-local-options") protected: virtual void on_open(const type_vec_files& files, const Glib::ustring& hint); @@ -415,7 +407,6 @@ protected: _WRAP_VFUNC(bool local_command_line(char**& arguments, int& exit_status), local_command_line) #m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3,true)') - _WRAP_VFUNC(void before_emit(const Glib::VariantBase& platform_data), "before_emit") _WRAP_VFUNC(void after_emit(const Glib::VariantBase& platform_data), "after_emit") @@ -425,6 +416,10 @@ protected: _WRAP_VFUNC(void quit_mainloop(), "quit_mainloop") _WRAP_VFUNC(void run_mainloop(), "run_mainloop") +#m4 _CONVERSION(`GDBusConnection*', `const Glib::RefPtr&', `Glib::wrap($3, true)') +#m4 _CONVERSION(`const Glib::RefPtr&',`GDBusConnection*',__CONVERT_REFPTR_TO_P) + _WRAP_VFUNC(bool dbus_register(const Glib::RefPtr& connection, const Glib::ustring& object_path), "dbus_register", errthrow) + _WRAP_VFUNC(void dbus_unregister(const Glib::RefPtr& connection, const Glib::ustring& object_path), "dbus_unregister") private: /** This is just a way to call Glib::init() (which calls g_type_init()) before @@ -434,10 +429,10 @@ private: */ const Glib::Class& custom_class_init(); - // Code, common to the public add_main_option_entry*() methods. - void add_main_option_entry_private(GOptionArg arg, const Glib::ustring& long_name, - gchar short_name, const Glib::ustring& description, - const Glib::ustring& arg_description, int flags); + // Code, common to the public add_main_option_entry*() methods with a callback slot. + void add_main_option_entry_private(const gchar* long_name, gchar short_name, + const gchar* description, const gchar* arg_description, + Glib::OptionEntry::Flags flags); }; } // namespace Gio diff --git a/gio/src/applicationcommandline.ccg b/gio/src/applicationcommandline.ccg index 474fc42..7fbee67 100644 --- a/gio/src/applicationcommandline.ccg +++ b/gio/src/applicationcommandline.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/applicationcommandline.hg b/gio/src/applicationcommandline.hg index 3c11745..4b357c4 100644 --- a/gio/src/applicationcommandline.hg +++ b/gio/src/applicationcommandline.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/asyncinitable.ccg b/gio/src/asyncinitable.ccg index f6fda2f..e91c984 100644 --- a/gio/src/asyncinitable.ccg +++ b/gio/src/asyncinitable.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/asyncinitable.hg b/gio/src/asyncinitable.hg index 6961edd..6d7d90f 100644 --- a/gio/src/asyncinitable.hg +++ b/gio/src/asyncinitable.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/asyncresult.ccg b/gio/src/asyncresult.ccg index 4a3b59f..bebc7ab 100644 --- a/gio/src/asyncresult.ccg +++ b/gio/src/asyncresult.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include //We are not allowed to include individual headers. @@ -32,7 +35,7 @@ AsyncResult::get_source_object_base() { auto cobj = g_async_result_get_source_object(gobj()); auto cppobj = Glib::wrap_auto(cobj); // ObjectBase::_get_current_wrapper(cobj); - return Glib::RefPtr( + return Glib::make_refptr_for_instance( cppobj); // g_async_result_get_source_object() gives us a ref, unusually. // TODO: For some reason this fails: Glib::wrap(cobj); } diff --git a/gio/src/asyncresult.hg b/gio/src/asyncresult.hg index 10a80c6..f0d2d68 100644 --- a/gio/src/asyncresult.hg +++ b/gio/src/asyncresult.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -41,7 +42,7 @@ class AsyncResult; * * @newin{2,16} */ -using SlotAsyncReady = sigc::slot&>; +using SlotAsyncReady = sigc::slot&)>; /** Provides a base class for implementing asynchronous function results. * Asynchronous operations are broken up into two separate operations which are chained together by a SlotAsyncReady. @@ -105,13 +106,7 @@ class AsyncResult : public Glib::Interface public: _IGNORE(g_async_result_get_user_data) - - //Note that this returns a reference, unlike most GTK+ get_*() functions, - //so we don't need to use refreturn. - _WRAP_METHOD(Glib::RefPtr get_source_object(), - g_async_result_get_source_object, deprecated "Use get_source_object_base()") - _WRAP_METHOD(Glib::RefPtr get_source_object() const, - g_async_result_get_source_object, constversion, deprecated "Use get_source_object_base()") + _IGNORE(g_async_result_get_source_object) //Note that this returns a reference, unlike most GTK+ get_*() functions, //so we don't need to use refreturn. @@ -122,15 +117,12 @@ public: _WRAP_METHOD(bool is_tagged(gpointer source_tag) const, g_async_result_is_tagged) - - // TODO: For some reason, the compiler cannot find an unwrap() for ObjectBase. + // The compiler cannot find an unwrap() for ObjectBase, because + // ObjectBase::BaseObjectType is not declared. //#m4 _CONVERSION(`Glib::RefPtr',`GObject*',__CONVERT_REFPTR_TO_P) #m4 _CONVERSION(`Glib::RefPtr',`GObject*',`unwrap_objectbase_custom($3)') - _WRAP_VFUNC(Glib::RefPtr get_source_object(), - "get_source_object") - - //TODO: is_tagged() vfunc when we can break ABI. + _WRAP_VFUNC(Glib::RefPtr get_source_object(), "get_source_object") + _WRAP_VFUNC(bool is_tagged(gpointer source_tag), "is_tagged") }; } // namespace Gio - diff --git a/gio/src/bufferedinputstream.ccg b/gio/src/bufferedinputstream.ccg index 7c82808..888b7af 100644 --- a/gio/src/bufferedinputstream.ccg +++ b/gio/src/bufferedinputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -23,7 +26,7 @@ namespace Gio Glib::RefPtr BufferedInputStream::create_sized(const Glib::RefPtr& base_stream, gsize buffer_size) { - return Glib::RefPtr(new BufferedInputStream(base_stream, buffer_size)); + return Glib::make_refptr_for_instance(new BufferedInputStream(base_stream, buffer_size)); } void diff --git a/gio/src/bufferedinputstream.hg b/gio/src/bufferedinputstream.hg index c50ecc8..413d965 100644 --- a/gio/src/bufferedinputstream.hg +++ b/gio/src/bufferedinputstream.hg @@ -11,10 +11,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include #include _DEFS(giomm,gio) @@ -39,9 +41,11 @@ namespace Gio * * @newin{2,16} */ -class BufferedInputStream : public Gio::FilterInputStream +class BufferedInputStream : public Gio::FilterInputStream, public Gio::Seekable { _CLASS_GOBJECT(BufferedInputStream, GBufferedInputStream, G_BUFFERED_INPUT_STREAM, Gio::FilterInputStream, GFilterInputStream) + _IMPLEMENTS_INTERFACE(Seekable) + protected: _WRAP_CTOR(BufferedInputStream(const Glib::RefPtr& base_stream), g_buffered_input_stream_new) @@ -106,9 +110,8 @@ public: _WRAP_PROPERTY("buffer-size", guint) protected: - //TODO: When we can break ABI, add vfunc. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 #m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') - //_WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr& cancellable), fill, errthrow, err_return_value -1) + _WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr& cancellable), fill, errthrow, err_return_value -1) }; } // namespace Gio diff --git a/gio/src/bufferedoutputstream.ccg b/gio/src/bufferedoutputstream.ccg index c334f5c..c549775 100644 --- a/gio/src/bufferedoutputstream.ccg +++ b/gio/src/bufferedoutputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -23,7 +26,7 @@ namespace Gio Glib::RefPtr BufferedOutputStream::create_sized(const Glib::RefPtr& base_stream, gsize size) { - return Glib::RefPtr(new BufferedOutputStream(base_stream, size)); + return Glib::make_refptr_for_instance(new BufferedOutputStream(base_stream, size)); } } // namespace Gio diff --git a/gio/src/bufferedoutputstream.hg b/gio/src/bufferedoutputstream.hg index 0d2aba2..39145e7 100644 --- a/gio/src/bufferedoutputstream.hg +++ b/gio/src/bufferedoutputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,10 +11,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include #include _DEFS(giomm,gio) @@ -37,9 +37,11 @@ namespace Gio * * @newin{2,16} */ -class BufferedOutputStream : public Gio::FilterOutputStream +class BufferedOutputStream : public Gio::FilterOutputStream, public Gio::Seekable { _CLASS_GOBJECT(BufferedOutputStream, GBufferedOutputStream, G_BUFFERED_OUTPUT_STREAM, Gio::FilterOutputStream, GFilterOutputStream) + _IMPLEMENTS_INTERFACE(Seekable) + protected: _WRAP_CTOR(BufferedOutputStream(const Glib::RefPtr& base_stream), g_buffered_output_stream_new) diff --git a/gio/src/cancellable.ccg b/gio/src/cancellable.ccg index 87d8f66..151f478 100644 --- a/gio/src/cancellable.ccg +++ b/gio/src/cancellable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/cancellable.hg b/gio/src/cancellable.hg index 94b97ac..a1cc68a 100644 --- a/gio/src/cancellable.hg +++ b/gio/src/cancellable.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -36,7 +37,7 @@ protected: _CTOR_DEFAULT public: - using SlotCancelledCallback = sigc::slot; + using SlotCancelledCallback = sigc::slot; _WRAP_CREATE() diff --git a/gio/src/charsetconverter.ccg b/gio/src/charsetconverter.ccg index f4218b5..2353843 100644 --- a/gio/src/charsetconverter.ccg +++ b/gio/src/charsetconverter.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -23,6 +24,7 @@ CharsetConverter::CharsetConverter( const Glib::ustring& to_charset, const Glib::ustring& from_charset) : _CONSTRUCT("to-charset", to_charset.c_str(), "from-charset", from_charset.c_str()) { + init(); } } // namespace Gio diff --git a/gio/src/charsetconverter.hg b/gio/src/charsetconverter.hg index b5bb234..37a32e2 100644 --- a/gio/src/charsetconverter.hg +++ b/gio/src/charsetconverter.hg @@ -11,11 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -27,14 +29,16 @@ namespace Gio * CharsetConverter is an implementation of Converter based on GIConv. * @newin{2,34} */ -class CharsetConverter : public Glib::Object, public Converter +class CharsetConverter +: public Glib::Object, public Converter, public Initable { _CLASS_GOBJECT(CharsetConverter, GCharsetConverter, G_CHARSET_CONVERTER, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Converter) + _IMPLEMENTS_INTERFACE(Initable) protected: - // Handwritten to ignore the final GError** parameter in the *_new() - // function. + // Handwritten to ignore the final GError** parameter in the *_new() function. + // But it can throw, due to its call to Initable::init(). explicit CharsetConverter(const Glib::ustring& to_charset, const Glib::ustring& from_charset); _IGNORE(g_charset_converter_new) @@ -45,7 +49,8 @@ public: * * @param to_charset Destination charset. * @param from_charset Source charset. - * @return A new CharsetConverter, or 0 on error. + * @return A new CharsetConverter, or nullptr on error. + * @throw Gio::Error */ _WRAP_CREATE(const Glib::ustring& to_charset, const Glib::ustring& from_charset) diff --git a/gio/src/converter.ccg b/gio/src/converter.ccg index 7f97a55..0f2d200 100644 --- a/gio/src/converter.ccg +++ b/gio/src/converter.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,11 +13,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +using Flags = Gio::Converter::Flags; +using Result = Gio::Converter::Result; + namespace Gio { diff --git a/gio/src/converter.hg b/gio/src/converter.hg index 2c219ad..cde99f8 100644 --- a/gio/src/converter.hg +++ b/gio/src/converter.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,8 +30,6 @@ typedef struct _GConverterIface GConverterIface; namespace Gio { -_WRAP_ENUM(ConverterResult, GConverterResult) -_WRAP_ENUM(ConverterFlags, GConverterFlags) /** Converter - Data conversion interface. * Converter is implemented by objects that convert binary data in various @@ -44,11 +45,14 @@ class Converter : public Glib::Interface _CLASS_INTERFACE(Converter, GConverter, G_CONVERTER, GConverterIface) public: - _WRAP_METHOD(ConverterResult convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, ConverterFlags flags, gsize& bytes_read, gsize& bytes_written), g_converter_convert, errthrow) + _WRAP_ENUM(Result, GConverterResult) + _WRAP_ENUM(Flags, GConverterFlags) + + _WRAP_METHOD(Result convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, Flags flags, gsize& bytes_read, gsize& bytes_written), g_converter_convert, errthrow) _WRAP_METHOD(void reset(), g_converter_reset) #m4 _CONVERSION(`gsize*',`gsize&',`*($3)') - _WRAP_VFUNC(ConverterResult convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, ConverterFlags flags, gsize& bytes_read, gsize& bytes_written), "convert", errthrow) + _WRAP_VFUNC(Result convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, Flags flags, gsize& bytes_read, gsize& bytes_written), "convert", errthrow) _WRAP_VFUNC(void reset(), "reset") }; diff --git a/gio/src/converterinputstream.ccg b/gio/src/converterinputstream.ccg index e18a328..4f46d64 100644 --- a/gio/src/converterinputstream.ccg +++ b/gio/src/converterinputstream.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/converterinputstream.hg b/gio/src/converterinputstream.hg index ae65e59..8c0e39a 100644 --- a/gio/src/converterinputstream.hg +++ b/gio/src/converterinputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/converteroutputstream.ccg b/gio/src/converteroutputstream.ccg index e492031..b122ac3 100644 --- a/gio/src/converteroutputstream.ccg +++ b/gio/src/converteroutputstream.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/converteroutputstream.hg b/gio/src/converteroutputstream.hg index 1729aac..eeb5d9d 100644 --- a/gio/src/converteroutputstream.hg +++ b/gio/src/converteroutputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/credentials.ccg b/gio/src/credentials.ccg index 2961657..ed04a99 100644 --- a/gio/src/credentials.ccg +++ b/gio/src/credentials.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/credentials.hg b/gio/src/credentials.hg index 31d50cd..60fb023 100644 --- a/gio/src/credentials.hg +++ b/gio/src/credentials.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -22,7 +25,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(CredentialsType, GCredentialsType, NO_GTYPE) /** An object containing credentials. * The Credentials type is a reference-counted wrapper for native credentials. @@ -55,12 +57,14 @@ protected: _IGNORE(g_credentials_new) public: + _WRAP_ENUM(Type, GCredentialsType, NO_GTYPE) + _WRAP_CREATE() _WRAP_METHOD(Glib::ustring to_string() const, g_credentials_to_string) - _WRAP_METHOD(gpointer get_native(CredentialsType native_type), g_credentials_get_native) - _WRAP_METHOD(void set_native(CredentialsType native_type, gpointer native), g_credentials_set_native) + _WRAP_METHOD(gpointer get_native(Type native_type), g_credentials_get_native) + _WRAP_METHOD(void set_native(Type native_type, gpointer native), g_credentials_set_native) _WRAP_METHOD(bool is_same_user(const Glib::RefPtr& other_credentials), g_credentials_is_same_user, errthrow) _WRAP_METHOD(uid_t get_unix_user(), g_credentials_get_unix_user, errthrow, ifdef G_OS_UNIX) diff --git a/gio/src/datainputstream.ccg b/gio/src/datainputstream.ccg index 7ae9beb..3665ac9 100644 --- a/gio/src/datainputstream.ccg +++ b/gio/src/datainputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/datainputstream.hg b/gio/src/datainputstream.hg index 4126c63..0b5a8bc 100644 --- a/gio/src/datainputstream.hg +++ b/gio/src/datainputstream.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dataoutputstream.ccg b/gio/src/dataoutputstream.ccg index c2e4ec8..5e41c70 100644 --- a/gio/src/dataoutputstream.ccg +++ b/gio/src/dataoutputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dataoutputstream.hg b/gio/src/dataoutputstream.hg index a74dd46..efd8211 100644 --- a/gio/src/dataoutputstream.hg +++ b/gio/src/dataoutputstream.hg @@ -11,29 +11,32 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include +#include #include _DEFS(giomm,gio) -_PINCLUDE(giomm/private/bufferedoutputstream_p.h) +_PINCLUDE(giomm/private/filteroutputstream_p.h) namespace Gio { /** - * An implementation of BufferedOutputStream that allows for high-level data + * An implementation of FilterOutputStream that allows for high-level data * manipulation of arbitrary data (including binary operations). * * @ingroup Streams * * @newin{2,16} */ -class DataOutputStream : public Gio::BufferedOutputStream +class DataOutputStream : public Gio::FilterOutputStream, public Gio::Seekable { - _CLASS_GOBJECT(DataOutputStream, GDataOutputStream, G_DATA_OUTPUT_STREAM, Gio::BufferedOutputStream, GBufferedOutputStream) + _CLASS_GOBJECT(DataOutputStream, GDataOutputStream, G_DATA_OUTPUT_STREAM, Gio::FilterOutputStream, GFilterOutputStream) + _IMPLEMENTS_INTERFACE(Seekable) protected: _WRAP_CTOR(DataOutputStream(const Glib::RefPtr& base_stream), g_data_output_stream_new) @@ -65,4 +68,3 @@ public: }; } // namespace Gio - diff --git a/gio/src/dbusactiongroup.ccg b/gio/src/dbusactiongroup.ccg index 2069b14..b8012ef 100644 --- a/gio/src/dbusactiongroup.ccg +++ b/gio/src/dbusactiongroup.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusactiongroup.hg b/gio/src/dbusactiongroup.hg index aafd8e2..991e106 100644 --- a/gio/src/dbusactiongroup.hg +++ b/gio/src/dbusactiongroup.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -38,11 +39,11 @@ _GMMPROC_EXTRA_NAMESPACE(DBus) * @newin{2,32} */ class ActionGroup -: public Glib::Object, public ::Gio::ActionGroup, public RemoteActionGroup +: public Glib::Object, public Gio::ActionGroup, public Gio::RemoteActionGroup { _CLASS_GOBJECT(ActionGroup, GDBusActionGroup, G_DBUS_ACTION_GROUP, Glib::Object, GObject) - _IMPLEMENTS_INTERFACE(::Gio::ActionGroup) - _IMPLEMENTS_INTERFACE(RemoteActionGroup) + _IMPLEMENTS_INTERFACE(Gio::ActionGroup) + _IMPLEMENTS_INTERFACE(Gio::RemoteActionGroup) protected: _CTOR_DEFAULT diff --git a/gio/src/dbusaddress.ccg b/gio/src/dbusaddress.ccg index 09a2188..30f2366 100644 --- a/gio/src/dbusaddress.ccg +++ b/gio/src/dbusaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusaddress.hg b/gio/src/dbusaddress.hg index aa105e7..ab5acd7 100644 --- a/gio/src/dbusaddress.hg +++ b/gio/src/dbusaddress.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusauthobserver.ccg b/gio/src/dbusauthobserver.ccg index d9f062c..8c30743 100644 --- a/gio/src/dbusauthobserver.ccg +++ b/gio/src/dbusauthobserver.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusauthobserver.hg b/gio/src/dbusauthobserver.hg index 03876c0..931af72 100644 --- a/gio/src/dbusauthobserver.hg +++ b/gio/src/dbusauthobserver.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg index 6199e85..5fe37d9 100644 --- a/gio/src/dbusconnection.ccg +++ b/gio/src/dbusconnection.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -278,7 +279,7 @@ Connection::create_sync(const Glib::RefPtr& stream, const std::string& const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(stream, guid, observer, cancellable, flags)); + return Glib::make_refptr_for_instance(new Connection(stream, guid, observer, cancellable, flags)); } // static @@ -286,7 +287,7 @@ Glib::RefPtr Connection::create_sync(const Glib::RefPtr& stream, const std::string& guid, const Glib::RefPtr& cancellable, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(stream, guid, cancellable, flags)); + return Glib::make_refptr_for_instance(new Connection(stream, guid, cancellable, flags)); } // static @@ -294,7 +295,7 @@ Glib::RefPtr Connection::create_sync(const Glib::RefPtr& stream, const std::string& guid, const Glib::RefPtr& observer, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(stream, guid, observer, flags)); + return Glib::make_refptr_for_instance(new Connection(stream, guid, observer, flags)); } // static @@ -302,7 +303,7 @@ Glib::RefPtr Connection::create_sync( const Glib::RefPtr& stream, const std::string& guid, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(stream, guid, flags)); + return Glib::make_refptr_for_instance(new Connection(stream, guid, flags)); } // static @@ -352,7 +353,7 @@ Connection::create_for_address_sync(const std::string& address, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(address, observer, cancellable, flags)); + return Glib::make_refptr_for_instance(new Connection(address, observer, cancellable, flags)); } // static @@ -360,7 +361,7 @@ Glib::RefPtr Connection::create_for_address_sync( const std::string& address, const Glib::RefPtr& cancellable, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(address, cancellable, flags)); + return Glib::make_refptr_for_instance(new Connection(address, cancellable, flags)); } // static @@ -368,14 +369,14 @@ Glib::RefPtr Connection::create_for_address_sync( const std::string& address, const Glib::RefPtr& observer, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(address, observer, flags)); + return Glib::make_refptr_for_instance(new Connection(address, observer, flags)); } // static Glib::RefPtr Connection::create_for_address_sync(const std::string& address, ConnectionFlags flags) { - return Glib::RefPtr(new Connection(address, flags)); + return Glib::make_refptr_for_instance(new Connection(address, flags)); } // static diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg index 363e354..c779cc5 100644 --- a/gio/src/dbusconnection.hg +++ b/gio/src/dbusconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -42,11 +43,11 @@ namespace DBus { _WRAP_ENUM(BusType, GBusType) -_WRAP_ENUM(CallFlags, GDBusCallFlags, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(SendMessageFlags, GDBusSendMessageFlags, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(SignalFlags, GDBusSignalFlags, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(CallFlags, GDBusCallFlags, NO_GTYPE) +_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, NO_GTYPE) +_WRAP_ENUM(SendMessageFlags, GDBusSendMessageFlags, NO_GTYPE) +_WRAP_ENUM(SignalFlags, GDBusSignalFlags, NO_GTYPE) +_WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, NO_GTYPE) _GMMPROC_EXTRA_NAMESPACE(DBus) @@ -172,9 +173,9 @@ public: * Glib::ustring& signal_name, const Glib::VariantContainerBase& parameters);. * @endcode */ - using SlotSignal = sigc::slot&, + using SlotSignal = sigc::slot&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, - const Glib::ustring&, const Glib::VariantContainerBase&>; + const Glib::ustring&, const Glib::VariantContainerBase&)>; /** Signature for slot used in add_filter(). * For example, @@ -190,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. */ - using SlotMessageFilter = sigc::slot, + using SlotMessageFilter = sigc::slot( const Glib::RefPtr&, - const Glib::RefPtr&, bool>; + const Glib::RefPtr&, bool)>; /** Asynchronously connects to the message bus specified by @a bus_type. * @@ -228,27 +229,27 @@ public: const Glib::RefPtr& observer, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new) static void create(const Glib::RefPtr& stream, const std::string& guid, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create(). static void create(const Glib::RefPtr& stream, const std::string& guid, const Glib::RefPtr& observer, const SlotAsyncReady& slot, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create(). static void create(const Glib::RefPtr& stream, const std::string& guid, const SlotAsyncReady& slot, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_finish) /// @throw Glib::Error. @@ -259,24 +260,24 @@ public: const Glib::RefPtr& observer, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address) static void create_for_address(const std::string& address, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_for_address(). static void create_for_address(const std::string& address, const Glib::RefPtr& observer, const SlotAsyncReady& slot, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_for_address(). static void create_for_address(const std::string& address, const SlotAsyncReady& slot, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_finish) /// @throw Glib::Error. @@ -289,7 +290,7 @@ public: const std::string& guid, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_sync) /// @throw Glib::Error. @@ -297,20 +298,20 @@ public: const Glib::RefPtr& stream, const std::string& guid, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_sync(). static Glib::RefPtr create_sync( const Glib::RefPtr& stream, const std::string& guid, const Glib::RefPtr& observer, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_sync(). static Glib::RefPtr create_sync( const Glib::RefPtr& stream, const std::string& guid, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_sync) /// @throw Glib::Error. @@ -318,25 +319,25 @@ public: const std::string& address, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_sync) /// @throw Glib::Error. static Glib::RefPtr create_for_address_sync( const std::string& address, const Glib::RefPtr& cancellable, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_for_address_sync(). static Glib::RefPtr create_for_address_sync( const std::string& address, const Glib::RefPtr& observer, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /// Non-cancellable version of create_for_address_sync(). static Glib::RefPtr create_for_address_sync( const std::string& address, - ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::ConnectionFlags::NONE); /** Closes the connection. Note that this never causes the process to exit * (this might only happen if the other end of a shared message bus @@ -488,11 +489,11 @@ public: /// A send_message() without an "out_serial" parameter. bool send_message(const Glib::RefPtr& message, - SendMessageFlags flags = Gio::DBus::SEND_MESSAGE_FLAGS_NONE); + SendMessageFlags flags = Gio::DBus::SendMessageFlags::NONE); /** Asynchronously sends message to the peer represented by the connection. * - * Unless flags contain the Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL + * Unless flags contain the Gio::DBus::SendMessageFlags::PRESERVE_SERIAL * flag, the serial number will be assigned by the connection and set on * message via Gio::DBus::Message::set_serial(). * @@ -508,7 +509,7 @@ public: * send_message_with_reply_sync() for the synchronous version. * * Note that message must be unlocked, unless flags contain the - * Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. + * Gio::DBus::SendMessageFlags::PRESERVE_SERIAL flag. * * See the C API docs for examples. * @@ -541,7 +542,7 @@ public: * reached. See send_message_with_reply() for the asynchronous version of * this method. * - * Unless flags contain the Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL + * Unless flags contain the Gio::DBus::SendMessageFlags::PRESERVE_SERIAL * flag, the serial number will be assigned by the connection and set on * message via Gio::DBus::Message::set_serial(). * @@ -558,7 +559,7 @@ public: * See the C API docs for examples. * * Note that message must be unlocked, unless flags contain the - * Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. + * Gio::DBus::SendMessageFlags::PRESERVE_SERIAL flag. * * @param message A Message. * @param cancellable A Cancellable. @@ -641,7 +642,7 @@ public: const Glib::RefPtr& cancellable, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); _IGNORE(g_dbus_connection_call) @@ -654,7 +655,7 @@ public: const SlotAsyncReady& slot, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); /** Finishes an operation started with call(). @@ -708,7 +709,7 @@ public: const Glib::RefPtr& cancellable, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); _IGNORE(g_dbus_connection_call_sync) @@ -720,7 +721,7 @@ public: const Glib::VariantContainerBase& parameters, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); #ifdef G_OS_UNIX @@ -759,7 +760,7 @@ public: const Glib::RefPtr& fd_list, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); _IGNORE(g_dbus_connection_call_with_unix_fd_list) @@ -775,7 +776,7 @@ public: const Glib::RefPtr& fd_list, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type = Glib::VariantType()); #endif // G_OS_UNIX @@ -800,7 +801,7 @@ public: Glib::RefPtr& out_fd_list{.>>}, const Glib::ustring& bus_name{.NULL} = Glib::ustring(), int timeout_msec{.} = -1, - CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE, + CallFlags flags{.} = Gio::DBus::CallFlags::NONE, const Glib::VariantType& reply_type{.} = Glib::VariantType() ), g_dbus_connection_call_with_unix_fd_list_sync, errthrow, ifdef G_OS_UNIX @@ -867,7 +868,7 @@ public: const Glib::ustring& member = Glib::ustring(), const Glib::ustring& object_path = Glib::ustring(), const Glib::ustring& arg0 = Glib::ustring(), - SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE); + SignalFlags flags = Gio::DBus::SignalFlags::NONE); _IGNORE(g_dbus_connection_signal_subscribe) _WRAP_METHOD(void signal_unsubscribe(guint subscription_id), g_dbus_connection_signal_unsubscribe) @@ -976,7 +977,7 @@ public: * * When handling remote calls into any node in the subtree, first the * enumerate slot is used to check if the node exists. If the node - * exists or the Gio::DBus::SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag + * exists or the Gio::DBus::SubtreeFlags::DISPATCH_TO_UNENUMERATED_NODES flag * is set the introspection slot is used to check if the node supports the * requested method. If so, the dispatch function is used to determine where * to dispatch the call. The collected InterfaceVTable will be used to @@ -1006,7 +1007,7 @@ public: */ guint register_subtree(const Glib::ustring& object_path, const SubtreeVTable& vtable, - SubtreeFlags flags = Gio::DBus::SUBTREE_FLAGS_NONE); + SubtreeFlags flags = Gio::DBus::SubtreeFlags::NONE); _IGNORE(g_dbus_connection_register_subtree) _WRAP_METHOD(bool unregister_subtree(guint registration_id), g_dbus_connection_unregister_subtree) diff --git a/gio/src/dbuserror.ccg b/gio/src/dbuserror.ccg index e3c93dc..555a34b 100644 --- a/gio/src/dbuserror.ccg +++ b/gio/src/dbuserror.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbuserror.hg b/gio/src/dbuserror.hg index 95bfe59..1e52dbb 100644 --- a/gio/src/dbuserror.hg +++ b/gio/src/dbuserror.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbuserrorutils.ccg b/gio/src/dbuserrorutils.ccg index f9dae85..d4e3490 100644 --- a/gio/src/dbuserrorutils.ccg +++ b/gio/src/dbuserrorutils.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbuserrorutils.hg b/gio/src/dbuserrorutils.hg index 084fa0c..a2c8ece 100644 --- a/gio/src/dbuserrorutils.hg +++ b/gio/src/dbuserrorutils.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(giomm,gio) diff --git a/gio/src/dbusinterface.ccg b/gio/src/dbusinterface.ccg index 4d2a74d..af4aa8e 100644 --- a/gio/src/dbusinterface.ccg +++ b/gio/src/dbusinterface.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusinterface.hg b/gio/src/dbusinterface.hg index 8725f38..485d2b5 100644 --- a/gio/src/dbusinterface.hg +++ b/gio/src/dbusinterface.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -35,8 +38,6 @@ class Object; _GMMPROC_EXTRA_NAMESPACE(DBus) -//TODO: Have Proxy derive from this interface when there is an ABI break. - /** Interface - Base type for D-Bus interfaces. * The Interface type is the base type for D-Bus interfaces both on the service * side (see InterfaceSkeleton) and client side (see Proxy). diff --git a/gio/src/dbusinterfaceskeleton.ccg b/gio/src/dbusinterfaceskeleton.ccg index 0c0b4e8..50e1f9f 100644 --- a/gio/src/dbusinterfaceskeleton.ccg +++ b/gio/src/dbusinterfaceskeleton.ccg @@ -11,9 +11,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include + +using Flags = Gio::DBus::InterfaceSkeleton::Flags; diff --git a/gio/src/dbusinterfaceskeleton.hg b/gio/src/dbusinterfaceskeleton.hg index 18612d3..ef7b1a2 100644 --- a/gio/src/dbusinterfaceskeleton.hg +++ b/gio/src/dbusinterfaceskeleton.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,8 +28,6 @@ namespace Gio namespace DBus { -_WRAP_ENUM(InterfaceSkeletonFlags, GDBusInterfaceSkeletonFlags, NO_GTYPE) - class InterfaceInfo; class Connection; class MethodInvocation; @@ -46,6 +45,8 @@ class InterfaceSkeleton _IMPLEMENTS_INTERFACE(Interface) public: + _WRAP_ENUM(Flags, GDBusInterfaceSkeletonFlags, NO_GTYPE) + _WRAP_METHOD(void flush(), g_dbus_interface_skeleton_flush) _WRAP_METHOD(Glib::RefPtr get_info(), g_dbus_interface_skeleton_get_info) @@ -71,10 +72,10 @@ public: _WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_interface_skeleton_get_object_path) - _WRAP_METHOD(InterfaceSkeletonFlags get_flags() const, g_dbus_interface_skeleton_get_flags) - _WRAP_METHOD(void set_flags(InterfaceSkeletonFlags flags), g_dbus_interface_skeleton_set_flags) + _WRAP_METHOD(Flags get_flags() const, g_dbus_interface_skeleton_get_flags) + _WRAP_METHOD(void set_flags(Flags flags), g_dbus_interface_skeleton_set_flags) - _WRAP_PROPERTY("g-flags", InterfaceSkeletonFlags) + _WRAP_PROPERTY("g-flags", Flags) #m4 _CONVERSION(`GDBusMethodInvocation*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(bool authorize_method(const Glib::RefPtr& invocation), "g_authorize_method") diff --git a/gio/src/dbusinterfacevtable.ccg b/gio/src/dbusinterfacevtable.ccg index d47b5a9..c6ffd89 100644 --- a/gio/src/dbusinterfacevtable.ccg +++ b/gio/src/dbusinterfacevtable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusinterfacevtable.hg b/gio/src/dbusinterfacevtable.hg index 287c2c4..c4081e7 100644 --- a/gio/src/dbusinterfacevtable.hg +++ b/gio/src/dbusinterfacevtable.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -60,14 +63,14 @@ public: * @endcode */ using SlotInterfaceMethodCall = sigc::slot< - void, + void( const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::VariantContainerBase&, - const Glib::RefPtr& + const Glib::RefPtr&) >; /** The type for a slot which handles getting a property for a D-Bus @@ -82,13 +85,13 @@ public: * @throw Glib::Error. */ using SlotInterfaceGetProperty = sigc::slot< - void, + void( Glib::VariantBase&, const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, - const Glib::ustring& + const Glib::ustring&) >; /** The type for a slot which handles setting a property for a D-Bus @@ -103,13 +106,13 @@ public: * @throw Glib::Error. */ using SlotInterfaceSetProperty = sigc::slot< - bool, + bool( const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, - const Glib::VariantBase& + const Glib::VariantBase&) >; /** Constructs a new InterfaceVTable using the specified slots. diff --git a/gio/src/dbusintrospection.ccg b/gio/src/dbusintrospection.ccg index 43f761c..4a37d37 100644 --- a/gio/src/dbusintrospection.ccg +++ b/gio/src/dbusintrospection.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusintrospection.hg b/gio/src/dbusintrospection.hg index d56f6da..a99d4e3 100644 --- a/gio/src/dbusintrospection.hg +++ b/gio/src/dbusintrospection.hg @@ -11,11 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include -#include +#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -26,7 +28,7 @@ namespace Gio namespace DBus { -_WRAP_ENUM(PropertyInfoFlags, GDBusPropertyInfoFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(PropertyInfoFlags, GDBusPropertyInfoFlags, NO_GTYPE) /** Stores information about an annotation. * @@ -39,8 +41,8 @@ class AnnotationInfo final _IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref) public: -#m4 _CONVERSION(`const Glib::ArrayHandle< Glib::RefPtr >&', `GDBusAnnotationInfo**', `const_cast($3.data())') - _WRAP_METHOD(static Glib::ustring info_lookup(const Glib::ArrayHandle< Glib::RefPtr >& annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup) +#m4 _CONVERSION(`const std::vector>&', `GDBusAnnotationInfo**',`Glib::ArrayHandler>::vector_to_array($3).data()') + _WRAP_METHOD(static Glib::ustring info_lookup(const std::vector>& annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup) }; /** ArgInfo - Stores information about an argument for a method or a diff --git a/gio/src/dbusmenumodel.ccg b/gio/src/dbusmenumodel.ccg index 2069b14..b8012ef 100644 --- a/gio/src/dbusmenumodel.ccg +++ b/gio/src/dbusmenumodel.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusmenumodel.hg b/gio/src/dbusmenumodel.hg index f704350..6ada9ed 100644 --- a/gio/src/dbusmenumodel.hg +++ b/gio/src/dbusmenumodel.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusmessage.ccg b/gio/src/dbusmessage.ccg index 50fe956..751fbfd 100644 --- a/gio/src/dbusmessage.ccg +++ b/gio/src/dbusmessage.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusmessage.hg b/gio/src/dbusmessage.hg index 2207604..0abe21a 100644 --- a/gio/src/dbusmessage.hg +++ b/gio/src/dbusmessage.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -31,10 +32,10 @@ namespace Gio namespace DBus { -_WRAP_ENUM(MessageType, GDBusMessageType, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(MessageFlags, GDBusMessageFlags, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(MessageHeaderField, GDBusMessageHeaderField, s#^DBUS_##, NO_GTYPE) -_WRAP_ENUM(CapabilityFlags, GDBusCapabilityFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(MessageType, GDBusMessageType, NO_GTYPE) +_WRAP_ENUM(MessageFlags, GDBusMessageFlags, NO_GTYPE) +_WRAP_ENUM(MessageHeaderField, GDBusMessageHeaderField, NO_GTYPE) +_WRAP_ENUM(CapabilityFlags, GDBusCapabilityFlags, NO_GTYPE) _GMMPROC_EXTRA_NAMESPACE(DBus) @@ -75,7 +76,7 @@ public: // Ignore variable argument functions. _IGNORE(g_dbus_message_new_method_error, g_dbus_message_new_method_error_valist) - _WRAP_METHOD(static Glib::RefPtr create_from_blob(const guchar* blob, gsize blob_len, CapabilityFlags capabilities = CAPABILITY_FLAGS_NONE), g_dbus_message_new_from_blob, errthrow) + _WRAP_METHOD(static Glib::RefPtr create_from_blob(const guchar* blob, gsize blob_len, CapabilityFlags capabilities = CapabilityFlags::NONE), g_dbus_message_new_from_blob, errthrow) _WRAP_METHOD(Glib::ustring print(guint indent), g_dbus_message_print) @@ -87,16 +88,8 @@ public: _WRAP_METHOD(MessageType get_message_type() const, g_dbus_message_get_message_type) _WRAP_METHOD(void set_message_type(MessageType type), g_dbus_message_set_message_type) - //gmmproc can't handle the character literals, and this won't be expanded in future, - //so we just wrap it by hand. - enum ByteOrder - { - BYTE_ORDER_BIG_ENDIAN = 'B', - BYTE_ORDER_LITTLE_ENDIAN = 'l' - }; - - #m4 _CONVERSION(`ByteOrder',`GDBusMessageByteOrder',`(GDBusMessageByteOrder)($3)') - #m4 _CONVERSION(`GDBusMessageByteOrder',`ByteOrder',`(ByteOrder)($3)') + // BIG_ENDIAN and LITTLE_ENDIAN are defined as preprocessor macros somewhere. + _WRAP_ENUM(ByteOrder, GDBusMessageByteOrder, NO_GTYPE, s#ENDIAN$#ENDIAN_ORDER#) _WRAP_METHOD(ByteOrder get_byte_order() const, g_dbus_message_get_byte_order) _WRAP_METHOD(void set_byte_order(ByteOrder byte_order), g_dbus_message_set_byte_order) @@ -137,8 +130,8 @@ public: _WRAP_METHOD(void set_header(MessageHeaderField header_field, const Glib::VariantBase& value), g_dbus_message_set_header) - #m4 _CONVERSION(`guchar*',`Glib::ArrayHandle',`Glib::ArrayHandle($3)') - _WRAP_METHOD(Glib::ArrayHandle get_header_fields() const, g_dbus_message_get_header_fields) + #m4 _CONVERSION(`guchar*',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(std::vector get_header_fields() const, g_dbus_message_get_header_fields) _WRAP_METHOD(Glib::ustring get_destination() const, g_dbus_message_get_destination) _WRAP_METHOD(void set_destination(const Glib::ustring& value), g_dbus_message_set_destination) @@ -168,7 +161,7 @@ public: _WRAP_METHOD(static gssize bytes_needed(const guchar* blob, gsize blob_len), g_dbus_message_bytes_needed, errthrow) - _WRAP_METHOD(guchar* to_blob(gsize& out_size, CapabilityFlags capabilities = CAPABILITY_FLAGS_NONE), g_dbus_message_to_blob, errthrow) + _WRAP_METHOD(guchar* to_blob(gsize& out_size, CapabilityFlags capabilities = CapabilityFlags::NONE), g_dbus_message_to_blob, errthrow) _WRAP_METHOD(void to_exception(), g_dbus_message_to_gerror, errthrow) diff --git a/gio/src/dbusmethodinvocation.ccg b/gio/src/dbusmethodinvocation.ccg index 870b3f7..02c2c65 100644 --- a/gio/src/dbusmethodinvocation.ccg +++ b/gio/src/dbusmethodinvocation.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusmethodinvocation.hg b/gio/src/dbusmethodinvocation.hg index 65e81c0..84fecef 100644 --- a/gio/src/dbusmethodinvocation.hg +++ b/gio/src/dbusmethodinvocation.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include diff --git a/gio/src/dbusobject.ccg b/gio/src/dbusobject.ccg index 7e1543d..68334df 100644 --- a/gio/src/dbusobject.ccg +++ b/gio/src/dbusobject.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusobject.hg b/gio/src/dbusobject.hg index 3be72cf..6979d82 100644 --- a/gio/src/dbusobject.hg +++ b/gio/src/dbusobject.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusownname.ccg b/gio/src/dbusownname.ccg index 81a7a9f..db1a37b 100644 --- a/gio/src/dbusownname.ccg +++ b/gio/src/dbusownname.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusownname.hg b/gio/src/dbusownname.hg index 5971bf2..596171e 100644 --- a/gio/src/dbusownname.hg +++ b/gio/src/dbusownname.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,7 +25,7 @@ namespace Gio namespace DBus { -_WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags, s#^DBUS_##) +_WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags) /** For example, * void on_bus_acquired(const Glib::RefPtr& connection, @@ -34,21 +33,21 @@ _WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags, s#^DBUS_##) * @newin{2,28} * @ingroup DBus */ -using SlotBusAcquired = sigc::slot&, Glib::ustring>; +using SlotBusAcquired = sigc::slot&, Glib::ustring)>; /** For example, * void on_name_acquired(const Glib::RefPtr& connection, * const Glib::ustring& name); * @ingroup DBus */ -using SlotNameAcquired = sigc::slot&, Glib::ustring>; +using SlotNameAcquired = sigc::slot&, Glib::ustring)>; /** For example, * void on_name_lost(const Glib::RefPtr& connection, * const Glib::ustring& name); * @ingroup DBus */ -using SlotNameLost = sigc::slot&, Glib::ustring>; +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. @@ -115,7 +114,7 @@ guint own_name( const SlotBusAcquired& bus_acquired_slot = SlotBusAcquired(), const SlotNameAcquired& name_acquired_slot = SlotNameAcquired(), const SlotNameLost& name_lost_slot = SlotNameLost(), - BusNameOwnerFlags flags = Gio::DBus::BUS_NAME_OWNER_FLAGS_NONE + BusNameOwnerFlags flags = Gio::DBus::BusNameOwnerFlags::NONE ); _IGNORE(g_bus_own_name) diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg index eefebcc..67ad4fa 100644 --- a/gio/src/dbusproxy.ccg +++ b/gio/src/dbusproxy.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -145,7 +146,7 @@ Proxy::create_sync(const Glib::RefPtr& connection, const Glib::ustri const Glib::RefPtr& cancellable, const Glib::RefPtr& info, ProxyFlags flags) { - return Glib::RefPtr( + return Glib::make_refptr_for_instance( new Proxy(connection, name, object_path, interface_name, cancellable, info, flags)); } @@ -154,7 +155,7 @@ Proxy::create_sync(const Glib::RefPtr& connection, const Glib::ustri const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info, ProxyFlags flags) { - return Glib::RefPtr(new Proxy(connection, name, object_path, interface_name, info, flags)); + return Glib::make_refptr_for_instance(new Proxy(connection, name, object_path, interface_name, info, flags)); } void @@ -180,7 +181,7 @@ Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::RefPtr& cancellable, const Glib::RefPtr& info, ProxyFlags flags) { - return Glib::RefPtr( + return Glib::make_refptr_for_instance( new Proxy(bus_type, name, object_path, interface_name, cancellable, info, flags)); } @@ -189,7 +190,7 @@ Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info, ProxyFlags flags) { - return Glib::RefPtr(new Proxy(bus_type, name, object_path, interface_name, info, flags)); + return Glib::make_refptr_for_instance(new Proxy(bus_type, name, object_path, interface_name, info, flags)); } void diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg index de241b7..fb49e88 100644 --- a/gio/src/dbusproxy.hg +++ b/gio/src/dbusproxy.hg @@ -11,12 +11,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include +#include #include #include #include @@ -32,7 +34,7 @@ namespace DBus //The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the DBus sub-namespace _GMMPROC_EXTRA_NAMESPACE(DBus) -_WRAP_ENUM(ProxyFlags, GDBusProxyFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(ProxyFlags, GDBusProxyFlags, NO_GTYPE) /** A client-side proxy. * This is a base class used for proxies to access a D-Bus interface on @@ -63,11 +65,13 @@ _WRAP_ENUM(ProxyFlags, GDBusProxyFlags, s#^DBUS_##, NO_GTYPE) class Proxy : public Glib::Object, public Initable, - public AsyncInitable + public AsyncInitable, + public Interface { _CLASS_GOBJECT(Proxy, GDBusProxy, G_DBUS_PROXY, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) _IMPLEMENTS_INTERFACE(AsyncInitable) + _IMPLEMENTS_INTERFACE(DBus::Interface) protected: @@ -78,7 +82,7 @@ protected: const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(const Glib::RefPtr& connection, const Glib::ustring& name, @@ -86,7 +90,7 @@ protected: const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(const Glib::RefPtr& connection, const Glib::ustring& name, @@ -94,14 +98,14 @@ protected: const Glib::ustring& interface_name, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(const Glib::RefPtr& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(BusType bus_type, const Glib::ustring& name, @@ -110,7 +114,7 @@ protected: const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(BusType bus_type, const Glib::ustring& name, @@ -118,7 +122,7 @@ protected: const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(BusType bus_type, const Glib::ustring& name, @@ -126,14 +130,14 @@ protected: const Glib::ustring& interface_name, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); public: @@ -145,7 +149,7 @@ public: const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); /// Non-cancellable version of create(). static void create(const Glib::RefPtr& connection, @@ -154,7 +158,7 @@ public: const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_finish) /// @throw Glib::Error. @@ -168,7 +172,7 @@ public: const Glib::ustring& interface_name, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); /// Non-cancellable version of create_sync(). static Glib::RefPtr @@ -177,7 +181,7 @@ public: const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus) static void create_for_bus(BusType bus_type, @@ -187,7 +191,7 @@ public: const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); /// Non-cancellable version of create_for_bus(). static void create_for_bus(BusType bus_type, @@ -196,7 +200,7 @@ public: const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus_finish) /// @throw Glib::Error. @@ -210,7 +214,7 @@ public: const Glib::ustring& interface_name, const Glib::RefPtr& cancellable, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); /// Non-cancellable version of create_for_bus_sync(). static Glib::RefPtr @@ -219,7 +223,7 @@ public: const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr& info = Glib::RefPtr(), - ProxyFlags flags = PROXY_FLAGS_NONE); + ProxyFlags flags = ProxyFlags::NONE); _WRAP_METHOD(ProxyFlags get_flags() const, g_dbus_proxy_get_flags) @@ -252,8 +256,8 @@ public: _WRAP_METHOD(void set_cached_property(const Glib::ustring& property_name, const Glib::VariantBase& value), g_dbus_proxy_set_cached_property) -#m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle get_cached_property_names() const, g_dbus_proxy_get_cached_property_names) +#m4 _CONVERSION(`gchar**', `std::vector', `Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector get_cached_property_names() const, g_dbus_proxy_get_cached_property_names) _WRAP_METHOD(void set_interface_info(const Glib::RefPtr& info), g_dbus_proxy_set_interface_info) _WRAP_METHOD(Glib::RefPtr get_interface_info(), g_dbus_proxy_get_interface_info) @@ -266,7 +270,7 @@ public: const Glib::RefPtr& cancellable{.?}, const Glib::VariantContainerBase& parameters{.} = Glib::VariantContainerBase(), int timeout_msec{.} = -1, - CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE + CallFlags flags{.} = Gio::DBus::CallFlags::NONE ), g_dbus_proxy_call, slot_name slot, slot_callback SignalProxy_async_callback ) @@ -287,7 +291,7 @@ public: const Glib::RefPtr& cancellable{.?}, const Glib::VariantContainerBase& parameters{.} = Glib::VariantContainerBase(), int timeout_msec{.} = -1, - CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE + CallFlags flags{.} = Gio::DBus::CallFlags::NONE ), g_dbus_proxy_call_sync, errthrow ) @@ -300,7 +304,7 @@ public: const Glib::RefPtr& cancellable{.?}, const Glib::RefPtr& fd_list{.}, int timeout_msec{.} = -1, - CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE + CallFlags flags{.} = Gio::DBus::CallFlags::NONE ), g_dbus_proxy_call_with_unix_fd_list, ifdef G_OS_UNIX, slot_name slot, slot_callback SignalProxy_async_callback @@ -324,7 +328,7 @@ public: const Glib::RefPtr& fd_list{.}, Glib::RefPtr& out_fd_list{.>>}, int timeout_msec{.} = -1, - CallFlags flags{.} = Gio::DBus::CALL_FLAGS_NONE + CallFlags flags{.} = Gio::DBus::CallFlags::NONE ), g_dbus_proxy_call_with_unix_fd_list_sync, errthrow, ifdef G_OS_UNIX ) diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg index cd8ca6d..403bd3b 100644 --- a/gio/src/dbusserver.ccg +++ b/gio/src/dbusserver.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,6 +21,8 @@ #include #include +using Flags = Gio::DBus::Server::Flags; + namespace Gio { @@ -28,7 +31,7 @@ namespace DBus Server::Server(const std::string& address, const std::string& guid, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ServerFlags flags) + Flags flags) : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast(flags), "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", Glib::unwrap(observer)) @@ -37,7 +40,7 @@ Server::Server(const std::string& address, const std::string& guid, } Server::Server(const std::string& address, const std::string& guid, - const Glib::RefPtr& cancellable, ServerFlags flags) + const Glib::RefPtr& cancellable, Flags flags) : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast(flags), "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", static_cast(nullptr)) @@ -46,7 +49,7 @@ Server::Server(const std::string& address, const std::string& guid, } Server::Server(const std::string& address, const std::string& guid, - const Glib::RefPtr& observer, ServerFlags flags) + const Glib::RefPtr& observer, Flags flags) : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast(flags), "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", Glib::unwrap(observer)) @@ -54,7 +57,7 @@ Server::Server(const std::string& address, const std::string& guid, init(); } -Server::Server(const std::string& address, const std::string& guid, ServerFlags flags) +Server::Server(const std::string& address, const std::string& guid, Flags flags) : _CONSTRUCT("address", Glib::c_str_or_nullptr(address), "flags", static_cast(flags), "guid", Glib::c_str_or_nullptr(guid), "authentication-observer", static_cast(nullptr)) @@ -65,29 +68,29 @@ Server::Server(const std::string& address, const std::string& guid, ServerFlags Glib::RefPtr Server::create_sync(const std::string& address, const std::string& guid, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ServerFlags flags) + Flags flags) { - return Glib::RefPtr(new Server(address, guid, observer, cancellable, flags)); + return Glib::make_refptr_for_instance(new Server(address, guid, observer, cancellable, flags)); } Glib::RefPtr Server::create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr& cancellable, ServerFlags flags) + const Glib::RefPtr& cancellable, Flags flags) { - return Glib::RefPtr(new Server(address, guid, cancellable, flags)); + return Glib::make_refptr_for_instance(new Server(address, guid, cancellable, flags)); } Glib::RefPtr Server::create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr& observer, ServerFlags flags) + const Glib::RefPtr& observer, Flags flags) { - return Glib::RefPtr(new Server(address, guid, observer, flags)); + return Glib::make_refptr_for_instance(new Server(address, guid, observer, flags)); } Glib::RefPtr -Server::create_sync(const std::string& address, const std::string& guid, ServerFlags flags) +Server::create_sync(const std::string& address, const std::string& guid, Flags flags) { - return Glib::RefPtr(new Server(address, guid, flags)); + return Glib::make_refptr_for_instance(new Server(address, guid, flags)); } } // namespace DBus diff --git a/gio/src/dbusserver.hg b/gio/src/dbusserver.hg index 64ed21b..914dd17 100644 --- a/gio/src/dbusserver.hg +++ b/gio/src/dbusserver.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -30,8 +29,6 @@ namespace Gio namespace DBus { -_WRAP_ENUM(ServerFlags, GDBusServerFlags, s#^DBUS_##, NO_GTYPE) - _GMMPROC_EXTRA_NAMESPACE(DBus) //TODO: Add example from the C API in class docs. @@ -55,27 +52,29 @@ class Server : public Glib::Object, public Initable _CLASS_GOBJECT(Server, GDBusServer, G_DBUS_SERVER, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) -protected: +public: + _WRAP_ENUM(Flags, GDBusServerFlags, NO_GTYPE) +protected: Server(const std::string& address, const std::string& guid, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ServerFlags flags); + Flags flags); Server(const std::string& address, const std::string& guid, const Glib::RefPtr& cancellable, - ServerFlags flags); + Flags flags); Server(const std::string& address, const std::string& guid, const Glib::RefPtr& observer, - ServerFlags flags); + Flags flags); Server(const std::string& address, const std::string& guid, - ServerFlags flags); + Flags flags); public: @@ -85,38 +84,38 @@ public: const std::string& guid, const Glib::RefPtr& observer, const Glib::RefPtr& cancellable, - ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); + Flags flags = Gio::DBus::Server::Flags::NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_server_new_sync) /// @throw Glib::Error. static Glib::RefPtr create_sync(const std::string& address, const std::string& guid, const Glib::RefPtr& cancellable, - ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); + Flags flags = Gio::DBus::Server::Flags::NONE); /// Non-cancellable version of create_sync(). static Glib::RefPtr create_sync(const std::string& address, const std::string& guid, const Glib::RefPtr& observer, - ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); + Flags flags = Gio::DBus::Server::Flags::NONE); /// Non-cancellable version of create_sync(). static Glib::RefPtr create_sync(const std::string& address, const std::string& guid, - ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); + Flags flags = Gio::DBus::Server::Flags::NONE); _WRAP_METHOD(void start(), g_dbus_server_start) _WRAP_METHOD(void stop(), g_dbus_server_stop) _WRAP_METHOD(bool is_active() const, g_dbus_server_is_active) _WRAP_METHOD(std::string get_guid() const, g_dbus_server_get_guid) - _WRAP_METHOD(ServerFlags get_flags() const, g_dbus_server_get_flags) + _WRAP_METHOD(Flags get_flags() const, g_dbus_server_get_flags) _WRAP_METHOD(std::string get_client_address() const, g_dbus_server_get_client_address) _WRAP_PROPERTY("active", bool) _WRAP_PROPERTY("address", std::string) _WRAP_PROPERTY("authentication-observer", Glib::RefPtr) _WRAP_PROPERTY("client-address", std::string) - _WRAP_PROPERTY("flags", ServerFlags) + _WRAP_PROPERTY("flags", Flags) _WRAP_PROPERTY("guid", std::string) #m4 _CONVERSION(`GDBusConnection*', `const Glib::RefPtr&', `Glib::wrap($3, true)') diff --git a/gio/src/dbussubtreevtable.ccg b/gio/src/dbussubtreevtable.ccg index 59ea274..0445386 100644 --- a/gio/src/dbussubtreevtable.ccg +++ b/gio/src/dbussubtreevtable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbussubtreevtable.hg b/gio/src/dbussubtreevtable.hg index 0fe4d53..3c2d6d8 100644 --- a/gio/src/dbussubtreevtable.hg +++ b/gio/src/dbussubtreevtable.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -64,10 +67,10 @@ public: * @endcode */ using SlotSubtreeEnumerate = sigc::slot< - std::vector, + std::vector( const Glib::RefPtr&, const Glib::ustring&, - const Glib::ustring& + const Glib::ustring&) >; /** The type for a slot which handles introspecting a child node. @@ -91,11 +94,11 @@ public: * @endcode */ using SlotSubtreeIntrospect = sigc::slot< - std::vector< Glib::RefPtr >, + std::vector< Glib::RefPtr >( const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, - const Glib::ustring& + const Glib::ustring&) >; /** The type for a slot which handles dispatching a remote call on a child @@ -113,12 +116,12 @@ public: * @endcode */ using SlotSubtreeDispatch = sigc::slot< - const InterfaceVTable*, + const InterfaceVTable*( const Glib::RefPtr&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, - const Glib::ustring& + const Glib::ustring&) >; /** Constructs a new SubtreeVTable using specified slots. diff --git a/gio/src/dbusutils.ccg b/gio/src/dbusutils.ccg index a84de1f..a614bce 100644 --- a/gio/src/dbusutils.ccg +++ b/gio/src/dbusutils.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbusutils.hg b/gio/src/dbusutils.hg index 85844dc..ac2acf9 100644 --- a/gio/src/dbusutils.hg +++ b/gio/src/dbusutils.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(giomm,gio) diff --git a/gio/src/dbuswatchname.ccg b/gio/src/dbuswatchname.ccg index 04878e7..fa7a1ee 100644 --- a/gio/src/dbuswatchname.ccg +++ b/gio/src/dbuswatchname.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/dbuswatchname.hg b/gio/src/dbuswatchname.hg index bb8b671..46d95d8 100644 --- a/gio/src/dbuswatchname.hg +++ b/gio/src/dbuswatchname.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,21 +25,21 @@ namespace Gio namespace DBus { -_WRAP_ENUM(BusNameWatcherFlags, GBusNameWatcherFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(BusNameWatcherFlags, GBusNameWatcherFlags, NO_GTYPE) /** For example, * void on_name_appeared(const Glib::RefPtr& connection, * const Glib::ustring& name, const Glib::ustring& name_owner); * @ingroup DBus */ -using SlotNameAppeared = sigc::slot&, Glib::ustring, const Glib::ustring&>; +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 */ -using SlotNameVanished = sigc::slot&, Glib::ustring>; +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 @@ -88,7 +87,7 @@ guint watch_name( const Glib::ustring& name, const SlotNameAppeared& name_appeared_slot = SlotNameAppeared(), const SlotNameVanished& name_vanished_slot = SlotNameVanished(), - BusNameWatcherFlags flags = Gio::DBus::BUS_NAME_WATCHER_FLAGS_NONE + BusNameWatcherFlags flags = Gio::DBus::BusNameWatcherFlags::NONE ); _IGNORE(g_bus_watch_name) @@ -111,7 +110,7 @@ guint watch_name( const Glib::ustring& name, const SlotNameAppeared& name_appeared_slot = SlotNameAppeared(), const SlotNameVanished& name_vanished_slot = SlotNameVanished(), - BusNameWatcherFlags flags = Gio::DBus::BUS_NAME_WATCHER_FLAGS_NONE + BusNameWatcherFlags flags = Gio::DBus::BusNameWatcherFlags::NONE ); _IGNORE(g_bus_watch_name_on_connection) diff --git a/gio/src/desktopappinfo.ccg b/gio/src/desktopappinfo.ccg index 27a37e7..42cfd45 100644 --- a/gio/src/desktopappinfo.ccg +++ b/gio/src/desktopappinfo.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/desktopappinfo.hg b/gio/src/desktopappinfo.hg index 3f0bfd9..6a9f130 100644 --- a/gio/src/desktopappinfo.hg +++ b/gio/src/desktopappinfo.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -56,8 +57,8 @@ public: _WRAP_METHOD(std::string get_filename() const, g_desktop_app_info_get_filename) _WRAP_METHOD(bool is_hidden() const, g_desktop_app_info_get_is_hidden) - _WRAP_METHOD(static void set_desktop_env(const std::string& desktop_env), g_desktop_app_info_set_desktop_env, - deprecated "Do not use this API. Since 2.42 the value of the `XDG_CURRENT_DESKTOP` environment variable will be used.") + + _IGNORE(g_desktop_app_info_set_desktop_env) #m4 _CONVERSION(`const char* const*', `std::vector', `Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_NONE)') _WRAP_METHOD(std::vector get_keywords() const, g_desktop_app_info_get_keywords) diff --git a/gio/src/drive.ccg b/gio/src/drive.ccg index 08a90d4..75bbea6 100644 --- a/gio/src/drive.ccg +++ b/gio/src/drive.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,12 +23,14 @@ #include #include "slot_async.h" +using StartStopType = Gio::Drive::StartStopType; + namespace Gio { void Drive::eject( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -38,7 +43,7 @@ Drive::eject( } void -Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) +Drive::eject(const SlotAsyncReady& slot, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -53,7 +58,7 @@ Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) void Drive::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -67,7 +72,7 @@ Drive::eject(const Glib::RefPtr& mount_operation, const SlotAsyn void Drive::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountUnmountFlags flags) + Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -81,7 +86,7 @@ Drive::eject(const Glib::RefPtr& mount_operation, const SlotAsyn } void -Drive::eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags) +Drive::eject(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { g_drive_eject_with_operation(gobj(), static_cast(flags), Glib::unwrap(mount_operation), @@ -91,7 +96,7 @@ Drive::eject(const Glib::RefPtr& mount_operation, MountUnmountFl } void -Drive::eject(MountUnmountFlags flags) +Drive::eject(Mount::UnmountFlags flags) { g_drive_eject_with_operation(gobj(), static_cast(flags), nullptr, // mount_operation @@ -134,7 +139,7 @@ Drive::poll_for_media() void Drive::stop(const Glib::RefPtr& mount_operation, - const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, MountUnmountFlags flags) + const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -147,7 +152,7 @@ Drive::stop(const Glib::RefPtr& mount_operation, void Drive::stop(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountUnmountFlags flags) + Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -160,7 +165,7 @@ Drive::stop(const Glib::RefPtr& mount_operation, const SlotAsync void Drive::start(const Glib::RefPtr& mount_operation, - const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, DriveStartFlags flags) + const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, StartFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -173,7 +178,7 @@ Drive::start(const Glib::RefPtr& mount_operation, void Drive::start(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - DriveStartFlags flags) + StartFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter diff --git a/gio/src/drive.hg b/gio/src/drive.hg index 9593de9..12b281c 100644 --- a/gio/src/drive.hg +++ b/gio/src/drive.hg @@ -11,10 +11,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include //#include @@ -31,9 +31,6 @@ typedef struct _GDriveIface GDriveIface; namespace Gio { -_WRAP_ENUM(DriveStartFlags, GDriveStartFlags) -_WRAP_ENUM(DriveStartStopType, GDriveStartStopType) - /** Virtual File System drive management. * * This represent a piece of hardware connected to the machine. It's generally only created for removable hardware or hardware with removable media. @@ -51,6 +48,9 @@ class Drive : public Glib::Interface _CLASS_INTERFACE(Drive, GDrive, G_DRIVE, GDriveIface) public: + _WRAP_ENUM(StartFlags, GDriveStartFlags) + _WRAP_ENUM(StartStopType, GDriveStartStopType) + _WRAP_METHOD(Glib::ustring get_name() const, g_drive_get_name) _WRAP_METHOD(Glib::RefPtr get_icon(), g_drive_get_icon, refreturn) @@ -61,8 +61,8 @@ public: _WRAP_METHOD(bool has_volumes() const, g_drive_has_volumes) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >',`$2($3, Glib::OWNERSHIP_SHALLOW)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > get_volumes(), g_drive_get_volumes) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(std::vector> get_volumes(), g_drive_get_volumes) _WRAP_METHOD(bool is_media_removable() const, g_drive_is_media_removable) _WRAP_METHOD(bool is_removable() const, g_drive_is_removable) @@ -76,21 +76,21 @@ public: * @param flags Flags affecting the unmount if required for eject. * @param cancellable A cancellable object which can be used to cancel the eject. */ - void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Ejects the drive. * @param slot A callback which will be called when the eject is completed. * @param flags Flags affecting the unmount if required for eject. */ - void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject(const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Ejects the drive. * @param flags Flags affecting the unmount if required for eject. */ - void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject(Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_drive_eject) _IGNORE(g_drive_eject_with_operation) @@ -125,13 +125,13 @@ public: _WRAP_METHOD(std::string get_identifier(const std::string& kind) const, g_drive_get_identifier) - #m4 _CONVERSION(`char**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, g_drive_enumerate_identifiers) + #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector enumerate_identifiers() const, g_drive_enumerate_identifiers) /** @newin{2,22} */ - void start(const Glib::RefPtr& mount_operation, const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, DriveStartFlags flags = DRIVE_START_NONE); + void start(const Glib::RefPtr& mount_operation, const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, StartFlags flags = StartFlags::NONE); /** @newin{2,22} */ - void start(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, DriveStartFlags flags = DRIVE_START_NONE); + void start(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, StartFlags flags = StartFlags::NONE); _IGNORE(g_drive_start) _WRAP_METHOD(bool start_finish(const Glib::RefPtr& result), g_drive_start_finish, errthrow) /** @newin{2,22} */ @@ -140,30 +140,22 @@ public: _WRAP_METHOD(bool can_start_degraded() const, g_drive_can_start_degraded) /** @newin{2,22} */ - void stop(const Glib::RefPtr& mount_operation, const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void stop(const Glib::RefPtr& mount_operation, const Glib::RefPtr& cancellable, const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** @newin{2,22} */ - void stop(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void stop(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_drive_stop) _WRAP_METHOD(bool stop_finish(const Glib::RefPtr& result), g_drive_stop_finish, errthrow) /** @newin{2,22} */ _WRAP_METHOD(bool can_stop() const, g_drive_can_stop) - _WRAP_METHOD(DriveStartStopType get_start_stop_type() const, g_drive_get_start_stop_type) + _WRAP_METHOD(StartStopType get_start_stop_type() const, g_drive_get_start_stop_type) _WRAP_METHOD(Glib::ustring get_sort_key() const, g_drive_get_sort_key) - /** @newin{2,20} - */ - _WRAP_SIGNAL(void changed(), changed, no_default_handler) - - /** @newin{2,20} - */ - _WRAP_SIGNAL(void disconnected(), disconnected, no_default_handler) - - /** @newin{2,20} - */ - _WRAP_SIGNAL(void eject_button(), eject_button, no_default_handler) - _WRAP_SIGNAL(void stop_button(), stop_button, no_default_handler) + _WRAP_SIGNAL(void changed(), changed, newin "2,20") + _WRAP_SIGNAL(void disconnected(), disconnected, newin "2,20") + _WRAP_SIGNAL(void eject_button(), eject_button, newin "2,20") + _WRAP_SIGNAL(void stop_button(), stop_button) //_WRAP_VFUNC(Glib::ustring get_name() const, get_name) //Careful of ref-counting: //_WRAP_VFUNC(Glib::RefPtr get_icon() const, get_icon) diff --git a/gio/src/emblem.ccg b/gio/src/emblem.ccg index 24667b5..fb5dbea 100644 --- a/gio/src/emblem.ccg +++ b/gio/src/emblem.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,11 +13,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +using Origin = Gio::Emblem::Origin; + namespace Gio { diff --git a/gio/src/emblem.hg b/gio/src/emblem.hg index fd4431e..9a88414 100644 --- a/gio/src/emblem.hg +++ b/gio/src/emblem.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -23,8 +26,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(EmblemOrigin, GEmblemOrigin, NO_GTYPE) - /** An object for emblems * * Emblem is an implementation of GIcon that supports having an emblem, which @@ -43,6 +44,9 @@ class Emblem _CLASS_GOBJECT(Emblem, GEmblem, G_EMBLEM, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Icon) +public: + _WRAP_ENUM(Origin, GEmblemOrigin, NO_GTYPE) + protected: /** Creates a new emblem for @a icon. * @param icon A Gio::Icon containing the icon. @@ -51,9 +55,9 @@ protected: /** Creates a new emblem for @a icon. * @param icon A Gio::Icon containing the icon. - * @param origin An EmblemOrigin value defining the emblem's origin + * @param origin An Origin value defining the emblem's origin */ - _WRAP_CTOR(Emblem(const Glib::RefPtr& icon, EmblemOrigin origin), g_emblem_new_with_origin) + _WRAP_CTOR(Emblem(const Glib::RefPtr& icon, Origin origin), g_emblem_new_with_origin) public: /** Creates a new emblem for @a icon. @@ -63,13 +67,13 @@ public: /** Creates a new emblem for @a icon. * @param icon A Gio::Icon containing the icon. - * @param origin An EmblemOrigin value defining the emblem's origin + * @param origin An Origin value defining the emblem's origin */ - _WRAP_CREATE(const Glib::RefPtr& icon, EmblemOrigin origin) + _WRAP_CREATE(const Glib::RefPtr& icon, Origin origin) _WRAP_METHOD(Glib::RefPtr get_icon(), g_emblem_get_icon) _WRAP_METHOD(Glib::RefPtr get_icon() const, g_emblem_get_icon, constversion) - _WRAP_METHOD(EmblemOrigin get_origin() const, g_emblem_get_origin) + _WRAP_METHOD(Origin get_origin() const, g_emblem_get_origin) }; diff --git a/gio/src/emblemedicon.ccg b/gio/src/emblemedicon.ccg index ebf9ed1..faa8e37 100644 --- a/gio/src/emblemedicon.ccg +++ b/gio/src/emblemedicon.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/emblemedicon.hg b/gio/src/emblemedicon.hg index 31d0c78..8ccd5ad 100644 --- a/gio/src/emblemedicon.hg +++ b/gio/src/emblemedicon.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,10 +13,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -78,11 +80,11 @@ public: _WRAP_METHOD(Glib::RefPtr get_icon(), g_emblemed_icon_get_icon) _WRAP_METHOD(Glib::RefPtr get_icon() const, g_emblemed_icon_get_icon, constversion) -#m4 _CONVERSION(`GList*',`Glib::ListHandle >',`$2($3, Glib::OWNERSHIP_NONE)') - _WRAP_METHOD(Glib::ListHandle > get_emblems(), g_emblemed_icon_get_emblems) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_NONE)') + _WRAP_METHOD(std::vector> get_emblems(), g_emblemed_icon_get_emblems) -//TODO: #m4 _CONVERSION(`GList*',`Glib::ListHandle >',`$2($3, Glib::OWNERSHIP_NONE)') -// _WRAP_METHOD(Glib::ListHandle > get_emblems() const, g_emblemed_icon_get_emblems, constversion) +//TODO: #m4 _CONVERSION(`GList*',`std::vector>',`$2($3, Glib::OWNERSHIP_NONE)') +// _WRAP_METHOD(std::vector> get_emblems() const, g_emblemed_icon_get_emblems, constversion) _WRAP_METHOD(void add_emblem(const Glib::RefPtr& emblem), g_emblemed_icon_add_emblem) _WRAP_METHOD(void clear_emblems(), g_emblemed_icon_clear_emblems) diff --git a/gio/src/enums.ccg b/gio/src/enums.ccg index 1c574d6..24ee9e8 100644 --- a/gio/src/enums.ccg +++ b/gio/src/enums.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,5 +13,6 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ diff --git a/gio/src/enums.hg b/gio/src/enums.hg index e38c5db..7cbe7f5 100644 --- a/gio/src/enums.hg +++ b/gio/src/enums.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,12 +23,11 @@ _DEFS(giomm,gio) namespace Gio { -_WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE) +// BIG_ENDIAN and LITTLE_ENDIAN are defined as preprocessor macros somewhere. +_WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE, s#ENDIAN$#ENDIAN_ORDER#) _WRAP_ENUM(DataStreamNewlineType, GDataStreamNewlineType, NO_GTYPE) -_WRAP_ENUM(ErrorEnum, GIOErrorEnum, NO_GTYPE) _WRAP_ENUM(SocketFamily, GSocketFamily) _WRAP_ENUM(TlsAuthenticationMode, GTlsAuthenticationMode) _WRAP_ENUM(TlsCertificateFlags, GTlsCertificateFlags) } // namespace Gio - diff --git a/gio/src/error.ccg b/gio/src/error.ccg index fd123ae..3f6ca4c 100644 --- a/gio/src/error.ccg +++ b/gio/src/error.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/error.hg b/gio/src/error.hg index 7df46d2..5369fa4 100644 --- a/gio/src/error.hg +++ b/gio/src/error.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/file.ccg b/gio/src/file.ccg index a1ded83..846ee18 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -222,7 +223,7 @@ File::read_async( void File::append_to_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - FileCreateFlags flags, int io_priority) + CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -234,7 +235,7 @@ File::append_to_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - FileCreateFlags flags, int io_priority) + CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -260,7 +261,7 @@ File::create_file_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileCreateFlags flags, int io_priority) + const Glib::RefPtr& cancellable, CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -287,7 +288,7 @@ File::create_file_readwrite_async(const SlotAsyncReady& slot, void File::create_file_readwrite_async( - const SlotAsyncReady& slot, FileCreateFlags flags, int io_priority) + const SlotAsyncReady& slot, CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -301,7 +302,7 @@ File::create_file_readwrite_async( void File::replace_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - const std::string& etag, bool make_backup, FileCreateFlags flags, int io_priority) + const std::string& etag, bool make_backup, CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -315,7 +316,7 @@ File::replace_async(const SlotAsyncReady& slot, const Glib::RefPtr& void File::replace_async(const SlotAsyncReady& slot, const std::string& etag, bool make_backup, - FileCreateFlags flags, int io_priority) + CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -355,7 +356,7 @@ File::open_readwrite_async( void File::replace_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& etag, bool make_backup, - FileCreateFlags flags, int io_priority) + CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -369,7 +370,7 @@ File::replace_readwrite_async(const SlotAsyncReady& slot, void File::replace_readwrite_async(const SlotAsyncReady& slot, const std::string& etag, bool make_backup, - FileCreateFlags flags, int io_priority) + CreateFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -580,7 +581,7 @@ File::set_display_name_async( bool File::copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, - const Glib::RefPtr& cancellable, FileCopyFlags flags) + const Glib::RefPtr& cancellable, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -602,7 +603,7 @@ File::copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, } bool -File::copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, FileCopyFlags flags) +File::copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -624,7 +625,7 @@ File::copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, } bool -File::copy(const Glib::RefPtr& destination, FileCopyFlags flags) +File::copy(const Glib::RefPtr& destination, CopyFlags flags) { GError* gerror = nullptr; bool res = g_file_copy(gobj(), Glib::unwrap(destination), static_cast(flags), @@ -639,7 +640,7 @@ File::copy(const Glib::RefPtr& destination, FileCopyFlags flags) void File::copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, - FileCopyFlags flags, int io_priority) + CopyFlags flags, int io_priority) { // Create a new pair which will hold copies of passed slots. // This will be deleted in the SignalProxy_file_copy_async_callback() callback @@ -657,7 +658,7 @@ File::copy_async(const Glib::RefPtr& destination, const SlotFileProgress& void File::copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, - const Glib::RefPtr& cancellable, FileCopyFlags flags, int io_priority) + const Glib::RefPtr& cancellable, CopyFlags flags, int io_priority) { // Create copies of slots. // Pointers to them will be passed through the callbacks' data parameter @@ -671,7 +672,7 @@ File::copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& sl void File::copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, - const SlotAsyncReady& slot_ready, FileCopyFlags flags, int io_priority) + const SlotAsyncReady& slot_ready, CopyFlags flags, int io_priority) { // Create a new pair which will hold copies of passed slots. // This will be deleted in the SignalProxy_file_copy_async_callback() callback @@ -689,7 +690,7 @@ File::copy_async(const Glib::RefPtr& destination, const SlotFileProgress& void File::copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, - FileCopyFlags flags, int io_priority) + CopyFlags flags, int io_priority) { // Create copies of slots. // Pointers to them will be passed through the callbacks' data parameter @@ -702,7 +703,7 @@ File::copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& sl bool File::move(const Glib::RefPtr& destination, const SlotFileProgress& slot, - const Glib::RefPtr& cancellable, FileCopyFlags flags) + const Glib::RefPtr& cancellable, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -724,7 +725,7 @@ File::move(const Glib::RefPtr& destination, const SlotFileProgress& slot, } bool -File::move(const Glib::RefPtr& destination, const SlotFileProgress& slot, FileCopyFlags flags) +File::move(const Glib::RefPtr& destination, const SlotFileProgress& slot, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -746,7 +747,7 @@ File::move(const Glib::RefPtr& destination, const SlotFileProgress& slot, } bool -File::move(const Glib::RefPtr& destination, FileCopyFlags flags) +File::move(const Glib::RefPtr& destination, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -804,7 +805,7 @@ File::set_attributes_finish( void File::mount_mountable(const Glib::RefPtr& mount_operation, - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -818,7 +819,7 @@ File::mount_mountable(const Glib::RefPtr& mount_operation, void File::mount_mountable(const Glib::RefPtr& mount_operation, - const SlotAsyncReady& slot, MountMountFlags flags) + const SlotAsyncReady& slot, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -830,7 +831,7 @@ File::mount_mountable(const Glib::RefPtr& mount_operation, } void -File::mount_mountable(const SlotAsyncReady& slot, MountMountFlags flags) +File::mount_mountable(const SlotAsyncReady& slot, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -842,7 +843,7 @@ File::mount_mountable(const SlotAsyncReady& slot, MountMountFlags flags) } void -File::mount_mountable(MountMountFlags flags) +File::mount_mountable(Mount::MountFlags flags) { g_file_mount_mountable( gobj(), static_cast(flags), nullptr, nullptr, nullptr, nullptr); @@ -850,7 +851,7 @@ File::mount_mountable(MountMountFlags flags) void File::unmount_mountable( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -862,7 +863,7 @@ File::unmount_mountable( } void -File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags) +File::unmount_mountable(const SlotAsyncReady& slot, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -874,7 +875,7 @@ File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags) } void -File::unmount_mountable(MountUnmountFlags flags) +File::unmount_mountable(Mount::UnmountFlags flags) { g_file_unmount_mountable_with_operation( gobj(), static_cast(flags), nullptr, nullptr, nullptr, nullptr); @@ -882,7 +883,7 @@ File::unmount_mountable(MountUnmountFlags flags) void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - const Glib::RefPtr& mount_operation, MountUnmountFlags flags) + const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -896,7 +897,7 @@ File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, MountUnmountFlags flags) + const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -909,7 +910,7 @@ File::unmount_mountable(const SlotAsyncReady& slot, void File::unmount_mountable( - const Glib::RefPtr& mount_operation, MountUnmountFlags flags) + const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { g_file_unmount_mountable_with_operation(gobj(), static_cast(flags), Glib::unwrap(mount_operation), nullptr, nullptr, nullptr); @@ -917,7 +918,7 @@ File::unmount_mountable( void File::mount_enclosing_volume(const Glib::RefPtr& mount_operation, - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -931,7 +932,7 @@ File::mount_enclosing_volume(const Glib::RefPtr& mount_operation void File::mount_enclosing_volume(const Glib::RefPtr& mount_operation, - const SlotAsyncReady& slot, MountMountFlags flags) + const SlotAsyncReady& slot, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -943,7 +944,7 @@ File::mount_enclosing_volume(const Glib::RefPtr& mount_operation } void -File::mount_enclosing_volume(const SlotAsyncReady& slot, MountMountFlags flags) +File::mount_enclosing_volume(const SlotAsyncReady& slot, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -955,7 +956,7 @@ File::mount_enclosing_volume(const SlotAsyncReady& slot, MountMountFlags flags) } void -File::mount_enclosing_volume(MountMountFlags flags) +File::mount_enclosing_volume(Mount::MountFlags flags) { g_file_mount_enclosing_volume( gobj(), static_cast(flags), nullptr, nullptr, nullptr, nullptr); @@ -963,7 +964,7 @@ File::mount_enclosing_volume(MountMountFlags flags) void File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - const Glib::RefPtr& mount_operation, MountUnmountFlags flags) + const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -977,7 +978,7 @@ File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, MountUnmountFlags flags) + const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -989,7 +990,7 @@ File::eject_mountable(const SlotAsyncReady& slot, } void -File::eject_mountable(const Glib::RefPtr& mount_operation, MountUnmountFlags flags) +File::eject_mountable(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { g_file_eject_mountable_with_operation(gobj(), static_cast(flags), Glib::unwrap(mount_operation), nullptr, nullptr, nullptr); @@ -997,7 +998,7 @@ File::eject_mountable(const Glib::RefPtr& mount_operation, Mount void File::eject_mountable( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1009,7 +1010,7 @@ File::eject_mountable( } void -File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags) +File::eject_mountable(const SlotAsyncReady& slot, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1021,7 +1022,7 @@ File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags) } void -File::eject_mountable(MountUnmountFlags flags) +File::eject_mountable(Mount::UnmountFlags flags) { g_file_eject_mountable_with_operation( gobj(), static_cast(flags), nullptr, nullptr, nullptr, nullptr); @@ -1089,7 +1090,7 @@ File::load_partial_contents_async( void File::replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr& cancellable, bool make_backup, - FileCreateFlags flags) + CreateFlags flags) { GError* gerror = nullptr; gchar* c_etag_new = nullptr; @@ -1107,7 +1108,7 @@ File::replace_contents(const char* contents, gsize length, const std::string& et void File::replace_contents(const char* contents, gsize length, const std::string& etag, - std::string& new_etag, bool make_backup, FileCreateFlags flags) + std::string& new_etag, bool make_backup, CreateFlags flags) { GError* gerror = nullptr; gchar* c_etag_new = nullptr; @@ -1124,7 +1125,7 @@ File::replace_contents(const char* contents, gsize length, const std::string& et void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, - const Glib::RefPtr& cancellable, bool make_backup, FileCreateFlags flags) + const Glib::RefPtr& cancellable, bool make_backup, CreateFlags flags) { GError* gerror = nullptr; gchar* c_etag_new = nullptr; @@ -1142,7 +1143,7 @@ File::replace_contents(const std::string& contents, const std::string& etag, std void File::replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, - bool make_backup, FileCreateFlags flags) + bool make_backup, CreateFlags flags) { GError* gerror = nullptr; gchar* c_etag_new = nullptr; @@ -1160,7 +1161,7 @@ File::replace_contents(const std::string& contents, const std::string& etag, std void File::replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const char* contents, gsize length, - const std::string& etag, bool make_backup, FileCreateFlags flags) + const std::string& etag, bool make_backup, CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1174,7 +1175,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, void File::replace_contents_async(const SlotAsyncReady& slot, const char* contents, gsize length, - const std::string& etag, bool make_backup, FileCreateFlags flags) + const std::string& etag, bool make_backup, CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1188,7 +1189,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, const char* contents, g void File::replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& contents, - const std::string& etag, bool make_backup, FileCreateFlags flags) + const std::string& etag, bool make_backup, CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1202,7 +1203,7 @@ File::replace_contents_async(const SlotAsyncReady& slot, void File::replace_contents_async(const SlotAsyncReady& slot, const std::string& contents, - const std::string& etag, bool make_backup, FileCreateFlags flags) + const std::string& etag, bool make_backup, CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1241,7 +1242,7 @@ File::replace_contents_finish(const Glib::RefPtr& result) void File::replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& contents, - const std::string& etag, bool make_backup, FileCreateFlags flags) + const std::string& etag, bool make_backup, CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1256,7 +1257,7 @@ File::replace_contents_bytes_async(const SlotAsyncReady& slot, void File::replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& contents, const std::string& etag, bool make_backup, - FileCreateFlags flags) + CreateFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1270,7 +1271,7 @@ File::replace_contents_bytes_async(const SlotAsyncReady& slot, Glib::RefPtr File::replace(const Glib::RefPtr& cancellable, const std::string& etag, - bool make_backup, FileCreateFlags flags) + bool make_backup, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_replace(gobj(), Glib::c_str_or_nullptr(etag), @@ -1283,7 +1284,7 @@ File::replace(const Glib::RefPtr& cancellable, const std::string& e } Glib::RefPtr -File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags) +File::replace(const std::string& etag, bool make_backup, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_replace(gobj(), Glib::c_str_or_nullptr(etag), @@ -1296,7 +1297,7 @@ File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags) Glib::RefPtr File::replace_readwrite(const Glib::RefPtr& cancellable, const std::string& etag, - bool make_backup, FileCreateFlags flags) + bool make_backup, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), Glib::c_str_or_nullptr(etag), @@ -1309,7 +1310,7 @@ File::replace_readwrite(const Glib::RefPtr& cancellable, const std: } Glib::RefPtr -File::replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags) +File::replace_readwrite(const std::string& etag, bool make_backup, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), Glib::c_str_or_nullptr(etag), @@ -1395,7 +1396,7 @@ File::monitor(FileMonitorFlags flags) void File::measure_disk_usage(const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, guint64& disk_usage, guint64& num_dirs, - guint64& num_files, FileMeasureFlags flags) + guint64& num_files, MeasureFlags flags) { GError* gerror = nullptr; g_file_measure_disk_usage(gobj(), ((GFileMeasureFlags)(flags)), @@ -1410,7 +1411,7 @@ File::measure_disk_usage(const Glib::RefPtr& cancellable, void File::measure_disk_usage_async(const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, - FileMeasureFlags flags, int io_priority) + MeasureFlags flags, int io_priority) { // Create a new pair which will hold copies of passed slots. // This will be deleted in the SignalProxy_file_measure_async_callback() callback @@ -1430,7 +1431,7 @@ File::measure_disk_usage_async(const SlotAsyncReady& slot_ready, void File::start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - const Glib::RefPtr& start_operation, DriveStartFlags flags) + const Glib::RefPtr& start_operation, Drive::StartFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1443,7 +1444,7 @@ File::start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& start_operation, DriveStartFlags flags) + const Glib::RefPtr& start_operation, Drive::StartFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1456,7 +1457,7 @@ File::start_mountable(const SlotAsyncReady& slot, void File::stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - const Glib::RefPtr& start_operation, MountUnmountFlags flags) + const Glib::RefPtr& start_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1469,7 +1470,7 @@ File::stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr void File::stop_mountable(const SlotAsyncReady& slot, - const Glib::RefPtr& start_operation, MountUnmountFlags flags) + const Glib::RefPtr& start_operation, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -1555,7 +1556,7 @@ File::set_attributes_from_info(const Glib::RefPtr& info, FileQueryInfo bool File::copy_attributes(const Glib::RefPtr& destination, - const Glib::RefPtr& cancellable, FileCopyFlags flags) + const Glib::RefPtr& cancellable, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -1570,7 +1571,7 @@ File::copy_attributes(const Glib::RefPtr& destination, } bool -File::copy_attributes(const Glib::RefPtr& destination, FileCopyFlags flags) +File::copy_attributes(const Glib::RefPtr& destination, CopyFlags flags) { GError* gerror = nullptr; bool res; @@ -1585,7 +1586,7 @@ File::copy_attributes(const Glib::RefPtr& destination, FileCopyFlags flags } Glib::RefPtr -File::create_file(const Glib::RefPtr& cancellable, FileCreateFlags flags) +File::create_file(const Glib::RefPtr& cancellable, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), @@ -1597,7 +1598,7 @@ File::create_file(const Glib::RefPtr& cancellable, FileCreateFlags } Glib::RefPtr -File::create_file(FileCreateFlags flags) +File::create_file(CreateFlags flags) { GError* gerror = nullptr; auto retvalue = @@ -1609,7 +1610,7 @@ File::create_file(FileCreateFlags flags) } Glib::RefPtr -File::create_file_readwrite(const Glib::RefPtr& cancellable, FileCreateFlags flags) +File::create_file_readwrite(const Glib::RefPtr& cancellable, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), @@ -1621,7 +1622,7 @@ File::create_file_readwrite(const Glib::RefPtr& cancellable, FileCr } Glib::RefPtr -File::create_file_readwrite(FileCreateFlags flags) +File::create_file_readwrite(CreateFlags flags) { GError* gerror = nullptr; auto retvalue = @@ -1633,7 +1634,7 @@ File::create_file_readwrite(FileCreateFlags flags) } Glib::RefPtr -File::append_to(const Glib::RefPtr& cancellable, FileCreateFlags flags) +File::append_to(const Glib::RefPtr& cancellable, CreateFlags flags) { GError* gerror = nullptr; auto retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), @@ -1645,7 +1646,7 @@ File::append_to(const Glib::RefPtr& cancellable, FileCreateFlags fl } Glib::RefPtr -File::append_to(FileCreateFlags flags) +File::append_to(CreateFlags flags) { GError* gerror = nullptr; auto retvalue = diff --git a/gio/src/file.hg b/gio/src/file.hg index 7fb60af..5df6972 100644 --- a/gio/src/file.hg +++ b/gio/src/file.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -44,10 +45,7 @@ class Mount; class Volume; _WRAP_ENUM(FileQueryInfoFlags, GFileQueryInfoFlags, NO_GTYPE) -_WRAP_ENUM(FileCreateFlags, GFileCreateFlags, NO_GTYPE) -_WRAP_ENUM(FileCopyFlags, GFileCopyFlags, NO_GTYPE) _WRAP_ENUM(FileMonitorFlags, GFileMonitorFlags, NO_GTYPE) -_WRAP_ENUM(FileMeasureFlags, GFileMeasureFlags, NO_GTYPE) /** File and directory handling. @@ -79,6 +77,9 @@ class File : public Glib::Interface _CLASS_INTERFACE(File, GFile, G_FILE, GFileIface) public: + _WRAP_ENUM(CreateFlags, GFileCreateFlags, NO_GTYPE) + _WRAP_ENUM(CopyFlags, GFileCopyFlags, NO_GTYPE) + _WRAP_ENUM(MeasureFlags, GFileMeasureFlags, NO_GTYPE) _IGNORE(g_file_icon_new) //g_file_icon_new is not a GFile method. @@ -221,7 +222,7 @@ public: * the file doesn't already exist it is created. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -234,17 +235,17 @@ public: * If the file is a directory a Gio::Error with IS_DIRECTORY will be * thrown. Other errors are possible too, and depend on what kind of * filesystem the file is on. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param cancellable Optional Cancellable object. * @return A FileOutputStream. */ - Glib::RefPtr append_to(const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr append_to(const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE); /** Gets an output stream for appending data to the file. If * the file doesn't already exist it is created. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -253,10 +254,10 @@ public: * If the file is a directory a Gio::Error with IS_DIRECTORY will be * thrown. Other errors are possible too, and depend on what kind of * filesystem the file is on. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @return A FileOutputStream. */ - Glib::RefPtr append_to(FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr append_to(CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_append_to) //We renamed this to create_file from (g_file_create() and g_file_create_readwrite), to avoid confusion with static create() methods, @@ -266,7 +267,7 @@ public: * The file must not already exist. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -284,16 +285,16 @@ public: * filesystem the file is on. * * @param cancellable A Cancellable object which can be used to cancel the operation. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @return A FileOutputStream for the newly created file. */ - Glib::RefPtr create_file(const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr create_file(const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE); /** Creates a new file and returns an output stream for writing to it. * The file must not already exist. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -307,17 +308,17 @@ public: * Other errors are possible too, and depend on what kind of * filesystem the file is on. * - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @return A FileOutputStream for the newly created file. */ - Glib::RefPtr create_file(FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr create_file(CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_create) /** Creates a new file and returns a stream for reading and writing to it. * The file must not already exist. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -339,16 +340,16 @@ public: * rather than just opening for reading or writing. * * @param cancellable A Cancellable object which can be used to cancel the operation. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @return A FileOutputStream for the newly created file. */ - Glib::RefPtr create_file_readwrite(const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr create_file_readwrite(const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE); /** Creates a new file and returns a stream for reading and writing to it. * The file must not already exist. * * By default files created are generally readable by everyone, - * but if you pass FILE_CREATE_PRIVATE in @a flags the file + * but if you pass CreateFlags::PRIVATE in @a flags the file * will be made readable only to the current user, to the level that * is supported on the target filesystem. * @@ -366,10 +367,10 @@ public: * supported, so make sure you really need to do read and write streaming, * rather than just opening for reading or writing. * - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @return A FileOutputStream for the newly created file. */ - Glib::RefPtr create_file_readwrite(FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr create_file_readwrite(CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_create_readwrite) @@ -379,7 +380,7 @@ public: * not affect an already existing copy of the file. For instance, for local files it may write to a * temporary file and then atomically rename over the destination when the stream is closed. * - * By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in + * By default files created are generally readable by everyone, but if you pass CreateFlags::PRIVATE in * @a flags the file will be made readable only to the current user, to the level that is supported on the * target filesystem. * @@ -405,10 +406,10 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param etag An optional entity tag for the current Glib::File. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @return A FileOutputStream. */ - Glib::RefPtr replace(const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr replace(const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Returns an output stream for overwriting the file, possibly creating a backup copy of the file first. @@ -416,7 +417,7 @@ public: * not affect an already existing copy of the file. For instance, for local files it may write to a * temporary file and then atomically rename over the destination when the stream is closed. * - * By default files created are generally readable by everyone, but if you pass FILE_CREATE_PRIVATE in + * By default files created are generally readable by everyone, but if you pass CreateFlags::PRIVATE in * @a flags the file will be made readable only to the current user, to the level that is supported on the * target filesystem. * @@ -438,10 +439,10 @@ public: * * @param etag An optional entity tag for the current Glib::File. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @return A FileOutputStream. */ - Glib::RefPtr replace(const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr replace(const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_replace) @@ -452,20 +453,20 @@ public: * When the operation is finished, @a slot will be called. You can then call append_to_finish() to get the result of the operation. * @param slot A callback slot which will be called when the request is satisfied. * @param cancellable A Cancellable object which can be used to cancel the operation. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void append_to_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void append_to_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asynchronously opens the file for appending. * For more details, see append_to() which is the synchronous version of this call. * * When the operation is finished, @a slot will be called. You can then call append_to_finish() to get the result of the operation. * @param slot A callback slot which will be called when the request is satisfied. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void append_to_async(const SlotAsyncReady& slot, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void append_to_async(const SlotAsyncReady& slot, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_append_to_async) _WRAP_METHOD(Glib::RefPtr append_to_finish(const Glib::RefPtr& res), @@ -482,10 +483,10 @@ public: * * @param slot A callback slot which will be called when the request is satisfied. * @param cancellable A Cancellable object which can be used to cancel the operation. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void create_file_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void create_file_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asynchronously creates a new file and returns an output stream for writing to it. The file must not already exist. * For more details, see create_file() which is the synchronous version of this call. @@ -493,10 +494,10 @@ public: * When the operation is finished, @a slot will be called. You can then call create_file_finish() to get the result of the operation. * * @param slot A callback slot which will be called when the request is satisfied. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void create_file_async(const SlotAsyncReady& slot, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void create_file_async(const SlotAsyncReady& slot, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_create_async) _WRAP_METHOD(Glib::RefPtr create_file_finish(const Glib::RefPtr& res), @@ -513,12 +514,12 @@ public: * * @param slot A callback slot which will be called when the request is satisfied. * @param cancellable A Cancellable object which can be used to cancel the operation. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. * * @newin{2,24} */ - void create_file_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void create_file_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asynchronously creates a new file and returns a stream for reading and * writing to it. The file must not already exist. @@ -528,12 +529,12 @@ public: * When the operation is finished, @a slot will be called. You can then call create_file_readwrite_finish() to get the result of the operation. * * @param slot A callback slot which will be called when the request is satisfied. - * @param flags a set of FileCreateFlags. + * @param flags a set of CreateFlags. * @param io_priority The I/O priority of the request. * * @newin{2,24} */ - void create_file_readwrite_async(const SlotAsyncReady& slot, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void create_file_readwrite_async(const SlotAsyncReady& slot, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_create_readwrite_async) _WRAP_METHOD(Glib::RefPtr create_file_readwrite_finish(const Glib::RefPtr& res), @@ -548,10 +549,10 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param etag An entity tag for the current Gio::File. * @param make_backup true if a backup of the existing file should be made. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void replace_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void replace_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asyncronously overwrites the file, replacing the contents, possibly creating a backup copy of the file first. * For more details, see replace() which is the synchronous version of this call. @@ -560,10 +561,10 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param etag An entity tag for the current Gio::File. * @param make_backup true if a backup of the existing file should be made. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param io_priority The I/O priority of the request. */ - void replace_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void replace_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_replace_async) _WRAP_METHOD(Glib::RefPtr replace_finish(const Glib::RefPtr& res), @@ -633,12 +634,12 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param etag An optional entity tag for the current Glib::File. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @return A FileOutputStream. * * @newin{2,24} */ - Glib::RefPtr replace_readwrite(const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr replace_readwrite(const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Returns an output stream for overwriting the file in readwrite mode, possibly creating a backup copy of the file first. @@ -653,12 +654,12 @@ public: * * @param etag An optional entity tag for the current Glib::File. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @return A FileOutputStream. * * @newin{2,24} */ - Glib::RefPtr replace_readwrite(const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + Glib::RefPtr replace_readwrite(const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_replace_readwrite) @@ -673,12 +674,12 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param etag An entity tag for the current Gio::File. * @param make_backup true if a backup of the existing file should be made. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param io_priority The I/O priority of the request. * * @newin{2,24} */ - void replace_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void replace_readwrite_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asyncronously overwrites the file in read-write mode, replacing the contents, possibly creating a backup copy of the file first. * @@ -688,12 +689,12 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param etag An entity tag for the current Gio::File. * @param make_backup true if a backup of the existing file should be made. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param io_priority The I/O priority of the request. * * @newin{2,24} */ - void replace_readwrite_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void replace_readwrite_async(const SlotAsyncReady& slot, const std::string& etag = std::string(), bool make_backup = false, CreateFlags flags = CreateFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_replace_readwrite_async) _WRAP_METHOD(Glib::RefPtr replace_readwrite_finish(const Glib::RefPtr& res), @@ -718,7 +719,7 @@ public: * * For symlinks, normally the information about the target of the * symlink is returned, rather than information about the symlink itself. - * However if you pass FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in @a flags the + * However if you pass FileQueryInfoFlags::NOFOLLOW_SYMLINKS in @a flags the * information about the symlink itself will be returned. Also, for symlinks * that point to non-existing files the information about the symlink itself * will be returned. @@ -731,7 +732,7 @@ public: * @param flags: A set of FileQueryInfoFlags. * @result a FileInfo for the file, or an empty RefPtr on error. */ - Glib::RefPtr query_info(const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const; + Glib::RefPtr query_info(const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE) const; /** Gets the requested information about the file. The result * is a FileInfo object that contains key-value attributes (such as the type or size @@ -747,7 +748,7 @@ public: * * For symlinks, normally the information about the target of the * symlink is returned, rather than information about the symlink itself. - * However if you pass FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in @a flags the + * However if you pass FileQueryInfoFlags::NOFOLLOW_SYMLINKS in @a flags the * information about the symlink itself will be returned. Also, for symlinks * that point to non-existing files the information about the symlink itself * will be returned. @@ -759,7 +760,7 @@ public: * @param flags: A set of FileQueryInfoFlags. * @result a FileInfo for the file, or an empty RefPtr on error. */ - Glib::RefPtr query_info(const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const; + Glib::RefPtr query_info(const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE) const; _IGNORE(g_file_query_info) @@ -779,7 +780,7 @@ public: * * @newin{2,18} */ - FileType query_file_type(FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE) const; + FileType query_file_type(FileQueryInfoFlags flags = FileQueryInfoFlags::NONE) const; /** Asynchronously gets the requested information about specified file. The result is a FileInfo object that contains key-value attributes (such as type or size for the file). * @@ -792,7 +793,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT) const; + void query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT) const; /** Asynchronously gets the requested information about specified file. The result is a FileInfo object that contains key-value attributes (such as type or size for the file). * @@ -804,7 +805,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void query_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT) const; + void query_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT) const; _IGNORE(g_file_query_info_async) @@ -958,7 +959,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return A FileEnumerator if successful. */ - Glib::RefPtr enumerate_children(const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); + Glib::RefPtr enumerate_children(const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE); _IGNORE(g_file_enumerate_children) /** Gets the requested information about the files in a directory. The result @@ -981,7 +982,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return A FileEnumerator if successful. */ - Glib::RefPtr enumerate_children(const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); + Glib::RefPtr enumerate_children(const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE); _IGNORE(g_file_enumerate_children) @@ -997,7 +998,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void enumerate_children_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void enumerate_children_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asynchronously gets the requested information about the files in a directory. The result is a GFileEnumerator object that will give out GFileInfo objects for all the files in the directory. * @@ -1009,7 +1010,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void enumerate_children_async(const SlotAsyncReady& slot, const std::string& attributes = "*", FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void enumerate_children_async(const SlotAsyncReady& slot, const std::string& attributes = "*", FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_enumerate_children_async) _WRAP_METHOD(Glib::RefPtr enumerate_children_finish(const Glib::RefPtr& res), @@ -1117,11 +1118,11 @@ public: /** A signal handler would be, for instance: * void on_file_progress(goffset current_num_bytes, goffset total_num_bytes); */ - using SlotFileProgress = sigc::slot; + using SlotFileProgress = sigc::slot; /** Copies the file source to the location specified by destination. Can not handle recursive copies of directories. - * If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. - * If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. + * If the flag CopyFlags::OVERWRITE is specified an already existing destination file is overwritten. + * If the flag CopyFlags::NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. * * The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, a Gio::Error with CANCELLED will be thrown. * @@ -1129,55 +1130,55 @@ public: * * If the source file does not exist then a Gio::Error with NOT_FOUND will be thrown, independent on the status of the destination. * - * If FILE_COPY_OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. + * If CopyFlags::OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. * * If trying to overwrite a file over a directory a Gio::Error with IS_DIRECTORY will be thrown. * If trying to overwrite a directory with a directory a Gio::Error with WOULD_MERGE will be thrown. * - * If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, + * If the source is a directory and the target does not exist, or CopyFlags::OVERWRITE is specified and the target is a file, * then a Gio::Error with WOULD_RECURSE will be thrown. * * If you are interested in copying the Gio::File object itself (not the on-disk file), see File::dup(). */ - bool copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, const Glib::RefPtr& cancellable, FileCopyFlags flags = FILE_COPY_NONE); + bool copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, const Glib::RefPtr& cancellable, CopyFlags flags = CopyFlags::NONE); /** Copies the file source to the location specified by destination. Can not handle recursive copies of directories. - * If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. - * If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. + * If the flag CopyFlags::OVERWRITE is specified an already existing destination file is overwritten. + * If the flag CopyFlags::NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. * * The operation can be monitored via the @a slot callback. * * If the source file does not exist then a Gio::Error with NOT_FOUND will be thrown, independent on the status of the destination. * - * If FILE_COPY_OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. + * If CopyFlags::OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. * * If trying to overwrite a file over a directory a Gio::Error with IS_DIRECTORY will be thrown. * If trying to overwrite a directory with a directory a Gio::Error with WOULD_MERGE will be thrown. * - * If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, + * If the source is a directory and the target does not exist, or CopyFlags::OVERWRITE is specified and the target is a file, * then a Gio::Error with WOULD_RECURSE will be thrown. * * If you are interested in copying the Gio::File object itself (not the on-disk file), see File::dup(). */ - bool copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, FileCopyFlags flags = FILE_COPY_NONE); + bool copy(const Glib::RefPtr& destination, const SlotFileProgress& slot, CopyFlags flags = CopyFlags::NONE); /** Copies the file source to the location specified by destination. Can not handle recursive copies of directories. - * If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. - * If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. + * If the flag CopyFlags::OVERWRITE is specified an already existing destination file is overwritten. + * If the flag CopyFlags::NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. * * If the source file does not exist then a Gio::Error with NOT_FOUND will be thrown, independent on the status of the destination. * - * If FILE_COPY_OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. + * If CopyFlags::OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. * * If trying to overwrite a file over a directory a Gio::Error with IS_DIRECTORY will be thrown. * If trying to overwrite a directory with a directory a Gio::Error with WOULD_MERGE will be thrown. * - * If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, + * If the source is a directory and the target does not exist, or CopyFlags::OVERWRITE is specified and the target is a file, * then a Gio::Error with WOULD_RECURSE will be thrown. * * If you are interested in copying the Gio::File object itself (not the on-disk file), see File::dup(). */ - bool copy(const Glib::RefPtr& destination, FileCopyFlags flags = FILE_COPY_NONE); + bool copy(const Glib::RefPtr& destination, CopyFlags flags = CopyFlags::NONE); _IGNORE(g_file_copy) /** Copies the file to the location specified by @a destination asynchronously. @@ -1194,10 +1195,10 @@ public: * @param slot_progress The callback slot to be called with progress information * @param slot_ready A SlotAsyncReady to call when the request is satisfied * @param cancellable A Cancellable object which can be used to cancel the operation - * @param flags Set of FileCopyFlags + * @param flags Set of CopyFlags * @param io_priority The I/O priority of the request */ - void copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Copies the file to the location specified by @a destination asynchronously. * For details of the behaviour, see copy(). @@ -1208,10 +1209,10 @@ public: * @param destination Destination File * @param slot_ready A SlotAsyncReady to call when the request is satisfied * @param cancellable A Cancellable object which can be used to cancel the operation - * @param flags Set of FileCopyFlags + * @param flags Set of CopyFlags * @param io_priority The I/O priority of the request */ - void copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Copies the file to the location specified by @a destination asynchronously. * For details of the behaviour, see copy(). @@ -1226,10 +1227,10 @@ public: * @param destination Destination File * @param slot_progress The callback slot to be called with progress information * @param slot_ready A SlotAsyncReady to call when the request is satisfied - * @param flags Set of FileCopyFlags + * @param flags Set of CopyFlags * @param io_priority The I/O priority of the request */ - void copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void copy_async(const Glib::RefPtr& destination, const SlotFileProgress& slot_progress, const SlotAsyncReady& slot_ready, CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Copies the file to the location specified by @a destination asynchronously. * For details of the behaviour, see copy(). @@ -1239,10 +1240,10 @@ public: * * @param destination Destination File * @param slot_ready A SlotAsyncReady to call when the request is satisfied - * @param flags Set of FileCopyFlags + * @param flags Set of CopyFlags * @param io_priority The I/O priority of the request */ - void copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, FileCopyFlags flags = FILE_COPY_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void copy_async(const Glib::RefPtr& destination, const SlotAsyncReady& slot_ready, CopyFlags flags = CopyFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_copy_async) _WRAP_METHOD(bool copy_finish(const Glib::RefPtr& res), @@ -1253,27 +1254,27 @@ public: * used, otherwise a copy and delete fallback is used. The native implementation may support moving directories (for instance on moves inside * the same filesystem), but the fallback code does not. * - * If the flag FILE_COPY_OVERWRITE is specified an already existing destination file is overwritten. + * If the flag CopyFlags::OVERWRITE is specified an already existing destination file is overwritten. * - * If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. + * If the flag CopyFlags::NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks, otherwise the target of the source symlink will be copied. * * The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, a Gio::Error with CANCELLED will be thrown. * * The operation can be monitored via the @a slot callback. * If the source file does not exist then a Gio::Error with NOT_FOUND will be thrown, independent on the status of the destination. * - * If G_FILE_COPY_OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. + * If G_CopyFlags::OVERWRITE is not specified and the target exists, then a Gio::Error with EXISTS will be thrown. * * If trying to overwrite a file over a directory a Gio::Error with IS_DIRECTORY will be thrown. * If trying to overwrite a directory with a directory a Gio::Error with WOULD_MERGE will be thrown. * - * If the source is a directory and the target does not exist, or FILE_COPY_OVERWRITE is specified and the target is a file, then a Gio::Error with WOULD_RECURSE may be thrown (if the native move operation isn't available). + * If the source is a directory and the target does not exist, or CopyFlags::OVERWRITE is specified and the target is a file, then a Gio::Error with WOULD_RECURSE may be thrown (if the native move operation isn't available). */ - bool move(const Glib::RefPtr& destination, const SlotFileProgress& slot, const Glib::RefPtr& cancellable, FileCopyFlags flags = FILE_COPY_NONE); + bool move(const Glib::RefPtr& destination, const SlotFileProgress& slot, const Glib::RefPtr& cancellable, CopyFlags flags = CopyFlags::NONE); - bool move(const Glib::RefPtr& destination, const SlotFileProgress& slot, FileCopyFlags flags = FILE_COPY_NONE); + bool move(const Glib::RefPtr& destination, const SlotFileProgress& slot, CopyFlags flags = CopyFlags::NONE); - bool move(const Glib::RefPtr& destination, FileCopyFlags flags = FILE_COPY_NONE); + bool move(const Glib::RefPtr& destination, CopyFlags flags = CopyFlags::NONE); _IGNORE(g_file_move) _WRAP_METHOD(bool make_directory(const Glib::RefPtr& cancellable{?}), @@ -1347,7 +1348,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return true if there was any error, false otherwise. */ - bool set_attributes_from_info(const Glib::RefPtr& info, const Glib::RefPtr& cancellable, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); + bool set_attributes_from_info(const Glib::RefPtr& info, const Glib::RefPtr& cancellable, FileQueryInfoFlags flags = FileQueryInfoFlags::NONE); /** Tries to set all attributes in the FileInfo on the target values, * not stopping on the first error. @@ -1365,7 +1366,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @return true if there was any error, false otherwise. */ - bool set_attributes_from_info(const Glib::RefPtr& info, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE); + bool set_attributes_from_info(const Glib::RefPtr& info, FileQueryInfoFlags flags = FileQueryInfoFlags::NONE); _IGNORE(g_file_set_attributes_from_info) @@ -1380,7 +1381,7 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void set_attributes_async(const Glib::RefPtr& info, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void set_attributes_async(const Glib::RefPtr& info, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Asynchronously sets the attributes of file with info. * @@ -1392,13 +1393,13 @@ public: * @param flags A set of FileQueryInfoFlags. * @param io_priority The I/O priority of the request. */ - void set_attributes_async(const Glib::RefPtr& info, const SlotAsyncReady& slot, FileQueryInfoFlags flags = FILE_QUERY_INFO_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void set_attributes_async(const Glib::RefPtr& info, const SlotAsyncReady& slot, FileQueryInfoFlags flags = FileQueryInfoFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_set_attributes_async) _IGNORE(g_file_set_attributes_finish) // takes GFileInfo** bool set_attributes_finish(const Glib::RefPtr& result, const Glib::RefPtr& info); - _WRAP_METHOD(bool set_attribute_string(const std::string& attribute, const std::string& value, FileQueryInfoFlags flags, const Glib::RefPtr& cancellable{?}), + _WRAP_METHOD(bool set_attribute_string(const std::string& attribute, const Glib::ustring& value, FileQueryInfoFlags flags, const Glib::RefPtr& cancellable{?}), g_file_set_attribute_string, errthrow) @@ -1435,7 +1436,7 @@ public: * @param cancellable A Cancellable object. * @param flags Flags affecting the operation. */ - void mount_enclosing_volume(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_enclosing_volume(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Starts a @a mount_operation, mounting the volume that contains the file. * @@ -1446,7 +1447,7 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void mount_enclosing_volume(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_enclosing_volume(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Starts a @a mount_operation, mounting the volume that contains the file. * @@ -1456,14 +1457,14 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void mount_enclosing_volume(const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_enclosing_volume(const SlotAsyncReady& slot, Mount::MountFlags flags = Mount::MountFlags::NONE); _IGNORE(g_file_mount_enclosing_volume) /** Starts a @a mount_operation, mounting the volume that contains the file. * * @param flags Flags affecting the operation. */ - void mount_enclosing_volume(MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_enclosing_volume(Mount::MountFlags flags = Mount::MountFlags::NONE); _IGNORE(g_file_mount_enclosing_volume) _WRAP_METHOD(bool mount_enclosing_volume_finish(const Glib::RefPtr& result), @@ -1483,7 +1484,7 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void mount_mountable(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_mountable(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a file of type FILE_TYPE_MOUNTABLE. Using @a mount_operation, you can request callbacks when, for instance, * passwords are needed during authentication. @@ -1494,7 +1495,7 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void mount_mountable(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_mountable(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction. * @@ -1503,13 +1504,13 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void mount_mountable(const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_mountable(const SlotAsyncReady& slot, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a file of type FILE_TYPE_MOUNTABLE without user interaction. * * @param flags Flags affecting the operation. */ - void mount_mountable(MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount_mountable(Mount::MountFlags flags = Mount::MountFlags::NONE); _IGNORE(g_file_mount_mountable) _WRAP_METHOD(Glib::RefPtr mount_mountable_finish(const Glib::RefPtr& result), @@ -1527,7 +1528,7 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param flags Flags affecting the operation. */ - void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Unmounts a file of type FILE_TYPE_MOUNTABLE. * @@ -1536,13 +1537,13 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Unmounts a file of type FILE_TYPE_MOUNTABLE. * * @param flags Flags affecting the operation. */ - void unmount_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Unmounts a file of type FILE_TYPE_MOUNTABLE. * @@ -1558,7 +1559,7 @@ public: * * @newin{2,24} */ - void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Unmounts a file of type FILE_TYPE_MOUNTABLE. * @@ -1570,7 +1571,7 @@ public: * * @newin{2,24} */ - void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Unmounts a file of type FILE_TYPE_MOUNTABLE. * @@ -1579,7 +1580,7 @@ public: * * @newin{2,24} */ - void unmount_mountable(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount_mountable(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_file_unmount_mountable, g_file_unmount_mountable_finish, g_file_unmount_mountable_with_operation) @@ -1598,7 +1599,7 @@ public: * @param cancellable A Cancellable object which can be used to cancel the operation. * @param flags Flags affecting the operation. */ - void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Starts an asynchronous eject on a mountable. * @@ -1607,13 +1608,13 @@ public: * @param slot A callback slot which will be called when the request is satisfied. * @param flags Flags affecting the operation. */ - void eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Starts an asynchronous eject on a mountable. * * @param flags Flags affecting the operation. */ - void eject_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Starts an asynchronous eject on a mountable. * @@ -1629,7 +1630,7 @@ public: * * @newin{2,24} */ - void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Starts an asynchronous eject on a mountable. * @@ -1641,7 +1642,7 @@ public: * * @newin{2,24} */ - void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Starts an asynchronous eject on a mountable. * @@ -1650,7 +1651,7 @@ public: * * @newin{2,24} */ - void eject_mountable(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject_mountable(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_file_eject_mountable, g_file_eject_mountable_finish, g_file_eject_mountable_with_operation) @@ -1664,7 +1665,7 @@ public: * Normally only a subset of the file attributes are copied, * those that are copies in a normal file copy operation * (which for instance does not include e.g. mtime). However - * if FILE_COPY_ALL_METADATA is specified in @a flags, then + * if CopyFlags::ALL_METADATA is specified in @a flags, then * all the metadata that is possible to copy is copied. * * @param destination A File to copy attributes to. @@ -1672,21 +1673,21 @@ public: * @param flags A set of FileMonitorFlags. * @result true if the attributes were copied successfully, false otherwise. */ - bool copy_attributes(const Glib::RefPtr& destination, const Glib::RefPtr& cancellable, FileCopyFlags flags = FILE_COPY_NONE); + bool copy_attributes(const Glib::RefPtr& destination, const Glib::RefPtr& cancellable, CopyFlags flags = CopyFlags::NONE); /** Copies the file attributes from @a source to @a destination. * * Normally only a subset of the file attributes are copied, * those that are copies in a normal file copy operation * (which for instance does not include e.g. mtime). However - * if FILE_COPY_ALL_METADATA is specified in @a flags, then + * if CopyFlags::ALL_METADATA is specified in @a flags, then * all the metadata that is possible to copy is copied. * * @param destination A File to copy attributes to. * @param flags A set of FileMonitorFlags. * @result true if the attributes were copied successfully, false otherwise. */ - bool copy_attributes(const Glib::RefPtr& destination, FileCopyFlags flags = FILE_COPY_NONE); + bool copy_attributes(const Glib::RefPtr& destination, CopyFlags flags = CopyFlags::NONE); _IGNORE(g_file_copy_attributes) /** Obtains a directory monitor for the given file. @@ -1699,7 +1700,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ - Glib::RefPtr monitor_directory(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor_directory(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FileMonitorFlags::NONE); /** Obtains a directory monitor for the given file. * This may fail if directory monitoring is not supported. @@ -1707,7 +1708,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ - Glib::RefPtr monitor_directory(FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor_directory(FileMonitorFlags flags = FileMonitorFlags::NONE); _IGNORE(g_file_monitor_directory) /** Obtains a file monitor for the given file. If no file notification @@ -1720,7 +1721,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ - Glib::RefPtr monitor_file(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor_file(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FileMonitorFlags::NONE); /** Obtains a file monitor for the given file. If no file notification * mechanism exists, then regular polling of the file is used. @@ -1731,7 +1732,7 @@ public: * @param flags A set of FileMonitorFlags. * @return A FileMonitor for the file. */ - Glib::RefPtr monitor_file(FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor_file(FileMonitorFlags flags = FileMonitorFlags::NONE); _IGNORE(g_file_monitor_file) @@ -1747,7 +1748,7 @@ public: * * @newin{2,18} */ - Glib::RefPtr monitor(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor(const Glib::RefPtr& cancellable, FileMonitorFlags flags = FileMonitorFlags::NONE); /** Obtains a file monitor for the given file. If no file notification * mechanism exists, then regular polling of the file is used. @@ -1760,7 +1761,7 @@ public: * * @newin{2,18} */ - Glib::RefPtr monitor(FileMonitorFlags flags = FILE_MONITOR_NONE); + Glib::RefPtr monitor(FileMonitorFlags flags = FileMonitorFlags::NONE); _IGNORE(g_file_monitor) @@ -1802,7 +1803,7 @@ public: * * @newin{2,38} */ - using SlotFileMeasureProgress = sigc::slot; + using SlotFileMeasureProgress = sigc::slot; //We do not use the {callback} syntax with _WRAP_METHOD here, because it expects to use user_data rather than progress_data. //We ignore the gboolean result, because we throw an exception if it is false. @@ -1832,9 +1833,9 @@ public: * @param disk_usage The number of bytes of disk space used. * @param num_dirs The number of directories encountered. * @param num_files The number of non-directories encountered. - * @param flags Set of FileMeasureFlags. + * @param flags Set of MeasureFlags. */ - void measure_disk_usage(const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, guint64& disk_usage, guint64& num_dirs, guint64& num_files, FileMeasureFlags flags = FILE_MEASURE_NONE); + void measure_disk_usage(const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, guint64& disk_usage, guint64& num_dirs, guint64& num_files, MeasureFlags flags = MeasureFlags::NONE); _IGNORE(g_file_measure_disk_usage) /** Recursively measures the disk usage of the file. @@ -1848,10 +1849,10 @@ public: * @param slot_ready A SlotAsyncReady to call when the request is satisfied * @param cancellable A Cancellable object which can be used to cancel the operation * @param slot_progress The callback slot to be called with progress information - * @param flags Set of FileMeasureFlags + * @param flags Set of MeasureFlags * @param io_priority The I/O priority of the request */ - void measure_disk_usage_async(const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, FileMeasureFlags flags = FILE_MEASURE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void measure_disk_usage_async(const SlotAsyncReady& slot_ready, const Glib::RefPtr& cancellable, const SlotFileMeasureProgress& slot_progress, MeasureFlags flags = MeasureFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_measure_disk_usage_async) _WRAP_METHOD(bool measure_disk_usage_finish(const Glib::RefPtr& result, guint64& disk_usage, guint64& num_dirs, guint64& num_files), g_file_measure_disk_usage_finish, errthrow) @@ -1878,7 +1879,7 @@ public: * * @newin{2,24} */ - void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& start_operation, DriveStartFlags flags = DRIVE_START_NONE); + void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& start_operation, Drive::StartFlags flags = Drive::StartFlags::NONE); /** Starts a file of type Mountable. * Using @a start_operation, you can request callbacks when, for instance, @@ -1897,7 +1898,7 @@ public: * * @newin{2,24} */ - void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& start_operation, DriveStartFlags flags = DRIVE_START_NONE); + void start_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& start_operation, Drive::StartFlags flags = Drive::StartFlags::NONE); _IGNORE(g_file_start_mountable) _WRAP_METHOD(bool start_mountable_finish(const Glib::RefPtr& result), @@ -1922,7 +1923,7 @@ public: * * @newin{2,24} */ - void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& start_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); /** Stops a file of type Mountable. @@ -1942,7 +1943,7 @@ public: * * @newin{2,24} */ - void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& start_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void stop_mountable(const SlotAsyncReady& slot, const Glib::RefPtr& start_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_file_stop_mountable) _WRAP_METHOD(bool stop_mountable_finish(const Glib::RefPtr& result), @@ -2096,7 +2097,7 @@ public: /** A signal handler would be, for instance: * bool on_read_more(const char* file_contents, goffset file_size); */ - using SlotReadMore = sigc::slot; + using SlotReadMore = sigc::slot; //Note that slot_read_more can be nullptr but that would not be a useful method overload, because the documentation says that it would //then be equivalent to load_contents_async. @@ -2171,12 +2172,12 @@ public: * @param etag The old entity tag * for the document. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param new_etag A location to a new entity tag * for the document. * @param cancellable A Cancellable object. */ - void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr& cancellable, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, const Glib::RefPtr& cancellable, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Replaces the contents of the file with @a contents of @a length bytes. * @@ -2192,11 +2193,11 @@ public: * @param etag The old entity tag * for the document. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param new_etag A location to a new entity tag * for the document. */ - void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents(const char* contents, gsize length, const std::string& etag, std::string& new_etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Replaces the contents of the file with @a contents. * @@ -2215,12 +2216,12 @@ public: * @param etag The old entity tag * for the document. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param new_etag A location to a new entity tag * for the document. * @param cancellable A Cancellable object. */ - void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr& cancellable, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, const Glib::RefPtr& cancellable, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Replaces the contents of the file with @a contents. * @@ -2235,11 +2236,11 @@ public: * @param etag The old entity tag * for the document. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. * @param new_etag A location to a new entity tag * for the document. */ - void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents(const std::string& contents, const std::string& etag, std::string& new_etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_replace_contents) @@ -2266,9 +2267,9 @@ public: * @param length The length of @a contents in bytes. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const char* contents, gsize length, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const char* contents, gsize length, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Starts an asynchronous replacement of the file with the given * @a contents of @a length bytes. @a etag will replace the document's @@ -2285,9 +2286,9 @@ public: * @param length The length of @a contents in bytes. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_async(const SlotAsyncReady& slot, const char* contents, gsize length, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_async(const SlotAsyncReady& slot, const char* contents, gsize length, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Starts an asynchronous replacement of the file with the given * @a contents of @a length bytes. @a etag will replace the document's @@ -2308,9 +2309,9 @@ public: * @param contents String of contents to replace the file with. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& contents, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const std::string& contents, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Starts an asynchronous replacement of the file with the given * @a contents. @a etag will replace the document's @@ -2330,9 +2331,9 @@ public: * @param contents String of contents to replace the file with. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_async(const SlotAsyncReady& slot, const std::string& contents, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_async(const SlotAsyncReady& slot, const std::string& contents, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_replace_contents_async) @@ -2372,9 +2373,9 @@ public: * @param contents Bytes of contents to replace the file with. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& contents, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, const Glib::RefPtr& contents, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); /** Same as replace_contents_async() but takes a Gio::Bytes input instead. * @@ -2392,9 +2393,9 @@ public: * @param contents Bytes of contents to replace the file with. * @param etag a new entity tag for the file. * @param make_backup true if a backup should be created. - * @param flags A set of FileCreateFlags. + * @param flags A set of CreateFlags. */ - void replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& contents, const std::string& etag, bool make_backup = false, FileCreateFlags flags = FILE_CREATE_NONE); + void replace_contents_bytes_async(const SlotAsyncReady& slot, const Glib::RefPtr& contents, const std::string& etag, bool make_backup = false, CreateFlags flags = CreateFlags::NONE); _IGNORE(g_file_replace_contents_async) diff --git a/gio/src/fileattributeinfo.ccg b/gio/src/fileattributeinfo.ccg index a3884e6..e33784c 100644 --- a/gio/src/fileattributeinfo.ccg +++ b/gio/src/fileattributeinfo.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -22,7 +25,7 @@ namespace Gio FileAttributeInfo::FileAttributeInfo(const GFileAttributeInfo* ginfo) : m_name(ginfo->name ? ginfo->name : ""), m_type(static_cast(ginfo->type)), - m_flags(static_cast(ginfo->flags)) + m_flags(static_cast(ginfo->flags)) { } @@ -73,7 +76,7 @@ FileAttributeInfo::get_type() const return m_type; } -FileAttributeInfoFlags +FileAttributeInfo::Flags FileAttributeInfo::get_flags() const { return m_flags; diff --git a/gio/src/fileattributeinfo.hg b/gio/src/fileattributeinfo.hg index 846c568..a76d04d 100644 --- a/gio/src/fileattributeinfo.hg +++ b/gio/src/fileattributeinfo.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,7 +27,6 @@ namespace Gio { _WRAP_ENUM(FileAttributeType, GFileAttributeType) -_WRAP_ENUM(FileAttributeInfoFlags, GFileAttributeInfoFlags) _WRAP_ENUM(FileAttributeStatus, GFileAttributeStatus) @@ -36,6 +38,8 @@ class FileAttributeInfo { _CLASS_GENERIC(FileAttributeInfo, GFileAttributeInfo) public: + _WRAP_ENUM(Flags, GFileAttributeInfoFlags) + explicit FileAttributeInfo(const GFileAttributeInfo* ginfo); FileAttributeInfo(const FileAttributeInfo& other); @@ -48,12 +52,12 @@ public: std::string get_name() const; FileAttributeType get_type() const; - FileAttributeInfoFlags get_flags() const; + Flags get_flags() const; protected: std::string m_name; FileAttributeType m_type; - FileAttributeInfoFlags m_flags; + Flags m_flags; }; } // namespace Gio diff --git a/gio/src/fileattributeinfolist.ccg b/gio/src/fileattributeinfolist.ccg index eee5028..98d0efa 100644 --- a/gio/src/fileattributeinfolist.ccg +++ b/gio/src/fileattributeinfolist.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileattributeinfolist.hg b/gio/src/fileattributeinfolist.hg index 5578b5b..1dcec02 100644 --- a/gio/src/fileattributeinfolist.hg +++ b/gio/src/fileattributeinfolist.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -31,7 +30,7 @@ namespace Gio * e.g. "standard::*" will return all of the keys in the "standard" namespace. * * Values are stored within the list in Gio::FileAttributeValue structures. Values can store different types, listed in the enum - * Gio::FileAttributeType. Upon creation of a Gio::FileAttributeValue, the type will be set to Gio::FILE_ATTRIBUTE_TYPE_INVALID. + * Gio::FileAttributeType. Upon creation of a Gio::FileAttributeValue, the type will be set to Gio::FileAttributeType::INVALID. * * The list of possible attributes for a filesystem (pointed to by a Gio::File) is availible as a Gio::FileAttributeInfoList. * This list is queryable by key names as indicated earlier. @@ -72,7 +71,7 @@ public: _WRAP_METHOD(Glib::RefPtr dup() const, g_file_attribute_info_list_dup) - _WRAP_METHOD(void add(const std::string& name, FileAttributeType type, FileAttributeInfoFlags flags = FILE_ATTRIBUTE_INFO_NONE), g_file_attribute_info_list_add) + _WRAP_METHOD(void add(const std::string& name, FileAttributeType type, FileAttributeInfo::Flags flags = FileAttributeInfo::Flags::NONE), g_file_attribute_info_list_add) }; } // namespace Gio diff --git a/glib/glibmm/sarray.cc b/gio/src/filedescriptorbased.ccg similarity index 76% rename from glib/glibmm/sarray.cc rename to gio/src/filedescriptorbased.ccg index 69958a7..84882c1 100644 --- a/glib/glibmm/sarray.cc +++ b/gio/src/filedescriptorbased.ccg @@ -1,6 +1,4 @@ -/* sarray.cc - * - * Copyright (C) 2002 The gtkmm Development Team +/* Copyright (C) 2017 The giomm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library. If not, see . */ -#include +#include +#include diff --git a/gio/src/filedescriptorbased.hg b/gio/src/filedescriptorbased.hg new file mode 100644 index 0000000..9d8308e --- /dev/null +++ b/gio/src/filedescriptorbased.hg @@ -0,0 +1,50 @@ +/* Copyright (C) 2017 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#include + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/interface_p.h) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef struct _GFileDescriptorBasedIface GFileDescriptorBasedIface; +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +namespace Gio +{ + +/** Interface for file descriptor based IO. + * + * %FileDescriptorBased is implemented by streams (implementations of + * Gio::InputStream or Gio::OutputStream) that are based on file descriptors. + * + * @ingroup Streams + * + * @newin{2,54} + */ +class FileDescriptorBased : public Glib::Interface +{ + _CLASS_INTERFACE(FileDescriptorBased, GFileDescriptorBased, G_FILE_DESCRIPTOR_BASED, GFileDescriptorBasedIface) + _GTKMMPROC_WIN32_NO_WRAP + +public: + _WRAP_METHOD(int get_fd() const, g_file_descriptor_based_get_fd, newin "2,54") + +protected: + _WRAP_VFUNC(int get_fd() const, "get_fd") +}; + +} // namespace Gio diff --git a/gio/src/fileenumerator.ccg b/gio/src/fileenumerator.ccg index 9b975bc..b59cca0 100644 --- a/gio/src/fileenumerator.ccg +++ b/gio/src/fileenumerator.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileenumerator.hg b/gio/src/fileenumerator.hg index f6e0568..ace27e5 100644 --- a/gio/src/fileenumerator.hg +++ b/gio/src/fileenumerator.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The glibmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,12 +13,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include #include #include #include @@ -96,8 +97,8 @@ public: void next_files_async(const SlotAsyncReady& slot, int num_files = 1, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_file_enumerator_next_files_async) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >', `$2(($3), Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > next_files_finish(const Glib::RefPtr& result), +#m4 _CONVERSION(`GList*',`std::vector>', `Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector> next_files_finish(const Glib::RefPtr& result), g_file_enumerator_next_files_finish, errthrow) diff --git a/gio/src/fileicon.ccg b/gio/src/fileicon.ccg index 06d4e85..70b732c 100644 --- a/gio/src/fileicon.ccg +++ b/gio/src/fileicon.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileicon.hg b/gio/src/fileicon.hg index 24c3982..f3ac97a 100644 --- a/gio/src/fileicon.hg +++ b/gio/src/fileicon.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -33,10 +32,11 @@ namespace Gio */ class FileIcon : public Glib::Object, - //Already derived by LoadableIcon: public Icon, + public Icon, public LoadableIcon { _CLASS_GOBJECT(FileIcon, GFileIcon, G_FILE_ICON, Glib::Object, GObject) + _IMPLEMENTS_INTERFACE(Icon) _IMPLEMENTS_INTERFACE(LoadableIcon) protected: diff --git a/gio/src/fileinfo.ccg b/gio/src/fileinfo.ccg index d18d926..fa35995 100644 --- a/gio/src/fileinfo.ccg +++ b/gio/src/fileinfo.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileinfo.hg b/gio/src/fileinfo.hg index 80399c3..93a39a6 100644 --- a/gio/src/fileinfo.hg +++ b/gio/src/fileinfo.hg @@ -11,10 +11,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include @@ -26,17 +26,7 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { - -// Rename FILE_TYPE_UNKNOWN to FILE_TYPE_NOT_KNOWN because the former is a -// define in a Windows header (winbase.h, included from windows.h). -_WRAP_ENUM(FileType, GFileType, NO_GTYPE, s#FILE_TYPE_UNKNOWN#FILE_TYPE_NOT_KNOWN#) - -// Provide FILE_TYPE_UNKNOWN for backwards compatibility. -#ifndef DOXYGEN_SHOULD_SKIP_THIS -#ifndef FILE_TYPE_UNKNOWN -const FileType FILE_TYPE_UNKNOWN = FILE_TYPE_NOT_KNOWN; -#endif -#endif +_WRAP_ENUM(FileType, GFileType, NO_GTYPE) //TODO: attribute strings @@ -95,8 +85,8 @@ public: _WRAP_METHOD(bool has_namespace(const std::string& name_space) const, g_file_info_has_namespace) - #m4 _CONVERSION(`char**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle list_attributes(const std::string& name_space{?}) const, + #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector list_attributes(const std::string& name_space{?}) const, g_file_info_list_attributes) _WRAP_METHOD(FileAttributeType get_attribute_type(const std::string& attribute) const, @@ -106,8 +96,7 @@ public: _WRAP_METHOD(FileAttributeStatus get_attribute_status(const std::string& attribute) const, g_file_info_get_attribute_status) - //TODO: This should return a ustring instead: https://bugzilla.gnome.org/show_bug.cgi?id=615950#c7 - _WRAP_METHOD(std::string get_attribute_string(const std::string& attribute) const, + _WRAP_METHOD(Glib::ustring get_attribute_string(const std::string& attribute) const, g_file_info_get_attribute_string) #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_NONE)') @@ -132,8 +121,7 @@ public: _WRAP_METHOD(bool set_attribute_status(const std::string& attribute, FileAttributeStatus status), g_file_info_set_attribute_status) - //TODO: This should take a ustring value instead: https://bugzilla.gnome.org/show_bug.cgi?id=615950#c7 - _WRAP_METHOD(void set_attribute_string(const std::string& attribute, const std::string& attr_value), + _WRAP_METHOD(void set_attribute_string(const std::string& attribute, const Glib::ustring& attr_value), g_file_info_set_attribute_string) #m4 _CONVERSION(`const std::vector&',`char**',`const_cast(Glib::ArrayHandler::vector_to_array($3).data())') @@ -164,11 +152,9 @@ public: _WRAP_METHOD(bool is_symlink() const, g_file_info_get_is_symlink) _WRAP_METHOD(std::string get_name() const, g_file_info_get_name) - //TODO: This should return a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(std::string get_display_name() const, g_file_info_get_display_name) + _WRAP_METHOD(Glib::ustring get_display_name() const, g_file_info_get_display_name) - //TODO: This should return a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(std::string get_edit_name() const, g_file_info_get_edit_name) + _WRAP_METHOD(Glib::ustring get_edit_name() const, g_file_info_get_edit_name) _WRAP_METHOD(Glib::RefPtr get_icon(), g_file_info_get_icon, refreturn) _WRAP_METHOD(Glib::RefPtr get_icon() const, g_file_info_get_icon, refreturn, constversion) @@ -176,8 +162,7 @@ public: _WRAP_METHOD(Glib::RefPtr get_symbolic_icon(), g_file_info_get_symbolic_icon, refreturn) _WRAP_METHOD(Glib::RefPtr get_symbolic_icon() const, g_file_info_get_symbolic_icon, refreturn, constversion) - //TODO: This should return a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(std::string get_content_type() const, g_file_info_get_content_type) + _WRAP_METHOD(Glib::ustring get_content_type() const, g_file_info_get_content_type) _WRAP_METHOD(goffset get_size() const, g_file_info_get_size) @@ -186,8 +171,7 @@ public: _WRAP_METHOD(std::string get_symlink_target() const, g_file_info_get_symlink_target) - //TODO: This should return a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(std::string get_etag() const, g_file_info_get_etag) + _WRAP_METHOD(Glib::ustring get_etag() const, g_file_info_get_etag) _WRAP_METHOD(gint32 get_sort_order() const, g_file_info_get_sort_order) _WRAP_METHOD(void set_attribute_mask(const Glib::RefPtr& mask), @@ -201,17 +185,14 @@ public: _WRAP_METHOD(void set_is_symlink(bool symlink = true), g_file_info_set_is_symlink) _WRAP_METHOD(void set_name(const std::string& name), g_file_info_set_name) - //TODO: This should take a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(void set_display_name(const std::string& display_name), g_file_info_set_display_name) + _WRAP_METHOD(void set_display_name(const Glib::ustring& display_name), g_file_info_set_display_name) - //TODO: This should take a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(void set_edit_name(const std::string& edit_name), g_file_info_set_edit_name) + _WRAP_METHOD(void set_edit_name(const Glib::ustring& edit_name), g_file_info_set_edit_name) _WRAP_METHOD(void set_icon(const Glib::RefPtr& icon), g_file_info_set_icon) _WRAP_METHOD(void set_symbolic_icon(const Glib::RefPtr& icon), g_file_info_set_symbolic_icon) - //TODO: This should take a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4 - _WRAP_METHOD(void set_content_type(const std::string& content_type), g_file_info_set_content_type) + _WRAP_METHOD(void set_content_type(const Glib::ustring& content_type), g_file_info_set_content_type) _WRAP_METHOD(void set_size(goffset size), g_file_info_set_size) diff --git a/gio/src/fileinputstream.ccg b/gio/src/fileinputstream.ccg index 9280054..ef1b73e 100644 --- a/gio/src/fileinputstream.ccg +++ b/gio/src/fileinputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileinputstream.hg b/gio/src/fileinputstream.hg index 0159d8c..a9cca15 100644 --- a/gio/src/fileinputstream.hg +++ b/gio/src/fileinputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileiostream.ccg b/gio/src/fileiostream.ccg index f358384..21002d3 100644 --- a/gio/src/fileiostream.ccg +++ b/gio/src/fileiostream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileiostream.hg b/gio/src/fileiostream.hg index 80c2ea7..3f2ca9c 100644 --- a/gio/src/fileiostream.hg +++ b/gio/src/fileiostream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -99,7 +98,7 @@ public: _WRAP_METHOD(Glib::RefPtr query_info_finish(const Glib::RefPtr& result), g_file_io_stream_query_info_finish, errthrow) - _WRAP_METHOD(std::string get_etag() const, g_file_io_stream_get_etag) + _WRAP_METHOD(Glib::ustring get_etag() const, g_file_io_stream_get_etag) }; diff --git a/gio/src/filelist.am b/gio/src/filelist.am index 9d1c0fe..c126eb7 100644 --- a/gio/src/filelist.am +++ b/gio/src/filelist.am @@ -94,6 +94,7 @@ giomm_files_any_hg = \ permission.hg \ pollableinputstream.hg \ pollableoutputstream.hg \ + propertyaction.hg \ proxy.hg \ proxyaddress.hg \ proxyresolver.hg \ @@ -136,6 +137,7 @@ giomm_files_any_hg = \ zlibcompressor.hg giomm_files_posix_hg = \ + filedescriptorbased.hg \ unixconnection.hg \ unixcredentialsmessage.hg \ unixfdlist.hg \ diff --git a/gio/src/filemonitor.ccg b/gio/src/filemonitor.ccg index 3901af9..5bcc977 100644 --- a/gio/src/filemonitor.ccg +++ b/gio/src/filemonitor.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,13 +13,16 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include +using Event = Gio::FileMonitor::Event; + namespace Gio { diff --git a/gio/src/filemonitor.hg b/gio/src/filemonitor.hg index 2318595..6348ee9 100644 --- a/gio/src/filemonitor.hg +++ b/gio/src/filemonitor.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include @@ -24,7 +27,6 @@ _PINCLUDE(gio/gio.h) namespace Gio { -_WRAP_ENUM(FileMonitorEvent, GFileMonitorEvent, NO_GTYPE) class File; @@ -44,6 +46,8 @@ protected: public: + _WRAP_ENUM(Event, GFileMonitorEvent, NO_GTYPE) + _WRAP_METHOD(bool cancel(), g_file_monitor_cancel) _WRAP_METHOD(bool is_cancelled() const, g_file_monitor_is_cancelled) _WRAP_METHOD(void set_rate_limit(int limit_msecs), g_file_monitor_set_rate_limit) @@ -52,7 +56,7 @@ public: _IGNORE(g_file_monitor_emit_event) #m4 _CONVERSION(`GFile*',`const Glib::RefPtr&',`Glib::wrap($3, true)') - _WRAP_SIGNAL(void changed(const Glib::RefPtr& file, const Glib::RefPtr& other_file, FileMonitorEvent event_type), "changed") + _WRAP_SIGNAL(void changed(const Glib::RefPtr& file, const Glib::RefPtr& other_file, Event event_type), "changed") //_WRAP_VFUNC(bool cancel(), cancel); diff --git a/gio/src/filenamecompleter.ccg b/gio/src/filenamecompleter.ccg index 3901af9..3161de1 100644 --- a/gio/src/filenamecompleter.ccg +++ b/gio/src/filenamecompleter.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/filenamecompleter.hg b/gio/src/filenamecompleter.hg index 676d196..5ec035a 100644 --- a/gio/src/filenamecompleter.hg +++ b/gio/src/filenamecompleter.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,11 +13,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include -#include #include _DEFS(giomm,gio) @@ -43,8 +45,8 @@ public: _WRAP_METHOD(std::string get_completion_suffix(const std::string& initial_text) const, g_filename_completer_get_completion_suffix) - #m4 _CONVERSION(`char**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle get_completions(const std::string& initial_text) const, g_filename_completer_get_completions) + #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector get_completions(const std::string& initial_text) const, g_filename_completer_get_completions) _WRAP_METHOD(void set_dirs_only(bool dirs_only = true), g_filename_completer_set_dirs_only) _WRAP_SIGNAL(void got_completion_data(), got_completion_data) diff --git a/gio/src/fileoutputstream.ccg b/gio/src/fileoutputstream.ccg index d118060..2e8040c 100644 --- a/gio/src/fileoutputstream.ccg +++ b/gio/src/fileoutputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/fileoutputstream.hg b/gio/src/fileoutputstream.hg index dc82d8d..3539c4c 100644 --- a/gio/src/fileoutputstream.hg +++ b/gio/src/fileoutputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -134,7 +135,7 @@ public: g_file_output_stream_query_info_finish, refreturn, errthrow) - _WRAP_METHOD(std::string get_etag() const, g_file_output_stream_get_etag) + _WRAP_METHOD(Glib::ustring get_etag() const, g_file_output_stream_get_etag) }; } // namespace Gio diff --git a/gio/src/filterinputstream.ccg b/gio/src/filterinputstream.ccg index 2ef4fcf..f69b83d 100644 --- a/gio/src/filterinputstream.ccg +++ b/gio/src/filterinputstream.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/filterinputstream.hg b/gio/src/filterinputstream.hg index 1549bd4..bd35f73 100644 --- a/gio/src/filterinputstream.hg +++ b/gio/src/filterinputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/filteroutputstream.ccg b/gio/src/filteroutputstream.ccg index ddcd3ef..49d0402 100644 --- a/gio/src/filteroutputstream.ccg +++ b/gio/src/filteroutputstream.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/filteroutputstream.hg b/gio/src/filteroutputstream.hg index 7a9f762..6af0821 100644 --- a/gio/src/filteroutputstream.hg +++ b/gio/src/filteroutputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/gio_docs_override.xml b/gio/src/gio_docs_override.xml index 9d757d3..cbeaae1 100644 --- a/gio/src/gio_docs_override.xml +++ b/gio/src/gio_docs_override.xml @@ -1,4 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gio/src/gio_enums.defs b/gio/src/gio_enums.defs index 98a7922..4771d57 100644 --- a/gio/src/gio_enums.defs +++ b/gio/src/gio_enums.defs @@ -498,7 +498,7 @@ '("busy" "G_IO_ERROR_BUSY" "26") '("would-block" "G_IO_ERROR_WOULD_BLOCK" "27") '("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND" "28") - '("host-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28") + '("host-was-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28") '("would-merge" "G_IO_ERROR_WOULD_MERGE" "29") '("failed-handled" "G_IO_ERROR_FAILED_HANDLED" "30") '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES" "31") @@ -1260,7 +1260,7 @@ (in-module "G") (c-name "GDBusMessageByteOrder") (values - '("big-endian" "G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN" "0") + '("big-endian" "G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN" "'B'") '("little-endian" "G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN" "'l'") ) ) @@ -1587,6 +1587,14 @@ (c-name "GSubprocessFlags") (values '("none" "G_SUBPROCESS_FLAGS_NONE" "0x0") + '("stdin-pipe" "G_SUBPROCESS_FLAGS_STDIN_PIPE" "(1u << 0)") + '("stdin-inherit" "G_SUBPROCESS_FLAGS_STDIN_INHERIT" "(1u << 1)") + '("stdout-pipe" "G_SUBPROCESS_FLAGS_STDOUT_PIPE" "(1u << 2)") + '("stdout-silence" "G_SUBPROCESS_FLAGS_STDOUT_SILENCE" "(1u << 3)") + '("stderr-pipe" "G_SUBPROCESS_FLAGS_STDERR_PIPE" "(1u << 4)") + '("stderr-silence" "G_SUBPROCESS_FLAGS_STDERR_SILENCE" "(1u << 5)") + '("stderr-merge" "G_SUBPROCESS_FLAGS_STDERR_MERGE" "(1u << 6)") + '("inherit-fds" "G_SUBPROCESS_FLAGS_INHERIT_FDS" "(1u << 7)") ) ) diff --git a/gio/src/gio_enums.defs.patch b/gio/src/gio_enums.defs.patch index 4d64a58..4ef9701 100644 --- a/gio/src/gio_enums.defs.patch +++ b/gio/src/gio_enums.defs.patch @@ -6,7 +6,7 @@ '("busy" "G_IO_ERROR_BUSY" "26") '("would-block" "G_IO_ERROR_WOULD_BLOCK" "27") '("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND" "28") -+ '("host-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28") ++ '("host-was-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28") '("would-merge" "G_IO_ERROR_WOULD_MERGE" "29") '("failed-handled" "G_IO_ERROR_FAILED_HANDLED" "30") '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES" "31") diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index 6699fdf..31a2683 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -9,7 +9,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "TRUE") ) (define-property name @@ -19,7 +18,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "") ) (define-property parameter-type @@ -54,8 +52,7 @@ (define-signal action-added (of-object "GActionGroup") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -64,8 +61,7 @@ (define-signal action-removed (of-object "GActionGroup") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -74,8 +70,7 @@ (define-signal action-enabled-changed (of-object "GActionGroup") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") '("gboolean" "p1") @@ -85,8 +80,7 @@ (define-signal action-state-changed (of-object "GActionGroup") (return-type "void") - (flags "Run Last, Must Collect") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") '("GVariant*" "p1") @@ -98,25 +92,25 @@ (define-signal activate (of-object "GApplication") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal startup (of-object "GApplication") (return-type "void") - (flags "Run First") + (when "first") ) (define-signal shutdown (of-object "GApplication") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal open (of-object "GApplication") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("gpointer" "p0") '("gint" "p1") @@ -127,7 +121,7 @@ (define-signal command-line (of-object "GApplication") (return-type "gint") - (flags "Run Last") + (when "last") (parameters '("GApplicationCommandLine*" "p0") ) @@ -136,7 +130,7 @@ (define-signal handle-local-options (of-object "GApplication") (return-type "gint") - (flags "Run Last") + (when "last") (parameters '("GVariantDict*" "p0") ) @@ -149,7 +143,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property flags @@ -159,7 +152,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_APPLICATION_FLAGS_NONE") ) (define-property resource-base-path @@ -169,7 +161,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property is-registered @@ -179,7 +170,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-remote @@ -189,7 +179,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property inactivity-timeout @@ -199,7 +188,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "0") ) (define-property action-group @@ -219,7 +207,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GAppInfoMonitor @@ -227,7 +214,7 @@ (define-signal changed (of-object "GAppInfoMonitor") (return-type "void") - (flags "Run First") + (when "first") ) ;; From GCancellable @@ -235,7 +222,7 @@ (define-signal cancelled (of-object "GCancellable") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GBufferedInputStream @@ -247,7 +234,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "4096") ) ;; From GBufferedOutputStream @@ -259,7 +245,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "4096") ) (define-property auto-grow @@ -269,7 +254,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) ;; From GCharsetConverter @@ -281,7 +265,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property to-charset @@ -291,7 +274,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property use-fallback @@ -301,7 +283,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) ;; From GConverterInputStream @@ -335,7 +316,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN") ) (define-property newline-type @@ -345,7 +325,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_DATA_STREAM_NEWLINE_TYPE_LF") ) ;; From GDataOutputStream @@ -357,7 +336,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN") ) ;; From GDrive @@ -365,25 +343,25 @@ (define-signal changed (of-object "GDrive") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal disconnected (of-object "GDrive") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal eject-button (of-object "GDrive") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal stop-button (of-object "GDrive") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GFile @@ -417,7 +395,7 @@ (define-signal changed (of-object "GFileMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GFile*" "p0") '("GFile*" "p1") @@ -432,7 +410,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "800") ) (define-property cancelled @@ -442,7 +419,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GFilenameCompleter @@ -450,7 +426,7 @@ (define-signal got-completion-data (of-object "GFilenameCompleter") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GFileInputStream @@ -475,7 +451,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) ;; From GFilterOutputStream @@ -496,7 +471,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "TRUE") ) ;; From GUnixCredentialsMessage @@ -530,7 +504,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "-1") ) (define-property close-fd @@ -540,7 +513,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) ;; From GUnixOutputStream @@ -552,7 +524,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "-1") ) (define-property close-fd @@ -562,7 +533,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) ;; From GUnixSocketAddress @@ -574,7 +544,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property path-as-array @@ -593,8 +562,6 @@ (readable #t) (writable #t) (construct-only #t) - (deprecated #t) - (default-value "FALSE") ) (define-property address-type @@ -604,7 +571,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_UNIX_SOCKET_ADDRESS_PATH") ) ;; From GInputStream @@ -614,7 +580,7 @@ (define-signal items-changed (of-object "GListModel") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("guint" "p0") '("guint" "p1") @@ -655,7 +621,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property data-size @@ -665,7 +630,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "0") ) (define-property realloc-function @@ -693,7 +657,7 @@ (define-signal items-changed (of-object "GMenuModel") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("gint" "p0") '("gint" "p1") @@ -706,19 +670,19 @@ (define-signal changed (of-object "GMount") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal unmounted (of-object "GMount") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal pre-unmount (of-object "GMount") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GMountOperation @@ -726,7 +690,7 @@ (define-signal ask-password (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("const-gchar*" "p0") '("const-gchar*" "p1") @@ -738,7 +702,7 @@ (define-signal ask-question (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("const-gchar*" "p0") '("const-gchar**" "p1") @@ -748,7 +712,7 @@ (define-signal reply (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GMountOperationResult" "p0") ) @@ -757,13 +721,13 @@ (define-signal aborted (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal show-processes (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("const-gchar*" "p0") '("GArray*" "p1") @@ -774,7 +738,7 @@ (define-signal show-unmount-progress (of-object "GMountOperation") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("const-gchar*" "p0") '("gint64" "p1") @@ -789,7 +753,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property password @@ -799,7 +762,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property anonymous @@ -809,7 +771,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property domain @@ -819,7 +780,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property password-save @@ -829,7 +789,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_PASSWORD_SAVE_NEVER") ) (define-property choice @@ -839,7 +798,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "0") ) ;; From GNotification @@ -853,7 +811,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property can-acquire @@ -863,7 +820,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property can-release @@ -873,7 +829,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GPropertyAction @@ -885,7 +840,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property parameter-type @@ -904,7 +858,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "TRUE") ) (define-property state-type @@ -941,7 +894,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "") ) (define-property invert-boolean @@ -951,7 +903,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "FALSE") ) ;; From GProxy @@ -965,7 +916,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property destination-protocol @@ -975,7 +925,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property destination-hostname @@ -985,7 +934,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property destination-port @@ -995,7 +943,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property username @@ -1005,7 +952,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property password @@ -1015,17 +961,15 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property uri (of-object "GProxyAddress") (prop-type "GParamString") - (docs "The proxy’s URI") + (docs "The proxy's URI") (readable #t) (writable #t) (construct-only #t) - (default-value "") ) ;; From GProxyAddressEnumerator @@ -1037,7 +981,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property default-port @@ -1047,7 +990,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property connectable @@ -1077,8 +1019,7 @@ (define-signal changed (of-object "GSettings") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -1087,7 +1028,7 @@ (define-signal change-event (of-object "GSettings") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("gpointer" "p0") '("gint" "p1") @@ -1097,8 +1038,7 @@ (define-signal writable-changed (of-object "GSettings") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -1107,7 +1047,7 @@ (define-signal writable-change-event (of-object "GSettings") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GQuark" "p0") ) @@ -1130,7 +1070,6 @@ (writable #t) (construct-only #t) (deprecated #t) - (default-value "") ) (define-property schema-id @@ -1140,7 +1079,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property backend @@ -1159,7 +1097,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property has-unapplied @@ -1169,17 +1106,15 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property delay-apply (of-object "GSettings") (prop-type "GParamBoolean") - (docs "Whether this settings object is in “delay-apply” mode") + (docs "Whether this settings object is in 'delay-apply' mode") (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GSettingsBackend @@ -1191,7 +1126,7 @@ (define-signal activate (of-object "GSimpleAction") (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters '("GVariant*" "p0") ) @@ -1200,7 +1135,7 @@ (define-signal change-state (of-object "GSimpleAction") (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters '("GVariant*" "p0") ) @@ -1213,7 +1148,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property parameter-type @@ -1232,7 +1166,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) (define-property state-type @@ -1282,7 +1215,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "G_SUBPROCESS_FLAGS_NONE") ) (define-property argv @@ -1303,7 +1235,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "G_SUBPROCESS_FLAGS_NONE") ) ;; From GThemedIcon @@ -1315,7 +1246,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "") ) (define-property names @@ -1330,11 +1260,10 @@ (define-property use-default-fallbacks (of-object "GThemedIcon") (prop-type "GParamBoolean") - (docs "Whether to use default fallbacks found by shortening the name at “-” characters. Ignores names after the first if multiple names are given.") + (docs "Whether to use default fallbacks found by shortening the name at '-' characters. Ignores names after the first if multiple names are given.") (readable #t) (writable #t) (construct-only #t) - (default-value "FALSE") ) ;; From GVolume @@ -1342,13 +1271,13 @@ (define-signal changed (of-object "GVolume") (return-type "void") - (flags "Run Last") + (when "last") ) (define-signal removed (of-object "GVolume") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GVolumeMonitor @@ -1356,7 +1285,7 @@ (define-signal volume-added (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GVolume*" "p0") ) @@ -1365,7 +1294,7 @@ (define-signal volume-removed (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GVolume*" "p0") ) @@ -1374,7 +1303,7 @@ (define-signal volume-changed (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GVolume*" "p0") ) @@ -1383,7 +1312,7 @@ (define-signal mount-added (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GMount*" "p0") ) @@ -1392,7 +1321,7 @@ (define-signal mount-removed (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GMount*" "p0") ) @@ -1401,7 +1330,7 @@ (define-signal mount-pre-unmount (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GMount*" "p0") ) @@ -1410,7 +1339,7 @@ (define-signal mount-changed (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GMount*" "p0") ) @@ -1419,7 +1348,7 @@ (define-signal drive-connected (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDrive*" "p0") ) @@ -1428,7 +1357,7 @@ (define-signal drive-disconnected (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDrive*" "p0") ) @@ -1437,7 +1366,7 @@ (define-signal drive-changed (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDrive*" "p0") ) @@ -1446,7 +1375,7 @@ (define-signal drive-eject-button (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDrive*" "p0") ) @@ -1455,7 +1384,7 @@ (define-signal drive-stop-button (of-object "GVolumeMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDrive*" "p0") ) @@ -1470,7 +1399,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_ZLIB_COMPRESSOR_FORMAT_ZLIB") ) (define-property level @@ -1480,7 +1408,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "-1") ) (define-property file-info @@ -1501,7 +1428,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_ZLIB_COMPRESSOR_FORMAT_ZLIB") ) (define-property file-info @@ -1522,7 +1448,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_SOCKET_FAMILY_INVALID") ) (define-property bytes @@ -1541,7 +1466,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-loopback @@ -1551,7 +1475,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-link-local @@ -1561,7 +1484,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-site-local @@ -1571,7 +1493,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-multicast @@ -1581,7 +1502,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-mc-global @@ -1591,7 +1511,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-mc-link-local @@ -1601,7 +1520,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-mc-node-local @@ -1611,7 +1529,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-mc-org-local @@ -1621,7 +1538,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property is-mc-site-local @@ -1631,7 +1547,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GInetSocketAddress @@ -1652,7 +1567,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property flowinfo @@ -1662,7 +1576,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property scope-id @@ -1672,7 +1585,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) ;; From GSocketAddress @@ -1684,7 +1596,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "G_SOCKET_FAMILY_INVALID") ) ;; From GSocketAddressEnumerator @@ -1698,7 +1609,7 @@ (define-signal reload (of-object "GResolver") (return-type "void") - (flags "Run Last") + (when "last") ) ;; From GNetworkAddress @@ -1710,7 +1621,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property port @@ -1720,7 +1630,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "0") ) (define-property scheme @@ -1730,7 +1639,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) ;; From GNetworkMonitor @@ -1738,7 +1646,7 @@ (define-signal network-changed (of-object "GNetworkMonitor") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("gboolean" "p0") ) @@ -1751,7 +1659,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "G_NETWORK_CONNECTIVITY_FULL") ) (define-property network-available @@ -1761,7 +1668,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property network-metered @@ -1771,7 +1677,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GNetworkService @@ -1783,7 +1688,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property protocol @@ -1793,7 +1697,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property domain @@ -1803,7 +1706,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property scheme @@ -1813,7 +1715,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) ;; From GSettings @@ -1821,8 +1722,7 @@ (define-signal changed (of-object "GSettings") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -1831,7 +1731,7 @@ (define-signal change-event (of-object "GSettings") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("gpointer" "p0") '("gint" "p1") @@ -1841,8 +1741,7 @@ (define-signal writable-changed (of-object "GSettings") (return-type "void") - (flags "Run Last") - (detailed #t) + (when "last") (parameters '("const-gchar*" "p0") ) @@ -1851,7 +1750,7 @@ (define-signal writable-change-event (of-object "GSettings") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GQuark" "p0") ) @@ -1874,7 +1773,6 @@ (writable #t) (construct-only #t) (deprecated #t) - (default-value "") ) (define-property schema-id @@ -1884,7 +1782,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property backend @@ -1903,7 +1800,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property has-unapplied @@ -1913,17 +1809,15 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property delay-apply (of-object "GSettings") (prop-type "GParamBoolean") - (docs "Whether this settings object is in “delay-apply” mode") + (docs "Whether this settings object is in 'delay-apply' mode") (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; GSettingsSchema is neither a GObject nor a GInterface. Not checked for signals and properties. @@ -1943,7 +1837,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_SOCKET_FAMILY_INVALID") ) (define-property type @@ -1953,7 +1846,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_SOCKET_TYPE_STREAM") ) (define-property protocol @@ -1963,7 +1855,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_SOCKET_PROTOCOL_UNKNOWN") ) (define-property fd @@ -1973,7 +1864,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "-1") ) (define-property blocking @@ -1983,7 +1873,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) (define-property listen-backlog @@ -1993,7 +1882,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "10") ) (define-property keepalive @@ -2003,7 +1891,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property local-address @@ -2031,7 +1918,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "0") ) (define-property ttl @@ -2041,7 +1927,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "0") ) (define-property broadcast @@ -2051,7 +1936,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property multicast-loopback @@ -2061,7 +1945,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) (define-property multicast-ttl @@ -2071,7 +1954,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "1") ) ;; From GSocketClient @@ -2079,7 +1961,7 @@ (define-signal event (of-object "GSocketClient") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GSocketClientEvent" "p0") '("GSocketConnectable*" "p1") @@ -2094,7 +1976,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_SOCKET_FAMILY_INVALID") ) (define-property type @@ -2104,7 +1985,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_SOCKET_TYPE_STREAM") ) (define-property protocol @@ -2114,7 +1994,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_SOCKET_PROTOCOL_DEFAULT") ) (define-property local-address @@ -2133,7 +2012,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "0") ) (define-property enable-proxy @@ -2143,7 +2021,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) (define-property tls @@ -2153,7 +2030,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property tls-validation-flags @@ -2163,7 +2039,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_TLS_CERTIFICATE_UNKNOWN_CA | G_TLS_CERTIFICATE_BAD_IDENTITY | G_TLS_CERTIFICATE_NOT_ACTIVATED | G_TLS_CERTIFICATE_EXPIRED | G_TLS_CERTIFICATE_REVOKED | G_TLS_CERTIFICATE_INSECURE | G_TLS_CERTIFICATE_GENERIC_ERROR") ) (define-property proxy-resolver @@ -2195,7 +2070,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) ;; From GTcpWrapperConnection @@ -2229,13 +2103,12 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property private-key (of-object "GTlsCertificate") (prop-type "GParamBoxed") - (docs "The DER representation of the certificate’s private key") + (docs "The DER representation of the certificate's private key") (readable #f) (writable #t) (construct-only #t) @@ -2244,11 +2117,10 @@ (define-property private-key-pem (of-object "GTlsCertificate") (prop-type "GParamString") - (docs "The PEM representation of the certificate’s private key") + (docs "The PEM representation of the certificate's private key") (readable #f) (writable #t) (construct-only #t) - (default-value "") ) (define-property issuer @@ -2287,7 +2159,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property validation-flags @@ -2297,7 +2168,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_TLS_CERTIFICATE_UNKNOWN_CA | G_TLS_CERTIFICATE_BAD_IDENTITY | G_TLS_CERTIFICATE_NOT_ACTIVATED | G_TLS_CERTIFICATE_EXPIRED | G_TLS_CERTIFICATE_REVOKED | G_TLS_CERTIFICATE_INSECURE | G_TLS_CERTIFICATE_GENERIC_ERROR") ) ;; From GTlsConnection @@ -2305,7 +2175,7 @@ (define-signal accept-certificate (of-object "GTlsConnection") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GTlsCertificate*" "p0") '("GTlsCertificateFlags" "p1") @@ -2328,7 +2198,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) (define-property rehandshake-mode @@ -2338,7 +2207,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_TLS_REHANDSHAKE_SAFELY") ) (define-property use-system-certdb @@ -2348,8 +2216,6 @@ (readable #t) (writable #t) (construct-only #f) - (deprecated #t) - (default-value "TRUE") ) (define-property database @@ -2373,7 +2239,7 @@ (define-property certificate (of-object "GTlsConnection") (prop-type "GParamObject") - (docs "The connection’s certificate") + (docs "The connection's certificate") (readable #t) (writable #t) (construct-only #f) @@ -2382,7 +2248,7 @@ (define-property peer-certificate (of-object "GTlsConnection") (prop-type "GParamObject") - (docs "The connection’s peer’s certificate") + (docs "The connection's peer's certificate") (readable #t) (writable #f) (construct-only #f) @@ -2391,11 +2257,10 @@ (define-property peer-certificate-errors (of-object "GTlsConnection") (prop-type "GParamFlags") - (docs "Errors found with the peer’s certificate") + (docs "Errors found with the peer's certificate") (readable #t) (writable #f) (construct-only #f) - (default-value "0") ) ;; From GTlsDatabase @@ -2409,7 +2274,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) ;; From GTlsInteraction @@ -2423,7 +2287,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_TLS_PASSWORD_NONE") ) (define-property description @@ -2433,7 +2296,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) (define-property warning @@ -2443,7 +2305,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "") ) ;; From GTlsServerConnection @@ -2455,7 +2316,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_TLS_AUTHENTICATION_NONE") ) ;; From GUnixConnection @@ -2465,7 +2325,7 @@ (define-signal event (of-object "GSocketListener") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GSocketListenerEvent" "p0") '("GSocket*" "p1") @@ -2479,7 +2339,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "10") ) ;; From GSocketService @@ -2487,7 +2346,7 @@ (define-signal incoming (of-object "GSocketService") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GSocketConnection*" "p0") '("GObject*" "p1") @@ -2501,7 +2360,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "TRUE") ) ;; From GThreadedSocketService @@ -2509,7 +2367,7 @@ (define-signal run (of-object "GThreadedSocketService") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GSocketConnection*" "p0") '("GObject*" "p1") @@ -2523,7 +2381,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "10") ) ;; From GDBusAuthObserver @@ -2531,7 +2388,7 @@ (define-signal authorize-authenticated-peer (of-object "GDBusAuthObserver") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GIOStream*" "p0") '("GCredentials*" "p1") @@ -2541,7 +2398,7 @@ (define-signal allow-mechanism (of-object "GDBusAuthObserver") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("const-gchar*" "p0") ) @@ -2552,7 +2409,7 @@ (define-signal closed (of-object "GDBusConnection") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("gboolean" "p0") '("GError*" "p1") @@ -2575,7 +2432,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "") ) (define-property flags @@ -2585,7 +2441,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "G_DBUS_CONNECTION_FLAGS_NONE") ) (define-property guid @@ -2595,7 +2450,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property unique-name @@ -2605,7 +2459,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "") ) (define-property closed @@ -2615,7 +2468,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property exit-on-close @@ -2625,7 +2477,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "FALSE") ) (define-property capabilities @@ -2635,7 +2486,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "G_DBUS_CAPABILITY_FLAGS_NONE") ) (define-property authentication-observer @@ -2668,7 +2518,7 @@ (define-signal g-authorize-method (of-object "GDBusInterfaceSkeleton") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GDBusMethodInvocation*" "p0") ) @@ -2681,7 +2531,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "G_DBUS_INTERFACE_SKELETON_FLAGS_NONE") ) ;; From GDBusObject @@ -2689,7 +2538,7 @@ (define-signal interface-added (of-object "GDBusObject") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDBusInterface*" "p0") ) @@ -2698,7 +2547,7 @@ (define-signal interface-removed (of-object "GDBusObject") (return-type "void") - (flags "Run Last") + (when "last") (parameters '("GDBusInterface*" "p0") ) @@ -2715,7 +2564,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) ;; From GDBusMethodInvocation @@ -2725,7 +2573,7 @@ (define-signal g-properties-changed (of-object "GDBusProxy") (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters '("GVariant*" "p0") '("const-gchar*const*" "p1") @@ -2735,7 +2583,7 @@ (define-signal g-signal (of-object "GDBusProxy") (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters '("const-gchar*" "p0") '("const-gchar*" "p1") @@ -2759,7 +2607,6 @@ (readable #f) (writable #t) (construct-only #t) - (default-value "G_BUS_TYPE_NONE") ) (define-property g-name @@ -2769,7 +2616,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property g-name-owner @@ -2779,7 +2625,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "") ) (define-property g-flags @@ -2789,7 +2634,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_DBUS_PROXY_FLAGS_NONE") ) (define-property g-object-path @@ -2799,7 +2643,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property g-interface-name @@ -2809,7 +2652,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property g-default-timeout @@ -2819,7 +2661,6 @@ (readable #t) (writable #t) (construct-only #f) - (default-value "-1") ) (define-property g-interface-info @@ -2836,7 +2677,7 @@ (define-signal new-connection (of-object "GDBusServer") (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters '("GDBusConnection*" "p0") ) @@ -2849,7 +2690,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property client-address @@ -2859,7 +2699,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "") ) (define-property flags @@ -2869,7 +2708,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_DBUS_SERVER_FLAGS_NONE") ) (define-property guid @@ -2879,7 +2717,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property active @@ -2889,7 +2726,6 @@ (readable #t) (writable #f) (construct-only #f) - (default-value "FALSE") ) (define-property authentication-observer diff --git a/gio/src/gio_signals.defs.patch b/gio/src/gio_signals.defs.patch index bf5d51a..06a331f 100644 --- a/gio/src/gio_signals.defs.patch +++ b/gio/src/gio_signals.defs.patch @@ -1,9 +1,7 @@ ---- ./../../gio/src/gio_signals.defs.orig 2017-09-12 17:06:06.023464567 +0200 -+++ ./../../gio/src/gio_signals.defs 2017-09-13 08:41:32.428298292 +0200 -@@ -87,11 +87,11 @@ - (return-type "void") - (flags "Run Last, Must Collect") - (detailed #t) +--- gio_signals.defs 2012-02-28 13:19:25.000000000 -0500 ++++ gio_signals.defs.new 2012-02-28 12:47:50.000000000 -0500 +@@ -83,7 +83,7 @@ + (when "last") (parameters '("const-gchar*" "p0") - '("GVariant" "p1") @@ -11,24 +9,8 @@ ) ) - ;; From GApplication - -@@ -591,10 +591,11 @@ - (prop-type "GParamBoolean") - (docs "Whether or not this is an abstract address") - (readable #t) - (writable #t) - (construct-only #t) -+ (deprecated #t) - (default-value "FALSE") - ) - - (define-property address-type - (of-object "GUnixSocketAddress") -@@ -738,11 +739,11 @@ - (of-object "GMountOperation") - (return-type "void") - (flags "Run Last") +@@ -579,7 +579,7 @@ + (when "last") (parameters '("const-gchar*" "p0") - '("GStrv*" "p1") @@ -36,74 +18,45 @@ ) ) - (define-signal reply - (of-object "GMountOperation") -@@ -1106,11 +1107,11 @@ - (define-signal writable-change-event - (of-object "GSettings") - (return-type "gboolean") - (flags "Run Last") - (parameters -- '("guint" "p0") -+ '("GQuark" "p0") - ) - ) - - (define-property settings-schema - (of-object "GSettings") -@@ -1190,20 +1191,20 @@ - (define-signal activate - (of-object "GSimpleAction") +@@ -849,7 +849,7 @@ (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters - '("GVariant" "p0") + '("GVariant*" "p0") ) ) - (define-signal change-state - (of-object "GSimpleAction") +@@ -858,7 +858,7 @@ (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters - '("GVariant" "p0") + '("GVariant*" "p0") ) ) - (define-property name - (of-object "GSimpleAction") -@@ -1850,11 +1851,11 @@ - (define-signal writable-change-event - (of-object "GSettings") +@@ -1049,6 +1049,6 @@ (return-type "gboolean") - (flags "Run Last") + (when "last") (parameters - '("guint" "p0") + '("GQuark" "p0") ) ) - - (define-property settings-schema - (of-object "GSettings") -@@ -2345,10 +2346,11 @@ - (prop-type "GParamBoolean") - (docs "Whether to verify peer certificates against the system certificate database") - (readable #t) - (writable #t) - (construct-only #f) -+ (deprecated #t) - (default-value "TRUE") + +@@ -1752,6 +1752,6 @@ + (return-type "gboolean") + (when "last") + (parameters +- '("guint" "p0") ++ '("GQuark" "p0") + ) ) - - (define-property database - (of-object "GTlsConnection") -@@ -2723,23 +2725,23 @@ - (define-signal g-properties-changed - (of-object "GDBusProxy") + +@@ -1824,8 +1824,8 @@ (return-type "void") - (flags "Run Last, Must Collect") + (when "last") (parameters - '("GVariant" "p0") - '("GStrv*" "p1") @@ -112,10 +65,7 @@ ) ) - (define-signal g-signal - (of-object "GDBusProxy") - (return-type "void") - (flags "Run Last, Must Collect") +@@ -1836,7 +1836,7 @@ (parameters '("const-gchar*" "p0") '("const-gchar*" "p1") @@ -124,5 +74,3 @@ ) ) - (define-property g-connection - (of-object "GDBusProxy") diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs index 4bcfa1e..8dfac73 100644 --- a/gio/src/gio_vfuncs.defs +++ b/gio/src/gio_vfuncs.defs @@ -311,9 +311,23 @@ (return-type "void") ) -(define-vfunc shutdown +(define-vfunc dbus_register + (of-object "GApplication") + (return-type "gboolean") + (parameters + '("GDBusConnection*" "connection") + '("const-gchar*" "object_path") + '("GError**" "error") + ) +) + +(define-vfunc dbus_unregister (of-object "GApplication") (return-type "void") + (parameters + '("GDBusConnection*" "connection") + '("const-gchar*" "object_path") + ) ) ; GAsyncInitable @@ -345,6 +359,14 @@ (return-type "GObject*") ) +(define-vfunc is_tagged + (of-object "GAsyncResult") + (return-type "gboolean") + (parameters + '("gpointer" "source_tag") + ) +) + ; GBufferedInputStream (define-vfunc fill @@ -555,6 +577,13 @@ ) ) +; GFileDescriptorBased + +(define-vfunc get_fd + (of-object "GFileDescriptorBased") + (return-type "int") +) + ; GFileInputStream (define-vfunc tell diff --git a/gio/src/icon.ccg b/gio/src/icon.ccg index cbd6540..fdc6c87 100644 --- a/gio/src/icon.ccg +++ b/gio/src/icon.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/icon.hg b/gio/src/icon.hg index ce9b07a..36888f7 100644 --- a/gio/src/icon.hg +++ b/gio/src/icon.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inetaddress.ccg b/gio/src/inetaddress.ccg index f61a2c6..f8c926f 100644 --- a/gio/src/inetaddress.ccg +++ b/gio/src/inetaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inetaddress.hg b/gio/src/inetaddress.hg index e4c0c0a..6dd4467 100644 --- a/gio/src/inetaddress.hg +++ b/gio/src/inetaddress.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inetsocketaddress.ccg b/gio/src/inetsocketaddress.ccg index 24667b5..5317f38 100644 --- a/gio/src/inetsocketaddress.ccg +++ b/gio/src/inetsocketaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inetsocketaddress.hg b/gio/src/inetsocketaddress.hg index 59c9fca..8b20c16 100644 --- a/gio/src/inetsocketaddress.hg +++ b/gio/src/inetsocketaddress.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2009 jonathon jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/initable.ccg b/gio/src/initable.ccg index 24c22d9..b3b3256 100644 --- a/gio/src/initable.ccg +++ b/gio/src/initable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2009 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/initable.hg b/gio/src/initable.hg index 27e9e1b..f47f678 100644 --- a/gio/src/initable.hg +++ b/gio/src/initable.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inputstream.ccg b/gio/src/inputstream.ccg index 620f93d..9716003 100644 --- a/gio/src/inputstream.ccg +++ b/gio/src/inputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/inputstream.hg b/gio/src/inputstream.hg index d122710..315ed86 100644 --- a/gio/src/inputstream.hg +++ b/gio/src/inputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -389,11 +390,10 @@ protected: _WRAP_METHOD(bool set_pending(), g_input_stream_set_pending, errthrow, newin "2,50") _WRAP_METHOD(void clear_pending(), g_input_stream_clear_pending, newin "2,50") - //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 #m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') - //_WRAP_VFUNC(gssize read(void* buffer, gsize count, const Glib::RefPtr& cancellable), read_fn, errthrow, err_return_value -1) - //_WRAP_VFUNC(gssize skip(gsize count, const Glib::RefPtr& cancellable), skip, errthrow, err_return_value -1) - //_WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) + _WRAP_VFUNC(gssize read(void* buffer, gsize count, const Glib::RefPtr& cancellable), read_fn, errthrow, err_return_value -1) + _WRAP_VFUNC(gssize skip(gsize count, const Glib::RefPtr& cancellable), skip, errthrow, err_return_value -1) + _WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) }; } // namespace Gio diff --git a/gio/src/iostream.ccg b/gio/src/iostream.ccg index 5807215..a278ddf 100644 --- a/gio/src/iostream.ccg +++ b/gio/src/iostream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -48,7 +51,7 @@ IOStream::close_async(const SlotAsyncReady& slot, int io_priority) void IOStream::splice_async(const Glib::RefPtr& stream2, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, IOStreamSpliceFlags flags, int io_priority) + const Glib::RefPtr& cancellable, SpliceFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -61,7 +64,7 @@ IOStream::splice_async(const Glib::RefPtr& stream2, const SlotAsyncRea void IOStream::splice_async(const Glib::RefPtr& stream2, const SlotAsyncReady& slot, - IOStreamSpliceFlags flags, int io_priority) + SpliceFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter diff --git a/gio/src/iostream.hg b/gio/src/iostream.hg index b53be02..1051b96 100644 --- a/gio/src/iostream.hg +++ b/gio/src/iostream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -29,8 +28,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(IOStreamSpliceFlags, GIOStreamSpliceFlags, NO_GTYPE) - /** IOStream - Base class for implementing read/write streams. * IOStream represents an object that has both read and write streams. * Generally the two streams acts as separate input and output streams, but @@ -66,6 +63,8 @@ class IOStream : public Glib::Object public: + _WRAP_ENUM(SpliceFlags, GIOStreamSpliceFlags, NO_GTYPE) + /** Asyncronously splice the output stream to the input stream of @a * stream2, and splice the output stream of @a stream2 to the input stream of * this stream. @@ -76,21 +75,21 @@ public: * @param stream2 The second IOStream. * @param slot A SlotAsyncReady slot. * @param cancellable A Cancellable object. - * @param flags A set of IOStreamSpliceFlags. + * @param flags A set of SpliceFlags. * @param io_priority The io priority of the request. * * @newin{2,34} */ void splice_async(const Glib::RefPtr& stream2, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, - IOStreamSpliceFlags flags = Gio::IO_STREAM_SPLICE_NONE, + SpliceFlags flags = SpliceFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_io_stream_splice_async) /// A non-cancellable version of splice_async(). void splice_async(const Glib::RefPtr& stream2, const SlotAsyncReady& slot, - IOStreamSpliceFlags flags = Gio::IO_STREAM_SPLICE_NONE, + SpliceFlags flags = SpliceFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _WRAP_METHOD(static bool splice_finish(const Glib::RefPtr& result), g_io_stream_splice_finish, errthrow) diff --git a/gio/src/listmodel.ccg b/gio/src/listmodel.ccg index aeabe40..b6004fa 100644 --- a/gio/src/listmodel.ccg +++ b/gio/src/listmodel.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/listmodel.hg b/gio/src/listmodel.hg index b7abfe9..3f8cec0 100644 --- a/gio/src/listmodel.hg +++ b/gio/src/listmodel.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/liststore.ccg b/gio/src/liststore.ccg index 3b2191d..4580c5e 100644 --- a/gio/src/liststore.ccg +++ b/gio/src/liststore.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/liststore.hg b/gio/src/liststore.hg index 16b8cdd..3b86e25 100644 --- a/gio/src/liststore.hg +++ b/gio/src/liststore.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -62,7 +63,7 @@ public: * * @newin{2,50} */ - using SlotCompare = sigc::slot&, const Glib::RefPtr&>; + using SlotCompare = sigc::slot&, const Glib::RefPtr&)>; _WRAP_METHOD(guint insert_sorted(const Glib::RefPtr& item, const SlotCompare& slot{compare_func}), g_list_store_insert_sorted, @@ -174,7 +175,7 @@ public: * * @newin{2,50} */ - using SlotCompare = sigc::slot&, const Glib::RefPtr&>; + using SlotCompare = sigc::slot&, const Glib::RefPtr&)>; /** Inserts @a item at a position to be determined by the @a slot. * @@ -243,13 +244,13 @@ ListStore::ListStore() template Glib::RefPtr> ListStore::create() { - return Glib::RefPtr>(new ListStore()); + return Glib::make_refptr_for_instance>(new ListStore()); } template Glib::RefPtr ListStore::get_item(guint position) { - return Glib::RefPtr::cast_dynamic(ListModel::get_object(position)); + return std::dynamic_pointer_cast(ListModel::get_object(position)); } template @@ -309,9 +310,9 @@ int ListStore::compare_data_func(gconstpointer a, gconstpointer b, gpoin // cast_dynamic is necessary if T_item is a user-derived class, such as // class MyObject : public Glib::Object - const Glib::RefPtr item_a = Glib::RefPtr::cast_dynamic( + const Glib::RefPtr item_a = std::dynamic_pointer_cast( Glib::wrap(static_cast(const_cast(a)), true)); - const Glib::RefPtr item_b = Glib::RefPtr::cast_dynamic( + const Glib::RefPtr item_b = std::dynamic_pointer_cast( Glib::wrap(static_cast(const_cast(b)), true)); return (*slot)(item_a, item_b); diff --git a/gio/src/loadableicon.ccg b/gio/src/loadableicon.ccg index 10ddbe8..f39c6e4 100644 --- a/gio/src/loadableicon.ccg +++ b/gio/src/loadableicon.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,12 +13,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include -#include #include "slot_async.h" namespace Gio diff --git a/gio/src/loadableicon.hg b/gio/src/loadableicon.hg index 0d7a485..a49b8c2 100644 --- a/gio/src/loadableicon.hg +++ b/gio/src/loadableicon.hg @@ -11,15 +11,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include #include -#include _DEFS(giomm,gio) -_PINCLUDE(giomm/private/icon_p.h) +_PINCLUDE(glibmm/private/interface_p.h) #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GLoadableIconIface GLoadableIconIface; @@ -32,9 +32,9 @@ namespace Gio * * @newin{2,16} */ -class LoadableIcon : public Icon +class LoadableIcon : public Glib::Interface { - _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface, Icon, GIcon) + _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface) public: /** diff --git a/gio/src/memoryinputstream.ccg b/gio/src/memoryinputstream.ccg index 1388d7f..38126a4 100644 --- a/gio/src/memoryinputstream.ccg +++ b/gio/src/memoryinputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,6 +30,9 @@ public: { } + SlotWithData(const SlotWithData& src) = delete; + SlotWithData& operator=(const SlotWithData& src) = delete; + ~SlotWithData() { delete m_slot; } void operator()() { (*m_slot)(m_data); } @@ -59,29 +65,6 @@ destroy_data_callback(void* user_data) namespace Gio { -_DEPRECATE_IFDEF_START -void -MemoryInputStream::add_data(const std::string& data) -{ - char* data_copy = g_strdup(data.c_str()); - g_memory_input_stream_add_data(gobj(), data_copy, -1, g_free); -} - -void -MemoryInputStream::add_data(const void* data, gssize len) -{ - char* data_copy = nullptr; - - // copy the data so that the caller doesn't need to keep the data alive - if (len < 0) - data_copy = g_strdup(static_cast(data)); - else - data_copy = static_cast(g_memdup(data, len)); - - g_memory_input_stream_add_data(gobj(), data_copy, len, g_free); -} -_DEPRECATE_IFDEF_END - void MemoryInputStream::add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot) { diff --git a/gio/src/memoryinputstream.hg b/gio/src/memoryinputstream.hg index 9fed8da..5a918fd 100644 --- a/gio/src/memoryinputstream.hg +++ b/gio/src/memoryinputstream.hg @@ -11,13 +11,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) #include #include +#include _DEFS(giomm,gio) _PINCLUDE(giomm/private/inputstream_p.h) @@ -33,10 +35,12 @@ namespace Gio */ class MemoryInputStream : public Gio::InputStream, - public Seekable + public Seekable, + public PollableInputStream { _CLASS_GOBJECT(MemoryInputStream, GMemoryInputStream, G_MEMORY_INPUT_STREAM, Gio::InputStream, GInputStream) _IMPLEMENTS_INTERFACE(Seekable) + _IMPLEMENTS_INTERFACE(PollableInputStream) protected: _CTOR_DEFAULT @@ -45,27 +49,6 @@ protected: public: _WRAP_CREATE() -_DEPRECATE_IFDEF_START - /** Appends to data that can be read from the input stream. - * - * @param data Input data. - * - * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead. - */ - void add_data(const std::string& data); - - /** Appends to data that can be read from the input stream. - * - * Note that the data will be copied internally and freed when no longer needed. - * - * @param data Input data. - * @param len Length of the data, may be -1 if data is a null-terminated string. - * - * @deprecated Use add_data() with SlotDestroyData or GDestroyNotify instead. - */ - void add_data(const void* data, gssize len); -_DEPRECATE_IFDEF_END - _WRAP_METHOD(void add_data(const void* data, gssize len, GDestroyNotify destroy), g_memory_input_stream_add_data) /** For example, @@ -75,7 +58,7 @@ _DEPRECATE_IFDEF_END * * @newin{2,40} */ - using SlotDestroyData = sigc::slot; + using SlotDestroyData = sigc::slot; /** Appends to data that can be read from the input stream. * diff --git a/gio/src/memoryoutputstream.ccg b/gio/src/memoryoutputstream.ccg index 8271958..45f52e0 100644 --- a/gio/src/memoryoutputstream.ccg +++ b/gio/src/memoryoutputstream.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/memoryoutputstream.hg b/gio/src/memoryoutputstream.hg index 329329e..6768615 100644 --- a/gio/src/memoryoutputstream.hg +++ b/gio/src/memoryoutputstream.hg @@ -11,11 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +#include #include // TODO: remove this if possible -- it's here for the GReallocFunc definition #include @@ -44,10 +46,12 @@ namespace Gio */ class MemoryOutputStream : public OutputStream, - public Seekable + public Seekable, + public PollableOutputStream { _CLASS_GOBJECT(MemoryOutputStream, GMemoryOutputStream, G_MEMORY_OUTPUT_STREAM, Gio::OutputStream, GOutputStream) _IMPLEMENTS_INTERFACE(Seekable) + _IMPLEMENTS_INTERFACE(PollableOutputStream) protected: // Hand-coded because it's equivalent to g_memory_output_stream_new_resizable(), diff --git a/gio/src/menu.ccg b/gio/src/menu.ccg index 7f97a55..969d51e 100644 --- a/gio/src/menu.ccg +++ b/gio/src/menu.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/menu.hg b/gio/src/menu.hg index c5d3831..e3f1d6d 100644 --- a/gio/src/menu.hg +++ b/gio/src/menu.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -47,10 +48,9 @@ public: _WRAP_METHOD(void freeze(), g_menu_freeze) - //TODO: Make the item "const Glib::RefPtr&" when we can break ABI? The function is documented as just copying its attributes. - _WRAP_METHOD(void insert_item(int position, const Glib::RefPtr& item), g_menu_insert_item) - _WRAP_METHOD(void prepend_item(const Glib::RefPtr& item), g_menu_prepend_item) - _WRAP_METHOD(void append_item(const Glib::RefPtr& item), g_menu_append_item) + _WRAP_METHOD(void insert_item(int position, const Glib::RefPtr& item), g_menu_insert_item) + _WRAP_METHOD(void prepend_item(const Glib::RefPtr& item), g_menu_prepend_item) + _WRAP_METHOD(void append_item(const Glib::RefPtr& item), g_menu_append_item) _WRAP_METHOD(void remove(int position), g_menu_remove) _WRAP_METHOD(void remove_all(), g_menu_remove_all) @@ -62,6 +62,7 @@ public: _WRAP_METHOD(void prepend(const Glib::ustring& label, const Glib::ustring& detailed_action{?}), g_menu_prepend) _WRAP_METHOD(void append(const Glib::ustring& label, const Glib::ustring& detailed_action{?}), g_menu_append) +// TODO: Should the MenuModel be const too? _WRAP_METHOD(void insert_section(int position, const Glib::ustring& label{?}, const Glib::RefPtr& section), g_menu_insert_section) _WRAP_METHOD(void prepend_section(const Glib::ustring& label{?}, const Glib::RefPtr& section), g_menu_prepend_section) _WRAP_METHOD(void append_section(const Glib::ustring& label{?}, const Glib::RefPtr& section), g_menu_append_section) diff --git a/gio/src/menuattributeiter.ccg b/gio/src/menuattributeiter.ccg index 7c74164..83ea74a 100644 --- a/gio/src/menuattributeiter.ccg +++ b/gio/src/menuattributeiter.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/menuattributeiter.hg b/gio/src/menuattributeiter.hg index 16bfb3b..0e2c941 100644 --- a/gio/src/menuattributeiter.hg +++ b/gio/src/menuattributeiter.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -38,10 +39,7 @@ public: _WRAP_METHOD(Glib::ustring get_name() const, g_menu_attribute_iter_get_name) - //TODO: When we can break ABI, remove the method overload and just make it const. - //It makes no sense to return const by value. - _WRAP_METHOD(Glib::VariantBase get_value(), g_menu_attribute_iter_get_value) - _WRAP_METHOD(const Glib::VariantBase get_value() const, g_menu_attribute_iter_get_value, constversion) + _WRAP_METHOD(Glib::VariantBase get_value() const, g_menu_attribute_iter_get_value) _WRAP_METHOD(bool next(), g_menu_attribute_iter_next) }; diff --git a/gio/src/menuitem.ccg b/gio/src/menuitem.ccg index a9a3ee5..2f6dc38 100644 --- a/gio/src/menuitem.ccg +++ b/gio/src/menuitem.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -42,14 +43,6 @@ MenuItem::MenuItem(const Glib::RefPtr& submenu) : _CONSTRUCT() set_submenu(submenu); } -_DEPRECATE_IFDEF_START -void -MenuItem::set_action_and_target(const Glib::ustring& action) -{ - g_menu_item_set_action_and_target_value(gobj(), action.c_str(), nullptr); -} -_DEPRECATE_IFDEF_END - void MenuItem::set_action(const Glib::ustring& action) { diff --git a/gio/src/menuitem.hg b/gio/src/menuitem.hg index 3215ec1..3830880 100644 --- a/gio/src/menuitem.hg +++ b/gio/src/menuitem.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -101,7 +102,6 @@ GMenuItem * g_menu_item_new_section (const Glib::ustring& label, //void set_attribute(const Glib::ustring& attribute, const T_Value& value) const; _WRAP_METHOD(void set_attribute_value(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value) - _WRAP_METHOD(void set_attribute(const Glib::ustring& attribute, const Glib::VariantBase& value), g_menu_item_set_attribute_value, deprecated "Use set_attribute() instead.") _IGNORE(g_menu_item_set_attribute) //These are documented as transfer-full, so we don't need to use refreturn. @@ -119,19 +119,11 @@ GMenuItem * g_menu_item_new_section (const Glib::ustring& label, //void get_attribute(const Glib::ustring& attribute, T_Value& value) const; //_WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value) - _WRAP_METHOD(Glib::VariantBase get_attribute(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value, deprecated "Use get_attribute_value() instead.") _WRAP_METHOD(Glib::VariantBase get_attribute_value(const Glib::ustring& attribute, const Glib::VariantType& expected_type{?}) const, g_menu_item_get_attribute_value) // Ignore varargs function. _IGNORE(g_menu_item_get_attribute) -_DEPRECATE_IFDEF_START - /** Unsets the target for the specified @a action. - * @deprecated Use set_action() or unset_target() instead. - */ - void set_action_and_target(const Glib::ustring& action); -_DEPRECATE_IFDEF_END - /** Sets the action for the menu item. * See set_action_and_target(). * diff --git a/gio/src/menulinkiter.ccg b/gio/src/menulinkiter.ccg index 190f557..542e46d 100644 --- a/gio/src/menulinkiter.ccg +++ b/gio/src/menulinkiter.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/menulinkiter.hg b/gio/src/menulinkiter.hg index 8cba9df..b3606d0 100644 --- a/gio/src/menulinkiter.hg +++ b/gio/src/menulinkiter.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/menumodel.ccg b/gio/src/menumodel.ccg index 9adbe29..48b9b2b 100644 --- a/gio/src/menumodel.ccg +++ b/gio/src/menumodel.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/menumodel.hg b/gio/src/menumodel.hg index 36a5ea7..bf29a12 100644 --- a/gio/src/menumodel.hg +++ b/gio/src/menumodel.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -131,16 +132,13 @@ public: #m4begin dnl See the .ccg implementation for how this conversion works. - //TODO: When we can break ABI, remove the method overload and just make it const. - //It makes no sense to return const by value. _CONVERSION(`MenuAttribute',`const gchar*',`giomm_get_menu_attribute($3)') #m4end //TODO: Add a get_item_attribute() templated method to get values directly //instead of returning a Glib::VariantBase? - _WRAP_METHOD(Glib::VariantBase get_item_attribute(int item_index, MenuAttribute attribute, const Glib::VariantType& expected_type), g_menu_model_get_item_attribute_value) - _WRAP_METHOD(const Glib::VariantBase get_item_attribute(int item_index, MenuAttribute attribute, const Glib::VariantType& expected_type) const, g_menu_model_get_item_attribute_value, constversion) + _WRAP_METHOD(Glib::VariantBase get_item_attribute(int item_index, MenuAttribute attribute, const Glib::VariantType& expected_type) const, g_menu_model_get_item_attribute_value) // Ignore varargs function _IGNORE(g_menu_model_get_item_attribute) diff --git a/gio/src/mount.ccg b/gio/src/mount.ccg index 939931d..2ba1001 100644 --- a/gio/src/mount.ccg +++ b/gio/src/mount.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,7 +29,7 @@ namespace Gio void Mount::unmount( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -39,7 +42,7 @@ Mount::unmount( } void -Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags) +Mount::unmount(const SlotAsyncReady& slot, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -53,7 +56,7 @@ Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags) } void -Mount::unmount(MountUnmountFlags flags) +Mount::unmount(UnmountFlags flags) { g_mount_unmount_with_operation(gobj(), GMountUnmountFlags(flags), nullptr, // mount_operation @@ -64,7 +67,7 @@ Mount::unmount(MountUnmountFlags flags) void Mount::unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const Glib::RefPtr& cancellable, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -77,7 +80,7 @@ Mount::unmount(const Glib::RefPtr& mount_operation, const SlotAs void Mount::unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountUnmountFlags flags) + UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -90,7 +93,7 @@ Mount::unmount(const Glib::RefPtr& mount_operation, const SlotAs } void -Mount::unmount(const Glib::RefPtr& mount_operation, MountUnmountFlags flags) +Mount::unmount(const Glib::RefPtr& mount_operation, UnmountFlags flags) { g_mount_unmount_with_operation(gobj(), GMountUnmountFlags(flags), Glib::unwrap(mount_operation), nullptr, // cancellable @@ -100,7 +103,7 @@ Mount::unmount(const Glib::RefPtr& mount_operation, MountUnmount void Mount::remount(const Glib::RefPtr& operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountMountFlags flags) + const Glib::RefPtr& cancellable, MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -113,7 +116,7 @@ Mount::remount(const Glib::RefPtr& operation, const SlotAsyncRea void Mount::remount( - const Glib::RefPtr& operation, const SlotAsyncReady& slot, MountMountFlags flags) + const Glib::RefPtr& operation, const SlotAsyncReady& slot, MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -125,21 +128,21 @@ Mount::remount( } void -Mount::remount(const Glib::RefPtr& operation, MountMountFlags flags) +Mount::remount(const Glib::RefPtr& operation, MountFlags flags) { g_mount_remount(gobj(), static_cast(flags), Glib::unwrap(operation), nullptr, nullptr, nullptr); } void -Mount::remount(MountMountFlags flags) +Mount::remount(MountFlags flags) { g_mount_remount(gobj(), static_cast(flags), nullptr, nullptr, nullptr, nullptr); } void Mount::eject( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -152,7 +155,7 @@ Mount::eject( } void -Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) +Mount::eject(const SlotAsyncReady& slot, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -166,7 +169,7 @@ Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) } void -Mount::eject(MountUnmountFlags flags) +Mount::eject(UnmountFlags flags) { g_mount_eject_with_operation(gobj(), GMountUnmountFlags(flags), nullptr, // mount_operation @@ -177,7 +180,7 @@ Mount::eject(MountUnmountFlags flags) void Mount::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const Glib::RefPtr& cancellable, UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -190,7 +193,7 @@ Mount::eject(const Glib::RefPtr& mount_operation, const SlotAsyn void Mount::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountUnmountFlags flags) + UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -203,7 +206,7 @@ Mount::eject(const Glib::RefPtr& mount_operation, const SlotAsyn } void -Mount::eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags) +Mount::eject(const Glib::RefPtr& mount_operation, UnmountFlags flags) { g_mount_eject_with_operation(gobj(), GMountUnmountFlags(flags), Glib::unwrap(mount_operation), nullptr, // cancellable diff --git a/gio/src/mount.hg b/gio/src/mount.hg index 6078d7d..3356ec3 100644 --- a/gio/src/mount.hg +++ b/gio/src/mount.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include @@ -34,8 +35,6 @@ typedef struct _GMountIface GMountIface; namespace Gio { -_WRAP_ENUM(MountUnmountFlags, GMountUnmountFlags, NO_GTYPE) -_WRAP_ENUM(MountMountFlags, GMountMountFlags, NO_GTYPE) class File; class Drive; @@ -58,6 +57,8 @@ class Mount : public Glib::Interface _CLASS_INTERFACE(Mount, GMount, G_MOUNT, GMountIface) public: + _WRAP_ENUM(UnmountFlags, GMountUnmountFlags, NO_GTYPE) + _WRAP_ENUM(MountFlags, GMountMountFlags, NO_GTYPE) _WRAP_METHOD(Glib::RefPtr get_root(), g_mount_get_root, refreturn) _WRAP_METHOD(Glib::RefPtr get_root() const, g_mount_get_root, refreturn, constversion) @@ -81,12 +82,12 @@ public: _WRAP_METHOD(bool can_unmount() const, g_mount_can_unmount) _WRAP_METHOD(bool can_eject() const, g_mount_can_eject) - void unmount(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void unmount(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void unmount(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags = UnmountFlags::NONE); + void unmount(const SlotAsyncReady& slot, UnmountFlags flags = UnmountFlags::NONE); + void unmount(UnmountFlags flags = UnmountFlags::NONE); + void unmount(const Glib::RefPtr& mount_operation, UnmountFlags flags = UnmountFlags::NONE); + void unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, UnmountFlags flags = UnmountFlags::NONE); + void unmount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags = UnmountFlags::NONE); _IGNORE(g_mount_unmount) _IGNORE(g_mount_unmount_with_operation) @@ -105,7 +106,7 @@ public: * @param cancellable A cancellable object which can be used to cancel the operation. * @param flags Flags affecting the operation. */ - void remount(const Glib::RefPtr& operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE); + void remount(const Glib::RefPtr& operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountFlags flags = MountFlags::NONE); /** Remounts a mount. * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot. @@ -118,7 +119,7 @@ public: * @param slot A callback which will be called when the operation is completed or canceled. * @param flags Flags affecting the operation. */ - void remount(const Glib::RefPtr& operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void remount(const Glib::RefPtr& operation, const SlotAsyncReady& slot, MountFlags flags = MountFlags::NONE); /** Remounts a mount. * @@ -129,7 +130,7 @@ public: * @param operation A mount operation. * @param flags Flags affecting the operation. */ - void remount(const Glib::RefPtr& operation, MountMountFlags flags = MOUNT_MOUNT_NONE); + void remount(const Glib::RefPtr& operation, MountFlags flags = MountFlags::NONE); /** Remounts a mount, without user interaction. * @@ -139,18 +140,18 @@ public: * * @param flags Flags affecting the operation. */ - void remount(MountMountFlags flags = MOUNT_MOUNT_NONE); + void remount(MountFlags flags = MountFlags::NONE); _IGNORE(g_mount_remount) _WRAP_METHOD(bool remount_finish(const Glib::RefPtr& result), g_mount_remount_finish, errthrow) - void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags = UnmountFlags::NONE); + void eject(const SlotAsyncReady& slot, UnmountFlags flags = UnmountFlags::NONE); + void eject(UnmountFlags flags = UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, UnmountFlags flags = UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, UnmountFlags flags = UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, UnmountFlags flags = UnmountFlags::NONE); _IGNORE(g_mount_eject) _IGNORE(g_mount_eject_with_operation) @@ -206,7 +207,7 @@ public: void guess_content_type_sync(bool force_rescan = true); _IGNORE(g_mount_guess_content_type_sync) - #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') + #m4 _CONVERSION(`gchar**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') /** Finishes guessing content types of the Mount. * If any errors occurred during the operation, an exception will be thrown. @@ -219,7 +220,7 @@ public: * @return An array of content types. * @throw Glib::Error */ - _WRAP_METHOD(Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr& result), g_mount_guess_content_type_finish, errthrow) + _WRAP_METHOD(std::vector guess_content_type_finish(const Glib::RefPtr& result), g_mount_guess_content_type_finish, errthrow) _WRAP_METHOD(bool is_shadowed() const, g_mount_is_shadowed) _WRAP_METHOD(void shadow(), g_mount_shadow) @@ -231,7 +232,7 @@ public: _WRAP_SIGNAL(void changed(), changed) _WRAP_SIGNAL(void unmounted(), unmounted) - _WRAP_SIGNAL(void pre_unmount(), pre_unmount, no_default_handler) + _WRAP_SIGNAL(void pre_unmount(), pre_unmount) //There are no properties. }; diff --git a/gio/src/mountoperation.ccg b/gio/src/mountoperation.ccg index 228e6fd..4aa7761 100644 --- a/gio/src/mountoperation.ccg +++ b/gio/src/mountoperation.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/mountoperation.hg b/gio/src/mountoperation.hg index 1e12852..7b2cc68 100644 --- a/gio/src/mountoperation.hg +++ b/gio/src/mountoperation.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,11 +11,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -80,20 +78,18 @@ public: #m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING) _WRAP_SIGNAL(void ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags), ask_password) - //TODO: We really need some test to make sure that our use of StringArrayHandle is correct. murrayc. -#m4 _CONVERSION(`const Glib::StringArrayHandle&',`const gchar**',`const_cast(($3).data())') -#m4 _CONVERSION(`const gchar**',`const Glib::StringArrayHandle&',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_SIGNAL(void ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices), ask_question) + //TODO: We really need some test to make sure that our use of ArrayHandler is correct. murrayc. +#m4 _CONVERSION(`const std::vector&',`const gchar**',`const_cast(Glib::ArrayHandler::vector_to_array($3).data())') +#m4 _CONVERSION(`const gchar**',`const std::vector&',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_SIGNAL(void ask_question(const Glib::ustring& message, const std::vector& choices), ask_question) _WRAP_SIGNAL(void reply(MountOperationResult result), reply) - - //TODO: Remove no_default_handler when we can break ABI: - _WRAP_SIGNAL(void aborted(), aborted, no_default_handler) + _WRAP_SIGNAL(void aborted(), aborted) //TODO: The array of char* is not very pleasant to wrap: //_WRAP_SIGNAL( void show_processes(const Glib::ustring& message, GArray* processes, const gchar *choices[]); - _WRAP_SIGNAL(void show_unmount_progress(const Glib::ustring& message, gint64 time_left, gint64 bytes_left), "show_unmount_progress", no_default_handler) + _WRAP_SIGNAL(void show_unmount_progress(const Glib::ustring& message, gint64 time_left, gint64 bytes_left), "show_unmount_progress") _WRAP_PROPERTY("username", Glib::ustring) _WRAP_PROPERTY("password", Glib::ustring) diff --git a/gio/src/networkaddress.ccg b/gio/src/networkaddress.ccg index 6f2f99d..43e2d87 100644 --- a/gio/src/networkaddress.ccg +++ b/gio/src/networkaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/networkaddress.hg b/gio/src/networkaddress.hg index ff5e123..5e6aeff 100644 --- a/gio/src/networkaddress.hg +++ b/gio/src/networkaddress.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/networkmonitor.ccg b/gio/src/networkmonitor.ccg index 1cd79ef..1b940c5 100644 --- a/gio/src/networkmonitor.ccg +++ b/gio/src/networkmonitor.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/networkmonitor.hg b/gio/src/networkmonitor.hg index 4ed6fc9..df55fda 100644 --- a/gio/src/networkmonitor.hg +++ b/gio/src/networkmonitor.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/networkservice.ccg b/gio/src/networkservice.ccg index a081e60..251999b 100644 --- a/gio/src/networkservice.ccg +++ b/gio/src/networkservice.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/networkservice.hg b/gio/src/networkservice.hg index 581fc78..e5288e8 100644 --- a/gio/src/networkservice.hg +++ b/gio/src/networkservice.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/notification.hg b/gio/src/notification.hg index df9a7ee..2ab0384 100644 --- a/gio/src/notification.hg +++ b/gio/src/notification.hg @@ -27,7 +27,6 @@ namespace Gio { class Icon; -_WRAP_ENUM(NotificationPriority, GNotificationPriority, newin "2,44") /** User Notifications (pop up messages). * @@ -65,14 +64,16 @@ protected: _IGNORE(g_notification_new) public: + _WRAP_ENUM(Priority, GNotificationPriority, newin "2,44") + _WRAP_METHOD_DOCS_ONLY(g_notification_new) _WRAP_CREATE(const Glib::ustring& title) _WRAP_METHOD(void set_title(const Glib::ustring& title), g_notification_set_title) _WRAP_METHOD(void set_body(const Glib::ustring& body), g_notification_set_body) _WRAP_METHOD(void set_icon(const Glib::RefPtr& icon), g_notification_set_icon) - _WRAP_METHOD(void set_urgent(bool urgent = true), g_notification_set_urgent, deprecated "Use set_priority() instead.") - _WRAP_METHOD(void set_priority(NotificationPriority priority = NOTIFICATION_PRIORITY_NORMAL), g_notification_set_priority, newin "2,44") + _IGNORE(g_notification_set_urgent) + _WRAP_METHOD(void set_priority(Priority priority = Priority::NORMAL), g_notification_set_priority, newin "2,44") _WRAP_METHOD(void add_button(const Glib::ustring& label, const Glib::ustring& detailed_action), g_notification_add_button) diff --git a/gio/src/outputstream.ccg b/gio/src/outputstream.ccg index 6ba8fe4..46cfdd1 100644 --- a/gio/src/outputstream.ccg +++ b/gio/src/outputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -19,6 +22,8 @@ #include #include "slot_async.h" +using SpliceFlags = Gio::OutputStream::SpliceFlags; + namespace Gio { @@ -76,7 +81,7 @@ OutputStream::write_all_async( void OutputStream::splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, OutputStreamSpliceFlags flags, int io_priority) + const Glib::RefPtr& cancellable, SpliceFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -90,7 +95,7 @@ OutputStream::splice_async(const Glib::RefPtr& source, const SlotAs void OutputStream::splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, - OutputStreamSpliceFlags flags, int io_priority) + SpliceFlags flags, int io_priority) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -226,7 +231,7 @@ OutputStream::write_bytes_async( gssize OutputStream::splice(const Glib::RefPtr& source, - const Glib::RefPtr& cancellable, OutputStreamSpliceFlags flags) + const Glib::RefPtr& cancellable, SpliceFlags flags) { GError* gerror = nullptr; gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), @@ -238,7 +243,7 @@ OutputStream::splice(const Glib::RefPtr& source, } gssize -OutputStream::splice(const Glib::RefPtr& source, OutputStreamSpliceFlags flags) +OutputStream::splice(const Glib::RefPtr& source, SpliceFlags flags) { GError* gerror = nullptr; gssize retvalue = g_output_stream_splice( diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg index 835a0a5..d3b517a 100644 --- a/gio/src/outputstream.hg +++ b/gio/src/outputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,7 +27,6 @@ _PINCLUDE(gio/gio.h) // for GOutputStreamSpliceFlags namespace Gio { -_WRAP_ENUM(OutputStreamSpliceFlags, GOutputStreamSpliceFlags, NO_GTYPE) /** Base class for implementing streaming output. * @@ -42,6 +42,7 @@ protected: _CTOR_DEFAULT public: + _WRAP_ENUM(SpliceFlags, GOutputStreamSpliceFlags, NO_GTYPE) _WRAP_METHOD(gssize write(const void* buffer, gsize count, const Glib::RefPtr& cancellable{?}), g_output_stream_write, @@ -204,21 +205,21 @@ public: /** Splices an input stream into an output stream. * * @param source An InputStream. - * @param flags A set of OutputStreamSpliceFlags. + * @param flags A set of SpliceFlags. * @param cancellable A Cancellable object. * ignore. * @return A #gssize containing the size of the data spliced. */ - gssize splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE); + gssize splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable, SpliceFlags flags = SpliceFlags::NONE); /** Splices an input stream into an output stream. * * @param source An InputStream. - * @param flags A set of OutputStreamSpliceFlags. + * @param flags A set of SpliceFlags. * ignore. * @return A #gssize containing the size of the data spliced. */ - gssize splice(const Glib::RefPtr& source, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE); + gssize splice(const Glib::RefPtr& source, SpliceFlags flags = SpliceFlags::NONE); _IGNORE(g_output_stream_splice) _WRAP_METHOD(bool flush(const Glib::RefPtr& cancellable{?}), @@ -410,10 +411,10 @@ public: * @param source An InputStream. * @param slot Callback slot to call when the request is satisfied. * @param cancellable Cancellable object. - * @param flags A set of OutputStreamSpliceFlags. + * @param flags A set of SpliceFlags. * @param io_priority The io priority of the request. */ - void splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, SpliceFlags flags = SpliceFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); /** Splices a stream asynchronously. * When the operation is finished @a slot will be called. @@ -425,10 +426,10 @@ public: * * @param source An InputStream. * @param slot Callback slot to call when the request is satisfied. - * @param flags A set of OutputStreamSpliceFlags. + * @param flags A set of SpliceFlags. * @param io_priority The io priority of the request. */ - void splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = Glib::PRIORITY_DEFAULT); + void splice_async(const Glib::RefPtr& source, const SlotAsyncReady& slot, SpliceFlags flags = SpliceFlags::NONE, int io_priority = Glib::PRIORITY_DEFAULT); _IGNORE(g_output_stream_splice_async) @@ -502,13 +503,12 @@ protected: _WRAP_METHOD(bool set_pending(), g_output_stream_set_pending, errthrow, newin "2,50") _WRAP_METHOD(void clear_pending(), g_output_stream_clear_pending, newin "2,50") - //TODO: When we can break ABI, add vfuncs. See https://bugzilla.gnome.org/show_bug.cgi?id=572471 #m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr&', `Glib::wrap($3, true)') #m4 _CONVERSION(`GInputStream*', `const Glib::RefPtr&', `Glib::wrap($3, true)') - //_WRAP_VFUNC(gssize write(const void* buffer, gsize count, const Glib::RefPtr& cancellable), write_fn, errthrow, err_return_value -1) - //_WRAP_VFUNC(gssize splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable{.}, OutputStreamSpliceFlags flags{.}), splice, errthrow, err_return_value -1) - //_WRAP_VFUNC(bool flush(const Glib::RefPtr& cancellable), flush, errthrow) - //_WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) + _WRAP_VFUNC(gssize write(const void* buffer, gsize count, const Glib::RefPtr& cancellable), write_fn, errthrow, err_return_value -1) + _WRAP_VFUNC(gssize splice(const Glib::RefPtr& source, const Glib::RefPtr& cancellable{.}, SpliceFlags flags{.}), splice, errthrow, err_return_value -1) + _WRAP_VFUNC(bool flush(const Glib::RefPtr& cancellable), flush, errthrow) + _WRAP_VFUNC(bool close(const Glib::RefPtr& cancellable), close_fn, errthrow) }; } // namespace Gio diff --git a/gio/src/permission.ccg b/gio/src/permission.ccg index f647cbe..6957457 100644 --- a/gio/src/permission.ccg +++ b/gio/src/permission.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/permission.hg b/gio/src/permission.hg index d702b5b..6405ece 100644 --- a/gio/src/permission.hg +++ b/gio/src/permission.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/pollableinputstream.ccg b/gio/src/pollableinputstream.ccg index 2bd4c95..8e0aacb 100644 --- a/gio/src/pollableinputstream.ccg +++ b/gio/src/pollableinputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/pollableinputstream.hg b/gio/src/pollableinputstream.hg index 7dc7a45..9c5aa21 100644 --- a/gio/src/pollableinputstream.hg +++ b/gio/src/pollableinputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -29,9 +30,12 @@ namespace Gio class Cancellable; -//TODO: Instead derive from InputStream, when we can break ABI, -//because the GPollableInputStream interface requires the GInputStream interface. -//LoadableIcon does a similar thing correctly, for instance. +// GPollableInputStream requires GInputStream (a GObject), but Gio::PollableInputStream +// shall not be derived from Gio::InputStream, like the Gio::Tls[Client|Server]Connection +// interfaces are derived from Gio::TlsConnection. The unusual Gio::TlsConnection class +// hierarchy is possible only because no subclass of Glib::Object implements +// Gio::Tls[Client|Server]Connection. +// See https://bugzilla.gnome.org/show_bug.cgi?id=776537 /** PollableInputStream - Interface for pollable input streams. * PollableInputStream is implemented by InputStreams that can be polled for diff --git a/gio/src/pollableoutputstream.ccg b/gio/src/pollableoutputstream.ccg index 2bd4c95..8e0aacb 100644 --- a/gio/src/pollableoutputstream.ccg +++ b/gio/src/pollableoutputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/pollableoutputstream.hg b/gio/src/pollableoutputstream.hg index 88915c1..881a92d 100644 --- a/gio/src/pollableoutputstream.hg +++ b/gio/src/pollableoutputstream.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -29,9 +30,12 @@ namespace Gio class Cancellable; -//TODO: Instead derive from OutputStream, when we can break ABI, -//because the GPollableOutputStream interface requires the GOutputStream interface. -//LoadableIcon does a similar thing correctly, for instance. +// GPollableOutputStream requires GOutputStream (a GObject), but Gio::PollableOutputStream +// shall not be derived from Gio::OutputStream, like the Gio::Tls[Client|Server]Connection +// interfaces are derived from Gio::TlsConnection. The unusual Gio::TlsConnection class +// hierarchy is possible only because no subclass of Glib::Object implements +// Gio::Tls[Client|Server]Connection. +// See https://bugzilla.gnome.org/show_bug.cgi?id=776537 /** PollableOutputStream - Interface for pollable output streams. * PollableOutputStream is implemented by OutputStreams that can be polled for diff --git a/glib/glibmm/sarray.h b/gio/src/propertyaction.ccg similarity index 54% rename from glib/glibmm/sarray.h rename to gio/src/propertyaction.ccg index dbd0b5c..85da4a8 100644 --- a/glib/glibmm/sarray.h +++ b/gio/src/propertyaction.ccg @@ -1,9 +1,4 @@ -#ifndef _GLIBMM_SARRAY_H -#define _GLIBMM_SARRAY_H - -/* array.h - * - * Copyright (C) 2002 The gtkmm Development Team +/* Copyright (C) 2017 The giomm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,24 +11,21 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library. If not, see . */ -#include - -#ifndef GLIBMM_DISABLE_DEPRECATED -#include -#include +#include -namespace Glib +namespace Gio { -/** - * @deprecated Use a std::vector instead. - */ -using SArray = Glib::ArrayHandle; +PropertyAction::PropertyAction(const Glib::ustring& name, + const Glib::PropertyProxy_Base& property_proxy, bool invert_boolean) +: +_CONSTRUCT("name", name.c_str(), "object", property_proxy.get_object()->gobj(), + "property-name", property_proxy.get_name(), + "invert-boolean", invert_boolean) +{ } -#endif // GLIBMM_DISABLE_DEPRECATED - -#endif // _GLIBMM_SARRAY_H +} // namespace Gio diff --git a/gio/src/propertyaction.hg b/gio/src/propertyaction.hg new file mode 100644 index 0000000..5037146 --- /dev/null +++ b/gio/src/propertyaction.hg @@ -0,0 +1,121 @@ +/* Copyright (C) 2017 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#include +#include +#include + +_DEFS(giomm,gio) +_PINCLUDE(glibmm/private/object_p.h) + +namespace Gio +{ +/** An Action reflecting a Glib::Object property. + * + * A %PropertyAction is a way to get an Action with a state value + * reflecting and controlling the value of a Glib::Object property. + * + * The state of the action will correspond to the value of the property. + * Changing it will change the property (assuming the requested value + * matches the requirements as specified in the GParamSpec, used when the + * property was installed). + * + * Only the most common types are presently supported. Booleans are + * mapped to booleans, strings to strings, signed/unsigned integers to + * int32/uint32 and floats and doubles to doubles. + * + * If the property is an enum then the state will be string-typed and + * conversion will automatically be performed between the enum value and + * "nick" string as per the GEnumValue table. + * + * Flags types are not currently supported. + * + * Properties of object types, boxed types and pointer types are not + * supported and probably never will be. + * + * Properties of Glib::Variant types are not currently supported. + * + * If the property is boolean-valued then the action will have a nullptr + * parameter type, and activating the action (with no parameter) will + * toggle the value of the property. + * + * In all other cases, the parameter type will correspond to the type of + * the property. + * + * The general idea here is to reduce the number of locations where a + * particular piece of state is kept (and therefore has to be synchronised + * between). %PropertyAction does not have a separate state that is kept + * in sync with the property value -- its state is the property value. + * + * For example, it might be useful to create an Action corresponding to + * property_visible_child_name() of a Gtk::Stack so that the current + * page can be switched from a menu. The active radio indication in the + * menu is then directly determined from the active page of the Gtk::Stack. + * + * An anti-example would be binding property_active_id() on a Gtk::ComboBox. + * This is because the state of the combobox itself is probably uninteresting + * and is actually being used to control something else. + * + * Another anti-example would be to bind to property_visible_child_name() + * of a Gtk::Stack if this value is actually stored in Gio::Settings. + * In that case, the real source of the value is + * Gio::Settings. If you want an Action to control a setting stored in + * Gio::Settings, see Gio::Settings::create_action() instead, and possibly + * combine its use with Gio::Settings::bind(). + * + * @newin{2,52} + */ +class PropertyAction : public Glib::Object, public Action +{ + _CLASS_GOBJECT(PropertyAction, GPropertyAction, G_PROPERTY_ACTION, Glib::Object, GObject) + _IMPLEMENTS_INTERFACE(Action) + +protected: + PropertyAction(const Glib::ustring& name, const Glib::PropertyProxy_Base& property_proxy, + bool invert_boolean = false); + +public: + /** Creates an Action corresponding to the value of property @a property_proxy. + * + * The property must be existent and readable and writable (and not construct-only). + * + * This function takes a reference on the property's object and doesn't + * release it until the action is destroyed. + * + * @param name The name of the action to create. + * @param property_proxy The property to bind. + * @param invert_boolean If true, the state of the action will be + * the negation of the property value, provided the property is boolean. + * @return A new %PropertyAction. + * + * @newin{2,52} + */ + _WRAP_CREATE(const Glib::ustring& name, const Glib::PropertyProxy_Base& property_proxy, + bool invert_boolean = false) + + _WRAP_PROPERTY("name", Glib::ustring, newin "2,52") + _WRAP_PROPERTY("parameter-type", Glib::VariantType, newin "2,52") + _WRAP_PROPERTY("enabled", bool, newin "2,52") + _WRAP_PROPERTY("state-type", Glib::VariantType, newin "2,52") + _WRAP_PROPERTY("state", Glib::VariantBase, newin "2,52") + //_WRAP_PROPERTY("object", Glib::ObjectBase) // write-only, construct-only + //_WRAP_PROPERTY("property-name", Glib::ustring) // write-only, construct-only + _WRAP_PROPERTY("invert-boolean", bool, newin "2,52") + + // There are no methods (apart from ctor and create), signals or vfuncs. +}; + +} // namespace Gio diff --git a/gio/src/proxy.ccg b/gio/src/proxy.ccg index bac28f6..f744a77 100644 --- a/gio/src/proxy.ccg +++ b/gio/src/proxy.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/proxy.hg b/gio/src/proxy.hg index 4fb94d2..a7d5808 100644 --- a/gio/src/proxy.hg +++ b/gio/src/proxy.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/proxyaddress.ccg b/gio/src/proxyaddress.ccg index bc4b3d7..ab1fdd7 100644 --- a/gio/src/proxyaddress.ccg +++ b/gio/src/proxyaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 glibmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/proxyaddress.hg b/gio/src/proxyaddress.hg index 5d64bdd..f1bb09c 100644 --- a/gio/src/proxyaddress.hg +++ b/gio/src/proxyaddress.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2009 The glibmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/proxyresolver.ccg b/gio/src/proxyresolver.ccg index 9d0a0a3..f9303e3 100644 --- a/gio/src/proxyresolver.ccg +++ b/gio/src/proxyresolver.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/proxyresolver.hg b/gio/src/proxyresolver.hg index 43c2af4..6bf449e 100644 --- a/gio/src/proxyresolver.hg +++ b/gio/src/proxyresolver.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -49,7 +52,7 @@ public: _WRAP_METHOD(bool is_supported() const, g_proxy_resolver_is_supported) - //TODO: Use std::string instead of ustring (StringArrayHandle uses ustring)?: + //TODO: Use std::string instead of ustring?: #m4 _CONVERSION(`gchar**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(std::vector lookup(const Glib::ustring& uri, const Glib::RefPtr& cancellable), g_proxy_resolver_lookup, errthrow) diff --git a/gio/src/remoteactiongroup.ccg b/gio/src/remoteactiongroup.ccg index a92a9fb..be265e5 100644 --- a/gio/src/remoteactiongroup.ccg +++ b/gio/src/remoteactiongroup.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Gio diff --git a/gio/src/remoteactiongroup.hg b/gio/src/remoteactiongroup.hg index e3b3cd6..74d094e 100644 --- a/gio/src/remoteactiongroup.hg +++ b/gio/src/remoteactiongroup.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -29,12 +28,6 @@ typedef struct _GRemoteActionGroupInterface GRemoteActionGroupInterface; namespace Gio { - -//TODO: Instead derive from ActionGroup, when we can break ABI, -//because the GRemoteActionGroup interface requires the GActionGroup interface. -//LoadableIcon does a similar thing correctly, for instance. - - /** RemoteActionGroup - a ActionGroup that interacts with other processes. * The RemoteActionGroup interface is implemented by ActionGroup instances that * either transmit action invocations to other processes or receive action @@ -66,8 +59,8 @@ public: #m4 _CONVERSION(`GVariant*',`const Glib::VariantBase&',`Glib::wrap($3, true)') - _WRAP_VFUNC(void activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter, const Glib::VariantBase& platform_data), "activate_action_full") - _WRAP_VFUNC(void change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value, const Glib::VariantBase& platform_data), "change_action_state_full") + _WRAP_VFUNC(void activate_action_full(const Glib::ustring& action_name, const Glib::VariantBase& parameter, const Glib::VariantBase& platform_data), "activate_action_full") + _WRAP_VFUNC(void change_action_state_full(const Glib::ustring& action_name, const Glib::VariantBase& value, const Glib::VariantBase& platform_data), "change_action_state_full") }; } // namespace Gio diff --git a/gio/src/resolver.ccg b/gio/src/resolver.ccg index 77b6f5e..7838f19 100644 --- a/gio/src/resolver.ccg +++ b/gio/src/resolver.ccg @@ -11,13 +11,30 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "slot_async.h" +namespace { + +struct SrvTargetListTraits +{ + 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; } + static CppType to_cpp_type(CType item) { return CppType(const_cast(item), true /* take_copy */); } + static void release_c_type(CType item) { g_srv_target_free(const_cast(item)); } +}; + +} // anonymous namespace + namespace Gio { @@ -94,7 +111,7 @@ Resolver::lookup_service_async(const Glib::ustring& service, const Glib::ustring } void -Resolver::lookup_records_async(const Glib::ustring& rrname, ResolverRecordType record_type, +Resolver::lookup_records_async(const Glib::ustring& rrname, RecordType record_type, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable) { auto slot_copy = new SlotAsyncReady(slot); @@ -106,7 +123,7 @@ Resolver::lookup_records_async(const Glib::ustring& rrname, ResolverRecordType r void Resolver::lookup_records_async( - const Glib::ustring& rrname, ResolverRecordType record_type, const SlotAsyncReady& slot) + const Glib::ustring& rrname, RecordType record_type, const SlotAsyncReady& slot) { auto slot_copy = new SlotAsyncReady(slot); diff --git a/gio/src/resolver.hg b/gio/src/resolver.hg index e01be3c..b360f5c 100644 --- a/gio/src/resolver.hg +++ b/gio/src/resolver.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -35,8 +36,6 @@ class VariantContainerBase; namespace Gio { -_WRAP_ENUM(ResolverRecordType, GResolverRecordType) - /** Asynchronous and cancellable DNS resolver * * Resolver provides cancellable synchronous and asynchronous DNS resolution, @@ -58,6 +57,8 @@ class Resolver protected: public: + _WRAP_ENUM(RecordType, GResolverRecordType) + static Glib::RefPtr get_default(); _IGNORE(g_resolver_get_default) static void set_default(const Glib::RefPtr& resolver); @@ -66,8 +67,8 @@ public: // g_resolver_free_addresses is just a C convenience function _IGNORE(g_resolver_free_addresses) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >',`$2($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_by_name, errthrow) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector> lookup_by_name(const Glib::ustring& hostname, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_by_name, errthrow) /** Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls @a slot, which must call * lookup_by_name_finish() to get the result. See lookup_by_name() for more details. @@ -87,7 +88,7 @@ public: void lookup_by_name_async(const Glib::ustring& hostname, const SlotAsyncReady& slot); _IGNORE(g_resolver_lookup_by_name_async) - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > lookup_by_name_finish(const Glib::RefPtr& result), g_resolver_lookup_by_name_finish, errthrow) + _WRAP_METHOD(std::vector> lookup_by_name_finish(const Glib::RefPtr& result), g_resolver_lookup_by_name_finish, errthrow) _WRAP_METHOD(Glib::ustring lookup_by_address(const Glib::RefPtr& address, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_by_address, errthrow) @@ -111,8 +112,8 @@ public: _WRAP_METHOD(Glib::ustring lookup_by_address_finish(const Glib::RefPtr& result), g_resolver_lookup_by_address_finish, errthrow) -#m4 _CONVERSION(`GList*',`ListHandle_SrvTarget',`$2($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(ListHandle_SrvTarget lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_service, errthrow) +#m4 _CONVERSION(`GList*',`std::vector',`Glib::ListHandler::list_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector lookup_service(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_service, errthrow) /** Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback, * which must call lookup_service_finish() to get the final result. See glookup_service() for more details. @@ -136,11 +137,11 @@ public: void lookup_service_async(const Glib::ustring& service, const Glib::ustring& protocol, const Glib::ustring& domain, const SlotAsyncReady& slot); _IGNORE(g_resolver_lookup_service_async) - _WRAP_METHOD(ListHandle_SrvTarget lookup_service_finish(const Glib::RefPtr& result), g_resolver_lookup_service_finish, errthrow) + _WRAP_METHOD(std::vector lookup_service_finish(const Glib::RefPtr& result), g_resolver_lookup_service_finish, errthrow) #m4 _CONVERSION(`GList*',`std::vector',`Glib::ListHandler::list_to_vector($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(std::vector lookup_records(const Glib::ustring& rrname, ResolverRecordType record_type, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_records, errthrow) + _WRAP_METHOD(std::vector lookup_records(const Glib::ustring& rrname, RecordType record_type, const Glib::RefPtr& cancellable{?}), g_resolver_lookup_records, errthrow) /** Begins asynchronously performing a DNS lookup for the given @a rrname, * and eventually calls @a slot, which must call lookup_records_finish() to @@ -153,18 +154,17 @@ public: * @newin{2,36} */ void lookup_records_async(const Glib::ustring& rrname, - ResolverRecordType record_type, const SlotAsyncReady& slot, + RecordType record_type, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable); _IGNORE(g_resolver_lookup_records_async) /// A non-cancellable version of lookup_records_async(). void lookup_records_async(const Glib::ustring& rrname, - ResolverRecordType record_type, const SlotAsyncReady& slot); + RecordType record_type, const SlotAsyncReady& slot); _WRAP_METHOD(std::vector lookup_records_finish(const Glib::RefPtr& result), g_resolver_lookup_records_finish, errthrow) - //TODO: Remove no_default_handler when we can break ABI: - _WRAP_SIGNAL(void reload(), reload, no_default_handler) + _WRAP_SIGNAL(void reload(), reload) }; std::string hostname_to_ascii (const Glib::ustring& hostname); diff --git a/gio/src/resource.ccg b/gio/src/resource.ccg index 78479de..7a579b4 100644 --- a/gio/src/resource.ccg +++ b/gio/src/resource.ccg @@ -11,17 +11,18 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include namespace Gio { -// Hand-coded because we want ResourceFlags& instead of guint32&. +// Hand-coded because we want Flags& instead of guint32&. void -Resource::get_info(const std::string& path, gsize& size, ResourceFlags& flags, - ResourceLookupFlags lookup_flags) const +Resource::get_info(const std::string& path, gsize& size, Flags& flags, + LookupFlags lookup_flags) const { guint32 file_flags = 0; GError* gerror = nullptr; @@ -31,11 +32,11 @@ Resource::get_info(const std::string& path, gsize& size, ResourceFlags& flags, (GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror); if (gerror) ::Glib::Error::throw_exception(gerror); - flags = static_cast(file_flags); + flags = static_cast(file_flags); } void -Resource::get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags) const +Resource::get_file_exists(const std::string& path, LookupFlags lookup_flags) const { GError* gerror = nullptr; g_resource_get_info(const_cast(gobj()), path.c_str(), @@ -45,17 +46,17 @@ Resource::get_file_exists(const std::string& path, ResourceLookupFlags lookup_fl } bool -Resource::get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags) const +Resource::get_file_exists_nothrow(const std::string& path, LookupFlags lookup_flags) const { return g_resource_get_info(const_cast(gobj()), path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr); } -// Hand-coded because we want ResourceFlags& instead of guint32&. +// Hand-coded because we want Flags& instead of guint32&. // static void Resource::get_info_global( - const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags) + const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags) { guint32 file_flags = 0; GError* gerror = nullptr; @@ -65,12 +66,12 @@ Resource::get_info_global( path.c_str(), (GResourceLookupFlags)lookup_flags, &size, &file_flags, &gerror); if (gerror) ::Glib::Error::throw_exception(gerror); - flags = static_cast(file_flags); + flags = static_cast(file_flags); } // static void -Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags) +Resource::get_file_exists_global(const std::string& path, LookupFlags lookup_flags) { GError* gerror = nullptr; g_resources_get_info(path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, &gerror); @@ -80,7 +81,7 @@ Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lo // static bool -Resource::get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags) +Resource::get_file_exists_global_nothrow(const std::string& path, LookupFlags lookup_flags) { return g_resources_get_info( path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr); diff --git a/gio/src/resource.hg b/gio/src/resource.hg index be41fac..96f3b51 100644 --- a/gio/src/resource.hg +++ b/gio/src/resource.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -34,9 +35,6 @@ namespace Gio */ _WRAP_GERROR(ResourceError, GResourceError, G_RESOURCE_ERROR, NO_GTYPE, newin "2,34") -_WRAP_ENUM(ResourceFlags, GResourceFlags, newin "2,44") -_WRAP_ENUM(ResourceLookupFlags, GResourceLookupFlags, newin "2,44") - /** %Resource framework. * * Applications and libraries often contain binary or textual data that is @@ -133,13 +131,16 @@ class Resource final _IGNORE(g_resource_ref, g_resource_unref) public: + _WRAP_ENUM(Flags, GResourceFlags, newin "2,44") + _WRAP_ENUM(LookupFlags, GResourceLookupFlags, newin "2,44") + _WRAP_METHOD(static Glib::RefPtr create_from_data(const Glib::RefPtr& data), g_resource_new_from_data, errthrow, newin "2,44") _WRAP_METHOD(static Glib::RefPtr create_from_file(const std::string& filename), g_resource_load, errthrow, newin "2,44") - _WRAP_METHOD(Glib::RefPtr open_stream(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_open_stream, errthrow, newin "2,44") - _WRAP_METHOD(Glib::RefPtr lookup_data(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_lookup_data, errthrow, newin "2,44") + _WRAP_METHOD(Glib::RefPtr open_stream(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const, g_resource_open_stream, errthrow, newin "2,44") + _WRAP_METHOD(Glib::RefPtr lookup_data(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const, g_resource_lookup_data, errthrow, newin "2,44") #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(std::vector enumerate_children(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const, g_resource_enumerate_children, errthrow, newin "2,44") + _WRAP_METHOD(std::vector enumerate_children(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const, g_resource_enumerate_children, errthrow, newin "2,44") /** Looks for a file at the specified @a path in the resource and * if found returns information about it. @@ -151,10 +152,10 @@ public: * @param path A pathname inside the resource. * @param[out] size A location to place the length of the contents of the file. * @param[out] flags A location to place the flags about the file. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @throw Gio::ResourceError if the file was not found. */ - void get_info(const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const; + void get_info(const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags = LookupFlags::NONE) const; _IGNORE(g_resource_get_info) /** Looks for a file at the specified @a path in the resource. @@ -164,10 +165,10 @@ public: * @newin{2,44} * * @param path A pathname inside the resource. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @throw Gio::ResourceError if the file was not found. */ - void get_file_exists(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const; + void get_file_exists(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const; /** Looks for a file at the specified @a path in the resource. * @@ -177,17 +178,17 @@ public: * @newin{2,44} * * @param path A pathname inside the resource. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @return true if the file was found, false if there were errors. */ - bool get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE) const; + bool get_file_exists_nothrow(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE) const; // 'register' is a keyword. Can't be the name of a method. _WRAP_METHOD(void register_global(), g_resources_register, newin "2,44") _WRAP_METHOD(void unregister_global(), g_resources_unregister, newin "2,44") - _WRAP_METHOD(static Glib::RefPtr open_stream_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_open_stream, errthrow, newin "2,44") - _WRAP_METHOD(static Glib::RefPtr lookup_data_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_lookup_data, errthrow, newin "2,44") - _WRAP_METHOD(static std::vector enumerate_children_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE), g_resources_enumerate_children, errthrow, newin "2,44") + _WRAP_METHOD(static Glib::RefPtr open_stream_global(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE), g_resources_open_stream, errthrow, newin "2,44") + _WRAP_METHOD(static Glib::RefPtr lookup_data_global(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE), g_resources_lookup_data, errthrow, newin "2,44") + _WRAP_METHOD(static std::vector enumerate_children_global(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE), g_resources_enumerate_children, errthrow, newin "2,44") /** Looks for a file at the specified @a path in the set of * globally registered resources and if found returns information about it. @@ -199,10 +200,10 @@ public: * @param path A pathname inside the resource. * @param[out] size A location to place the length of the contents of the file. * @param[out] flags A location to place the flags about the file. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @throw Gio::ResourceError if the file was not found. */ - static void get_info_global(const std::string& path, gsize& size, ResourceFlags& flags, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE); + static void get_info_global(const std::string& path, gsize& size, Flags& flags, LookupFlags lookup_flags = LookupFlags::NONE); _IGNORE(g_resources_get_info) /** Looks for a file at the specified @a path in the set of @@ -213,10 +214,10 @@ public: * @newin{2,44} * * @param path A pathname inside the resource. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @throw Gio::ResourceError if the file was not found. */ - static void get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE); + static void get_file_exists_global(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE); /** Looks for a file at the specified @a path in the set of * globally registered resources. @@ -227,10 +228,10 @@ public: * @newin{2,44} * * @param path A pathname inside the resource. - * @param lookup_flags A ResourceLookupFlags. + * @param lookup_flags A LookupFlags. * @return true if the file was found, false if there were errors. */ - static bool get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags = RESOURCE_LOOKUP_FLAGS_NONE); + static bool get_file_exists_global_nothrow(const std::string& path, LookupFlags lookup_flags = LookupFlags::NONE); _IGNORE(g_static_resource_init, g_static_resource_fini, g_static_resource_get_resource)dnl//Used only by the glib-compile-resources command }; diff --git a/gio/src/seekable.ccg b/gio/src/seekable.ccg index 937ee25..43f4afe 100644 --- a/gio/src/seekable.ccg +++ b/gio/src/seekable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/seekable.hg b/gio/src/seekable.hg index ec3a635..79c0d07 100644 --- a/gio/src/seekable.hg +++ b/gio/src/seekable.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/settings.ccg b/gio/src/settings.ccg index 05595ac..183dcf8 100644 --- a/gio/src/settings.ccg +++ b/gio/src/settings.ccg @@ -11,12 +11,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include +#include namespace Gio { @@ -53,7 +55,7 @@ Settings::get_default_value(const Glib::ustring& key, Glib::VariantBase& value) } void Settings::bind( - const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, SettingsBindFlags flags) + const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, BindFlags flags) { bind(key, property_proxy.get_object(), property_proxy.get_name(), flags); } @@ -65,14 +67,4 @@ Settings::bind_writable( bind_writable(key, property_proxy.get_object(), property_proxy.get_name(), inverted); } -_DEPRECATE_IFDEF_START -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -std::vector -Settings::list_schemas() -{ - return Glib::ArrayHandler::array_to_vector( - g_settings_list_schemas(), Glib::OWNERSHIP_NONE); -} -G_GNUC_END_IGNORE_DEPRECATIONS -_DEPRECATE_IFDEF_END } diff --git a/gio/src/settings.hg b/gio/src/settings.hg index 029eb6a..a55a694 100644 --- a/gio/src/settings.hg +++ b/gio/src/settings.hg @@ -11,12 +11,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) -#include #include #include #include @@ -26,8 +26,7 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { - - _WRAP_ENUM(SettingsBindFlags, GSettingsBindFlags) +class SettingsSchema; /** A high-level API for application settings * @@ -40,17 +39,22 @@ class Settings : public Glib::Object { _CLASS_GOBJECT(Settings, GSettings, G_SETTINGS, Glib::Object, GObject) +public: + _WRAP_ENUM(BindFlags, GSettingsBindFlags) + protected: _WRAP_CTOR(Settings(const Glib::ustring& schema_id), g_settings_new) _WRAP_CTOR(Settings(const Glib::ustring& schema_id, const Glib::ustring& path), g_settings_new_with_path) //TODO: Requires SettingsBackend: _WRAP_CTOR(Settings(const Glib::ustring& schema_id, const Glib::RefPtr& backend), g_settings_new_with_backend) //TODO: Requires SettingsBackend: _WRAP_CTOR(Settings(const Glib::ustring& schema_id, const Glib::RefPtr& backend, const Glib::ustring& path), g_settings_new_with_backend_and_path) + //TODO: Requires SettingsBackend: _WRAP_CTOR(Settings(const Glib::RefPtr& settings_schema, const Glib::RefPtr& backend, const Glib::ustring& path), g_settings_new_full) public: _WRAP_CREATE(const Glib::ustring& schema_id) _WRAP_CREATE(const Glib::ustring& schema_id, const Glib::ustring& path) //TODO: Requires SettingsBackend: _WRAP_CREATE(const Glib::ustring& schema_id, const Glib::RefPtr& backend) //TODO: Requires SettingsBackend: _WRAP_CREATE(const Glib::ustring& schema_id, const Glib::RefPtr& backend, const Glib::ustring& path) + //TODO: Requires SettingsBackend: _WRAP_CREATE(const Glib::RefPtr& settings_schema, const Glib::RefPtr& backend, const Glib::ustring& path) //TODO: Rename these to get/set_*_value_variant() and add templated get/set_*_value() methods as elsewhere? _WRAP_METHOD(bool set_value(const Glib::ustring& key, const Glib::VariantBase& value), g_settings_set_value) @@ -135,7 +139,6 @@ public: _WRAP_METHOD(gint64 get_int64(const Glib::ustring& key) const, g_settings_get_int64) _WRAP_METHOD(void set_int64(const Glib::ustring& key, gint64 value), g_settings_set_int64) _WRAP_METHOD(guint get_uint(const Glib::ustring& key) const, g_settings_get_uint) - _WRAP_METHOD(void set_uiint(const Glib::ustring& key, guint value), g_settings_set_uint, deprecated "Use set_uint() instead.") _WRAP_METHOD(void set_uint(const Glib::ustring& key, guint value), g_settings_set_uint) _WRAP_METHOD(guint64 get_uint64(const Glib::ustring& key) const, g_settings_get_uint64) _WRAP_METHOD(void set_uint64(const Glib::ustring& key, guint64 value), g_settings_set_uint64) @@ -146,18 +149,14 @@ public: _WRAP_METHOD(double get_double(const Glib::ustring& key) const, g_settings_get_double) _WRAP_METHOD(void set_double(const Glib::ustring& key, double value), g_settings_set_double) - #m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle get_string_array(const Glib::ustring& key) const, g_settings_get_strv) + #m4 _CONVERSION(`gchar**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector get_string_array(const Glib::ustring& key) const, g_settings_get_strv) - _WRAP_METHOD(bool set_string_array(const Glib::ustring& key, const Glib::StringArrayHandle& value), g_settings_set_strv) + _WRAP_METHOD(bool set_string_array(const Glib::ustring& key, const std::vector& value), g_settings_set_strv) _WRAP_METHOD(int get_enum(const Glib::ustring& key) const, g_settings_get_enum) - _WRAP_METHOD(bool get_enum(const Glib::ustring& key, int value), g_settings_set_enum, - deprecated "This method is misnamed. Use set_enum() instead.") _WRAP_METHOD(bool set_enum(const Glib::ustring& key, int value), g_settings_set_enum) _WRAP_METHOD(guint get_flags(const Glib::ustring& key) const, g_settings_get_flags) - _WRAP_METHOD(bool get_flags(const Glib::ustring& key, guint value), g_settings_set_flags, - deprecated "This method is misnamed. Use set_flags() instead.") _WRAP_METHOD(bool set_flags(const Glib::ustring& key, guint value), g_settings_set_flags) // Ignore varargs functions. @@ -174,27 +173,17 @@ public: _WRAP_METHOD(void reset(const Glib::ustring& key), g_settings_reset) -_DEPRECATE_IFDEF_START -//We must hand-code this because gmmproc is confused by the static keyword with the vector. -//#m4 _CONVERSION(`const gchar*const*',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_NONE)') - _WRAP_METHOD_DOCS_ONLY(g_settings_list_schemas) - static std::vector list_schemas(); - _IGNORE(g_settings_list_schemas) -_DEPRECATE_IFDEF_END - #m4 _CONVERSION(`gchar**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') _WRAP_METHOD(std::vector list_children() const, g_settings_list_children) - _WRAP_METHOD(std::vector list_keys() const, g_settings_list_keys, deprecated "Use SettingsSchema::list_kes().") + _IGNORE(g_settings_list_keys) _IGNORE(g_settings_get_range, g_settings_list_relocatable_schemas) // deprecated - _WRAP_METHOD(bool range_check(const Glib::ustring& key, const Glib::VariantBase& value) const, g_settings_range_check, - deprecated "Use g_settings_schema_key_range_check() instead.") - //TODO: Wrap GSettingsSchema + _IGNORE(g_settings_range_check) #m4 _CONVERSION(`Glib::ObjectBase*',`gpointer',(gpointer)$3->gobj()) - _WRAP_METHOD(void bind(const Glib::ustring& key, Glib::ObjectBase* object, const Glib::ustring& property, SettingsBindFlags flags=SETTINGS_BIND_DEFAULT), g_settings_bind) - void bind(const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, SettingsBindFlags flags=SETTINGS_BIND_DEFAULT); + _WRAP_METHOD(void bind(const Glib::ustring& key, Glib::ObjectBase* object, const Glib::ustring& property, BindFlags flags = BindFlags::DEFAULT), g_settings_bind) + void bind(const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, BindFlags flags = BindFlags::DEFAULT); // TODO: implement bind_with_mapping _WRAP_METHOD(void bind_writable(const Glib::ustring& key, Glib::ObjectBase* object, const Glib::ustring& property, bool inverted=false), g_settings_bind_writable) void bind_writable(const Glib::ustring& key, const Glib::PropertyProxy_Base& property_proxy, bool inverted=false); @@ -207,19 +196,18 @@ _DEPRECATE_IFDEF_END _WRAP_PROPERTY("delay-apply", bool) _WRAP_PROPERTY("has-unapplied", bool) _WRAP_PROPERTY("path", std::string) - _WRAP_PROPERTY("schema", Glib::ustring, deprecated "Use the 'schema-id' property instead. In a future version, this property may instead refer to a SettingsSchema.") + _IGNORE_PROPERTY("schema") _WRAP_PROPERTY("schema-id", Glib::ustring) - //TODO: _WRAP_PROPERTY("settings-schema", Glib::RefPtr) + _WRAP_PROPERTY("settings-schema", Glib::RefPtr, newin "2,52") - //TODO?: _WRAP_SIGNAL(bool change_event(const Glib::ArrayHandle& keys, int n_keys), "change-event") + //TODO?: _WRAP_SIGNAL(bool change_event(const std::vector& keys, int n_keys), "change-event") - //TODO: Remove two_signal_methods when we can break ABI. #m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING) - _WRAP_SIGNAL(void changed(const Glib::ustring& key), "changed", detail_name key, two_signal_methods) + _WRAP_SIGNAL(void changed(const Glib::ustring& key), "changed", detail_name key) _WRAP_SIGNAL(bool writable_change_event(GQuark key), "writable-change-event") - _WRAP_SIGNAL(void writable_changed(const Glib::ustring& key), writable_changed, detail_name key, two_signal_methods) + _WRAP_SIGNAL(void writable_changed(const Glib::ustring& key), writable_changed) }; } // namespace Gio diff --git a/gio/src/settingsschema.ccg b/gio/src/settingsschema.ccg index 1c73326..27d1a1e 100644 --- a/gio/src/settingsschema.ccg +++ b/gio/src/settingsschema.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/settingsschema.hg b/gio/src/settingsschema.hg index 843f96d..c5f6c95 100644 --- a/gio/src/settingsschema.hg +++ b/gio/src/settingsschema.hg @@ -11,13 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) #include -#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) diff --git a/gio/src/settingsschemakey.ccg b/gio/src/settingsschemakey.ccg index 1c73326..27d1a1e 100644 --- a/gio/src/settingsschemakey.ccg +++ b/gio/src/settingsschemakey.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/settingsschemakey.hg b/gio/src/settingsschemakey.hg index 4734ca0..cf5f0da 100644 --- a/gio/src/settingsschemakey.hg +++ b/gio/src/settingsschemakey.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) diff --git a/gio/src/settingsschemasource.ccg b/gio/src/settingsschemasource.ccg index 1c73326..27d1a1e 100644 --- a/gio/src/settingsschemasource.ccg +++ b/gio/src/settingsschemasource.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/settingsschemasource.hg b/gio/src/settingsschemasource.hg index 5975c38..f330945 100644 --- a/gio/src/settingsschemasource.hg +++ b/gio/src/settingsschemasource.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) diff --git a/gio/src/simpleaction.ccg b/gio/src/simpleaction.ccg index d4fb0e1..42b236e 100644 --- a/gio/src/simpleaction.ccg +++ b/gio/src/simpleaction.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/simpleaction.hg b/gio/src/simpleaction.hg index 5874112..fe7e669 100644 --- a/gio/src/simpleaction.hg +++ b/gio/src/simpleaction.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/simpleactiongroup.ccg b/gio/src/simpleactiongroup.ccg index e33de0b..3a80251 100644 --- a/gio/src/simpleactiongroup.ccg +++ b/gio/src/simpleactiongroup.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/simpleactiongroup.hg b/gio/src/simpleactiongroup.hg index 770b029..36dd91b 100644 --- a/gio/src/simpleactiongroup.hg +++ b/gio/src/simpleactiongroup.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -48,11 +49,7 @@ public: _WRAP_METHOD_DOCS_ONLY(g_simple_action_group_new) _WRAP_CREATE() - _WRAP_METHOD(Glib::RefPtr lookup(const Glib::ustring& action_name), g_simple_action_group_lookup, refreturn, deprecated "Use ActionMap::lookup_action() instead") - _WRAP_METHOD(Glib::RefPtr lookup(const Glib::ustring& action_name) const, g_simple_action_group_lookup, refreturn, constversion, deprecated "Use ActionMap::lookup_action() instead") - - _WRAP_METHOD(void insert(const Glib::RefPtr& action), g_simple_action_group_insert, deprecated "Use ActionMap::add_action() instead") - _WRAP_METHOD(void remove(const Glib::ustring& action_name), g_simple_action_group_remove, deprecated "Use ActionMap::remove_action() instead") + _IGNORE(g_simple_action_group_lookup, g_simple_action_group_insert, g_simple_action_group_remove) _IGNORE(g_simple_action_group_add_entries) // deprecated }; diff --git a/gio/src/simplepermission.ccg b/gio/src/simplepermission.ccg index cb85474..e627cda 100644 --- a/gio/src/simplepermission.ccg +++ b/gio/src/simplepermission.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/simplepermission.hg b/gio/src/simplepermission.hg index cce3b6b..c6a2ea3 100644 --- a/gio/src/simplepermission.hg +++ b/gio/src/simplepermission.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socket.ccg b/gio/src/socket.ccg index 767882e..4e4910c 100644 --- a/gio/src/socket.ccg +++ b/gio/src/socket.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,10 +23,13 @@ #include #include "slot_async.h" +using Type = Gio::Socket::Type; +using Protocol = Gio::Socket::Protocol; + namespace Gio { -Socket::Socket(SocketFamily family, SocketType type, SocketProtocol protocol, +Socket::Socket(SocketFamily family, Type type, Protocol protocol, const Glib::RefPtr& cancellable) : _CONSTRUCT("family", int(family), "type", int(type), "protocol", int(protocol)) { @@ -37,17 +43,17 @@ Socket::Socket(int fd, const Glib::RefPtr& cancellable) : _CONSTRUC // static Glib::RefPtr -Socket::create(SocketFamily family, SocketType type, SocketProtocol protocol, +Socket::create(SocketFamily family, Type type, Protocol protocol, const Glib::RefPtr& cancellable) { - return Glib::RefPtr(new Socket(family, type, protocol, cancellable)); + return Glib::make_refptr_for_instance(new Socket(family, type, protocol, cancellable)); } // static Glib::RefPtr Socket::create_from_fd(int fd, const Glib::RefPtr& cancellable) { - return Glib::RefPtr(new Socket(fd, cancellable)); + return Glib::make_refptr_for_instance(new Socket(fd, cancellable)); } gssize @@ -111,10 +117,7 @@ Socket::send_with_blocking( Glib::RefPtr Socket::create_source(Glib::IOCondition condition, const Glib::RefPtr& cancellable) { - // The corresponding unreference() takes place in the dtor - // of the Glib::RefPtr object below. - reference(); - return SocketSource::create(Glib::RefPtr(this), condition, cancellable); + return SocketSource::create(gobj(), condition, cancellable); } } // namespace Gio diff --git a/gio/src/socket.hg b/gio/src/socket.hg index b3b0e29..55a3ce9 100644 --- a/gio/src/socket.hg +++ b/gio/src/socket.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -30,9 +31,6 @@ namespace Gio { class SocketSource; -_WRAP_ENUM(SocketType, GSocketType) -_WRAP_ENUM(SocketProtocol, GSocketProtocol) -_WRAP_ENUM(SocketMsgFlags, GSocketMsgFlags) /** @defgroup NetworkIO Portable Network I/O Functionality */ @@ -90,8 +88,13 @@ class Socket : public Glib::Object, public Initable _CLASS_GOBJECT(Socket, GSocket, G_SOCKET, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) +public: + _WRAP_ENUM(Type, GSocketType) + _WRAP_ENUM(Protocol, GSocketProtocol) + _WRAP_ENUM(MsgFlags, GSocketMsgFlags) + protected: - Socket(SocketFamily family, SocketType type, SocketProtocol protocol, + Socket(SocketFamily family, Type type, Protocol protocol, const Glib::RefPtr& cancellable); Socket(int fd, const Glib::RefPtr& cancellable); @@ -103,7 +106,7 @@ public: * @throw Glib::Error */ static Glib::RefPtr - create(SocketFamily family, SocketType type, SocketProtocol protocol, + create(SocketFamily family, Type type, Protocol protocol, const Glib::RefPtr& cancellable = Glib::RefPtr()); // gmmproc thinks that this function should be wrapped in this class because @@ -277,8 +280,8 @@ public: _WRAP_METHOD(int get_fd() const, g_socket_get_fd) _WRAP_METHOD(Glib::RefPtr get_local_address() const, g_socket_get_local_address, errthrow) _WRAP_METHOD(Glib::RefPtr get_remote_address() const, g_socket_get_remote_address, errthrow) - _WRAP_METHOD(SocketProtocol get_protocol() const, g_socket_get_protocol) - _WRAP_METHOD(SocketType get_socket_type() const, g_socket_get_socket_type) + _WRAP_METHOD(Protocol get_protocol() const, g_socket_get_protocol) + _WRAP_METHOD(Type get_socket_type() const, g_socket_get_socket_type) _WRAP_METHOD(bool speaks_ipv4() const, g_socket_speaks_ipv4) _WRAP_METHOD(Glib::RefPtr get_credentials(), g_socket_get_credentials, errthrow) @@ -319,9 +322,9 @@ public: _WRAP_PROPERTY("local-address", Glib::RefPtr) _WRAP_PROPERTY("remote-address", Glib::RefPtr) _WRAP_PROPERTY("timeout", guint) - _WRAP_PROPERTY("protocol", SocketProtocol) + _WRAP_PROPERTY("protocol", Protocol) _WRAP_PROPERTY("broadcast", bool) - _WRAP_PROPERTY("type", SocketType) + _WRAP_PROPERTY("type", Type) _WRAP_PROPERTY("ttl", guint) _WRAP_PROPERTY("multicast-loopback", bool) _WRAP_PROPERTY("multicast-ttl", guint) diff --git a/gio/src/socketaddress.ccg b/gio/src/socketaddress.ccg index f5d23a7..eb8adb6 100644 --- a/gio/src/socketaddress.ccg +++ b/gio/src/socketaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketaddress.hg b/gio/src/socketaddress.hg index 713986b..ed7cf8f 100644 --- a/gio/src/socketaddress.hg +++ b/gio/src/socketaddress.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketaddressenumerator.ccg b/gio/src/socketaddressenumerator.ccg index 9e01483..405773f 100644 --- a/gio/src/socketaddressenumerator.ccg +++ b/gio/src/socketaddressenumerator.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2009 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketaddressenumerator.hg b/gio/src/socketaddressenumerator.hg index 28cf187..01a137a 100644 --- a/gio/src/socketaddressenumerator.hg +++ b/gio/src/socketaddressenumerator.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketclient.ccg b/gio/src/socketclient.ccg index 8339f12..c3ec6f0 100644 --- a/gio/src/socketclient.ccg +++ b/gio/src/socketclient.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketclient.hg b/gio/src/socketclient.hg index 4b896a1..26f0bd6 100644 --- a/gio/src/socketclient.hg +++ b/gio/src/socketclient.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -13,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -62,10 +61,10 @@ public: _WRAP_CREATE() _WRAP_METHOD(SocketFamily get_family() const, g_socket_client_get_family) _WRAP_METHOD(void set_family(SocketFamily family), g_socket_client_set_family) - _WRAP_METHOD(SocketType get_socket_type() const, g_socket_client_get_socket_type) - _WRAP_METHOD(void set_socket_type(SocketType type), g_socket_client_set_socket_type) - _WRAP_METHOD(SocketProtocol get_protocol() const, g_socket_client_get_protocol) - _WRAP_METHOD(void set_protocol(SocketProtocol protocol), g_socket_client_set_protocol) + _WRAP_METHOD(Socket::Type get_socket_type() const, g_socket_client_get_socket_type) + _WRAP_METHOD(void set_socket_type(Socket::Type type), g_socket_client_set_socket_type) + _WRAP_METHOD(Socket::Protocol get_protocol() const, g_socket_client_get_protocol) + _WRAP_METHOD(void set_protocol(Socket::Protocol protocol), g_socket_client_set_protocol) _WRAP_METHOD(Glib::RefPtr get_local_address(), g_socket_client_get_local_address) _WRAP_METHOD(Glib::RefPtr get_local_address() const, g_socket_client_get_local_address, constversion) _WRAP_METHOD(void set_local_address(const Glib::RefPtr& address), g_socket_client_set_local_address) @@ -160,8 +159,8 @@ public: _WRAP_PROPERTY("family", SocketFamily) _WRAP_PROPERTY("local-address", Glib::RefPtr) - _WRAP_PROPERTY("protocol", SocketProtocol) - _WRAP_PROPERTY("type", SocketType) + _WRAP_PROPERTY("protocol", Socket::Protocol) + _WRAP_PROPERTY("type", Socket::Type) _WRAP_PROPERTY("timeout", guint) _WRAP_PROPERTY("enable-proxy", bool) _WRAP_PROPERTY("tls", bool) @@ -170,7 +169,7 @@ public: #m4 _CONVERSION(`GSocketConnectable*',`const Glib::RefPtr&',`Glib::wrap($3)') #m4 _CONVERSION(`GIOStream*',`const Glib::RefPtr&',`Glib::wrap($3)') - _WRAP_SIGNAL(void event(SocketClientEvent event, const Glib::RefPtr& connectable, const Glib::RefPtr& connection), event, no_default_handler) + _WRAP_SIGNAL(void event(SocketClientEvent event, const Glib::RefPtr& connectable, const Glib::RefPtr& connection), event) }; } // namespace Gio diff --git a/gio/src/socketconnectable.ccg b/gio/src/socketconnectable.ccg index a4150d7..0f94c18 100644 --- a/gio/src/socketconnectable.ccg +++ b/gio/src/socketconnectable.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2009 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketconnectable.hg b/gio/src/socketconnectable.hg index 266a8a6..812df3d 100644 --- a/gio/src/socketconnectable.hg +++ b/gio/src/socketconnectable.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketconnection.ccg b/gio/src/socketconnection.ccg index 13c2569..4c71d8f 100644 --- a/gio/src/socketconnection.ccg +++ b/gio/src/socketconnection.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketconnection.hg b/gio/src/socketconnection.hg index 1c9a738..5ac0b2d 100644 --- a/gio/src/socketconnection.hg +++ b/gio/src/socketconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketcontrolmessage.ccg b/gio/src/socketcontrolmessage.ccg index b921f77..e7119a3 100644 --- a/gio/src/socketcontrolmessage.ccg +++ b/gio/src/socketcontrolmessage.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketcontrolmessage.hg b/gio/src/socketcontrolmessage.hg index 96e5f36..834393b 100644 --- a/gio/src/socketcontrolmessage.hg +++ b/gio/src/socketcontrolmessage.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketlistener.ccg b/gio/src/socketlistener.ccg index c48dbb8..4185651 100644 --- a/gio/src/socketlistener.ccg +++ b/gio/src/socketlistener.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -33,8 +36,8 @@ SocketListener::add_socket(const Glib::RefPtr& socket) } bool -SocketListener::add_address(const Glib::RefPtr& address, SocketType type, - SocketProtocol protocol, const Glib::RefPtr& source_object, +SocketListener::add_address(const Glib::RefPtr& address, Socket::Type type, + Socket::Protocol protocol, const Glib::RefPtr& source_object, Glib::RefPtr& effective_address) { GError* gerror = nullptr; @@ -52,8 +55,8 @@ SocketListener::add_address(const Glib::RefPtr& address, SocketTy } bool -SocketListener::add_address(const Glib::RefPtr& address, SocketType type, - SocketProtocol protocol, Glib::RefPtr& effective_address) +SocketListener::add_address(const Glib::RefPtr& address, Socket::Type type, + Socket::Protocol protocol, Glib::RefPtr& effective_address) { GError* gerror = nullptr; GSocketAddress* retaddr = nullptr; diff --git a/gio/src/socketlistener.hg b/gio/src/socketlistener.hg index 4520635..d463e44 100644 --- a/gio/src/socketlistener.hg +++ b/gio/src/socketlistener.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -63,11 +66,11 @@ public: bool add_socket(const Glib::RefPtr& socket); _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_address) -bool add_address(const Glib::RefPtr& address, SocketType type, SocketProtocol protocol, const Glib::RefPtr& source_object, Glib::RefPtr& effective_address); +bool add_address(const Glib::RefPtr& address, Socket::Type type, Socket::Protocol protocol, const Glib::RefPtr& source_object, Glib::RefPtr& effective_address); _IGNORE(g_socket_listener_add_address) _WRAP_METHOD_DOCS_ONLY(g_socket_listener_add_address) - bool add_address(const Glib::RefPtr& address, SocketType type, SocketProtocol protocol, Glib::RefPtr& effective_address); + bool add_address(const Glib::RefPtr& address, Socket::Type type, Socket::Protocol protocol, Glib::RefPtr& effective_address); _WRAP_METHOD(bool add_inet_port(guint16 port, const Glib::RefPtr& source_object), g_socket_listener_add_inet_port, errthrow) diff --git a/gio/src/socketservice.ccg b/gio/src/socketservice.ccg index 990512f..58f3251 100644 --- a/gio/src/socketservice.ccg +++ b/gio/src/socketservice.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/socketservice.hg b/gio/src/socketservice.hg index a21eb18..cc025ca 100644 --- a/gio/src/socketservice.hg +++ b/gio/src/socketservice.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/srvtarget.ccg b/gio/src/srvtarget.ccg index 6dfac73..931000c 100644 --- a/gio/src/srvtarget.ccg +++ b/gio/src/srvtarget.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2008 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/srvtarget.hg b/gio/src/srvtarget.hg index 5ca8f60..0625461 100644 --- a/gio/src/srvtarget.hg +++ b/gio/src/srvtarget.hg @@ -11,14 +11,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include - -// unfortunately we need to include the C header for the type traits -// implementation -#include +#include _DEFS(giomm,gio) @@ -58,23 +55,6 @@ public: }; -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -struct SrvTargetListTraits -{ - 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; } - static CppType to_cpp_type(CType item) { return CppType(const_cast(item), true /* take_copy */); } - static void release_c_type(CType item) { g_srv_target_free(const_cast(item)); } -}; - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -using ListHandle_SrvTarget = Glib::ListHandle; } // namespace Gio diff --git a/gio/src/tcpconnection.ccg b/gio/src/tcpconnection.ccg index 5a8b3d2..6e07769 100644 --- a/gio/src/tcpconnection.ccg +++ b/gio/src/tcpconnection.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tcpconnection.hg b/gio/src/tcpconnection.hg index 6352c17..edaa3f7 100644 --- a/gio/src/tcpconnection.hg +++ b/gio/src/tcpconnection.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tcpwrapperconnection.ccg b/gio/src/tcpwrapperconnection.ccg index 8571d6d..58b9f17 100644 --- a/gio/src/tcpwrapperconnection.ccg +++ b/gio/src/tcpwrapperconnection.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tcpwrapperconnection.hg b/gio/src/tcpwrapperconnection.hg index 420d17a..a469007 100644 --- a/gio/src/tcpwrapperconnection.hg +++ b/gio/src/tcpwrapperconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/themedicon.ccg b/gio/src/themedicon.ccg index 48b7686..e9a7f30 100644 --- a/gio/src/themedicon.ccg +++ b/gio/src/themedicon.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/themedicon.hg b/gio/src/themedicon.hg index ab0bed1..f077f48 100644 --- a/gio/src/themedicon.hg +++ b/gio/src/themedicon.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -77,8 +78,8 @@ public: _WRAP_METHOD(void prepend_name(const std::string& iconname), g_themed_icon_prepend_name) _WRAP_METHOD(void append_name(const std::string& iconname), g_themed_icon_append_name) - #m4 _CONVERSION(`const gchar* const*',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle get_names() const, g_themed_icon_get_names) + #m4 _CONVERSION(`const gchar* const*',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector get_names() const, g_themed_icon_get_names) //There are no signals. diff --git a/gio/src/threadedsocketservice.ccg b/gio/src/threadedsocketservice.ccg index 990512f..58f3251 100644 --- a/gio/src/threadedsocketservice.ccg +++ b/gio/src/threadedsocketservice.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/threadedsocketservice.hg b/gio/src/threadedsocketservice.hg index ef23974..d14a545 100644 --- a/gio/src/threadedsocketservice.hg +++ b/gio/src/threadedsocketservice.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlscertificate.ccg b/gio/src/tlscertificate.ccg index 57fdd6a..2df281e 100644 --- a/gio/src/tlscertificate.ccg +++ b/gio/src/tlscertificate.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,7 +25,7 @@ namespace Gio Glib::RefPtr TlsCertificate::create_from_pem(const std::string& data, gssize length) { - return Glib::RefPtr(new TlsCertificate(data, length)); + return Glib::make_refptr_for_instance(new TlsCertificate(data, length)); } } // namesapce Gio diff --git a/gio/src/tlscertificate.hg b/gio/src/tlscertificate.hg index 09c992e..80484fb 100644 --- a/gio/src/tlscertificate.hg +++ b/gio/src/tlscertificate.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsclientconnection.ccg b/gio/src/tlsclientconnection.ccg index c2785a4..e18f6c7 100644 --- a/gio/src/tlsclientconnection.ccg +++ b/gio/src/tlsclientconnection.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsclientconnection.hg b/gio/src/tlsclientconnection.hg index 40af030..599a3de 100644 --- a/gio/src/tlsclientconnection.hg +++ b/gio/src/tlsclientconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsconnection.ccg b/gio/src/tlsconnection.ccg index 4ec8d7e..61f13d9 100644 --- a/gio/src/tlsconnection.ccg +++ b/gio/src/tlsconnection.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsconnection.hg b/gio/src/tlsconnection.hg index bee6d66..319c052 100644 --- a/gio/src/tlsconnection.hg +++ b/gio/src/tlsconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -63,10 +64,7 @@ public: _WRAP_METHOD(void set_rehandshake_mode(TlsRehandshakeMode mode), g_tls_connection_set_rehandshake_mode) _WRAP_METHOD(TlsRehandshakeMode get_rehandshake_mode() const, g_tls_connection_get_rehandshake_mode) - _WRAP_METHOD(void set_use_system_certdb(bool use_system_certdb = true), g_tls_connection_set_use_system_certdb, - deprecated "Use set_database() instead.") - _WRAP_METHOD(bool get_use_system_certdb() const, g_tls_connection_get_use_system_certdb, - deprecated "Use get_database() instead.") + _IGNORE(g_tls_connection_set_use_system_certdb, g_tls_connection_get_use_system_certdb) _WRAP_METHOD(Glib::RefPtr get_database(), g_tls_connection_get_database) _WRAP_METHOD(Glib::RefPtr get_database() const, g_tls_connection_get_database, constversion) @@ -93,7 +91,7 @@ public: _WRAP_PROPERTY("peer-certificate-errors", TlsCertificateFlags) _WRAP_PROPERTY("rehandshake-mode", TlsRehandshakeMode) _WRAP_PROPERTY("require-close-notify", bool) - _WRAP_PROPERTY("use-system-certdb", bool, deprecated "Use property_database() instead.") + _IGNORE_PROPERTY("use-system-certdb") #m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(bool accept_certificate(const Glib::RefPtr& peer_cert, TlsCertificateFlags errors), "accept_certificate") diff --git a/gio/src/tlsdatabase.ccg b/gio/src/tlsdatabase.ccg index e464c17..2bf254f 100644 --- a/gio/src/tlsdatabase.ccg +++ b/gio/src/tlsdatabase.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,3 +21,7 @@ #include #include #include "slot_async.h" + + +using VerifyFlags = Gio::TlsDatabase::VerifyFlags; +using LookupFlags = Gio::TlsDatabase::LookupFlags; diff --git a/gio/src/tlsdatabase.hg b/gio/src/tlsdatabase.hg index 52d1a25..610402b 100644 --- a/gio/src/tlsdatabase.hg +++ b/gio/src/tlsdatabase.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -32,9 +33,6 @@ class ByteArray; namespace Gio { -_WRAP_ENUM(TlsDatabaseVerifyFlags, GTlsDatabaseVerifyFlags) -_WRAP_ENUM(TlsDatabaseLookupFlags, GTlsDatabaseLookupFlags) - class Cancellable; class SocketConnectable; class TlsCertificate; @@ -60,64 +58,70 @@ public: //TODO?: Have a constant for the C macro G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER (which is a string)? //TODO?: Have a constant for the C macro G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT (which is a string)? - _WRAP_METHOD(TlsCertificateFlags verify_chain(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity{?}, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseVerifyFlags flags{.} = TLS_DATABASE_VERIFY_NONE) const, g_tls_database_verify_chain, errthrow) - _WRAP_METHOD(void verify_chain_async(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity{?}, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseVerifyFlags flags{.} = TLS_DATABASE_VERIFY_NONE) const, g_tls_database_verify_chain_async, slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_ENUM(VerifyFlags, GTlsDatabaseVerifyFlags) + _WRAP_ENUM(LookupFlags, GTlsDatabaseLookupFlags) + + _WRAP_METHOD(TlsCertificateFlags verify_chain(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity{?}, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, VerifyFlags flags{.} = VerifyFlags::NONE) const, g_tls_database_verify_chain, errthrow) + _WRAP_METHOD(void verify_chain_async(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity{?}, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, VerifyFlags flags{.} = VerifyFlags::NONE) const, g_tls_database_verify_chain_async, slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_METHOD(TlsCertificateFlags verify_chain_finish(const Glib::RefPtr& result), g_tls_database_verify_chain_finish, errthrow) - _WRAP_METHOD(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_issuer, errthrow) - _WRAP_METHOD(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE) const, g_tls_database_lookup_certificate_issuer, errthrow, constversion) + _WRAP_METHOD(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificate_issuer, errthrow) + _WRAP_METHOD(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE) const, g_tls_database_lookup_certificate_issuer, errthrow, constversion) - _WRAP_METHOD(void lookup_certificate_issuer_async(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_issuer_async, slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_METHOD(void lookup_certificate_issuer_async(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificate_issuer_async, slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_METHOD(Glib::RefPtr lookup_certificate_issuer_finish(const Glib::RefPtr& result), g_tls_database_lookup_certificate_issuer_finish, errthrow) #m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr >',`Glib::ListHandler< Glib::RefPtr >::list_to_vector($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = Gio::TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificates_issued_by, errthrow) + _WRAP_METHOD(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificates_issued_by, errthrow) #m4 _CONVERSION(`GList*',`std::vector< Glib::RefPtr >',`Glib::ListHandler< Glib::RefPtr >::list_to_vector($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = Gio::TLS_DATABASE_LOOKUP_NONE) const, g_tls_database_lookup_certificates_issued_by, errthrow) + _WRAP_METHOD(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE) const, g_tls_database_lookup_certificates_issued_by, errthrow) - _WRAP_METHOD(void lookup_certificates_issued_by_async(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = Gio::TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificates_issued_by_async, slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_METHOD(void lookup_certificates_issued_by_async(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificates_issued_by_async, slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_METHOD(std::vector< Glib::RefPtr > lookup_certificates_issued_by_finish(const Glib::RefPtr& result), g_tls_database_lookup_certificates_issued_by_finish, errthrow) _WRAP_METHOD(Glib::ustring create_certificate_handle(const Glib::RefPtr& certificate) const, g_tls_database_create_certificate_handle) - _WRAP_METHOD(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_for_handle, errthrow) - _WRAP_METHOD(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE) const, g_tls_database_lookup_certificate_for_handle, errthrow, constversion) + _WRAP_METHOD(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificate_for_handle, errthrow) + _WRAP_METHOD(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE) const, g_tls_database_lookup_certificate_for_handle, errthrow, constversion) - _WRAP_METHOD(void lookup_certificate_for_handle_async(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.} = TLS_DATABASE_LOOKUP_NONE), g_tls_database_lookup_certificate_for_handle_async, slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_METHOD(void lookup_certificate_for_handle_async(const Glib::ustring& handle, const Glib::RefPtr& interaction{?}, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.} = LookupFlags::NONE), g_tls_database_lookup_certificate_for_handle_async, slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_METHOD(Glib::RefPtr lookup_certificate_for_handle_finish(const Glib::RefPtr& result), g_tls_database_lookup_certificate_for_handle_finish, errthrow) #m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr&',`Glib::wrap($3, true)') #m4 _CONVERSION(`GSocketConnectable*',`const Glib::RefPtr&',`Glib::wrap($3, true)') #m4 _CONVERSION(`GTlsInteraction*',`const Glib::RefPtr&',`Glib::wrap($3, true)') - _WRAP_VFUNC(TlsCertificateFlags verify_chain(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, TlsDatabaseVerifyFlags flags{.}) const, "verify_chain", errthrow) - _WRAP_VFUNC(void verify_chain_async(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseVerifyFlags flags{.}) const, "verify_chain_async", slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_VFUNC(TlsCertificateFlags verify_chain(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, VerifyFlags flags{.}) const, "verify_chain", errthrow) + _WRAP_VFUNC(void verify_chain_async(const Glib::RefPtr& chain, const Glib::ustring& purpose, const Glib::RefPtr& identity, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, VerifyFlags flags{.}) const, "verify_chain_async", slot_name slot, slot_callback SignalProxy_async_callback) #m4 _CONVERSION(`GAsyncResult*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_VFUNC(TlsCertificateFlags verify_chain_finish(const Glib::RefPtr& result), "verify_chain_finish", errthrow) dnl// create_certificate_handle_vfunc() shall return a newly allocated string. +dnl// Also, ensure that create_certificate_handle_vfunc() never returns an empty char[], +dnl// because that could be caused by an intermediate empty ustring from an initial null char*. #m4 _CONVERSION(`GTlsCertificate*',`const Glib::RefPtr&',`Glib::wrap($3, true)') +#m4 _CONVERSION(`Glib::ustring',`gchar*',`g_strdup(Glib::c_str_or_nullptr($3))') #m4 _CONVERSION(`gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)') _WRAP_VFUNC(Glib::ustring create_certificate_handle(const Glib::RefPtr& certificate) const, "create_certificate_handle") #m4 _CONVERSION(`Glib::RefPtr',`GTlsCertificate*',`G_TLS_CERTIFICATE(g_object_ref(Glib::unwrap($3)))') - _WRAP_VFUNC(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificate_for_handle", errthrow) - _WRAP_VFUNC(void lookup_certificate_for_handle_async(const Glib::ustring& handle, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificate_for_handle_async", slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_VFUNC(Glib::RefPtr lookup_certificate_for_handle(const Glib::ustring& handle, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificate_for_handle", errthrow) + _WRAP_VFUNC(void lookup_certificate_for_handle_async(const Glib::ustring& handle, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificate_for_handle_async", slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_VFUNC(Glib::RefPtr lookup_certificate_for_handle_finish(const Glib::RefPtr& result), "lookup_certificate_for_handle_finish", errthrow) - _WRAP_VFUNC(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificate_issuer", errthrow) - _WRAP_VFUNC(void lookup_certificate_issuer_async(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificate_issuer_async", slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_VFUNC(Glib::RefPtr lookup_certificate_issuer(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificate_issuer", errthrow) + _WRAP_VFUNC(void lookup_certificate_issuer_async(const Glib::RefPtr& certificate, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificate_issuer_async", slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_VFUNC(Glib::RefPtr lookup_certificate_issuer_finish(const Glib::RefPtr& result), "lookup_certificate_issuer_finish", errthrow) #m4 _CONVERSION(`std::vector< Glib::RefPtr >',`GList*',`g_list_copy(Glib::ListHandler< Glib::RefPtr >::vector_to_list($3).data())') #m4 _CONVERSION(`GByteArray*',`const Glib::RefPtr&',`Glib::wrap($3, true)') - _WRAP_VFUNC(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificates_issued_by", errthrow) - _WRAP_VFUNC(void lookup_certificates_issued_by_async(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, TlsDatabaseLookupFlags flags{.}), "lookup_certificates_issued_by_async", slot_name slot, slot_callback SignalProxy_async_callback) + _WRAP_VFUNC(std::vector< Glib::RefPtr > lookup_certificates_issued_by(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificates_issued_by", errthrow) + _WRAP_VFUNC(void lookup_certificates_issued_by_async(const Glib::RefPtr& issuer_raw_dn, const Glib::RefPtr& interaction, const SlotAsyncReady& slot{callback}, const Glib::RefPtr& cancellable{.?}, LookupFlags flags{.}), "lookup_certificates_issued_by_async", slot_name slot, slot_callback SignalProxy_async_callback) _WRAP_VFUNC(std::vector< Glib::RefPtr > lookup_certificates_issued_by_finish(const Glib::RefPtr& result), "lookup_certificates_issued_by_finish", errthrow) }; diff --git a/gio/src/tlsfiledatabase.ccg b/gio/src/tlsfiledatabase.ccg index eb7ed06..d76f332 100644 --- a/gio/src/tlsfiledatabase.ccg +++ b/gio/src/tlsfiledatabase.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsfiledatabase.hg b/gio/src/tlsfiledatabase.hg index bed39f8..08650c5 100644 --- a/gio/src/tlsfiledatabase.hg +++ b/gio/src/tlsfiledatabase.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsinteraction.ccg b/gio/src/tlsinteraction.ccg index 2252149..a55675f 100644 --- a/gio/src/tlsinteraction.ccg +++ b/gio/src/tlsinteraction.ccg @@ -1,4 +1,3 @@ - /* Copyright (C) 2012 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -12,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsinteraction.hg b/gio/src/tlsinteraction.hg index 09bb2cb..1f48904 100644 --- a/gio/src/tlsinteraction.hg +++ b/gio/src/tlsinteraction.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlspassword.ccg b/gio/src/tlspassword.ccg index 8cba83c..5a4c31c 100644 --- a/gio/src/tlspassword.ccg +++ b/gio/src/tlspassword.ccg @@ -11,7 +11,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include + +using Flags = Gio::TlsPassword::Flags; diff --git a/gio/src/tlspassword.hg b/gio/src/tlspassword.hg index 28a5413..7e2ec17 100644 --- a/gio/src/tlspassword.hg +++ b/gio/src/tlspassword.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -22,7 +23,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(TlsPasswordFlags, GTlsPasswordFlags) /** TlsPassword - TLS Passwords for prompting. * Holds a password used in TLS. @@ -32,12 +32,15 @@ class TlsPassword : public Glib::Object { _CLASS_GOBJECT(TlsPassword, GTlsPassword, G_TLS_PASSWORD, Glib::Object, GObject) +public: + _WRAP_ENUM(Flags, GTlsPasswordFlags) + protected: - _WRAP_CTOR(TlsPassword(const Glib::ustring& description{.}, TlsPasswordFlags flags{.} = Gio::TLS_PASSWORD_NONE), g_tls_password_new) + _WRAP_CTOR(TlsPassword(const Glib::ustring& description{.}, Flags flags{.} = Flags::NONE), g_tls_password_new) public: _WRAP_METHOD_DOCS_ONLY(g_tls_password_new) - _WRAP_CREATE(const Glib::ustring& description{.}, TlsPasswordFlags flags{.} = Gio::TLS_PASSWORD_NONE) + _WRAP_CREATE(const Glib::ustring& description{.}, Flags flags{.} = Flags::NONE) _WRAP_METHOD(const guchar* get_value(gsize& length{?}) const, g_tls_password_get_value) @@ -50,14 +53,14 @@ public: _WRAP_METHOD(Glib::ustring get_description() const, g_tls_password_get_description) _WRAP_METHOD(void set_description(const Glib::ustring& description), g_tls_password_set_description) - _WRAP_METHOD(TlsPasswordFlags get_flags() const, g_tls_password_get_flags) - _WRAP_METHOD(void set_flags(TlsPasswordFlags flags), g_tls_password_set_flags) + _WRAP_METHOD(Flags get_flags() const, g_tls_password_get_flags) + _WRAP_METHOD(void set_flags(Flags flags), g_tls_password_set_flags) _WRAP_METHOD(Glib::ustring get_warning() const, g_tls_password_get_warning) _WRAP_METHOD(void set_warning(const Glib::ustring& warning), g_tls_password_set_warning) _WRAP_PROPERTY("description", Glib::ustring) - _WRAP_PROPERTY("flags", TlsPasswordFlags) + _WRAP_PROPERTY("flags", Flags) _WRAP_PROPERTY("warning", Glib::ustring) #m4 _CONVERSION(`gsize*', `gsize&', `*($3)') diff --git a/gio/src/tlsserverconnection.ccg b/gio/src/tlsserverconnection.ccg index 01cfc85..4f97609 100644 --- a/gio/src/tlsserverconnection.ccg +++ b/gio/src/tlsserverconnection.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/tlsserverconnection.hg b/gio/src/tlsserverconnection.hg index a9b52a4..dbf1a41 100644 --- a/gio/src/tlsserverconnection.hg +++ b/gio/src/tlsserverconnection.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixconnection.ccg b/gio/src/unixconnection.ccg index 3b9929c..20a3cde 100644 --- a/gio/src/unixconnection.ccg +++ b/gio/src/unixconnection.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixconnection.hg b/gio/src/unixconnection.hg index 1ddd1d2..8134ad6 100644 --- a/gio/src/unixconnection.hg +++ b/gio/src/unixconnection.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 Jonathon Jongsma * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixcredentialsmessage.ccg b/gio/src/unixcredentialsmessage.ccg index f3fc155..47a59dd 100644 --- a/gio/src/unixcredentialsmessage.ccg +++ b/gio/src/unixcredentialsmessage.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixcredentialsmessage.hg b/gio/src/unixcredentialsmessage.hg index 9ba8239..1ad9523 100644 --- a/gio/src/unixcredentialsmessage.hg +++ b/gio/src/unixcredentialsmessage.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixfdlist.ccg b/gio/src/unixfdlist.ccg index f35d700..d24555c 100644 --- a/gio/src/unixfdlist.ccg +++ b/gio/src/unixfdlist.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,7 +21,7 @@ namespace Gio { -UnixFDList::UnixFDList(const Glib::ArrayHandle& fds) +UnixFDList::UnixFDList(const std::vector& fds) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), // g_unix_fd_list_new_from_array() must be called. @@ -28,11 +29,11 @@ UnixFDList::UnixFDList(const Glib::ArrayHandle& fds) // _CONSTRUCT() + g_unit_fd_list_append() is not an alternative. // g_unit_fd_list_append() duplicates the file descriptor, // but g_unix_fd_list_new_from_array() does not. - Glib::Object((GObject*)g_unix_fd_list_new_from_array(fds.data(), fds.size())) + Glib::Object((GObject*)g_unix_fd_list_new_from_array(Glib::ArrayHandler::vector_to_array(fds).data(), fds.size())) { } -UnixFDList::UnixFDList(const Glib::ArrayHandle& fds, int n_fds) +UnixFDList::UnixFDList(const std::vector& fds, int n_fds) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), // g_unix_fd_list_new_from_array() must be called. @@ -40,28 +41,28 @@ UnixFDList::UnixFDList(const Glib::ArrayHandle& fds, int n_fds) // _CONSTRUCT() + g_unit_fd_list_append() is not an alternative. // g_unit_fd_list_append() duplicates the file descriptor, // but g_unix_fd_list_new_from_array() does not. - Glib::Object((GObject*)g_unix_fd_list_new_from_array(fds.data(), n_fds)) + Glib::Object((GObject*)g_unix_fd_list_new_from_array(Glib::ArrayHandler::vector_to_array(fds).data(), n_fds)) { } -const Glib::ArrayHandle +const std::vector UnixFDList::peek_fds() const { int length = 0; const auto fds = g_unix_fd_list_peek_fds(const_cast(gobj()), &length); // The array is terminated with a -1, but that terminating element is // not included in the length that g_unix_fd_list_peek_fds() returns. - return Glib::ArrayHandle(fds, length, Glib::OWNERSHIP_NONE); + return Glib::ArrayHandler::array_to_vector(fds, length, Glib::OWNERSHIP_NONE); } -Glib::ArrayHandle +std::vector UnixFDList::steal_fds() { int length = 0; const auto fds = g_unix_fd_list_steal_fds(gobj(), &length); // The array is terminated with a -1, but that terminating element is // not included in the length that g_unix_fd_list_steal_fds() returns. - return Glib::ArrayHandle(fds, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(fds, length, Glib::OWNERSHIP_DEEP); } } // namespace Gio diff --git a/gio/src/unixfdlist.hg b/gio/src/unixfdlist.hg index 838793f..b85804f 100644 --- a/gio/src/unixfdlist.hg +++ b/gio/src/unixfdlist.hg @@ -11,11 +11,11 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -43,9 +43,9 @@ protected: _CTOR_DEFAULT _IGNORE(g_unix_fd_list_new) - explicit UnixFDList(const Glib::ArrayHandle& fds); + explicit UnixFDList(const std::vector& fds); - explicit UnixFDList(const Glib::ArrayHandle& fds, int n_fds); + explicit UnixFDList(const std::vector& fds, int n_fds); _IGNORE(g_unix_fd_list_new_from_array) public: @@ -60,10 +60,10 @@ public: * @param fds The list of file descriptors to use for creation. * @return A new UnixFDList. */ - _WRAP_CREATE(const Glib::ArrayHandle& fds) + _WRAP_CREATE(const std::vector& fds) _WRAP_METHOD_DOCS_ONLY(g_unix_fd_list_new_from_array) - _WRAP_CREATE(const Glib::ArrayHandle& fds, int n_fds) + _WRAP_CREATE(const std::vector& fds, int n_fds) _WRAP_METHOD(int get_length() const, g_unix_fd_list_get_length) _WRAP_METHOD(int get(int index) const, g_unix_fd_list_get, errthrow) @@ -77,7 +77,7 @@ public: * * @newin{2,28} */ - const Glib::ArrayHandle peek_fds() const; + const std::vector peek_fds() const; _IGNORE(g_unix_fd_list_peek_fds) /** Returns the array of file descriptors that is contained in this object. @@ -92,7 +92,7 @@ public: * * @newin{2,28} */ - Glib::ArrayHandle steal_fds(); + std::vector steal_fds(); _IGNORE(g_unix_fd_list_steal_fds) _WRAP_METHOD_DOCS_ONLY(g_unix_fd_list_append) diff --git a/gio/src/unixfdmessage.ccg b/gio/src/unixfdmessage.ccg index b7b6f55..a88cf4f 100644 --- a/gio/src/unixfdmessage.ccg +++ b/gio/src/unixfdmessage.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -21,14 +22,14 @@ namespace Gio { -Glib::ArrayHandle +std::vector UnixFDMessage::steal_fds() { int length = 0; const auto fds = g_unix_fd_message_steal_fds(gobj(), &length); // The array is terminated with a -1, but that terminating element is // not included in the length that g_unix_fd_message_steal_fds() returns. - return Glib::ArrayHandle(fds, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(fds, length, Glib::OWNERSHIP_DEEP); } } // namespace Gio diff --git a/gio/src/unixfdmessage.hg b/gio/src/unixfdmessage.hg index f418f94..f25dacc 100644 --- a/gio/src/unixfdmessage.hg +++ b/gio/src/unixfdmessage.hg @@ -11,10 +11,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include _DEFS(giomm,gio) @@ -71,7 +71,7 @@ public: * * @newin{2,28} */ - Glib::ArrayHandle steal_fds(); + std::vector steal_fds(); _IGNORE(g_unix_fd_message_steal_fds) _WRAP_PROPERTY("fd-list", Glib::RefPtr) diff --git a/gio/src/unixinputstream.ccg b/gio/src/unixinputstream.ccg index 30fcbd2..61fd7b0 100644 --- a/gio/src/unixinputstream.ccg +++ b/gio/src/unixinputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixinputstream.hg b/gio/src/unixinputstream.hg index de00b22..f7c71fb 100644 --- a/gio/src/unixinputstream.hg +++ b/gio/src/unixinputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,10 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include +#include _DEFS(giomm,gio) _PINCLUDE(giomm/private/inputstream_p.h) @@ -33,9 +34,12 @@ namespace Gio * * @newin{2,16} */ -class UnixInputStream : public Gio::InputStream +class UnixInputStream +: public Gio::InputStream, public PollableInputStream, public FileDescriptorBased { _CLASS_GOBJECT(UnixInputStream, GUnixInputStream, G_UNIX_INPUT_STREAM, Gio::InputStream, GInputStream) + _IMPLEMENTS_INTERFACE(PollableInputStream) + _IMPLEMENTS_INTERFACE(FileDescriptorBased) _GTKMMPROC_WIN32_NO_WRAP protected: diff --git a/gio/src/unixmount.ccg b/gio/src/unixmount.ccg index 12a276f..98fab0c 100644 --- a/gio/src/unixmount.ccg +++ b/gio/src/unixmount.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixmount.hg b/gio/src/unixmount.hg index 7c8f2f6..97c27d5 100644 --- a/gio/src/unixmount.hg +++ b/gio/src/unixmount.hg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixoutputstream.ccg b/gio/src/unixoutputstream.ccg index 5e6d1de..1ecd417 100644 --- a/gio/src/unixoutputstream.ccg +++ b/gio/src/unixoutputstream.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/unixoutputstream.hg b/gio/src/unixoutputstream.hg index be49ac4..fc3f1e3 100644 --- a/gio/src/unixoutputstream.hg +++ b/gio/src/unixoutputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -13,10 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include +#include _DEFS(giomm,gio) _PINCLUDE(giomm/private/outputstream_p.h) @@ -32,9 +33,12 @@ namespace Gio * * @newin{2,16} */ -class UnixOutputStream : public Gio::OutputStream +class UnixOutputStream +: public Gio::OutputStream, public PollableOutputStream, public FileDescriptorBased { _CLASS_GOBJECT(UnixOutputStream, GUnixOutputStream, G_UNIX_OUTPUT_STREAM, Gio::OutputStream, GOutputStream) + _IMPLEMENTS_INTERFACE(PollableOutputStream) + _IMPLEMENTS_INTERFACE(FileDescriptorBased) _GTKMMPROC_WIN32_NO_WRAP protected: diff --git a/gio/src/unixsocketaddress.ccg b/gio/src/unixsocketaddress.ccg index 9c8b042..8b5b480 100644 --- a/gio/src/unixsocketaddress.ccg +++ b/gio/src/unixsocketaddress.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2010 The giomm Development Team * * This library is free software; you can redistribute it and/or @@ -11,16 +13,19 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +using Type = Gio::UnixSocketAddress::Type; + namespace Gio { Glib::RefPtr -UnixSocketAddress::create(const std::string& path, UnixSocketAddressType type, int path_len) +UnixSocketAddress::create(const std::string& path, Type type, int path_len) { return Glib::wrap(reinterpret_cast(g_unix_socket_address_new_with_type( path.c_str(), path_len, static_cast(type)))); diff --git a/gio/src/unixsocketaddress.hg b/gio/src/unixsocketaddress.hg index 5cfdc94..263e86b 100644 --- a/gio/src/unixsocketaddress.hg +++ b/gio/src/unixsocketaddress.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -24,8 +25,6 @@ _PINCLUDE(giomm/private/socketaddress_p.h) namespace Gio { -_WRAP_ENUM(UnixSocketAddressType, GUnixSocketAddressType) - class ByteArray; /** UnixSocketAddress - UNIX SocketAddress. @@ -51,12 +50,15 @@ class UnixSocketAddress _CLASS_GOBJECT(UnixSocketAddress, GUnixSocketAddress, G_UNIX_SOCKET_ADDRESS, SocketAddress, GSocketAddress) _GTKMMPROC_WIN32_NO_WRAP +public: + _WRAP_ENUM(Type, GUnixSocketAddressType) + protected: _WRAP_CTOR(UnixSocketAddress(const std::string& path), g_unix_socket_address_new) //TODO: Possibly add when g_unix_socket_address_new_with_type() does not do //more than call g_object_new() (maybe file a bug). - //_WRAP_CTOR(UnixSocketAddress(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH), g_unix_socket_address_new_with_type) + //_WRAP_CTOR(UnixSocketAddress(const std::string& path, int path_len = -1, Type type = Type::PATH), g_unix_socket_address_new_with_type) public: _WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new) @@ -65,23 +67,23 @@ public: //TODO: Add when the above constructor is included, removing the handwritten //create() method for it below. //_WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type) - //_WRAP_CREATE(const std::string& path, int path_len = -1, UnixSocketAddressType type = Gio::UNIX_SOCKET_ADDRESS_PATH) + //_WRAP_CREATE(const std::string& path, int path_len = -1, Type type = Type::PATH) _WRAP_METHOD_DOCS_ONLY(g_unix_socket_address_new_with_type) static Glib::RefPtr create(const std::string& path, - UnixSocketAddressType type, int path_len = -1); + Type type, int path_len = -1); // Deprecated. _IGNORE(g_unix_socket_address_get_is_abstract) - _WRAP_METHOD(UnixSocketAddressType get_address_type() const, g_unix_socket_address_get_address_type) + _WRAP_METHOD(Type get_address_type() const, g_unix_socket_address_get_address_type) _WRAP_METHOD(std::string get_path() const, g_unix_socket_address_get_path) _IGNORE(g_unix_socket_address_get_path_len) _WRAP_METHOD(static bool abstract_names_supported(), g_unix_socket_address_abstract_names_supported) - _WRAP_PROPERTY("abstract", bool, deprecated "Use property_address_type() instead, which distinguishes between zero-padded and non-zero-padded abstract addresses.") - _WRAP_PROPERTY("address-type", UnixSocketAddressType) + _IGNORE_PROPERTY("abstract") + _WRAP_PROPERTY("address-type", Type) _WRAP_PROPERTY("path", std::string) _WRAP_PROPERTY("path-as-array", Glib::RefPtr) }; diff --git a/gio/src/volume.ccg b/gio/src/volume.ccg index 2d1d01a..9ba1898 100644 --- a/gio/src/volume.ccg +++ b/gio/src/volume.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,7 +29,7 @@ namespace Gio void Volume::mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountMountFlags flags) + const Glib::RefPtr& cancellable, Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -39,7 +42,7 @@ Volume::mount(const Glib::RefPtr& mount_operation, const SlotAsy void Volume::mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountMountFlags flags) + Mount::MountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -52,7 +55,7 @@ Volume::mount(const Glib::RefPtr& mount_operation, const SlotAsy } void -Volume::mount(const Glib::RefPtr& mount_operation, MountMountFlags flags) +Volume::mount(const Glib::RefPtr& mount_operation, Mount::MountFlags flags) { g_volume_mount(gobj(), static_cast(flags), Glib::unwrap(mount_operation), nullptr, // cancellable @@ -60,7 +63,7 @@ Volume::mount(const Glib::RefPtr& mount_operation, MountMountFla } void -Volume::mount(MountMountFlags flags) +Volume::mount(Mount::MountFlags flags) { g_volume_mount(gobj(), static_cast(flags), nullptr, nullptr, // cancellable @@ -69,7 +72,7 @@ Volume::mount(MountMountFlags flags) void Volume::eject( - const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -82,7 +85,7 @@ Volume::eject( } void -Volume::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) +Volume::eject(const SlotAsyncReady& slot, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -96,7 +99,7 @@ Volume::eject(const SlotAsyncReady& slot, MountUnmountFlags flags) } void -Volume::eject(MountUnmountFlags flags) +Volume::eject(Mount::UnmountFlags flags) { g_volume_eject_with_operation(gobj(), static_cast(flags), nullptr, // mount_operation @@ -107,7 +110,7 @@ Volume::eject(MountUnmountFlags flags) void Volume::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - const Glib::RefPtr& cancellable, MountUnmountFlags flags) + const Glib::RefPtr& cancellable, Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -121,7 +124,7 @@ Volume::eject(const Glib::RefPtr& mount_operation, const SlotAsy void Volume::eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, - MountUnmountFlags flags) + Mount::UnmountFlags flags) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -135,7 +138,7 @@ Volume::eject(const Glib::RefPtr& mount_operation, const SlotAsy } void -Volume::eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags) +Volume::eject(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags) { g_volume_eject_with_operation(gobj(), static_cast(flags), Glib::unwrap(mount_operation), diff --git a/gio/src/volume.hg b/gio/src/volume.hg index a1488d8..f6339c9 100644 --- a/gio/src/volume.hg +++ b/gio/src/volume.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -97,7 +98,7 @@ public: * @param cancellable A cancellable object which can be used to cancel the operation. * @param flags Flags affecting the operation. */ - void mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a volume. * This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot. @@ -106,20 +107,20 @@ public: * @param slot A callback which will be called when the operation is completed or canceled. * @param flags Flags affecting the operation. */ - void mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a volume. * * @param mount_operation A mount operation. * @param flags Flags affecting the operation. */ - void mount(const Glib::RefPtr& mount_operation, MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount(const Glib::RefPtr& mount_operation, Mount::MountFlags flags = Mount::MountFlags::NONE); /** Mounts a volume. * * @param flags Flags affecting the operation. */ - void mount(MountMountFlags flags = MOUNT_MOUNT_NONE); + void mount(Mount::MountFlags flags = Mount::MountFlags::NONE); _IGNORE(g_volume_mount) @@ -127,12 +128,12 @@ public: g_volume_mount_finish, errthrow) - void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); - void eject(const Glib::RefPtr& mount_operation, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE); + void eject(const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr& cancellable, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, const SlotAsyncReady& slot, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); + void eject(const Glib::RefPtr& mount_operation, Mount::UnmountFlags flags = Mount::UnmountFlags::NONE); _IGNORE(g_volume_eject) _IGNORE(g_volume_eject_with_operation) @@ -144,8 +145,8 @@ public: _WRAP_METHOD(std::string get_identifier(const std::string& kind) const, g_volume_get_identifier) - #m4 _CONVERSION(`char**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') - _WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, + #m4 _CONVERSION(`char**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(std::vector enumerate_identifiers() const, g_volume_enumerate_identifiers) _WRAP_METHOD(Glib::RefPtr get_activation_root(), g_volume_get_activation_root) diff --git a/gio/src/volumemonitor.ccg b/gio/src/volumemonitor.ccg index 59e4bd5..48ac82a 100644 --- a/gio/src/volumemonitor.ccg +++ b/gio/src/volumemonitor.ccg @@ -1,3 +1,5 @@ +// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- + /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/volumemonitor.hg b/gio/src/volumemonitor.hg index 24c62fb..6eb5c65 100644 --- a/gio/src/volumemonitor.hg +++ b/gio/src/volumemonitor.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _CONFIGINCLUDE(giommconfig.h) @@ -42,20 +43,19 @@ public: _WRAP_METHOD(static Glib::RefPtr get(), g_volume_monitor_get) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >',`$2($3, Glib::OWNERSHIP_SHALLOW)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > get_connected_drives(), g_volume_monitor_get_connected_drives) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(std::vector> get_connected_drives(), g_volume_monitor_get_connected_drives) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >',`$2($3, Glib::OWNERSHIP_SHALLOW)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > get_volumes(), g_volume_monitor_get_volumes) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(std::vector> get_volumes(), g_volume_monitor_get_volumes) -#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr >',`$2($3, Glib::OWNERSHIP_SHALLOW)') - _WRAP_METHOD(Glib::ListHandle< Glib::RefPtr > get_mounts(), g_volume_monitor_get_mounts) +#m4 _CONVERSION(`GList*',`std::vector>',`Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_SHALLOW)') + _WRAP_METHOD(std::vector> get_mounts(), g_volume_monitor_get_mounts) _WRAP_METHOD(Glib::RefPtr get_volume_for_uuid(const std::string& uuid), g_volume_monitor_get_volume_for_uuid, refreturn) _WRAP_METHOD(Glib::RefPtr get_mount_for_uuid(const std::string& uuid), g_volume_monitor_get_mount_for_uuid, refreturn) - _WRAP_METHOD(static Glib::RefPtr adopt_orphan_mount(const Glib::RefPtr& mount), g_volume_monitor_adopt_orphan_mount, - deprecated "Instead of using this function, create shadow mounts with the URI of the mount you intend to adopt.") + _IGNORE(g_volume_monitor_adopt_orphan_mount) #m4 _CONVERSION(`GVolume*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(void volume_added(const Glib::RefPtr& volume), volume_added) @@ -73,9 +73,8 @@ public: _WRAP_SIGNAL(void drive_disconnected(const Glib::RefPtr& drive), drive_disconnected) _WRAP_SIGNAL(void drive_changed(const Glib::RefPtr& drive), drive_changed) - //TODO: Remove no_default_handler when we can break ABI: - _WRAP_SIGNAL(void drive_eject_button(const Glib::RefPtr& drive), drive_eject_button, no_default_handler) - _WRAP_SIGNAL(void drive_stop_button(const Glib::RefPtr& drive), drive_stop_button, no_default_handler) + _WRAP_SIGNAL(void drive_eject_button(const Glib::RefPtr& drive), drive_eject_button) + _WRAP_SIGNAL(void drive_stop_button(const Glib::RefPtr& drive), drive_stop_button) //TODO: Use ListHandle? //_WRAP_VFUNC(GList* get_volumes(), get_volumes) diff --git a/gio/src/zlibcompressor.ccg b/gio/src/zlibcompressor.ccg index 37de341..4366e58 100644 --- a/gio/src/zlibcompressor.ccg +++ b/gio/src/zlibcompressor.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/zlibcompressor.hg b/gio/src/zlibcompressor.hg index 58e7cc8..223b617 100644 --- a/gio/src/zlibcompressor.hg +++ b/gio/src/zlibcompressor.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/zlibdecompressor.ccg b/gio/src/zlibdecompressor.ccg index 37de341..4366e58 100644 --- a/gio/src/zlibdecompressor.ccg +++ b/gio/src/zlibdecompressor.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/gio/src/zlibdecompressor.hg b/gio/src/zlibdecompressor.hg index aab9763..7ae8166 100644 --- a/gio/src/zlibdecompressor.hg +++ b/gio/src/zlibdecompressor.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm.h b/glib/glibmm.h index ac753ce..101b80e 100644 --- a/glib/glibmm.h +++ b/glib/glibmm.h @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GLIBMM_H @@ -64,12 +65,12 @@ * * If your source file is @c program.cc, you can compile it with: * @code - * g++ program.cc -o program `pkg-config --cflags --libs glibmm-2.4 giomm-2.4` + * g++ program.cc -o program `pkg-config --cflags --libs glibmm-2.56 giomm-2.56` * @endcode * * Alternatively, if using autoconf, use the following in @c configure.ac: * @code - * PKG_CHECK_MODULES([GLIBMM], [glibmm-2.4 giomm-2.4]) + * PKG_CHECK_MODULES([GLIBMM], [glibmm-2.56 giomm-2.56]) * @endcode * Then use the generated @c GLIBMM_CFLAGS and @c GLIBMM_LIBS variables in the * project Makefile.am files. For example: @@ -83,13 +84,6 @@ //#include //This must be included by the application, after system headers such as //. -// Include this first because we need it to be the first thing to include , -// so we can do an undef trick to still use deprecated API in the header: -#include - -#include - -#include #include #include #ifndef GLIBMM_INCLUDED_FROM_WRAP_INIT_CC @@ -110,13 +104,10 @@ #include #include #include -#include #include #include #include #include -#include -#include #include #include #include @@ -136,23 +127,19 @@ #include #include #include -#include #include #include -#include #include #include #include #include #include #include -#include #include #include #include #include #include -#include #include #endif /* _GLIBMM_H */ diff --git a/glib/glibmm.pc.in b/glib/glibmm.pc.in index b08f62d..25e6c16 100644 --- a/glib/glibmm.pc.in +++ b/glib/glibmm.pc.in @@ -16,6 +16,6 @@ Name: glibmm Description: C++ wrapper for GLib Version: @PACKAGE_VERSION@ URL: http://www.gtkmm.org/ -Requires: gobject-2.0 sigc++-2.0 +Requires: gobject-2.0 sigc++-3.0 Libs: -L${libdir} -lglibmm-@GLIBMM_API_VERSION@ Cflags: -I${includedir}/@GLIBMM_MODULE_NAME@ -I${libdir}/@GLIBMM_MODULE_NAME@/include diff --git a/glib/glibmm/arrayhandle.cc b/glib/glibmm/arrayhandle.cc deleted file mode 100644 index 3a388b6..0000000 --- a/glib/glibmm/arrayhandle.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 2011 The glibmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include - -namespace Glib -{ - -ArrayHandle>::~ArrayHandle() noexcept -{ - if (parray_ && ownership_ != Glib::OWNERSHIP_NONE) - { - if (ownership_ != Glib::OWNERSHIP_SHALLOW) - { - // Deep ownership: release each container element. - const CType* const pend = parray_ + size_; - for (const CType* p = parray_; p != pend; ++p) - Tr::release_c_type(*p); - } - g_free(const_cast(parray_)); - } -} - -} // namespace Glib diff --git a/glib/glibmm/arrayhandle.h b/glib/glibmm/arrayhandle.h deleted file mode 100644 index 735b661..0000000 --- a/glib/glibmm/arrayhandle.h +++ /dev/null @@ -1,754 +0,0 @@ -#ifndef _GLIBMM_ARRAYHANDLE_H -#define _GLIBMM_ARRAYHANDLE_H - -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include - -namespace Glib -{ - -namespace Container_Helpers -{ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/* Count the number of elements in a 0-terminated sequence. - */ -template -inline std::size_t -compute_array_size(const T* array) -{ - const T* pend = array; - - while (*pend) - ++pend; - - return (pend - array); -} - -/* Allocate and fill a 0-terminated array. The size argument - * specifies the number of elements in the input sequence. - */ -template -typename Tr::CType* -create_array(For pbegin, std::size_t size, Tr) -{ - using CType = typename Tr::CType; - - CType* const array = static_cast(g_malloc((size + 1) * sizeof(CType))); - CType* const array_end = array + size; - - for (CType* pdest = array; pdest != array_end; ++pdest) - { - // Use & to force a warning if the iterator returns a temporary object. - *pdest = Tr::to_c_type(*&*pbegin); - ++pbegin; - } - - *array_end = CType(); - return array; -} - -template -gboolean* -create_bool_array(For pbegin, std::size_t size) -{ - gboolean* const array(static_cast(g_malloc((size + 1) * sizeof(gboolean)))); - gboolean* const array_end(array + size); - - for (gboolean* pdest(array); pdest != array_end; ++pdest) - { - *pdest = *pbegin; - ++pbegin; - } - - *array_end = false; - return array; -} - -/* Convert from any container that supports forward - * iterators and has a size() method. - */ -template -struct ArraySourceTraits -{ - using CType = typename Tr::CType; - - static std::size_t get_size(const Cont& cont) { return cont.size(); } - - static const CType* get_data(const Cont& cont, std::size_t size) - { - return Glib::Container_Helpers::create_array(cont.begin(), size, Tr()); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -// source traits for bools. -template -struct BoolArraySourceTraits -{ - using CType = gboolean; - - static std::size_t get_size(const Cont& cont) { return cont.size(); } - - static const CType* get_data(const Cont& cont, std::size_t size) - { - return Glib::Container_Helpers::create_bool_array(cont.begin(), size); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; -/* Convert from a 0-terminated array. The Cont argument must be a pointer - * to the first element. Note that only arrays of the C type are supported. - */ -template -struct ArraySourceTraits -{ - using CType = typename Tr::CType; - - static std::size_t get_size(const CType* array) - { - return (array) ? Glib::Container_Helpers::compute_array_size(array) : 0; - } - - static const CType* get_data(const CType* array, std::size_t) { return array; } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; -}; - -template -struct ArraySourceTraits : ArraySourceTraits -{ -}; - -/* Convert from a 0-terminated array. The Cont argument must be a pointer - * to the first element. Note that only arrays of the C type are supported. - * For consistency, the array must be 0-terminated, even though the array - * size is known at compile time. - */ -template -struct ArraySourceTraits -{ - using CType = typename Tr::CType; - - static std::size_t get_size(const CType*) { return (N - 1); } - - static const CType* get_data(const CType* array, std::size_t) { return array; } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE; -}; - -template -struct ArraySourceTraits : ArraySourceTraits -{ -}; - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -/** - * @ingroup ContHelpers - */ -template -class ArrayHandleIterator -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - 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); - - inline value_type operator*() const; - inline value_type operator[](difference_type offset) const; - - inline ArrayHandleIterator& operator++(); - inline const ArrayHandleIterator operator++(int); - // these are needed by msvc 2005 when using deque. - inline ArrayHandleIterator& operator--(); - inline const ArrayHandleIterator operator--(int); - - // All this random access stuff is only there because STL algorithms - // usually have optimized specializations for random access iterators, - // and we don't want to give away efficiency for nothing. - // - inline ArrayHandleIterator& operator+=(difference_type rhs); - inline ArrayHandleIterator& operator-=(difference_type rhs); - inline const ArrayHandleIterator operator+(difference_type rhs) const; - inline const ArrayHandleIterator operator-(difference_type rhs) const; - inline difference_type operator-(const ArrayHandleIterator& rhs) const; - - inline bool operator==(const ArrayHandleIterator& rhs) const; - inline bool operator!=(const ArrayHandleIterator& rhs) const; - inline bool operator<(const ArrayHandleIterator& rhs) const; - inline bool operator>(const ArrayHandleIterator& rhs) const; - inline bool operator<=(const ArrayHandleIterator& rhs) const; - inline bool operator>=(const ArrayHandleIterator& rhs) const; - -private: - const CType* pos_; -}; - -} // namespace Container_Helpers - -// TODO: When we can break ABI, remove this and replace uses of it with std::vector. -// We cannot deprecate it yet, because we cannot easily deprecate methods that use it -//- for instance, we cannot just override methods that use it as a return type. - -/** This is an intermediate type. When a method takes this, or returns this, you - * should use a standard C++ container of your choice, such as std::list or - * std::vector. - * - * However, this is not used in new API. We now prefer to just use std::vector, - * which is less flexibile, but makes the API clearer. - * - * @ingroup ContHandles - */ -template > -class ArrayHandle -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - using value_type = CppType; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using const_iterator = Glib::Container_Helpers::ArrayHandleIterator; - using iterator = Glib::Container_Helpers::ArrayHandleIterator; - - template - inline ArrayHandle(const Cont& container); - - // Take over ownership of an array created by GTK+ functions. - inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership); - inline ArrayHandle(const CType* array, Glib::OwnershipType ownership); - - // Copying clears the ownership flag of the source handle. - inline ArrayHandle(const ArrayHandle& other); - - ~ArrayHandle() noexcept; - - inline const_iterator begin() const; - inline const_iterator end() const; - - template - inline operator std::vector() const; - template - inline operator std::deque() const; - template - inline operator std::list() const; - - template - inline void assign_to(Cont& container) const; - - template - inline void copy(Out pdest) const; - - inline const CType* data() const; - inline std::size_t size() const; - inline bool empty() const; - -private: - std::size_t size_; - const CType* parray_; - mutable Glib::OwnershipType ownership_; - - // No copy assignment. - ArrayHandle& operator=(const ArrayHandle&); -}; - -template <> -class ArrayHandle> -{ -public: - using Me = ArrayHandle>; - using Tr = Container_Helpers::TypeTraits; - - using CppType = Tr::CppType; - using CType = Tr::CType; - - using value_type = CppType; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using const_iterator = Glib::Container_Helpers::ArrayHandleIterator; - using iterator = Glib::Container_Helpers::ArrayHandleIterator; - - template - inline ArrayHandle(const Cont& container); - - // Take over ownership of an array created by GTK+ functions. - inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership); - inline ArrayHandle(const CType* array, Glib::OwnershipType ownership); - - // Copying clears the ownership flag of the source handle. - inline ArrayHandle(const Me& other); - - ~ArrayHandle() noexcept; - - inline const_iterator begin() const; - inline const_iterator end() const; - - // this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code. - template - inline operator std::vector() const - { -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::vector(this->begin(), this->end()); -#else - std::vector temp; - temp.reserve(this->size()); - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif - } - - // this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code. - template - inline operator std::deque() const - { -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::deque(this->begin(), this->end()); -#else - std::deque temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif - } - - // this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code. - template - inline operator std::list() const - { -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::list(this->begin(), this->end()); -#else - std::list temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif - } - - template - inline void assign_to(Cont& container) const; - - template - inline void copy(Out pdest) const; - - inline const CType* data() const; - inline std::size_t size() const; - inline bool empty() const; - -private: - std::size_t size_; - const CType* parray_; - mutable Glib::OwnershipType ownership_; - - // No copy assignment. - Me& operator=(const Me&); -}; - -// TODO: Remove this when we can break glibmm API. -/** If a method takes this as an argument, or has this as a return type, then you can use a standard - * container such as std::list or std::vector. - * - * - * However, this is not used in new API. We now prefer to just use std::vector, - * which is less flexibile, but makes the API clearer. - * - * @ingroup ContHandles - */ -using StringArrayHandle = ArrayHandle; - -/***************************************************************************/ -/* Inline implementation */ -/***************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -namespace Container_Helpers -{ - -/**** Glib::Container_Helpers::ArrayHandleIterator<> ***********************/ - -template -inline ArrayHandleIterator::ArrayHandleIterator(const CType* pos) : pos_(pos) -{ -} - -template -inline typename ArrayHandleIterator::value_type ArrayHandleIterator::operator*() const -{ - return Tr::to_cpp_type(*pos_); -} - -template -inline typename ArrayHandleIterator::value_type ArrayHandleIterator::operator[]( - difference_type offset) const -{ - return Tr::to_cpp_type(pos_[offset]); -} - -template -inline ArrayHandleIterator& ArrayHandleIterator::operator++() -{ - ++pos_; - return *this; -} - -template -inline const ArrayHandleIterator ArrayHandleIterator::operator++(int) -{ - return ArrayHandleIterator(pos_++); -} - -template -inline ArrayHandleIterator& ArrayHandleIterator::operator--() -{ - --pos_; - return *this; -} - -template -inline const ArrayHandleIterator ArrayHandleIterator::operator--(int) -{ - return ArrayHandleIterator(pos_--); -} - -template -inline ArrayHandleIterator& -ArrayHandleIterator::operator+=(typename ArrayHandleIterator::difference_type rhs) -{ - pos_ += rhs; - return *this; -} - -template -inline ArrayHandleIterator& -ArrayHandleIterator::operator-=(typename ArrayHandleIterator::difference_type rhs) -{ - pos_ -= rhs; - return *this; -} - -template -inline const ArrayHandleIterator -ArrayHandleIterator::operator+(typename ArrayHandleIterator::difference_type rhs) const -{ - return ArrayHandleIterator(pos_ + rhs); -} - -template -inline const ArrayHandleIterator -ArrayHandleIterator::operator-(typename ArrayHandleIterator::difference_type rhs) const -{ - return ArrayHandleIterator(pos_ - rhs); -} - -template -inline typename ArrayHandleIterator::difference_type -ArrayHandleIterator::operator-(const ArrayHandleIterator& rhs) const -{ - return (pos_ - rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator==(const ArrayHandleIterator& rhs) const -{ - return (pos_ == rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator!=(const ArrayHandleIterator& rhs) const -{ - return (pos_ != rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator<(const ArrayHandleIterator& rhs) const -{ - return (pos_ < rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator>(const ArrayHandleIterator& rhs) const -{ - return (pos_ > rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator<=(const ArrayHandleIterator& rhs) const -{ - return (pos_ <= rhs.pos_); -} - -template -inline bool -ArrayHandleIterator::operator>=(const ArrayHandleIterator& rhs) const -{ - return (pos_ >= rhs.pos_); -} - -} // namespace Container_Helpers - -/**** Glib::ArrayHandle<> **************************************************/ - -template -template -inline ArrayHandle::ArrayHandle(const Cont& container) -: size_(Glib::Container_Helpers::ArraySourceTraits::get_size(container)), - parray_(Glib::Container_Helpers::ArraySourceTraits::get_data(container, size_)), - ownership_(Glib::Container_Helpers::ArraySourceTraits::initial_ownership) -{ -} - -template -inline ArrayHandle::ArrayHandle(const typename ArrayHandle::CType* array, - std::size_t array_size, Glib::OwnershipType ownership) -: size_((array) ? array_size : 0), parray_(array), ownership_(ownership) -{ -} - -template -inline ArrayHandle::ArrayHandle( - const typename ArrayHandle::CType* array, Glib::OwnershipType ownership) -: size_((array) ? Glib::Container_Helpers::compute_array_size(array) : 0), - parray_(array), - ownership_(ownership) -{ -} - -template -inline ArrayHandle::ArrayHandle(const ArrayHandle& other) -: size_(other.size_), parray_(other.parray_), ownership_(other.ownership_) -{ - other.ownership_ = Glib::OWNERSHIP_NONE; -} - -template -ArrayHandle::~ArrayHandle() noexcept -{ - if (parray_ && ownership_ != Glib::OWNERSHIP_NONE) - { - if (ownership_ != Glib::OWNERSHIP_SHALLOW) - { - // Deep ownership: release each container element. - const CType* const pend = parray_ + size_; - for (const CType* p = parray_; p != pend; ++p) - Tr::release_c_type(*p); - } - g_free(const_cast(parray_)); - } -} - -template -inline typename ArrayHandle::const_iterator -ArrayHandle::begin() const -{ - return Glib::Container_Helpers::ArrayHandleIterator(parray_); -} - -template -inline typename ArrayHandle::const_iterator -ArrayHandle::end() const -{ - return Glib::Container_Helpers::ArrayHandleIterator(parray_ + size_); -} - -template -template -inline ArrayHandle::operator std::vector() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::vector(this->begin(), this->end()); -#else - std::vector temp; - temp.reserve(this->size()); - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline ArrayHandle::operator std::deque() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::deque(this->begin(), this->end()); -#else - std::deque temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline ArrayHandle::operator std::list() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::list(this->begin(), this->end()); -#else - std::list temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline void -ArrayHandle::assign_to(Cont& container) const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - container.assign(this->begin(), this->end()); -#else - Cont temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - container.swap(temp); -#endif -} - -template -template -inline void -ArrayHandle::copy(Out pdest) const -{ - std::copy(this->begin(), this->end(), pdest); -} - -template -inline const typename ArrayHandle::CType* -ArrayHandle::data() const -{ - return parray_; -} - -template -inline std::size_t -ArrayHandle::size() const -{ - return size_; -} - -template -inline bool -ArrayHandle::empty() const -{ - return (size_ == 0); -} - -/**** Glib::ArrayHandle **********************************************/ - -template -inline ArrayHandle>::ArrayHandle(const Cont& container) -: size_(Glib::Container_Helpers::BoolArraySourceTraits::get_size(container)), - parray_(Glib::Container_Helpers::BoolArraySourceTraits::get_data(container, size_)), - ownership_(Glib::Container_Helpers::BoolArraySourceTraits::initial_ownership) -{ -} - -inline ArrayHandle>::ArrayHandle( - const gboolean* array, std::size_t array_size, Glib::OwnershipType ownership) -: size_((array) ? array_size : 0), parray_(array), ownership_(ownership) -{ -} - -inline ArrayHandle>::ArrayHandle( - const gboolean* array, Glib::OwnershipType ownership) -: size_((array) ? Glib::Container_Helpers::compute_array_size(array) : 0), - parray_(array), - ownership_(ownership) -{ -} - -inline ArrayHandle>::ArrayHandle( - const ArrayHandle>& other) -: size_(other.size_), parray_(other.parray_), ownership_(other.ownership_) -{ - other.ownership_ = Glib::OWNERSHIP_NONE; -} - -inline ArrayHandle>::const_iterator -ArrayHandle>::begin() const -{ - return Glib::Container_Helpers::ArrayHandleIterator(parray_); -} - -inline ArrayHandle>::const_iterator -ArrayHandle>::end() const -{ - return Glib::Container_Helpers::ArrayHandleIterator(parray_ + size_); -} - -template -inline void -ArrayHandle>::assign_to(Cont& container) const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - container.assign(this->begin(), this->end()); -#else - Cont temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - container.swap(temp); -#endif -} - -template -inline void -ArrayHandle>::copy(Out pdest) const -{ - std::copy(this->begin(), this->end(), pdest); -} - -inline const gboolean* -ArrayHandle>::data() const -{ - return parray_; -} - -inline std::size_t -ArrayHandle>::size() const -{ - return size_; -} - -inline bool -ArrayHandle>::empty() const -{ - return (size_ == 0); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} // namespace Glib - -#endif /* _GLIBMM_ARRAYHANDLE_H */ diff --git a/glib/glibmm/base64.cc b/glib/glibmm/base64.cc index 9f098db..c9c279c 100644 --- a/glib/glibmm/base64.cc +++ b/glib/glibmm/base64.cc @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/base64.h b/glib/glibmm/base64.h index 5fae475..eda3da0 100644 --- a/glib/glibmm/base64.h +++ b/glib/glibmm/base64.h @@ -15,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc index 29219a6..29ab8cf 100644 --- a/glib/glibmm/class.cc +++ b/glib/glibmm/class.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -84,14 +85,9 @@ Class::register_derived_type(GType base_type, GTypeModule* module) } GType -Class::clone_custom_type(const char* custom_type_name) const -{ - return clone_custom_type(custom_type_name, interface_class_vector_type()); -} - -GType Class::clone_custom_type( - const char* custom_type_name, const interface_class_vector_type& interface_classes) const + const char* custom_type_name, const interface_classes_type* interface_classes, + const class_init_funcs_type* class_init_funcs, GInstanceInitFunc instance_init_func) const { std::string full_name("gtkmm__CustomObject_"); Glib::append_canonical_typename(full_name, custom_type_name); @@ -117,30 +113,43 @@ Class::clone_custom_type( // GTypeQuery::instance_size is guint but GTypeInfo::instance_size is guint16. const guint16 instance_size = (guint16)base_query.instance_size; + // Let the wrapper's class_init_function() be the first one to call. + auto all_class_init_funcs = new class_init_funcs_type( + 1, std::tuple(class_init_func_, nullptr)); + if (class_init_funcs) + all_class_init_funcs->insert(all_class_init_funcs->end(), + class_init_funcs->begin(), class_init_funcs->end()); + const GTypeInfo derived_info = { class_size, nullptr, // base_init &Class::custom_class_base_finalize_function, // base_finalize &Class::custom_class_init_function, nullptr, // class_finalize - this, // class_data + all_class_init_funcs, // class_data instance_size, 0, // n_preallocs - nullptr, // instance_init + instance_init_func, // instance_init nullptr, // value_table }; + // custom_class_init_function() is called when the first object of the custom + // class is created, which is after clone_custom_type() has returned. + // Let custom_class_init_function() delete all_class_init_funcs. + custom_type = g_type_register_static(base_type, full_name.c_str(), &derived_info, GTypeFlags(0)); // Add derived versions of interfaces, if the C type implements any interfaces. // For instance, TreeModel_Class::add_interface(). - for (interface_class_vector_type::size_type i = 0; i < interface_classes.size(); i++) + if (interface_classes) { - const Interface_Class* interface_class = interface_classes[i]; - if (interface_class) + for (auto interface_class : *interface_classes) { - interface_class->add_interface(custom_type); + if (interface_class) + { + interface_class->add_interface(custom_type); + } } } } @@ -176,19 +185,36 @@ Class::custom_class_base_finalize_function(void* g_class) void Class::custom_class_init_function(void* g_class, void* class_data) { - // The class_data pointer is set to 'this' by clone_custom_type(). - const Class* const self = static_cast(class_data); + // clone_custom_type() sets the class data pointer to a pointer to a vector + // of pointers to functions to be called. + const class_init_funcs_type& class_init_funcs = + *static_cast(class_data); - g_return_if_fail(self->class_init_func_ != nullptr); + g_return_if_fail(!class_init_funcs.empty() && std::get(class_init_funcs[0]) != nullptr); // Call the wrapper's class_init_function() to redirect // the vfunc and default signal handler callbacks. - (*self->class_init_func_)(g_class, nullptr); + auto init_func = std::get(class_init_funcs[0]); + (*init_func)(g_class, nullptr); GObjectClass* const gobject_class = static_cast(g_class); gobject_class->get_property = &Glib::custom_get_property_callback; gobject_class->set_property = &Glib::custom_set_property_callback; + // Call extra class init functions, if any. + for (std::size_t i = 1; i < class_init_funcs.size(); ++i) + { + if (auto extra_init_func = std::get(class_init_funcs[i])) + { + auto extra_class_data = std::get(class_init_funcs[i]); + (*extra_init_func)(g_class, extra_class_data); + } + } + + // Assume that this function is called exactly once for each type. + // Delete the class_init_funcs_type that was created in clone_custom_type(). + delete static_cast(class_data); + // Override the properties of implemented interfaces, if any. const GType object_type = G_TYPE_FROM_CLASS(g_class); diff --git a/glib/glibmm/class.h b/glib/glibmm/class.h index 3ffc51e..e790715 100644 --- a/glib/glibmm/class.h +++ b/glib/glibmm/class.h @@ -1,9 +1,6 @@ -// -*- c++ -*- #ifndef _GLIBMM_CLASS_H #define _GLIBMM_CLASS_H -/* $Id$ */ - /* Copyright 2001 Free Software Foundation * Copyright (C) 1998-2002 The gtkmm Development Team * @@ -18,13 +15,15 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include //Include this here so that the /private/*.h classes have access to GLIBMM_VFUNCS_ENABLED #include //For interface properties that custom types might override. +#include #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -53,20 +52,13 @@ public: inline GType get_type() const; - // TODO: Remove this method at the next ABI/API break. - /** 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 - * of the get_type() type. If a type with the specified name is already registered, - * nothing is done. register_derived_type() must have been called. - * @param custom_type_name The name of the registered type is - * "gtkmm__CustomObject_" + canonic(custom_type_name), where canonic() - * replaces special characters with '+'. - * @return The registered type. - */ - GType clone_custom_type(const char* custom_type_name) const; - /// The type that holds pointers to the interfaces of custom types. - using interface_class_vector_type = std::vector; + using interface_classes_type = std::vector; + /** The type that holds pointers to extra class init functions of custom types. + * The std::tuple contains a function pointer and a pointer to class data. + * The class data pointer can be nullptr, if the function does not need it. + */ + using class_init_funcs_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 @@ -75,11 +67,16 @@ public: * @param custom_type_name The name of the registered type is * "gtkmm__CustomObject_" + canonic(custom_type_name), where canonic() * replaces special characters with '+'. - * @param interface_classes Interfaces that the custom type implements. + * @param interface_classes Interfaces that the custom type implements (can be nullptr). + * @param class_init_funcs Extra class init functions (can be nullptr). These + * functions, if any, are called after the class init function of this + * class's type, e.g. Gtk::Widget. + * @param instance_init_func Instance init function (can be nullptr). * @return The registered type. */ GType clone_custom_type( - const char* custom_type_name, const interface_class_vector_type& interface_classes) const; + const char* custom_type_name, const interface_classes_type* interface_classes, + const class_init_funcs_type* class_init_funcs, GInstanceInitFunc instance_init_func) const; protected: GType gtype_; diff --git a/glib/glibmm/containerhandle_shared.h b/glib/glibmm/containerhandle_shared.h index 851df9c..c798550 100644 --- a/glib/glibmm/containerhandle_shared.h +++ b/glib/glibmm/containerhandle_shared.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -53,43 +54,6 @@ enum OwnershipType OWNERSHIP_DEEP /*!< Release the list, and its elements, when the container is deleted. */ }; -/** Utility class holding an iterator sequence. - * @ingroup ContHandles - * This can be used to initialize a Glib container handle (such as - * Glib::ArrayHandle) with an iterator sequence. Use the helper - * function Glib::sequence() to create a Sequence<> object. - */ -template -class Sequence -{ -private: - Iterator pbegin_; - Iterator pend_; - -public: - Sequence(Iterator pbegin, Iterator pend) : pbegin_(pbegin), pend_(pend) {} - - Iterator begin() const { return pbegin_; } - Iterator end() const { return pend_; } - std::size_t size() const { return std::distance(pbegin_, pend_); } -}; - -/** Helper function to create a Glib::Sequence<> object, which - * in turn can be used to initialize a container handle. - * @ingroup ContHandles - * - * @par Usage example: - * @code - * combo.set_popdown_strings(Glib::sequence(foo_begin, foo_end)); - * @endcode - */ -template -inline Sequence -sequence(Iterator pbegin, Iterator pend) -{ - return Sequence(pbegin, pend); -} - namespace Container_Helpers { @@ -205,7 +169,7 @@ struct TypeTraits> // because that would be "dependent", and g++ 3.4 does not allow that. // The specific Glib::wrap() overloads don't do anything special anyway. GObject* cobj = (GObject*)(ptr); - return Glib::RefPtr(dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); + return Glib::make_refptr_for_instance(dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); // We use dynamic_cast<> in case of multiple inheritance. } @@ -241,7 +205,7 @@ struct TypeTraits> // because that would be "dependent", and g++ 3.4 does not allow that. // The specific Glib::wrap() overloads don't do anything special anyway. GObject* cobj = (GObject*)const_cast(ptr); - return Glib::RefPtr( + return Glib::make_refptr_for_instance( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); // We use dynamic_cast<> in case of multiple inheritance. } diff --git a/glib/glibmm/containers.h b/glib/glibmm/containers.h deleted file mode 100644 index 55fc2c5..0000000 --- a/glib/glibmm/containers.h +++ /dev/null @@ -1,360 +0,0 @@ -#ifndef _GLIBMM_CONTAINERS_H -#define _GLIBMM_CONTAINERS_H - -/* containers.h - * - * Copyright (C) 1998-2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include /* for backward compatibility */ -#include -#include -#include -#include - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -namespace Glib -{ - -template -class List_Iterator; -template -class List_ConstIterator; -template -class List_ReverseIterator; - -// Most of these methods in the non-template classes needs to be moved -// to implementation. - -// Daniel Elstner has ideas about generating these per-widget with m4. murrayc. - -extern GLIBMM_API gpointer glibmm_null_pointer; - -template -class List_Iterator_Base -{ -public: - using value_type = T; - using pointer = T*; - using reference = T&; -}; - -/// For instance, List_Iterator< Gtk::Widget > -template -class List_Iterator : public List_Iterator_Base -{ -public: - using iterator_category = std::bidirectional_iterator_tag; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using pointer = typename List_Iterator_Base::pointer; - using reference = typename List_Iterator_Base::reference; - - GList* const* head_; - GList* node_; - - using Self = List_Iterator; - - List_Iterator(GList* const& head, GList* node) : head_(&head), node_(node) {} - - List_Iterator() : head_(nullptr), node_(nullptr) {} - - List_Iterator(const Self& src) : head_(src.head_), node_(src.node_) {} - - bool operator==(const Self& src) const { return node_ == src.node_; } - bool operator!=(const Self& src) const { return node_ != src.node_; } - - Self& operator++() - { - if (!node_) - node_ = g_list_first(*head_); - else - node_ = (GList*)g_list_next(node_); - return *this; - } - - Self operator++(int) - { - Self tmp = *this; - ++*this; - return tmp; - } - - Self& operator--() - { - if (!node_) - node_ = g_list_last(*head_); - else - node_ = (GList*)g_list_previous(node_); - - return *this; - } - - Self operator--(int) - { - Self tmp = *this; - --*this; - return tmp; - } - - reference operator*() const { return *(pointer)(node_ ? node_->data : glibmm_null_pointer); } - - pointer operator->() const { return &**this; } -}; - -/// For instance, SList_Iterator< Gtk::Widget > -template -class SList_Iterator : public List_Iterator_Base -{ -public: - using iterator_category = std::forward_iterator_tag; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using pointer = typename List_Iterator_Base::pointer; - using reference = typename List_Iterator_Base::reference; - - GSList* node_; - using Self = SList_Iterator; - - SList_Iterator(GSList* node) : node_(node) {} - - SList_Iterator() : node_(nullptr) {} - - SList_Iterator(const Self& src) : node_(src.node_) {} - - bool operator==(const Self& src) const { return node_ == src.node_; } - bool operator!=(const Self& src) const { return node_ != src.node_; } - - Self& operator++() - { - node_ = g_slist_next(node_); - return *this; - } - - Self operator++(int) - { - Self tmp = *this; - ++*this; - return tmp; - } - - reference operator*() const - { - return reinterpret_cast(node_ ? node_->data : glibmm_null_pointer); - } - - pointer operator->() const { return &**this; } -}; - -// This iterator variation returns T_IFace (wrapped from T_Impl) -// For instance, List_Cpp_Iterator is -// a little like std::list::iterator -template -class List_Cpp_Iterator : public List_Iterator_Base -{ -public: - using iterator_category = std::bidirectional_iterator_tag; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using pointer = typename List_Iterator_Base::pointer; - using reference = typename List_Iterator_Base::reference; - - using Self = List_Cpp_Iterator; - - GList** head_; - GList* node_; - - bool operator==(const Self& src) const { return node_ == src.node_; } - bool operator!=(const Self& src) const { return node_ != src.node_; } - - List_Cpp_Iterator(GList*& head, GList* node) : head_(&head), node_(node) {} - - List_Cpp_Iterator() : head_(nullptr), node_(nullptr) {} - - List_Cpp_Iterator(const Self& src) : head_(src.head_), node_(src.node_) {} - - reference operator*() const - { - if (node_ && node_->data) - { - // We copy/paste the widget wrap() implementation here, - // because we can not use a specific Glib::wrap(T_Impl) overload here, - // because that would be "dependent", and g++ 3.4 does not allow that. - // The specific Glib::wrap() overloads don't do anything special anyway. - GObject* cobj = static_cast(node_->data); - -#ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION - return *dynamic_cast(Glib::wrap_auto(cobj, false)); -#else - // We really do need to use dynamic_cast<>, so I expect problems if this code is used. - // murrayc. - return *static_cast(Glib::wrap_auto(cobj, false)); -#endif - } - return *static_cast(nullptr); // boom! - } - - pointer operator->() const { return &**this; } - - Self& operator++() - { - if (!node_) - node_ = g_list_first(*head_); - else - node_ = (GList*)g_list_next(node_); - - return *this; - } - - Self operator++(int) - { - Self tmp = *this; - ++*this; - return tmp; - } - - Self& operator--() - { - if (!node_) - node_ = g_list_last(*head_); - else - node_ = (GList*)g_list_previous(node_); - - return *this; - } - - Self operator--(int) - { - Self tmp = *this; - --*this; - return tmp; - } -}; - -template -class List_ReverseIterator : private T_Base -{ -public: - using iterator_category = typename T_Base::iterator_category; - using size_type = typename T_Base::size_type; - using difference_type = typename T_Base::difference_type; - - using value_type = typename T_Base::value_type; - using pointer = typename T_Base::pointer; - using reference = typename T_Base::reference; - - 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); } - - List_ReverseIterator(GList* const& head, GList* node) : T_Base(head, node) {} - - List_ReverseIterator() : T_Base() {} - - List_ReverseIterator(const Self& src) : T_Base(src) {} - - List_ReverseIterator(const T_Base& src) : T_Base(src) { ++(*this); } - - Self& operator++() - { - T_Base::operator--(); - return *this; - } - Self& operator--() - { - T_Base::operator++(); - return *this; - } - Self operator++(int) - { - Self src = *this; - T_Base::operator--(); - return src; - } - Self operator--(int) - { - Self src = *this; - T_Base::operator++(); - return src; - } - - reference operator*() const { return T_Base::operator*(); } - pointer operator->() const { return T_Base::operator->(); } -}; - -template -class List_ConstIterator : public T_Base -{ -public: - using iterator_category = typename T_Base::iterator_category; - using size_type = typename T_Base::size_type; - using difference_type = typename T_Base::difference_type; - - using value_type = const typename T_Base::value_type; - using pointer = const typename T_Base::pointer; - using reference = const typename T_Base::reference; - - 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); } - - List_ConstIterator(GList* const& head, GList* node) : T_Base(head, node) {} - - List_ConstIterator() : T_Base() {} - - List_ConstIterator(const Self& src) : T_Base(src) {} - - List_ConstIterator(const T_Base& src) : T_Base(src) {} - - Self& operator++() - { - T_Base::operator++(); - return *this; - } - Self& operator--() - { - T_Base::operator--(); - return *this; - } - Self operator++(int) - { - Self src = *this; - T_Base::operator++(); - return src; - } - Self operator--(int) - { - Self src = *this; - T_Base::operator--(); - return src; - } - - reference operator*() const { return T_Base::operator*(); } - pointer operator->() const { return T_Base::operator->(); } -}; - -} // namespace Glib - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -#endif /* _GLIBMM_CONTAINERS_H */ diff --git a/glib/glibmm/debug.cc b/glib/glibmm/debug.cc index fd0b757..4fc3699 100644 --- a/glib/glibmm/debug.cc +++ b/glib/glibmm/debug.cc @@ -1,3 +1,5 @@ +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/debug.h b/glib/glibmm/debug.h index 2c32e54..831f246 100644 --- a/glib/glibmm/debug.h +++ b/glib/glibmm/debug.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GLIBMM_DEBUG_H #define _GLIBMM_DEBUG_H @@ -14,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc index 601e99e..cd6c43d 100644 --- a/glib/glibmm/dispatcher.cc +++ b/glib/glibmm/dispatcher.cc @@ -11,13 +11,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef GLIBMM_CAN_USE_THREAD_LOCAL -#include -#endif - #include #include #include @@ -26,7 +23,8 @@ #include #include #include -#include +#include +#include #include // For std::move() #ifdef G_OS_WIN32 @@ -50,17 +48,26 @@ #define EINTR 0 /* TODO: should use the real define */ #endif +namespace Glib +{ +class DispatchNotifier; +} + namespace { struct DispatchNotifyData { - Glib::Dispatcher* dispatcher; + Glib::Dispatcher::Impl* dispatcher_impl; Glib::DispatchNotifier* notifier; - DispatchNotifyData() : dispatcher(nullptr), notifier(nullptr) {} + DispatchNotifyData() + : dispatcher_impl(nullptr), notifier(nullptr) + {} - DispatchNotifyData(Glib::Dispatcher* d, Glib::DispatchNotifier* n) : dispatcher(d), notifier(n) {} + DispatchNotifyData(Glib::Dispatcher::Impl* d, Glib::DispatchNotifier* n) + : dispatcher_impl(d), notifier(n) + {} }; static void @@ -120,11 +127,33 @@ fd_close_and_invalidate(int& fd) } #endif /* !G_OS_WIN32 */ +void warn_dropped_dispatcher_message() +{ + g_warning("Dropped dispatcher message as the dispatcher no longer exists."); +} + } // anonymous namespace namespace Glib { +// The most important reason for having the dispatcher implementation in a separate +// class is that its deletion can be delayed until it's safe to delete it. +// Deletion is safe when the pipe does not contain any message to the dispatcher +// to delete. When the pipe is empty, it's surely safe. +struct Dispatcher::Impl +{ +public: + sigc::signal signal_; + DispatchNotifier* notifier_; + + explicit Impl(const Glib::RefPtr& context); + + // noncopyable + Impl(const Impl&) = delete; + Impl& operator=(const Impl&) = delete; +}; + class DispatchNotifier : public sigc::trackable { public: @@ -134,11 +163,10 @@ public: DispatchNotifier(const DispatchNotifier&) = delete; DispatchNotifier& operator=(const DispatchNotifier&) = delete; - static DispatchNotifier* reference_instance( - const Glib::RefPtr& context, const Dispatcher* dispatcher); - static void unreference_instance(DispatchNotifier* notifier, const Dispatcher* dispatcher); + static DispatchNotifier* reference_instance(const Glib::RefPtr& context); + static void unreference_instance(DispatchNotifier* notifier, Dispatcher::Impl* dispatcher_impl); - void send_notification(Dispatcher* dispatcher); + void send_notification(Dispatcher::Impl* dispatcher_impl); protected: // Only used by reference_instance(). Should be private, but that triggers @@ -146,14 +174,10 @@ 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_; + using UniqueImplPtr = std::unique_ptr; + std::forward_list orphaned_dispatcher_impl_; long ref_count_; Glib::RefPtr context_; #ifdef G_OS_WIN32 @@ -172,16 +196,10 @@ 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_(), +: orphaned_dispatcher_impl_(), ref_count_(0), context_(context), #ifdef G_OS_WIN32 @@ -204,10 +222,10 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr& context) // The following code is equivalent to // context_->signal_io().connect( - // sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN); + // sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IOCondition::IN); // except for source->set_can_recurse(true). - const auto source = IOSource::create(fd, Glib::IO_IN); + const auto source = IOSource::create(fd, Glib::IOCondition::IN); // If the signal emission in pipe_io_handler() starts a new main loop, // the event source shall not be blocked while that loop runs. (E.g. while @@ -277,40 +295,20 @@ DispatchNotifier::create_pipe() } // static -DispatchNotifier* -DispatchNotifier::reference_instance( - const Glib::RefPtr& context, const Dispatcher* dispatcher) +DispatchNotifier* DispatchNotifier::reference_instance( + const Glib::RefPtr& context) { -#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 { // Prevent massive mess-up. g_return_val_if_fail(instance->context_ == context, nullptr); - - // In the possible but unlikely case that a new dispatcher gets the same - // address as a newly deleted one, if the pipe still contains messages to - // the deleted dispatcher, those messages will be delivered to the new one. - // Not ideal, but perhaps the best that can be done without breaking ABI. - // The alternative would be to remove the following erase(), and risk not - // delivering messages sent to the new dispatcher. - // TODO: When we can break ABI, a better solution without this drawback can - // be implemented. See https://bugzilla.gnome.org/show_bug.cgi?id=651942 - // especially comment 16. - instance->deleted_dispatchers_.erase(dispatcher); } ++instance->ref_count_; // initially 0 @@ -319,48 +317,49 @@ DispatchNotifier::reference_instance( } // static -void -DispatchNotifier::unreference_instance(DispatchNotifier* notifier, const Dispatcher* dispatcher) +void DispatchNotifier::unreference_instance( + DispatchNotifier* notifier, Dispatcher::Impl* dispatcher_impl) { -#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); if (instance->pipe_is_empty()) - // No messages in the pipe. No need to keep track of deleted dispatchers. - instance->deleted_dispatchers_.clear(); + { + // No messages in the pipe. Delete the Dispatcher::Impl immediately. + delete dispatcher_impl; + instance->orphaned_dispatcher_impl_.clear(); + } else - // There are messages in the pipe, possibly to the deleted dispatcher. - // Keep its address, so pipe_io_handler() can avoid delivering messages to it. - instance->deleted_dispatchers_.insert(dispatcher); + { + // There are messages in the pipe, possibly to the orphaned Dispatcher::Impl. + // Keep it around until it can safely be deleted. + // Delete all slots connected to the Dispatcher. Then the signal emission + // in pipe_io_handler() will do nothing. + dispatcher_impl->signal_.clear(); + // Add a slot that will warn that a message has been dropped. + dispatcher_impl->signal_.connect(sigc::ptr_fun(warn_dropped_dispatcher_message)); + instance->orphaned_dispatcher_impl_.push_front(UniqueImplPtr(dispatcher_impl)); + } if (--instance->ref_count_ <= 0) { 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 } } -void -DispatchNotifier::send_notification(Dispatcher* dispatcher) +void DispatchNotifier::send_notification(Dispatcher::Impl* dispatcher_impl) { #ifdef G_OS_WIN32 { const std::lock_guard lock(mutex_); const bool was_empty = notify_queue_.empty(); - notify_queue_.emplace_back(DispatchNotifyData(dispatcher, this)); + notify_queue_.emplace_back(DispatchNotifyData(dispatcher_impl, this)); if (was_empty) { @@ -372,7 +371,7 @@ DispatchNotifier::send_notification(Dispatcher* dispatcher) } #else /* !G_OS_WIN32 */ - DispatchNotifyData data(dispatcher, this); + DispatchNotifyData data(dispatcher_impl, this); gssize n_written; do @@ -405,10 +404,10 @@ DispatchNotifier::pipe_is_empty() #ifdef G_OS_WIN32 return notify_queue_.empty(); #else - PollFD poll_fd(fd_receiver_, Glib::IO_IN); + PollFD poll_fd(fd_receiver_, Glib::IOCondition::IN); // GPollFD*, number of file descriptors to poll, timeout (ms) g_poll(poll_fd.gobj(), 1, 0); - return (poll_fd.get_revents() & Glib::IO_IN) == 0; + return static_cast(poll_fd.get_revents() & Glib::IOCondition::IN) == 0; #endif } @@ -466,75 +465,69 @@ bool DispatchNotifier::pipe_io_handler(Glib::IOCondition) g_return_val_if_fail(data.notifier == this, true); - // Drop the received message, if it is addressed to a deleted dispatcher. - const bool drop_message = - (deleted_dispatchers_.find(data.dispatcher) != deleted_dispatchers_.end()); - - // If the pipe is empty, there can be no messages to deleted dispatchers. - // No reason to keep track of them any more. - if (!deleted_dispatchers_.empty() && pipe_is_empty()) - deleted_dispatchers_.clear(); - - if (drop_message) - { - g_warning("Dropped dispatcher message as the dispatcher no longer exists"); - return true; - } - // Actually, we wouldn't need the try/catch block because the Glib::Source // C callback already does it for us. However, we do it anyway because the // default return value is 'false', which is not what we want. try { - data.dispatcher->signal_(); // emit + data.dispatcher_impl->signal_(); // emit } catch (...) { Glib::exception_handlers_invoke(); } + if (!orphaned_dispatcher_impl_.empty() && pipe_is_empty()) + orphaned_dispatcher_impl_.clear(); + return true; } -/**** Glib::Dispatcher *****************************************************/ +/**** Glib::Dispatcher and Glib::Dispatcher::Impl **************************/ -Dispatcher::Dispatcher() -: signal_(), notifier_(DispatchNotifier::reference_instance(MainContext::get_default(), this)) +Dispatcher::Impl::Impl(const Glib::RefPtr& context) +: signal_(), + notifier_(DispatchNotifier::reference_instance(context)) { } +Dispatcher::Dispatcher() +: impl_(new Dispatcher::Impl(MainContext::get_default())) +{} + + Dispatcher::Dispatcher(const Glib::RefPtr& context) -: signal_(), notifier_(DispatchNotifier::reference_instance(context, this)) +: impl_(new Dispatcher::Impl(context)) { } Dispatcher::~Dispatcher() noexcept { - DispatchNotifier::unreference_instance(notifier_, this); + DispatchNotifier::unreference_instance(impl_->notifier_, impl_); } void Dispatcher::emit() { - notifier_->send_notification(this); + impl_->notifier_->send_notification(impl_); } void Dispatcher::operator()() { - notifier_->send_notification(this); + impl_->notifier_->send_notification(impl_); } sigc::connection -Dispatcher::connect(const sigc::slot& slot) +Dispatcher::connect(const sigc::slot& slot) { - return signal_.connect(slot); + return impl_->signal_.connect(slot); } sigc::connection -Dispatcher::connect(sigc::slot&& slot) +Dispatcher::connect(sigc::slot&& slot) { - return signal_.connect(std::move(slot)); + return impl_->signal_.connect(std::move(slot)); } } // namespace Glib diff --git a/glib/glibmm/dispatcher.h b/glib/glibmm/dispatcher.h index 9b7b967..f66a523 100644 --- a/glib/glibmm/dispatcher.h +++ b/glib/glibmm/dispatcher.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -23,13 +24,9 @@ namespace Glib { -#ifndef DOXYGEN_SHOULD_SKIP_THIS -class DispatchNotifier; -#endif - /** Signal class for inter-thread communication. * @ingroup Threads - * Glib::Dispatcher works similar to sigc::signal. But unlike normal + * Glib::Dispatcher works similar to sigc::signal. But unlike normal * signals, the notification happens asynchronously through a pipe. This is * a simple and efficient way of communicating between threads, and especially * useful in a thread model with a single GUI thread. @@ -87,18 +84,17 @@ public: void emit(); void operator()(); - sigc::connection connect(const sigc::slot& slot); + sigc::connection connect(const sigc::slot& slot); /** @newin{2,48} */ - sigc::connection connect(sigc::slot&& slot); + sigc::connection connect(sigc::slot&& slot); -private: - sigc::signal signal_; - DispatchNotifier* notifier_; + #ifndef DOXYGEN_SHOULD_SKIP_THIS + struct Impl; + #endif -#ifndef DOXYGEN_SHOULD_SKIP_THIS - friend class Glib::DispatchNotifier; -#endif +private: + Impl* impl_; // hidden implementation }; /*! A Glib::Dispatcher example. diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc index e3afe5b..0906336 100644 --- a/glib/glibmm/error.cc +++ b/glib/glibmm/error.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h index c015e75..eb61b4e 100644 --- a/glib/glibmm/error.h +++ b/glib/glibmm/error.h @@ -15,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/exception.cc b/glib/glibmm/exception.cc index 2c25ea9..b1e9322 100644 --- a/glib/glibmm/exception.cc +++ b/glib/glibmm/exception.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* exception.cc * * Copyright 2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include //For g_assert() in glib >= 2.15.0 diff --git a/glib/glibmm/exception.h b/glib/glibmm/exception.h index 726f39e..bc9feae 100644 --- a/glib/glibmm/exception.h +++ b/glib/glibmm/exception.h @@ -1,5 +1,7 @@ +// -*- c++ -*- #ifndef _GLIBMM_EXCEPTION_H #define _GLIBMM_EXCEPTION_H +/* $Id$ */ /* exception.h * @@ -16,7 +18,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc index 023c204..e80e009 100644 --- a/glib/glibmm/exceptionhandler.cc +++ b/glib/glibmm/exceptionhandler.cc @@ -1,3 +1,5 @@ +// -*- c++ -*- + /* exceptionhandler.cc * * Copyright 2002 The gtkmm Development Team @@ -13,12 +15,10 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef GLIBMM_CAN_USE_THREAD_LOCAL -#include -#endif #include #include #include @@ -33,11 +33,7 @@ using HandlerList = std::list>; // 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) @@ -87,22 +83,14 @@ namespace Glib { sigc::connection -add_exception_handler(const sigc::slot& slot) +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->emplace_back(slot); @@ -127,11 +115,7 @@ 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->begin(); diff --git a/glib/glibmm/exceptionhandler.h b/glib/glibmm/exceptionhandler.h index 34a0250..acfd6f5 100644 --- a/glib/glibmm/exceptionhandler.h +++ b/glib/glibmm/exceptionhandler.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GLIBMM_EXCEPTIONHANDLER_H #define _GLIBMM_EXCEPTIONHANDLER_H @@ -16,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,7 +29,7 @@ namespace Glib /** Specify a slot to be called when an exception is thrown by a signal handler. */ -sigc::connection add_exception_handler(const sigc::slot& slot); +sigc::connection add_exception_handler(const sigc::slot& slot); #ifndef DOXYGEN_SHOULD_SKIP_THIS // internal diff --git a/glib/glibmm/containers.cc b/glib/glibmm/extraclassinit.cc similarity index 57% rename from glib/glibmm/containers.cc rename to glib/glibmm/extraclassinit.cc index bb19f45..343fc6f 100644 --- a/glib/glibmm/containers.cc +++ b/glib/glibmm/extraclassinit.cc @@ -1,6 +1,4 @@ -/* containers.h - * - * Copyright (C) 1998-2002 The gtkmm Development Team +/* Copyright (C) 2017 The glibmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,14 +11,22 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library. If not, see . */ -#include +#include namespace Glib { -gpointer glibmm_null_pointer = nullptr; +ExtraClassInit::ExtraClassInit(GClassInitFunc class_init_func, void* class_data, + GInstanceInitFunc instance_init_func) +{ + if (class_init_func) + add_custom_class_init_function(class_init_func, class_data); + + if (instance_init_func) + set_custom_instance_init_function(instance_init_func); +} } // namespace Glib diff --git a/glib/glibmm/extraclassinit.h b/glib/glibmm/extraclassinit.h new file mode 100644 index 0000000..9d2fc60 --- /dev/null +++ b/glib/glibmm/extraclassinit.h @@ -0,0 +1,97 @@ +#ifndef _GLIBMM_EXTRACLASSINIT_H +#define _GLIBMM_EXTRACLASSINIT_H +/* Copyright (C) 2017 The glibmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#include + +namespace Glib +{ + +/** A convenience class for named custom types. + * + * Use it if you need to add code to GType's class init function and/or + * need an instance init function. + * Example: + * @code + * #include + * + * class MyExtraInit : public Glib::ExtraClassInit + * { + * public: + * MyExtraInit(const Glib::ustring& css_name) + * : + * Glib::ExtraClassInit(my_extra_class_init_function, &m_css_name, my_instance_init_function), + * m_css_name(css_name) + * { } + * + * private: + * static void my_extra_class_init_function(void* g_class, void* class_data) + * { + * const auto klass = static_cast(g_class); + * const auto css_name = static_cast(class_data); + * gtk_widget_class_set_css_name(klass, css_name->c_str()); + * } + * static void my_instance_init_function(GTypeInstance* instance, void* g_class) + * { + * gtk_widget_set_has_window(GTK_WIDGET(instance), true); + * } + * + * Glib::ustring m_css_name; + * }; + * + * class MyWidget : public Gtk::WidgetCustomDraw, public MyExtraInit, public Gtk::Widget + * { + * public: + * MyWidget() + * : + * // The GType name will be gtkmm__CustomObject_MyMidget + * Glib::ObjectBase("MyWidget"), // Unique class name + * Gtk::WidgetCustomDraw(), + * MyExtraInit("my-widget"), + * Gtk::Widget() + * { + * // ... + * } + * // ... + * }; + * @endcode + * + * @note Classes derived from %ExtraClassInit (Gtk::WidgetCustomDraw and MyExtraInit + * in the example) must be listed before Glib::Object or a class derived from + * %Glib::Object (Gtk::Widget in the example) in the list of base classes. + * + * @newin{2,52} + */ +class ExtraClassInit : virtual public ObjectBase +{ +protected: + /** Constructor. + * + * @param class_init_func Pointer to an extra class init function. + * nullptr, if no extra class init function is needed. + * @param class_data Class data pointer, passed to the class init function. + * Can be nullptr, if the class init function does not need it. + * @param instance_init_func Pointer to an instance init function. + * nullptr, if no instance init function is needed. + */ + explicit ExtraClassInit(GClassInitFunc class_init_func, void* class_data = nullptr, + GInstanceInitFunc instance_init_func = nullptr); +}; + +} // namespace Glib + +#endif /* _GLIBMM_EXTRACLASSINIT_H */ diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am index b5a6169..0218b17 100644 --- a/glib/glibmm/filelist.am +++ b/glib/glibmm/filelist.am @@ -5,15 +5,14 @@ glibmm_files_built_h = $(glibmm_files_used_hg:.hg=.h) $(glibmm_files_h_m4:.m4=) glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_used_hg)) glibmm_files_extra_cc = \ - arrayhandle.cc \ base64.cc \ class.cc \ - containers.cc \ debug.cc \ dispatcher.cc \ error.cc \ exception.cc \ exceptionhandler.cc \ + extraclassinit.cc \ init.cc \ interface.cc \ main.cc \ @@ -25,12 +24,9 @@ glibmm_files_extra_cc = \ propertyproxy_base.cc \ quark.cc \ random.cc \ - sarray.cc \ signalproxy.cc \ signalproxy_connectionnode.cc \ - streamiochannel.cc \ stringutils.cc \ - threadpool.cc \ timer.cc \ timeval.cc \ ustring.cc \ @@ -42,22 +38,19 @@ glibmm_files_extra_cc = \ wrap.cc glibmm_files_extra_h = \ - arrayhandle.h \ base64.h \ class.h \ containerhandle_shared.h \ - containers.h \ debug.h \ dispatcher.h \ error.h \ exception.h \ exceptionhandler.h \ - helperlist.h \ + extraclassinit.h \ i18n-lib.h \ i18n.h \ init.h \ interface.h \ - listhandle.h \ main.h \ object.h \ objectbase.h \ @@ -69,13 +62,9 @@ glibmm_files_extra_h = \ quark.h \ random.h \ refptr.h \ - sarray.h \ signalproxy.h \ signalproxy_connectionnode.h \ - slisthandle.h \ - streamiochannel.h \ stringutils.h \ - threadpool.h \ timer.h \ timeval.h \ ustring.h \ @@ -84,7 +73,6 @@ glibmm_files_extra_h = \ value_custom.h \ variantdbusstring.h \ vectorutils.h \ - weakref.h \ wrap.h \ wrap_init.h diff --git a/glib/glibmm/helperlist.h b/glib/glibmm/helperlist.h deleted file mode 100644 index 751b42d..0000000 --- a/glib/glibmm/helperlist.h +++ /dev/null @@ -1,151 +0,0 @@ -#ifndef _GLIBMM_HELPERLIST_H -#define _GLIBMM_HELPERLIST_H - -/* helperlist.h - * - * Copyright 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -// This is not hidden by GLIBMM_DISABLE_DEPRECATED -// because gtkmm-2.24 still uses this type in its public API. -// Note that gtkmm-2.24 itself is completely deprecated, so we really -// can remove this whole class some time soon. -//#ifndef GLIBMM_DISABLE_DEPRECATED - -#include - -namespace Glib -{ - -// This class has some pure virtual methods which need to be implemented by derived classes. - -/** - * @deprecated This class should no longer be necessary. It has not been used - * by glibmm or gtkmm since gtkmm-2.4. - */ -template -class HelperList -{ -public: - HelperList() : gparent_(nullptr) {} - - HelperList(GObject* - gp) // We use gp instead of gparent because that can cause warnings about a shadowed member. - : gparent_(gp) - { - } - - virtual ~HelperList() noexcept {} - - using value_type = T_Child; - using reference = value_type&; - using const_reference = const value_type&; - - using iterator = T_Iterator; - using const_iterator = List_ConstIterator; - using reverse_iterator = List_ReverseIterator; - using const_reverse_iterator = List_ConstIterator; - - using element_type = T_CppElement; - - 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; - - virtual void erase(iterator start, iterator stop) - { - while (start != stop) - start = erase(start); // Implemented in derived class. - } - - virtual void remove(const_reference) = 0; - - size_type size() const { return g_list_length(glist()); } - - inline size_type max_size() { return size_type(-1); } - inline bool empty() { return glist() == nullptr; } - - inline iterator begin() { return begin_(); } - inline iterator end() { return end_(); } - - inline const_iterator begin() const { return const_iterator(begin_()); } - inline const_iterator end() const { return const_iterator(end_()); } - - inline reverse_iterator rbegin() { return reverse_iterator(end_()); } - inline reverse_iterator rend() { return reverse_iterator(begin_()); } - - inline const_reverse_iterator rbegin() const - { - return const_reverse_iterator(reverse_iterator(end_())); - } - inline const_reverse_iterator rend() const - { - return const_reverse_iterator(reverse_iterator(begin_())); - } - - reference front() const { return *begin(); } - - reference back() const { return *(--end()); } - - reference operator[](size_type l) const - { - size_type j = 0; - iterator i; - for (i = begin(), j = 0; i != end() && j < l; ++i, ++j) - ; - return (*i); - } - - // iterator find(const_reference w) - // { - // iterator i = begin(); - // for(i = begin(); i != end() && (*i != w); i++); - // return i; - // } - // - // iterator find(Widget& w) - // { - // iterator i; - // for (i = begin(); i != end() && ((*i)->$1() != &w); i++); - // return i; - // } - - // Derived classes might choose to reimplement these as public: - inline void pop_front() { erase(begin()); } - inline void pop_back() { erase(--end()); } - - void clear() { erase(begin(), end()); } - - GObject* gparent() { return gparent_; }; - const GObject* gparent() const { return gparent_; }; - -protected: - virtual GList*& glist() const = 0; // front of list - - iterator begin_() const { return iterator(glist(), glist()); } - - iterator end_() const { return iterator(glist(), (GList*)nullptr); } - - GObject* gparent_; -}; - -} /* namespace Glib */ - -//#endif //GLIBMM_DISABLE_DEPRECATED - -#endif /* _GLIBMM_HELPERLIST_H */ diff --git a/glib/glibmm/i18n-lib.h b/glib/glibmm/i18n-lib.h index 62a19f6..1a7cd1b 100644 --- a/glib/glibmm/i18n-lib.h +++ b/glib/glibmm/i18n-lib.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_I18N_LIB_H #define _GLIBMM_I18N_LIB_H +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -14,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // Include this file to define internationalization macros such as _(). diff --git a/glib/glibmm/i18n.h b/glib/glibmm/i18n.h index 17639ac..d35d9a7 100644 --- a/glib/glibmm/i18n.h +++ b/glib/glibmm/i18n.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_I18N_H #define _GLIBMM_I18N_H +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -14,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // Include this file to define internationalization macros such as _(). diff --git a/glib/glibmm/init.cc b/glib/glibmm/init.cc index ab96892..f42cdf5 100644 --- a/glib/glibmm/init.cc +++ b/glib/glibmm/init.cc @@ -11,20 +11,73 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include +#include +#include +#include + +namespace +{ + bool init_to_users_preferred_locale = true; + +} // anonymous namespace namespace Glib { +void set_init_to_users_preferred_locale(bool state) +{ + init_to_users_preferred_locale = state; +} + +bool get_init_to_users_preferred_locale() +{ + return init_to_users_preferred_locale; +} -void -init() +void init() { + static bool is_initialized = false; + + if (is_initialized) + return; + + if (init_to_users_preferred_locale) + { + try + { + // Set the global locale for C++ functions and the locale for C functions + // to the user-preferred locale. + std::locale::global(std::locale("")); + } + catch (const std::runtime_error& ex) + { + g_warning("Can't set the global locale to the user's preferred locale.\n" + " %s\n The environment variable LANG may be wrong.\n", ex.what()); + } + } + else + { + try + { + // Make the C++ locale equal to the C locale. + std::locale::global(std::locale(std::setlocale(LC_ALL, nullptr))); + } + catch (const std::runtime_error& ex) + { + g_warning("Can't make the global C++ locale equal to the C locale.\n" + " %s\n C locale = %s\n", ex.what(), std::setlocale(LC_ALL, nullptr)); + } + } + // Also calls Glib::wrap_register_init() and Glib::wrap_init(). Glib::Error::register_init(); + + is_initialized = true; } } // namespace Glib diff --git a/glib/glibmm/init.h b/glib/glibmm/init.h index 1245cd3..a736093 100644 --- a/glib/glibmm/init.h +++ b/glib/glibmm/init.h @@ -1,9 +1,6 @@ -// -*- c++ -*- #ifndef _GLIBMM_INIT_H #define _GLIBMM_INIT_H -/* $Id$ */ - /* Copyright (C) 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -17,19 +14,58 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Glib { /** Initialize glibmm. - * You may call this more than once. - * You do not need to call this if you are using Glib::MainLoop or Gtk::Main, - * because they call it for you. + * + * You may call this more than once. Calls after the first one have no effect. + * Sets the global locale as specified by set_init_to_users_preferred_locale(). + * You do not need to call %Glib::init() if you are using Gtk::Application, + * because it calls %Glib::init() for you. + * + * @see set_init_to_users_preferred_locale() */ void init(); +/** Instruct Glib::init() which global locale to set. + * + * To have the intended effect, this function must be called before init() is called. + * Not calling it has the same effect as calling it with @a state = true. + * + * Note the confusing difference between C locale and "C" locale. + * The C locale is the locale used by C code, set by std::setlocale(LC_ALL, locale_name). + * The "C" locale is the classic locale, set by std::setlocale(LC_ALL, "C") + * or std::locale::global(std::locale::classic()). It's the default global locale + * in a C or C++ program. + * + * In a mixed C and C++ program, like a program using glibmm, having the C global + * locale differ from std::locale::global() is error prone. Glib::init() tries + * to avoid that. + * + * @param state If true, init() will set the C and C++ global locale + * to the user's preferred locale (std::locale::global(std::locale(""))). + * The user's preferred locale is set in the program's environment, + * usually with the LANG environment variable.
+ * If false, init() will set the C++ global locale to the C global locale + * (std::locale::global(std::locale(std::setlocale(LC_ALL, nullptr)))). + * + * @newin{2,52} + */ +void set_init_to_users_preferred_locale(bool state = true); + +/** Get the state, set with set_init_to_users_preferred_locale(). + * @returns The state, set with set_init_to_users_preferred_locale(); true + * if set_init_to_users_preferred_locale() has not been called. + * + * @newin{2,52} + */ +bool get_init_to_users_preferred_locale(); + } // namespace Glib #endif /* _GLIBMM_INIT_H */ diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc index d13c5d8..34f590e 100644 --- a/glib/glibmm/interface.cc +++ b/glib/glibmm/interface.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -95,10 +96,9 @@ Interface::Interface(const Interface_Class& interface_class) } else // gobject_ == nullptr { - // The GObject is not instantiated yet. Add to the custom_interface_classes - // and add the interface in the Glib::Object constructor. - std::lock_guard lock(extra_object_base_data_mutex); - extra_object_base_data[this].custom_interface_classes.emplace_back(&interface_class); + // The GObject is not instantiated yet. Add to the stored custom interface + // classes, and add the interface to the GType in the Glib::Object constructor. + add_custom_interface_class(&interface_class); } } } @@ -156,7 +156,7 @@ Interface::get_base_type() RefPtr wrap_interface(GObject* object, bool take_copy) { - return Glib::RefPtr(wrap_auto(object, take_copy)); + return Glib::make_refptr_for_instance(wrap_auto(object, take_copy)); } } // namespace Glib diff --git a/glib/glibmm/interface.h b/glib/glibmm/interface.h index 9e35b5e..0b27914 100644 --- a/glib/glibmm/interface.h +++ b/glib/glibmm/interface.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_INTERFACE_H #define _GLIBMM_INTERFACE_H +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -14,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/listhandle.h b/glib/glibmm/listhandle.h deleted file mode 100644 index d9ffeb1..0000000 --- a/glib/glibmm/listhandle.h +++ /dev/null @@ -1,412 +0,0 @@ -#ifndef _GLIBMM_LISTHANDLE_H -#define _GLIBMM_LISTHANDLE_H - -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include -#include - -namespace Glib -{ - -namespace Container_Helpers -{ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/* Create and fill a GList as efficient as possible. - * This requires bidirectional iterators. - */ -template -GList* -create_list(Bi pbegin, Bi pend, Tr) -{ - GList* head = nullptr; - - while (pend != pbegin) - { - // Use & to force a warning if the iterator returns a temporary object. - const void* const item = Tr::to_c_type(*&*--pend); - head = g_list_prepend(head, const_cast(item)); - } - - return head; -} - -/* Create a GList from a 0-terminated input sequence. - * Build it in reverse order and reverse the whole list afterwards, - * because appending to the list would be horribly inefficient. - */ -template -GList* -create_list(For pbegin, Tr) -{ - GList* head = nullptr; - - while (*pbegin) - { - // Use & to force a warning if the iterator returns a temporary object. - const void* const item = Tr::to_c_type(*&*pbegin); - head = g_list_prepend(head, const_cast(item)); - ++pbegin; - } - - return g_list_reverse(head); -} - -/* Convert from any container that supports bidirectional iterators. - */ -template -struct ListSourceTraits -{ - static GList* get_data(const Cont& cont) - { - return Glib::Container_Helpers::create_list(cont.begin(), cont.end(), Tr()); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -/* Convert from a 0-terminated array. The Cont - * argument must be a pointer to the first element. - */ -template -struct ListSourceTraits -{ - static GList* get_data(const Cont* array) - { - return (array) ? Glib::Container_Helpers::create_list(array, Tr()) : nullptr; - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -template -struct ListSourceTraits : ListSourceTraits -{ -}; - -/* Convert from a 0-terminated array. The Cont argument must be a pointer - * to the first element. For consistency, the array must be 0-terminated, - * even though the array size is known at compile time. - */ -template -struct ListSourceTraits -{ - static GList* get_data(const Cont* array) - { - return Glib::Container_Helpers::create_list(array, array + (N - 1), Tr()); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -template -struct ListSourceTraits : ListSourceTraits -{ -}; - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -/** - * @ingroup ContHelpers - */ -template -class ListHandleIterator -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - 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); - - inline value_type operator*() const; - inline ListHandleIterator& operator++(); - inline const ListHandleIterator operator++(int); - - inline bool operator==(const ListHandleIterator& rhs) const; - inline bool operator!=(const ListHandleIterator& rhs) const; - -private: - const GList* node_; -}; - -} // namespace Container_Helpers - -// TODO: Remove this when we can break glibmm API. -/** This is an intermediate type. When a method takes this, or returns this, you - * should use a standard C++ container of your choice, such as std::list or - * std::vector. - * - * However, this is not used in new API. We now prefer to just use std::vector, - * which is less flexibile, but makes the API clearer. - * - * @ingroup ContHandles - */ -template > -class ListHandle -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - using value_type = CppType; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using const_iterator = Glib::Container_Helpers::ListHandleIterator; - using iterator = Glib::Container_Helpers::ListHandleIterator; - - template - inline ListHandle(const Cont& container); - - // Take over ownership of an array created by GTK+ functions. - inline ListHandle(GList* glist, Glib::OwnershipType ownership); - - // Copying clears the ownership flag of the source handle. - inline ListHandle(const ListHandle& other); - - ~ListHandle() noexcept; - - inline const_iterator begin() const; - inline const_iterator end() const; - - template - inline operator std::vector() const; - template - inline operator std::deque() const; - template - inline operator std::list() const; - - template - inline void assign_to(Cont& container) const; - - template - inline void copy(Out pdest) const; - - inline GList* data() const; - inline std::size_t size() const; - inline bool empty() const; - -private: - GList* plist_; - mutable Glib::OwnershipType ownership_; - - // No copy assignment. - ListHandle& operator=(const ListHandle&); -}; - -/***************************************************************************/ -/* Inline implementation */ -/***************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -namespace Container_Helpers -{ - -/**** Glib::Container_Helpers::ListHandleIterator<> ************************/ - -template -inline ListHandleIterator::ListHandleIterator(const GList* node) : node_(node) -{ -} - -template -inline typename ListHandleIterator::value_type ListHandleIterator::operator*() const -{ - return Tr::to_cpp_type(static_cast(node_->data)); -} - -template -inline ListHandleIterator& ListHandleIterator::operator++() -{ - node_ = node_->next; - return *this; -} - -template -inline const ListHandleIterator ListHandleIterator::operator++(int) -{ - const ListHandleIterator tmp(*this); - node_ = node_->next; - return tmp; -} - -template -inline bool -ListHandleIterator::operator==(const ListHandleIterator& rhs) const -{ - return (node_ == rhs.node_); -} - -template -inline bool -ListHandleIterator::operator!=(const ListHandleIterator& rhs) const -{ - return (node_ != rhs.node_); -} - -} // namespace Container_Helpers - -/**** Glib::ListHandle<> ***************************************************/ - -template -template -inline ListHandle::ListHandle(const Cont& container) -: plist_(Glib::Container_Helpers::ListSourceTraits::get_data(container)), - ownership_(Glib::Container_Helpers::ListSourceTraits::initial_ownership) -{ -} - -template -inline ListHandle::ListHandle(GList* glist, Glib::OwnershipType ownership) -: plist_(glist), ownership_(ownership) -{ -} - -template -inline ListHandle::ListHandle(const ListHandle& other) -: plist_(other.plist_), ownership_(other.ownership_) -{ - other.ownership_ = Glib::OWNERSHIP_NONE; -} - -template -ListHandle::~ListHandle() noexcept -{ - if (ownership_ != Glib::OWNERSHIP_NONE) - { - if (ownership_ != Glib::OWNERSHIP_SHALLOW) - { - // Deep ownership: release each container element. - for (GList* node = plist_; node != nullptr; node = node->next) - Tr::release_c_type(static_cast(node->data)); - } - g_list_free(plist_); - } -} - -template -inline typename ListHandle::const_iterator -ListHandle::begin() const -{ - return Glib::Container_Helpers::ListHandleIterator(plist_); -} - -template -inline typename ListHandle::const_iterator -ListHandle::end() const -{ - return Glib::Container_Helpers::ListHandleIterator(nullptr); -} - -template -template -inline ListHandle::operator std::vector() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::vector(this->begin(), this->end()); -#else - std::vector temp; - temp.reserve(this->size()); - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline ListHandle::operator std::deque() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::deque(this->begin(), this->end()); -#else - std::deque temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline ListHandle::operator std::list() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::list(this->begin(), this->end()); -#else - std::list temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline void -ListHandle::assign_to(Cont& container) const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - container.assign(this->begin(), this->end()); -#else - Cont temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - container.swap(temp); -#endif -} - -template -template -inline void -ListHandle::copy(Out pdest) const -{ - std::copy(this->begin(), this->end(), pdest); -} - -template -inline GList* -ListHandle::data() const -{ - return plist_; -} - -template -inline std::size_t -ListHandle::size() const -{ - return g_list_length(plist_); -} - -template -inline bool -ListHandle::empty() const -{ - return (plist_ == nullptr); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} // namespace Glib - -#endif /* _GLIBMM_LISTHANDLE_H */ diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc index 68f2176..1f51e51 100644 --- a/glib/glibmm/main.cc +++ b/glib/glibmm/main.cc @@ -11,28 +11,20 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include // May define GLIBMM_DISABLE_DEPRECATED -#ifndef GLIBMM_DISABLE_DEPRECATED -// Include glibmm/thread.h first because we need it to be first to include , -// so we can do an undef trick to still use deprecated API in the header: -#include -#include -#endif // GLIBMM_DISABLE_DEPRECATED - #include #include #include #include #include -#include // Needed until the next ABI break. namespace { -#ifdef GLIBMM_DISABLE_DEPRECATED void time64_to_time_val(gint64 time64, Glib::TimeVal& time_val) { @@ -42,34 +34,14 @@ time64_to_time_val(gint64 time64, Glib::TimeVal& time_val) static_cast(time64 - static_cast(seconds) * G_GINT64_CONSTANT(1000000)); time_val = Glib::TimeVal(seconds, microseconds); } -#endif // GLIBMM_DISABLE_DEPRECATED - -// TODO: At the next ABI break, replace ExtraSourceData by new data members in Source. -// Then the mutex is not necessary, but to keep the code thread-safe, use the -// g_atomic_*() functions on these data elements. -// These are new data members that can't be added to Glib::Source now, -// because it would break ABI. -struct ExtraSourceData -{ - ExtraSourceData() : ref_count(1), keep_wrapper(2) {} - int ref_count; - // When both Source::unreference() and SourceCallbackData::destroy_notify_callback() - // have decreased keep_wrapper, it's time to delete the C++ wrapper. - int keep_wrapper; -}; - -std::map extra_source_data; -// Source instances may be used in different threads. -// Accesses to extra_source_data must be thread-safe. -std::mutex extra_source_data_mutex; -class SourceConnectionNode +class SourceConnectionNode : public sigc::notifiable { public: explicit inline SourceConnectionNode(const sigc::slot_base& slot); - static void* notify(void* data); - static void destroy_notify_callback(void* data); + static void notify(sigc::notifiable* data); + static void destroy_notify_callback(sigc::notifiable* data); inline void install(GSource* source); inline sigc::slot_base* get_slot(); @@ -85,8 +57,8 @@ inline SourceConnectionNode::SourceConnectionNode(const sigc::slot_base& slot) slot_.set_parent(this, &SourceConnectionNode::notify); } -void* -SourceConnectionNode::notify(void* data) +void +SourceConnectionNode::notify(sigc::notifiable* data) { SourceConnectionNode* const self = static_cast(data); @@ -101,13 +73,11 @@ SourceConnectionNode::notify(void* data) // Destroying the object triggers execution of destroy_notify_handler(), // either immediately or later, so we leave that to do the deletion. } - - return nullptr; } // static void -SourceConnectionNode::destroy_notify_callback(void* data) +SourceConnectionNode::destroy_notify_callback(sigc::notifiable* data) { SourceConnectionNode* const self = static_cast(data); @@ -173,17 +143,8 @@ SourceCallbackData::destroy_notify_callback(void* data) if (self->node) SourceConnectionNode::destroy_notify_callback(self->node); - if (self->wrapper) - { - std::unique_lock lock(extra_source_data_mutex); - if (--extra_source_data[self->wrapper].keep_wrapper == 0) - { - // No other reference exists to the wrapper. Delete it! - extra_source_data.erase(self->wrapper); - lock.unlock(); - Glib::Source::destroy_notify_callback(self->wrapper); - } - } + // destroy_notify_callback2() does nothing if self->wrapper == nullptr. + Glib::Source::destroy_notify_callback2(self->wrapper); delete self; } @@ -231,7 +192,7 @@ glibmm_source_callback(void* data) try { // Recreate the specific slot from the generic slot node. - return (*static_cast*>(conn_data->get_slot()))(); + return (*static_cast*>(conn_data->get_slot()))(); } catch (...) { @@ -252,7 +213,7 @@ glibmm_source_callback_once(void* data) try { // Recreate the specific slot from the generic slot node. - (*static_cast*>(conn_data->get_slot()))(); + (*static_cast*>(conn_data->get_slot()))(); } catch (...) { @@ -261,6 +222,13 @@ glibmm_source_callback_once(void* data) return 0; // Destroy the event source after one call } +static void +glibmm_source_destroy_notify_callback(void* data) +{ + SourceConnectionNode* const conn_data = static_cast(data); + SourceConnectionNode::destroy_notify_callback(conn_data); +} + static gboolean glibmm_iosource_callback(GIOChannel*, GIOCondition condition, void* data) { @@ -270,7 +238,7 @@ glibmm_iosource_callback(GIOChannel*, GIOCondition condition, void* data) try { // Recreate the specific slot from the generic slot node. - return (*static_cast*>(callback_data->node->get_slot()))( + return (*static_cast*>(callback_data->node->get_slot()))( (Glib::IOCondition)condition); } catch (...) @@ -292,7 +260,7 @@ glibmm_child_watch_callback(GPid pid, gint child_status, void* data) try { // Recreate the specific slot from the generic slot node. - (*static_cast*>(conn_data->get_slot()))(pid, child_status); + (*static_cast*>(conn_data->get_slot()))(pid, child_status); } catch (...) { @@ -303,7 +271,7 @@ glibmm_child_watch_callback(GPid pid, gint child_status, void* data) static void glibmm_signal_connect_once( - const sigc::slot& slot, int priority, GSource* source, GMainContext* context) + const sigc::slot& slot, int priority, GSource* source, GMainContext* context) { SourceConnectionNode* const conn_node = new SourceConnectionNode(slot); @@ -311,7 +279,7 @@ glibmm_signal_connect_once( g_source_set_priority(source, priority); g_source_set_callback(source, &glibmm_source_callback_once, conn_node, - &SourceConnectionNode::destroy_notify_callback); + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context); @@ -326,7 +294,7 @@ glibmm_main_context_invoke_callback(void* data) try { // Recreate the specific slot from the generic slot node. - return (*static_cast*>(slot))(); + return (*static_cast*>(slot))(); } catch (...) { @@ -366,7 +334,7 @@ PollFD::PollFD(PollFD::fd_t fd) PollFD::PollFD(PollFD::fd_t fd, IOCondition events) { gobject_.fd = fd; - gobject_.events = events; + gobject_.events = static_cast(events); gobject_.revents = 0; } @@ -378,7 +346,7 @@ inline SignalTimeout::SignalTimeout(GMainContext* context) : context_(context) /* Note that this is our equivalent of g_timeout_add(). */ sigc::connection -SignalTimeout::connect(const sigc::slot& slot, unsigned int interval, int priority) +SignalTimeout::connect(const sigc::slot& slot, unsigned int interval, int priority) { SourceConnectionNode* const conn_node = new SourceConnectionNode(slot); const sigc::connection connection(*conn_node->get_slot()); @@ -389,7 +357,8 @@ SignalTimeout::connect(const sigc::slot& slot, unsigned int interval, int g_source_set_priority(source, priority); g_source_set_callback( - source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback); + source, &glibmm_source_callback, conn_node, + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context_); @@ -399,7 +368,7 @@ SignalTimeout::connect(const sigc::slot& slot, unsigned int interval, int } void -SignalTimeout::connect_once(const sigc::slot& slot, unsigned int interval, int priority) +SignalTimeout::connect_once(const sigc::slot& slot, unsigned int interval, int priority) { GSource* const source = g_timeout_source_new(interval); glibmm_signal_connect_once(slot, priority, source, context_); @@ -407,7 +376,7 @@ SignalTimeout::connect_once(const sigc::slot& slot, unsigned int interval, /* Note that this is our equivalent of g_timeout_add_seconds(). */ sigc::connection -SignalTimeout::connect_seconds(const sigc::slot& slot, unsigned int interval, int priority) +SignalTimeout::connect_seconds(const sigc::slot& slot, unsigned int interval, int priority) { SourceConnectionNode* const conn_node = new SourceConnectionNode(slot); const sigc::connection connection(*conn_node->get_slot()); @@ -418,7 +387,8 @@ SignalTimeout::connect_seconds(const sigc::slot& slot, unsigned int interv g_source_set_priority(source, priority); g_source_set_callback( - source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback); + source, &glibmm_source_callback, conn_node, + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context_); @@ -429,7 +399,7 @@ SignalTimeout::connect_seconds(const sigc::slot& slot, unsigned int interv void SignalTimeout::connect_seconds_once( - const sigc::slot& slot, unsigned int interval, int priority) + const sigc::slot& slot, unsigned int interval, int priority) { GSource* const source = g_timeout_source_new_seconds(interval); glibmm_signal_connect_once(slot, priority, source, context_); @@ -448,7 +418,7 @@ inline SignalIdle::SignalIdle(GMainContext* context) : context_(context) } sigc::connection -SignalIdle::connect(const sigc::slot& slot, int priority) +SignalIdle::connect(const sigc::slot& slot, int priority) { SourceConnectionNode* const conn_node = new SourceConnectionNode(slot); const sigc::connection connection(*conn_node->get_slot()); @@ -459,7 +429,8 @@ SignalIdle::connect(const sigc::slot& slot, int priority) g_source_set_priority(source, priority); g_source_set_callback( - source, &glibmm_source_callback, conn_node, &SourceConnectionNode::destroy_notify_callback); + source, &glibmm_source_callback, conn_node, + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context_); @@ -469,7 +440,7 @@ SignalIdle::connect(const sigc::slot& slot, int priority) } void -SignalIdle::connect_once(const sigc::slot& slot, int priority) +SignalIdle::connect_once(const sigc::slot& slot, int priority) { GSource* const source = g_idle_source_new(); glibmm_signal_connect_once(slot, priority, source, context_); @@ -489,7 +460,7 @@ inline SignalIO::SignalIO(GMainContext* context) : context_(context) sigc::connection SignalIO::connect( - const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, int priority) + const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, int priority) { const auto source = IOSource::create(fd, condition); @@ -504,7 +475,7 @@ SignalIO::connect( } sigc::connection -SignalIO::connect(const sigc::slot& slot, const Glib::RefPtr& channel, +SignalIO::connect(const sigc::slot& slot, const Glib::RefPtr& channel, IOCondition condition, int priority) { const auto source = IOSource::create(channel, condition); @@ -532,7 +503,7 @@ inline SignalChildWatch::SignalChildWatch(GMainContext* context) : context_(cont } sigc::connection -SignalChildWatch::connect(const sigc::slot& slot, GPid pid, int priority) +SignalChildWatch::connect(const sigc::slot& slot, GPid pid, int priority) { SourceConnectionNode* const conn_node = new SourceConnectionNode(slot); const sigc::connection connection(*conn_node->get_slot()); @@ -542,8 +513,9 @@ SignalChildWatch::connect(const sigc::slot& slot, GPid pid, int if (priority != G_PRIORITY_DEFAULT) g_source_set_priority(source, priority); - g_source_set_callback(source, (GSourceFunc)&glibmm_child_watch_callback, conn_node, - &SourceConnectionNode::destroy_notify_callback); + g_source_set_callback(source, (GSourceFunc)&glibmm_child_watch_callback, + conn_node, + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context_); @@ -564,7 +536,7 @@ signal_child_watch() Glib::RefPtr MainContext::create() { - return Glib::RefPtr(reinterpret_cast(g_main_context_new())); + return Glib::make_refptr_for_instance(reinterpret_cast(g_main_context_new())); } // static @@ -598,20 +570,6 @@ MainContext::acquire() return g_main_context_acquire(gobj()); } -#ifndef GLIBMM_DISABLE_DEPRECATED -bool -MainContext::wait(Glib::Cond& cond, Glib::Mutex& mutex) -{ - return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj()); -} - -bool -MainContext::wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex) -{ - return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj()); -} -#endif // GLIBMM_DISABLE_DEPRECATED - void MainContext::release() { @@ -690,10 +648,10 @@ MainContext::remove_poll(PollFD& fd) } void -MainContext::invoke(const sigc::slot& slot, int priority) +MainContext::invoke(const sigc::slot& slot, int priority) { // Make a copy of slot on the heap. - sigc::slot_base* const slot_copy = new sigc::slot(slot); + sigc::slot_base* const slot_copy = new sigc::slot(slot); g_main_context_invoke_full(gobj(), priority, glibmm_main_context_invoke_callback, slot_copy, glibmm_main_context_invoke_destroy_notify_callback); @@ -760,7 +718,7 @@ wrap(GMainContext* gobject, bool take_copy) if (take_copy && gobject) g_main_context_ref(gobject); - return Glib::RefPtr(reinterpret_cast(gobject)); + return Glib::make_refptr_for_instance(reinterpret_cast(gobject)); } /**** Glib::MainLoop *******************************************************/ @@ -768,13 +726,13 @@ wrap(GMainContext* gobject, bool take_copy) Glib::RefPtr MainLoop::create(bool is_running) { - return Glib::RefPtr(reinterpret_cast(g_main_loop_new(nullptr, is_running))); + return Glib::make_refptr_for_instance(reinterpret_cast(g_main_loop_new(nullptr, is_running))); } Glib::RefPtr MainLoop::create(const Glib::RefPtr& context, bool is_running) { - return Glib::RefPtr( + return Glib::make_refptr_for_instance( reinterpret_cast(g_main_loop_new(Glib::unwrap(context), is_running))); } @@ -846,7 +804,7 @@ wrap(GMainLoop* gobject, bool take_copy) if (take_copy && gobject) g_main_loop_ref(gobject); - return Glib::RefPtr(reinterpret_cast(gobject)); + return Glib::make_refptr_for_instance(reinterpret_cast(gobject)); } /**** Glib::Source *********************************************************/ @@ -925,30 +883,17 @@ Source::gobj_copy() const void Source::reference() const { - std::lock_guard lock(extra_source_data_mutex); - ++extra_source_data[this].ref_count; + ++ref_count_; } void Source::unreference() const { - std::unique_lock lock(extra_source_data_mutex); - if (--extra_source_data[this].ref_count == 0) + if (--ref_count_ == 0) { GSource* const tmp_gobject = gobject_; - if (--extra_source_data[this].keep_wrapper == 0) - { - // The last reference from a RefPtr has been deleted, and - // SourceCallbackData::destroy_notify_callback() has been called while - // extra_source_data[this].keep_wrapper was > 1. - // Delete the wrapper! - extra_source_data.erase(this); - lock.unlock(); - destroy_notify_callback(const_cast(this)); - } - else - lock.unlock(); + destroy_notify_callback2(const_cast(this)); // Drop the one and only GSource reference held by the C++ wrapper. // If the GSource instance is attached to a main context, the GMainContext @@ -1018,16 +963,6 @@ Source::remove_poll(Glib::PollFD& poll_fd) g_source_remove_poll(gobject_, poll_fd.gobj()); } -#ifndef GLIBMM_DISABLE_DEPRECATED -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -void -Source::get_current_time(Glib::TimeVal& current_time) -{ - g_source_get_current_time(gobject_, ¤t_time); -} -G_GNUC_END_IGNORE_DEPRECATIONS -#endif // GLIBMM_DISABLE_DEPRECATED - gint64 Source::get_time() const { @@ -1099,17 +1034,19 @@ Source::dispatch_vfunc(GSource*, GSourceFunc callback, void* user_data) // static void -Source::destroy_notify_callback(void* data) +Source::destroy_notify_callback2(void* data) { if (data) { Source* const self = static_cast(data); + if (--self->keep_wrapper_ == 0) + { + // gobject_ is already invalid at this point. + self->gobject_ = nullptr; - // gobject_ is already invalid at this point. - self->gobject_ = nullptr; - - // No exception checking: if the dtor throws, you're out of luck anyway. - delete self; + // No exception checking: if the dtor throws, you're out of luck anyway. + delete self; + } } } @@ -1125,7 +1062,8 @@ Source::attach_signal_source(const sigc::slot_base& slot, int priority, GSource* g_source_set_priority(source, priority); g_source_set_callback( - source, callback_func, conn_node, &SourceConnectionNode::destroy_notify_callback); + source, callback_func, conn_node, + &glibmm_source_destroy_notify_callback); conn_node->install(source); g_source_attach(source, context); @@ -1156,11 +1094,11 @@ Source::get_slot_from_callback_data(void* data) Glib::RefPtr TimeoutSource::create(unsigned int interval) { - return Glib::RefPtr(new TimeoutSource(interval)); + return Glib::make_refptr_for_instance(new TimeoutSource(interval)); } sigc::connection -TimeoutSource::connect(const sigc::slot& slot) +TimeoutSource::connect(const sigc::slot& slot) { return connect_generic(slot); } @@ -1179,11 +1117,7 @@ bool TimeoutSource::prepare(int& timeout) { Glib::TimeVal current_time; -#ifndef GLIBMM_DISABLE_DEPRECATED - get_current_time(current_time); -#else time64_to_time_val(get_time(), current_time); -#endif // GLIBMM_DISABLE_DEPRECATED Glib::TimeVal remaining = expiration_; remaining.subtract(current_time); @@ -1220,11 +1154,7 @@ bool TimeoutSource::check() { Glib::TimeVal current_time; -#ifndef GLIBMM_DISABLE_DEPRECATED - get_current_time(current_time); -#else time64_to_time_val(get_time(), current_time); -#endif // GLIBMM_DISABLE_DEPRECATED return (expiration_ <= current_time); } @@ -1232,15 +1162,11 @@ TimeoutSource::check() bool TimeoutSource::dispatch(sigc::slot_base* slot) { - const bool again = (*static_cast*>(slot))(); + const bool again = (*static_cast*>(slot))(); if (again) { -#ifndef GLIBMM_DISABLE_DEPRECATED - get_current_time(expiration_); -#else time64_to_time_val(get_time(), expiration_); -#endif // GLIBMM_DISABLE_DEPRECATED expiration_.add_milliseconds(std::min(G_MAXLONG, interval_)); } @@ -1253,11 +1179,11 @@ TimeoutSource::dispatch(sigc::slot_base* slot) Glib::RefPtr IdleSource::create() { - return Glib::RefPtr(new IdleSource()); + return Glib::make_refptr_for_instance(new IdleSource()); } sigc::connection -IdleSource::connect(const sigc::slot& slot) +IdleSource::connect(const sigc::slot& slot) { return connect_generic(slot); } @@ -1287,7 +1213,7 @@ IdleSource::check() bool IdleSource::dispatch(sigc::slot_base* slot) { - return (*static_cast*>(slot))(); + return (*static_cast*>(slot))(); } /**** Glib::IOSource *******************************************************/ @@ -1296,17 +1222,23 @@ IdleSource::dispatch(sigc::slot_base* slot) Glib::RefPtr IOSource::create(PollFD::fd_t fd, IOCondition condition) { - return Glib::RefPtr(new IOSource(fd, condition)); + return Glib::make_refptr_for_instance(new IOSource(fd, condition)); } Glib::RefPtr IOSource::create(const Glib::RefPtr& channel, IOCondition condition) { - return Glib::RefPtr(new IOSource(channel, condition)); + return Glib::make_refptr_for_instance(new IOSource(channel, condition)); +} + +Glib::RefPtr +IOSource::create(GIOChannel* channel, IOCondition condition) +{ + return Glib::make_refptr_for_instance(new IOSource(channel, condition)); } sigc::connection -IOSource::connect(const sigc::slot& slot) +IOSource::connect(const sigc::slot& slot) { return connect_generic(slot); } @@ -1322,6 +1254,12 @@ IOSource::IOSource(const Glib::RefPtr& channel, IOCondition condition { } +IOSource::IOSource(GIOChannel* channel, IOCondition condition) +: Source(g_io_create_watch(channel, (GIOCondition)condition), + (GSourceFunc)&glibmm_iosource_callback) +{ +} + IOSource::IOSource(GSource* cast_item, GSourceFunc callback_func) : Source(cast_item, callback_func) { } @@ -1340,13 +1278,13 @@ IOSource::prepare(int& timeout) bool IOSource::check() { - return ((poll_fd_.get_revents() & poll_fd_.get_events()) != 0); + return static_cast(poll_fd_.get_revents() & poll_fd_.get_events()) != 0; } bool IOSource::dispatch(sigc::slot_base* slot) { - return (*static_cast*>(slot))(poll_fd_.get_revents()); + return (*static_cast*>(slot))(poll_fd_.get_revents()); } } // namespace Glib diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h index 1b9a853..3306500 100644 --- a/glib/glibmm/main.h +++ b/glib/glibmm/main.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -25,21 +26,11 @@ #include #include #include +#include namespace Glib { -#ifndef GLIBMM_DISABLE_DEPRECATED -class Cond; -class Mutex; - -namespace Threads -{ -class Cond; -class Mutex; -} -#endif // GLIBMM_DISABLE_DEPRECATED - /** @defgroup MainLoop The Main Event Loop * Manages all available sources of events. * @{ @@ -57,10 +48,10 @@ public: void set_fd(fd_t fd) { gobject_.fd = fd; } fd_t get_fd() const { return gobject_.fd; } - void set_events(IOCondition events) { gobject_.events = events; } + void set_events(IOCondition events) { gobject_.events = static_cast(events); } IOCondition get_events() const { return static_cast(gobject_.events); } - void set_revents(IOCondition revents) { gobject_.revents = revents; } + void set_revents(IOCondition revents) { gobject_.revents = static_cast(revents); } IOCondition get_revents() const { return static_cast(gobject_.revents); } GPollFD* gobj() { return &gobject_; } @@ -70,16 +61,6 @@ private: GPollFD gobject_; }; -// Concerning SignalTimeout::connect_once(), SignalTimeout::connect_seconds_once() -// and SignalIdle::connect_once(): -// See https://bugzilla.gnome.org/show_bug.cgi?id=396963 and -// http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. -// It's recommended to replace sigc::slot& by std::function& in -// Threads::Thread::create() and ThreadPool::push() at the next ABI break. -// Such a replacement would be a mixed blessing in SignalTimeout and SignalIdle. -// In a single-threaded program auto-disconnection of trackable slots is safe -// and can be useful. - class SignalTimeout { public: @@ -123,7 +104,7 @@ public: * @return A connection handle, which can be used to disconnect the handler. */ sigc::connection connect( - const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); + const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); /** Connects a timeout handler that runs only once. * This method takes a function pointer to a function with a void return @@ -145,7 +126,7 @@ public: * @param priority The priority of the new event source. */ void connect_once( - const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); + const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); /** Connects a timeout handler with whole second granularity. * @@ -183,7 +164,7 @@ public: * @newin{2,14} */ sigc::connection connect_seconds( - const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); + const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); /** Connects a timeout handler that runs only once with whole second * granularity. @@ -207,7 +188,7 @@ public: * @param priority The priority of the new event source. */ void connect_seconds_once( - const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); + const sigc::slot& slot, unsigned int interval, int priority = PRIORITY_DEFAULT); private: GMainContext* context_; @@ -245,7 +226,7 @@ public: * @param priority The priority of the new event source. * @return A connection handle, which can be used to disconnect the handler. */ - sigc::connection connect(const sigc::slot& slot, int priority = PRIORITY_DEFAULT_IDLE); + sigc::connection connect(const sigc::slot& slot, int priority = PRIORITY_DEFAULT_IDLE); /** Connects an idle handler that runs only once. * This method takes a function pointer to a function with a void return @@ -265,7 +246,7 @@ public: * @endcode * @param priority The priority of the new event source. */ - void connect_once(const sigc::slot& slot, int priority = PRIORITY_DEFAULT_IDLE); + void connect_once(const sigc::slot& slot, int priority = PRIORITY_DEFAULT_IDLE); private: GMainContext* context_; @@ -306,7 +287,7 @@ public: * @param priority The priority of the new event source. * @return A connection handle, which can be used to disconnect the handler. */ - sigc::connection connect(const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, + sigc::connection connect(const sigc::slot& slot, PollFD::fd_t fd, IOCondition condition, int priority = PRIORITY_DEFAULT); /** Connects an I/O handler that watches an I/O channel. @@ -335,7 +316,7 @@ public: * @param priority The priority of the new event source. * @return A connection handle, which can be used to disconnect the handler. */ - sigc::connection connect(const sigc::slot& slot, + sigc::connection connect(const sigc::slot& slot, const Glib::RefPtr& channel, IOCondition condition, int priority = PRIORITY_DEFAULT); private: @@ -367,7 +348,7 @@ public: * @return A connection handle, which can be used to disconnect the handler. */ sigc::connection connect( - const sigc::slot& slot, GPid pid, int priority = PRIORITY_DEFAULT); + const sigc::slot& slot, GPid pid, int priority = PRIORITY_DEFAULT); private: GMainContext* context_; @@ -454,36 +435,6 @@ public: */ bool acquire(); -#ifndef GLIBMM_DISABLE_DEPRECATED - /** Tries to become the owner of the specified context, as with acquire(). But if another thread - * is the owner, - * atomically drop mutex and wait on cond until that owner releases ownership or until cond is - * signaled, then try - * again (once) to become the owner. - * @param cond A condition variable. - * @param mutex A mutex, currently held. - * @return true if the operation succeeded, and this thread is now the owner of context. - * - * @deprecated Use wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex) instead. - */ - bool wait(Glib::Cond& cond, Glib::Mutex& mutex); - - // Deprecated mostly because it uses deprecated Glib::Threads:: for parameters. - /** Tries to become the owner of the specified context, as with acquire(). But if another thread - * is the owner, - * atomically drop mutex and wait on cond until that owner releases ownership or until cond is - * signaled, then try - * again (once) to become the owner. - * @param cond A condition variable. - * @param mutex A mutex, currently held. - * @return true if the operation succeeded, and this thread is now the owner of context. - * - * @deprecated Please use the underlying g_main_context_wait() function if you really need this - * functionality. - */ - bool wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex); -#endif // GLIBMM_DISABLE_DEPRECATED - /** Releases ownership of a context previously acquired by this thread with acquire(). If the * context was acquired * multiple times, the only release ownership when release() is called as many times as it was @@ -584,7 +535,7 @@ public: * * @newin{2,38} */ - void invoke(const sigc::slot& slot, int priority = PRIORITY_DEFAULT); + void invoke(const sigc::slot& slot, int priority = PRIORITY_DEFAULT); /** Timeout signal, attached to this MainContext. * @return A signal proxy; you want to use SignalTimeout::connect(). @@ -822,6 +773,13 @@ protected: private: GSource* gobject_; + mutable std::atomic_int ref_count_ {1}; + // The C++ wrapper (the Source instance) is deleted, when both Source::unreference() + // and SourceCallbackData::destroy_notify_callback() have decreased keep_wrapper_ + // by calling destroy_notify_callback2(). + // https://bugzilla.gnome.org/show_bug.cgi?id=561885 + std::atomic_int keep_wrapper_ {2}; + #ifndef DOXYGEN_SHOULD_SKIP_THIS static inline Source* get_wrapper(GSource* source); @@ -832,7 +790,8 @@ private: static gboolean dispatch_vfunc(GSource* source, GSourceFunc callback, void* user_data); public: - static void destroy_notify_callback(void* data); + // Really destroys the object during the second call. See keep_wrapper_. + static void destroy_notify_callback2(void* data); // Used by SignalXyz, possibly in other files. static sigc::connection attach_signal_source(const sigc::slot_base& slot, int priority, GSource* source, GMainContext* context, GSourceFunc callback_func); @@ -849,7 +808,7 @@ public: using CppObjectType = Glib::TimeoutSource; static Glib::RefPtr create(unsigned int interval); - sigc::connection connect(const sigc::slot& slot); + sigc::connection connect(const sigc::slot& slot); protected: explicit TimeoutSource(unsigned int interval); @@ -872,7 +831,7 @@ public: using CppObjectType = Glib::IdleSource; static Glib::RefPtr create(); - sigc::connection connect(const sigc::slot& slot); + sigc::connection connect(const sigc::slot& slot); protected: IdleSource(); @@ -891,7 +850,7 @@ public: static Glib::RefPtr create(PollFD::fd_t fd, IOCondition condition); static Glib::RefPtr create( const Glib::RefPtr& channel, IOCondition condition); - sigc::connection connect(const sigc::slot& slot); + sigc::connection connect(const sigc::slot& slot); protected: IOSource(PollFD::fd_t fd, IOCondition condition); @@ -911,6 +870,14 @@ protected: bool dispatch(sigc::slot_base* slot) override; private: + friend IOChannel; + + // This is just to avoid the need for Gio::Socket to create a RefPtr<> to itself. + static Glib::RefPtr create(GIOChannel* channel, IOCondition condition); + + // This is just to avoid the need for Gio::Socket to create a RefPtr<> to itself. + IOSource(GIOChannel* channel, IOCondition condition); + PollFD poll_fd_; }; diff --git a/glib/glibmm/object.cc b/glib/glibmm/object.cc index 9169846..ce14269 100644 --- a/glib/glibmm/object.cc +++ b/glib/glibmm/object.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,33 +27,11 @@ #include -// Weak references: -// I'm not sure what the point of these are apart from being a hacky way out of circular references, -// but maybe we could make it easier to use them by making a Java Reference Object -style class like -// so: -// Glib::WeakRef weakrefSomeObject(object1); -// ... -// if(weakrefSomeObject->isStillAlive()) -// { -// weakrefSomeObject->some_method(); -// } -// else -// { -// //Deal with it, maybe recreating the object. -// } -// -// Without this, the coder has to define his own signal handler which sets his own isStillAlive -// boolean. -// weakrefSomeObject<> could still have its own signal_destroyed signal so that coders can choose to -// deal -// with the destruction as soon as it happens instead of just checking later before they try to use -// it. - namespace Glib { ConstructParams::ConstructParams(const Glib::Class& glibmm_class_) -: glibmm_class(glibmm_class_), n_parameters(0), parameters(nullptr) +: glibmm_class(glibmm_class_), n_parameters(0), parameter_names(nullptr), parameter_values(nullptr) { } @@ -68,7 +47,7 @@ ConstructParams::ConstructParams(const Glib::Class& glibmm_class_) */ ConstructParams::ConstructParams( const Glib::Class& glibmm_class_, const char* first_property_name, ...) -: glibmm_class(glibmm_class_), n_parameters(0), parameters(nullptr) +: glibmm_class(glibmm_class_), n_parameters(0), parameter_names(nullptr), parameter_values(nullptr) { va_list var_args; va_start(var_args, first_property_name); @@ -91,23 +70,26 @@ ConstructParams::ConstructParams( break; } - if (n_parameters >= n_alloced_params) - parameters = g_renew(GParameter, parameters, n_alloced_params += 8); - - GParameter& param = parameters[n_parameters]; + if (n_parameters >= n_alloced_params) { + n_alloced_params += 8; + parameter_names = g_renew(const char*, parameter_names, n_alloced_params); + parameter_values = g_renew(GValue, parameter_values, n_alloced_params); + } - param.name = name; - param.value.g_type = 0; + auto& param_name = parameter_names[n_parameters]; + auto& param_value = parameter_values[n_parameters]; + param_name = name; + param_value.g_type = 0; // Fill the GValue with the current vararg, and move on to the next one. - g_value_init(¶m.value, G_PARAM_SPEC_VALUE_TYPE(pspec)); - G_VALUE_COLLECT(¶m.value, var_args, 0, &collect_error); + g_value_init(¶m_value, G_PARAM_SPEC_VALUE_TYPE(pspec)); + G_VALUE_COLLECT(¶m_value, var_args, 0, &collect_error); if (collect_error) { g_warning("Glib::ConstructParams::ConstructParams(): %s", collect_error); g_free(collect_error); - g_value_unset(¶m.value); + g_value_unset(¶m_value); break; } @@ -121,30 +103,13 @@ ConstructParams::ConstructParams( ConstructParams::~ConstructParams() noexcept { - while (n_parameters > 0) - g_value_unset(¶meters[--n_parameters].value); - - g_free(parameters); -} - -/* - * Some compilers require the existence of a copy constructor in certain - * usage contexts. This implementation is fully functional, but unlikely - * to be ever actually called due to optimization. - */ -ConstructParams::ConstructParams(const ConstructParams& other) -: glibmm_class(other.glibmm_class), - n_parameters(other.n_parameters), - parameters(g_new(GParameter, n_parameters)) -{ - for (unsigned int i = 0; i < n_parameters; ++i) - { - parameters[i].name = other.parameters[i].name; - parameters[i].value.g_type = 0; - - g_value_init(¶meters[i].value, G_VALUE_TYPE(&other.parameters[i].value)); - g_value_copy(&other.parameters[i].value, ¶meters[i].value); + while (n_parameters > 0) { + auto& param_value = parameter_values[--n_parameters]; + g_value_unset(¶m_value); } + + g_free(parameter_names); + g_free(parameter_values); } /**** Glib::Object_Class ***************************************************/ @@ -193,27 +158,19 @@ Object::Object() if (custom_type_name_ && !is_anonymous_custom_()) { - Class::interface_class_vector_type custom_interface_classes; - - { - std::lock_guard lock(extra_object_base_data_mutex); - const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this); - if (iter != extra_object_base_data.end()) - { - custom_interface_classes = iter->second.custom_interface_classes; - extra_object_base_data.erase(iter); - } - } - object_class_.init(); + // This creates a type that is derived (indirectly) from GObject. - object_type = object_class_.clone_custom_type(custom_type_name_, custom_interface_classes); + object_type = object_class_.clone_custom_type(custom_type_name_, + get_custom_interface_classes(), get_custom_class_init_functions(), + get_custom_instance_init_function()); + custom_class_init_finished(); } - void* const new_object = g_object_new(object_type, nullptr); + GObject* const new_object = g_object_new_with_properties(object_type, 0, nullptr, nullptr); // Connect the GObject and Glib::Object instances. - ObjectBase::initialize(static_cast(new_object)); + ObjectBase::initialize(new_object); } Object::Object(const Glib::ConstructParams& construct_params) @@ -226,36 +183,22 @@ Object::Object(const Glib::ConstructParams& construct_params) if (custom_type_name_ && !is_anonymous_custom_()) { - Class::interface_class_vector_type custom_interface_classes; - - { - std::lock_guard lock(extra_object_base_data_mutex); - const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this); - if (iter != extra_object_base_data.end()) - { - custom_interface_classes = iter->second.custom_interface_classes; - extra_object_base_data.erase(iter); - } - } - object_type = - construct_params.glibmm_class.clone_custom_type(custom_type_name_, custom_interface_classes); + construct_params.glibmm_class.clone_custom_type(custom_type_name_, + get_custom_interface_classes(), get_custom_class_init_functions(), + get_custom_instance_init_function()); + custom_class_init_finished(); } // Create a new GObject with the specified array of construct properties. // This works with custom types too, since those inherit the properties of // their base class. - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - //TODO: Replace g_object_newv() by g_object_new_with_properties() when we can - // require glib 2.54. GParameter is also deprecated (only mentioned in a comment). - // Don't use it in ConstructParams when we can break ABI. - void* const new_object = - g_object_newv(object_type, construct_params.n_parameters, construct_params.parameters); - G_GNUC_END_IGNORE_DEPRECATIONS + GObject* const new_object = + g_object_new_with_properties(object_type, construct_params.n_parameters, construct_params.parameter_names, construct_params.parameter_values); // Connect the GObject and Glib::Object instances. - ObjectBase::initialize(static_cast(new_object)); + ObjectBase::initialize(new_object); } Object::Object(GObject* castitem) diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h index 79b37b5..006d5ea 100644 --- a/glib/glibmm/object.h +++ b/glib/glibmm/object.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // X11 defines DestroyNotify and some other non-prefixed stuff, and it's too late to change that @@ -53,8 +54,9 @@ class GSigConnectionNode; /* ConstructParams::ConstructParams() takes a varargs list of properties * and values, like g_object_new() does. This list will then be converted - * to a GParameter array, for use with g_object_newv(). No overhead is - * involved, since g_object_new() is just a wrapper around g_object_newv() + * to an array of parameter names and an array of parameter values, + * for use with g_object_new_with_properties(). No overhead is + * involved, since g_object_new() is just a wrapper around g_object_new_with_properties() * as well. * * The advantage of an auxiliary ConstructParams object over g_object_new() @@ -70,22 +72,16 @@ class ConstructParams public: const Glib::Class& glibmm_class; unsigned int n_parameters; - GParameter* parameters; + const char ** parameter_names; + GValue* parameter_values; explicit ConstructParams(const Glib::Class& glibmm_class_); ConstructParams(const Glib::Class& glibmm_class_, const char* first_property_name, ...) G_GNUC_NULL_TERMINATED; // warn if called without a trailing NULL pointer ~ConstructParams() noexcept; - // The copy constructor is semantically required by the C++ compiler - // (since g++ 3.4) to be able to create temporary instances, depending - // on the usage context. Apparently the compiler will actually optimize - // away the copy, though. See bug #132300. - ConstructParams(const ConstructParams& other); - -private: - // no copy assignment - ConstructParams& operator=(const ConstructParams&); + ConstructParams(const ConstructParams& other) = delete; + ConstructParams& operator=(const ConstructParams&) = delete; }; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ @@ -185,7 +181,7 @@ struct TypeTraits> // because that would be "dependent", and g++ 3.4 does not allow that. // The specific Glib::wrap() overloads don't do anything special anyway. GObject* cobj = (GObject*)const_cast(ptr); - return Glib::RefPtr(dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); + return Glib::make_refptr_for_instance(dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); // We use dynamic_cast<> in case of multiple inheritance. } @@ -221,7 +217,7 @@ struct TypeTraits> // because that would be "dependent", and g++ 3.4 does not allow that. // The specific Glib::wrap() overloads don't do anything special anyway. GObject* cobj = (GObject*)(ptr); - return Glib::RefPtr( + return Glib::make_refptr_for_instance( dynamic_cast(Glib::wrap_auto(cobj, true /* take_copy */))); // We use dynamic_cast<> in case of multiple inheritance. } @@ -237,9 +233,9 @@ struct TypeTraits> } // namespace Container_Helpers -template +template inline PtrT -Value_Pointer::get_(Glib::Object*) const +Value_Pointer::get_(Glib::Object*) const { return dynamic_cast(get_object()); } @@ -256,8 +252,8 @@ public: static GType value_type() { return T::get_base_type(); } - void set(const CppType& data) { set_object(data.operator->()); } - CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } + void set(const CppType& data) { set_object(data.get()); } + CppType get() const { return std::dynamic_pointer_cast(get_object_copy()); } }; // The SUN Forte Compiler has a problem with this: @@ -275,8 +271,8 @@ public: static GType value_type() { return T::get_base_type(); } - void set(const CppType& data) { set_object(const_cast(data.operator->())); } - CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } + void set(const CppType& data) { set_object(const_cast(data.get())); } + CppType get() const { return std::dynamic_pointer_cast(get_object_copy()); } }; #endif /* GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS */ diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc index 19fda47..7e36414 100644 --- a/glib/glibmm/objectbase.cc +++ b/glib/glibmm/objectbase.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -39,9 +40,16 @@ namespace Glib /**** Glib::ObjectBase *****************************************************/ -// static data members -ObjectBase::extra_object_base_data_type ObjectBase::extra_object_base_data; -std::mutex ObjectBase::extra_object_base_data_mutex; +// Used only during the construction of named custom types. +struct ObjectBase::PrivImpl +{ + // Pointers to the interfaces of custom types. + Class::interface_classes_type custom_interface_classes; + // Pointers to extra class init functions. + Class::class_init_funcs_type custom_class_init_functions; + // Pointer to the instance init function. + GInstanceInitFunc custom_instance_init_function = nullptr; +}; ObjectBase::ObjectBase() : gobject_(nullptr), @@ -51,12 +59,14 @@ ObjectBase::ObjectBase() } ObjectBase::ObjectBase(const char* custom_type_name) -: gobject_(nullptr), custom_type_name_(custom_type_name), cpp_destruction_in_progress_(false) +: gobject_(nullptr), custom_type_name_(custom_type_name), + cpp_destruction_in_progress_(false) { } ObjectBase::ObjectBase(const std::type_info& custom_type_info) -: gobject_(nullptr), custom_type_name_(custom_type_info.name()), cpp_destruction_in_progress_(false) +: gobject_(nullptr), custom_type_name_(custom_type_info.name()), + cpp_destruction_in_progress_(false) { } @@ -153,14 +163,6 @@ ObjectBase::~ObjectBase() noexcept // we have to call g_object_unref() on our own. // - // Just a precaution. Unless a derived class's ctor has thrown an exception, - // 'this' should have been erased from extra_object_base_data by - // Glib::Object's constructor. - { - std::lock_guard lock(extra_object_base_data_mutex); - extra_object_base_data.erase(this); - } - if (GObject* const gobject = gobject_) { #ifdef GLIBMM_DEBUG_REFCOUNTING @@ -350,22 +352,9 @@ ObjectBase::get_property_value(const Glib::ustring& property_name, Glib::ValueBa g_object_get_property(const_cast(gobj()), property_name.c_str(), value.gobj()); } -void -ObjectBase::connect_property_changed( - const Glib::ustring& property_name, const sigc::slot& slot) -{ - connect_property_changed_with_return(property_name, slot); -} - -void -ObjectBase::connect_property_changed(const Glib::ustring& property_name, sigc::slot&& slot) -{ - connect_property_changed_with_return(property_name, std::move(slot)); -} - sigc::connection -ObjectBase::connect_property_changed_with_return( - const Glib::ustring& property_name, const sigc::slot& slot) +ObjectBase::connect_property_changed( + const Glib::ustring& property_name, const sigc::slot& slot) { // Create a proxy to hold our connection info // This will be deleted by destroy_notify_handler. @@ -377,8 +366,8 @@ ObjectBase::connect_property_changed_with_return( } sigc::connection -ObjectBase::connect_property_changed_with_return( - const Glib::ustring& property_name, sigc::slot&& slot) +ObjectBase::connect_property_changed( + const Glib::ustring& property_name, sigc::slot&& slot) { // Create a proxy to hold our connection info // This will be deleted by destroy_notify_handler. @@ -401,6 +390,49 @@ ObjectBase::thaw_notify() g_object_thaw_notify(gobj()); } +void ObjectBase::add_custom_interface_class(const Interface_Class* iface_class) +{ + if (!priv_pimpl_) + priv_pimpl_ = std::make_unique(); + priv_pimpl_->custom_interface_classes.emplace_back(iface_class); +} + +void ObjectBase::add_custom_class_init_function(GClassInitFunc class_init_func, void* class_data) +{ + if (!priv_pimpl_) + priv_pimpl_ = std::make_unique(); + priv_pimpl_->custom_class_init_functions.emplace_back( + std::make_tuple(class_init_func, class_data)); +} + +void ObjectBase::set_custom_instance_init_function(GInstanceInitFunc instance_init_func) +{ + if (!priv_pimpl_) + priv_pimpl_ = std::make_unique(); + priv_pimpl_->custom_instance_init_function = instance_init_func; +} + +const Class::interface_classes_type* ObjectBase::get_custom_interface_classes() const +{ + return priv_pimpl_ ? &priv_pimpl_->custom_interface_classes : nullptr; +} + +const Class::class_init_funcs_type* ObjectBase::get_custom_class_init_functions() const +{ + return priv_pimpl_ ? &priv_pimpl_->custom_class_init_functions : nullptr; +} + +GInstanceInitFunc ObjectBase::get_custom_instance_init_function() const +{ + return priv_pimpl_ ? priv_pimpl_->custom_instance_init_function : nullptr; +} + +void ObjectBase::custom_class_init_finished() +{ + priv_pimpl_.reset(); +} + +/**** Global function *****************************************************/ bool _gobject_cppinstance_already_deleted(GObject* gobject) { diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h index 198f295..3faed9d 100644 --- a/glib/glibmm/objectbase.h +++ b/glib/glibmm/objectbase.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,9 +28,7 @@ #include #include #include -#include // Needed until the next ABI break. -#include // Not used by ObjectBase any more, but user code may rely on it being here. -#include +#include #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { @@ -119,34 +118,19 @@ public: template void get_property(const Glib::ustring& property_name, PropertyType& value) const; - // TODO: At the next ABI break, delete connect_property_changed_with_return() - // and let connect_property_changed() return sigc::connection. - /** You can use the signal_changed() signal of the property proxy instead. - * - * See also connect_property_changed_with_return(). - */ - void connect_property_changed(const Glib::ustring& property_name, const sigc::slot& slot); - - /** You can use the signal_changed() signal of the property proxy instead. - * - * @newin{2,48} - */ - void connect_property_changed(const Glib::ustring& property_name, sigc::slot&& slot); + /// You probably want to use a specific property_*() accessor method instead. + template + PropertyType get_property(const Glib::ustring& property_name) const; /** You can use the signal_changed() signal of the property proxy instead. - * - * This method was added because connect_property_changed() does not return a sigc::connection, - * and we could not break the ABI by changing that function. */ - sigc::connection connect_property_changed_with_return( - const Glib::ustring& property_name, const sigc::slot& slot); + sigc::connection connect_property_changed(const Glib::ustring& property_name, const sigc::slot& slot); /** You can use the signal_changed() signal of the property proxy instead. * * @newin{2,48} */ - sigc::connection connect_property_changed_with_return( - const Glib::ustring& property_name, sigc::slot&& slot); + sigc::connection connect_property_changed(const Glib::ustring& property_name, sigc::slot&& slot); /** Increases the freeze count on object. If the freeze count is non-zero, the * emission of "notify" signals on object is stopped. The signals are queued @@ -219,20 +203,15 @@ protected: bool is_anonymous_custom_() const; - // TODO: At the next ABI break, replace extra_object_base_data by a non-static - // data member. - // This is a new data member that can't be added as instance data to - // ObjectBase now, because it would break ABI. - struct ExtraObjectBaseData - { - Class::interface_class_vector_type custom_interface_classes; - }; - - 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. - static std::mutex extra_object_base_data_mutex; + // The following 7 methods are used by Glib::ExtraClassInit, Glib::Interface + // and Glib::Object during construction of a named custom type. + void add_custom_interface_class(const Interface_Class* iface_class); + void add_custom_class_init_function(GClassInitFunc class_init_func, void* class_data = nullptr); + void set_custom_instance_init_function(GInstanceInitFunc instance_init_func); + const Class::interface_classes_type* get_custom_interface_classes() const; + const Class::class_init_funcs_type* get_custom_class_init_functions() const; + GInstanceInitFunc get_custom_instance_init_function() const; + void custom_class_init_finished(); public: // is_derived_() must be public, so that overridden vfuncs and signal handlers can call it @@ -260,12 +239,15 @@ protected: private: #ifndef DOXYGEN_SHOULD_SKIP_THIS + // Private part of implementation. + // Used only during construction of named custom types. + struct PrivImpl; + std::unique_ptr priv_pimpl_; + virtual void set_manage(); // calls g_error() -#endif // DOXYGEN_SHOULD_SKIP_THIS -#ifndef DOXYGEN_SHOULD_SKIP_THIS friend class Glib::GSigConnectionNode; // for GSigConnectionNode::notify() -#endif +#endif // DOXYGEN_SHOULD_SKIP_THIS }; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -293,6 +275,16 @@ ObjectBase::get_property(const Glib::ustring& property_name, PropertyType& value value = property_value.get(); } +template +inline PropertyType +ObjectBase::get_property(const Glib::ustring& property_name) const +{ + PropertyType value; + get_property(property_name, value); + + return value; +} + #endif /* DOXYGEN_SHOULD_SKIP_THIS */ bool _gobject_cppinstance_already_deleted(GObject* gobject); diff --git a/glib/glibmm/pattern.cc b/glib/glibmm/pattern.cc index 4493606..8fb94fc 100644 --- a/glib/glibmm/pattern.cc +++ b/glib/glibmm/pattern.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* pattern.cc * * Copyright (C) 2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/pattern.h b/glib/glibmm/pattern.h index 0446907..fddec5c 100644 --- a/glib/glibmm/pattern.h +++ b/glib/glibmm/pattern.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_PATTERN_H #define _GLIBMM_PATTERN_H +/* $Id$ */ + /* pattern.h * * Copyright (C) 2002 The gtkmm Development Team @@ -16,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ extern "C" { diff --git a/glib/glibmm/priorities.h b/glib/glibmm/priorities.h index 9634c0a..a856751 100644 --- a/glib/glibmm/priorities.h +++ b/glib/glibmm/priorities.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_PRIORITIES_H #define _GLIBMM_PRIORITIES_H +/* $Id: priorities.h 420 2007-06-22 15:29:58Z murrayc $ */ + /* Copyright (C) 2002-2008 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -14,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Glib diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc index 30de748..45d90b3 100644 --- a/glib/glibmm/property.cc +++ b/glib/glibmm/property.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h index 593fba1..ca8cde9 100644 --- a/glib/glibmm/property.h +++ b/glib/glibmm/property.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -131,9 +132,9 @@ private: * * This Property class currently supports the name, nick name, description default value and flags. * The minimum and maximum bounds are set to the full range of the value. - * Because of internal implementation, flags shouldn't be set to values: Glib::PARAM_STATIC_NAME, - * Glib::PARAM_STATIC_NICK, Glib::PARAM_STATIC_BLURB, Glib::PARAM_CONSTRUCT and - * Glib::PARAM_CONSTRUCT_ONLY. + * Because of internal implementation, flags shouldn't be set to values: Glib::ParamFlags::STATIC_NAME, + * Glib::ParamFlags::STATIC_NICK, Glib::ParamFlags::STATIC_BLURB, Glib::ParamFlags::CONSTRUCT and + * Glib::ParamFlags::CONSTRUCT_ONLY. * * The class information must be installed into the GObject system once per * property, but this is handled automatically. @@ -331,7 +332,7 @@ public: template Property::Property(Glib::Object& object, const Glib::ustring& name) -: Property(object, name, Glib::ustring(), Glib::ustring(), Glib::PARAM_READWRITE) +: Property(object, name, Glib::ustring(), Glib::ustring(), Glib::ParamFlags::READWRITE) { } @@ -339,7 +340,7 @@ template Property::Property(Glib::Object& object, const Glib::ustring& name, const typename Property::PropertyType& default_value) : Property(object, name, default_value, Glib::ustring(), - Glib::ustring(), Glib::PARAM_READWRITE) + Glib::ustring(), Glib::ParamFlags::READWRITE) { } @@ -348,7 +349,7 @@ Property::Property(Glib::Object& object, const Glib::ustring& name, const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_READWRITE; + flags |= Glib::ParamFlags::READWRITE; if (!lookup_property(name)) install_property(static_cast(value_).create_param_spec(name, nick, blurb, flags)); @@ -360,7 +361,7 @@ Property::Property(Glib::Object& object, const Glib::ustring& name, const Pro : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_READWRITE; + flags |= Glib::ParamFlags::READWRITE; static_cast(value_).set(default_value); @@ -409,7 +410,7 @@ Property::get_proxy() template Property_ReadOnly::Property_ReadOnly(Glib::Object& object, const Glib::ustring& name) -: Property_ReadOnly(object, name, Glib::ustring(), Glib::ustring(), Glib::PARAM_READABLE) +: Property_ReadOnly(object, name, Glib::ustring(), Glib::ustring(), Glib::ParamFlags::READABLE) { } @@ -417,7 +418,7 @@ template Property_ReadOnly::Property_ReadOnly(Glib::Object& object, const Glib::ustring& name, const typename Property_ReadOnly::PropertyType& default_value) : Property_ReadOnly(object, name, default_value, Glib::ustring(), Glib::ustring(), - Glib::PARAM_READABLE) + Glib::ParamFlags::READABLE) { } @@ -426,8 +427,8 @@ Property_ReadOnly::Property_ReadOnly(Glib::Object& object, const Glib::ustrin const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_READABLE; - flags &= ~Glib::PARAM_WRITABLE; + flags |= Glib::ParamFlags::READABLE; + flags &= ~Glib::ParamFlags::WRITABLE; if (!lookup_property(name)) install_property(static_cast(value_).create_param_spec(name, nick, blurb, flags)); @@ -438,8 +439,8 @@ Property_ReadOnly::Property_ReadOnly(Glib::Object& object, const Glib::ustrin const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_READABLE; - flags &= ~Glib::PARAM_WRITABLE; + flags |= Glib::ParamFlags::READABLE; + flags &= ~Glib::ParamFlags::WRITABLE; static_cast(value_).set(default_value); @@ -472,7 +473,7 @@ Property_ReadOnly::get_proxy() template Property_WriteOnly::Property_WriteOnly(Glib::Object& object, const Glib::ustring& name) : Property_WriteOnly(object, name, Glib::ustring(), - Glib::ustring(), Glib::PARAM_WRITABLE) + Glib::ustring(), Glib::ParamFlags::WRITABLE) { } @@ -480,7 +481,7 @@ template Property_WriteOnly::Property_WriteOnly(Glib::Object& object, const Glib::ustring& name, const typename Property_WriteOnly::PropertyType& default_value) : Property_WriteOnly(object, name, default_value, Glib::ustring(), - Glib::ustring(), Glib::PARAM_WRITABLE) + Glib::ustring(), Glib::ParamFlags::WRITABLE) { } @@ -489,8 +490,8 @@ Property_WriteOnly::Property_WriteOnly(Glib::Object& object, const Glib::ustr const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_WRITABLE; - flags &= ~Glib::PARAM_READABLE; + flags |= Glib::ParamFlags::WRITABLE; + flags &= ~Glib::ParamFlags::READABLE; if (!lookup_property(name)) install_property(static_cast(value_).create_param_spec(name, nick, blurb, flags)); @@ -502,8 +503,8 @@ Property_WriteOnly::Property_WriteOnly(Glib::Object& object, const Glib::ustr const Glib::ustring& nick, const Glib::ustring& blurb, Glib::ParamFlags flags) : PropertyBase(object, ValueType::value_type()) { - flags |= Glib::PARAM_WRITABLE; - flags &= ~Glib::PARAM_READABLE; + flags |= Glib::ParamFlags::WRITABLE; + flags &= ~Glib::ParamFlags::READABLE; static_cast(value_).set(default_value); diff --git a/glib/glibmm/propertyproxy.cc b/glib/glibmm/propertyproxy.cc index db0574e..bd02587 100644 --- a/glib/glibmm/propertyproxy.cc +++ b/glib/glibmm/propertyproxy.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* propertyproxy.cc * * Copyright 2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/propertyproxy.h b/glib/glibmm/propertyproxy.h index 67eaab3..bc27409 100644 --- a/glib/glibmm/propertyproxy.h +++ b/glib/glibmm/propertyproxy.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GLIBMM_PROPERTYPROXY_H #define _GLIBMM_PROPERTYPROXY_H @@ -16,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/propertyproxy_base.cc b/glib/glibmm/propertyproxy_base.cc index 21f01fe..66ebf70 100644 --- a/glib/glibmm/propertyproxy_base.cc +++ b/glib/glibmm/propertyproxy_base.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -57,7 +58,7 @@ void PropertyProxyConnectionNode::callback(GObject*, GParamSpec* pspec, gpointer if (pspec && data) { if (sigc::slot_base* const slot = SignalProxyBase::data_to_slot(data)) - (*static_cast*>(slot))(); + (*static_cast*>(slot))(); } } diff --git a/glib/glibmm/propertyproxy_base.h b/glib/glibmm/propertyproxy_base.h index bc76c32..c5e6a53 100644 --- a/glib/glibmm/propertyproxy_base.h +++ b/glib/glibmm/propertyproxy_base.h @@ -16,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -38,7 +39,7 @@ public: SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name); ~SignalProxyProperty() noexcept; - using SlotType = sigc::slot; + using SlotType = sigc::slot; sigc::connection connect(const SlotType& slot); /** @newin{2,48} */ diff --git a/glib/glibmm/quark.cc b/glib/glibmm/quark.cc index d8b5cf5..a528be8 100644 --- a/glib/glibmm/quark.cc +++ b/glib/glibmm/quark.cc @@ -1,3 +1,5 @@ +/* $Id$ */ + /* quark.cc * * Copyright 2002 The gtkmm Development Team @@ -13,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/quark.h b/glib/glibmm/quark.h index b860e74..ae0731c 100644 --- a/glib/glibmm/quark.h +++ b/glib/glibmm/quark.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GLIBMM_QUARK_H #define _GLIBMM_QUARK_H @@ -16,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/random.cc b/glib/glibmm/random.cc index aec836b..11f5cdf 100644 --- a/glib/glibmm/random.cc +++ b/glib/glibmm/random.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* random.cc * * Copyright (C) 2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/random.h b/glib/glibmm/random.h index 3b9893e..d934044 100644 --- a/glib/glibmm/random.h +++ b/glib/glibmm/random.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_RANDOM_H #define _GLIBMM_RANDOM_H +/* $Id$ */ + /* random.h * * Copyright (C) 2002 The gtkmm Development Team @@ -16,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h index 981dd79..8edf68b 100644 --- a/glib/glibmm/refptr.h +++ b/glib/glibmm/refptr.h @@ -14,24 +14,34 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include -#include +#include namespace Glib { +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template +void RefPtrDeleter(T_CppObject* object) +{ + if (!object) + return; + + object->unreference(); +} +#endif // DOXYGEN_SHOULD_SKIP_THIS + /** RefPtr<> is a reference-counting shared smartpointer. * * Some objects in gtkmm are obtained from a shared * store. Consequently you cannot instantiate them yourself. Instead they * return a RefPtr which behaves much like an ordinary pointer in that members * can be reached with the usual object_ptr->member notation. - * Unlike most other smart pointers, RefPtr doesn't support dereferencing - * through *object_ptr. * * Reference counting means that a shared reference count is incremented each * time a RefPtr is copied, and decremented each time a RefPtr is destroyed, @@ -39,469 +49,41 @@ namespace Glib * zero, the contained object is deleted, meaning you don't need to remember * to delete the object. * - * RefPtr<> can store any class that has reference() and unreference() methods, - * and whose destructor is noexcept (the default for destructors). - * In gtkmm, that is anything derived from Glib::ObjectBase, such as - * Gdk::Pixmap. - * * See the "Memory Management" section in the "Programming with gtkmm" * book for further information. */ template -class RefPtr -{ -private: -#ifndef DOXYGEN_SHOULD_SKIP_THIS - /** Helper class for disallowing use of Glib::RefPtr with certain classes. - * - * Disallow for instance in Gtk::Widget and its subclasses. - * Glib::RefPtr::is_allowed_type::value is false if - * T:dont_allow_use_in_glib_refptr_ is a public type, else it's true. - * Example: - * @code - * using dont_allow_use_in_glib_refptr_ = int; - * @endcode - */ - class is_allowed_type - { - private: - struct big - { - int memory[64]; - }; - - static big check(...); - - // If X::dont_allow_use_in_glib_refptr_ is not a type, this check() overload - // is ignored because of the SFINAE rule (Substitution Failure Is Not An Error). - template - static typename X::dont_allow_use_in_glib_refptr_ check(X* obj); - - public: - static const bool value = sizeof(check(static_cast(nullptr))) == sizeof(big); - }; - - static_assert(is_allowed_type::value, "Glib::RefPtr must not be used with this class."); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -public: - /** Default constructor - * - * Afterwards it will be null and use of -> will invoke undefined behaviour. - */ - inline RefPtr() noexcept; - - /// Destructor - decrements reference count. - inline ~RefPtr() noexcept; - - /// For use only by the \::create() methods. - explicit inline RefPtr(T_CppObject* pCppObject) noexcept; - - /** Copy constructor - * - * This increments the shared reference count. - */ - inline RefPtr(const RefPtr& src) noexcept; - - /** Move constructor - */ - inline RefPtr(RefPtr&& src) noexcept; - - /** Move constructor (from different, but castable type). - */ - template - inline RefPtr(RefPtr&& src) noexcept; - - /** Copy constructor (from different, but castable type). - * - * Increments the reference count. - */ - template - inline RefPtr(const RefPtr& src) noexcept; - - /** Swap the contents of two RefPtr<>. - * This method swaps the internal pointers to T_CppObject. This can be - * done safely without involving a reference/unreference cycle and is - * therefore highly efficient. - */ - inline void swap(RefPtr& other) noexcept; - - /// Copy from another RefPtr: - inline RefPtr& operator=(const RefPtr& src) noexcept; - - /// Move assignment operator: - inline RefPtr& operator=(RefPtr&& src) noexcept; - - /// Move assignment operator (from different, but castable type): - template - inline RefPtr& operator=(RefPtr&& src) noexcept; - - /** Copy from different, but castable type). - * - * Increments the reference count. - */ - template - inline RefPtr& operator=(const RefPtr& src) noexcept; - - /// Tests whether the RefPtr<> point to the same underlying instance. - inline bool operator==(const RefPtr& src) const noexcept; - - /// See operator==(). - inline bool operator!=(const RefPtr& src) const noexcept; - - /** Dereferencing. - * - * Use the methods of the underlying instance like so: - * refptr->memberfun(). - */ - inline T_CppObject* operator->() const noexcept; - - /** Test whether the RefPtr<> points to any underlying instance. - * - * Mimics usage of ordinary pointers: - * @code - * if (ptr) - * do_something(); - * @endcode - */ - inline explicit operator bool() const noexcept; - -#ifndef GLIBMM_DISABLE_DEPRECATED - /// @deprecated Use reset() instead because this leads to confusion with clear() methods on the - /// underlying class. For instance, people use .clear() when they mean ->clear(). - inline void clear() noexcept; -#endif // GLIBMM_DISABLE_DEPRECATED - - /** Set underlying instance to nullptr, decrementing reference count of existing instance - * appropriately. - * @newin{2,16} - */ - inline void reset() noexcept; - - /** Release the ownership of underlying instance. - * - * RefPtr's underlying instance is set to nullptr, therefore underlying object can't be accessed - * through this RefPtr anymore. - * @return an underlying instance. - * - * Most users should not use release(). It can spoil the automatic destruction - * of the managed object. A legitimate use is if you immediately give RefPtr's - * reference to another object. - */ - inline T_CppObject* release() noexcept G_GNUC_WARN_UNUSED_RESULT; - - /** Dynamic cast to derived class. - * - * The RefPtr can't be cast with the usual notation so instead you can use - * @code - * ptr_derived = RefPtr::cast_dynamic(ptr_base); - * @endcode - */ - template - static inline RefPtr cast_dynamic(const RefPtr& src) noexcept; - - /** Static cast to derived class. - * - * Like the dynamic cast; the notation is - * @code - * ptr_derived = RefPtr::cast_static(ptr_base); - * @endcode - */ - template - static inline RefPtr cast_static(const RefPtr& src) noexcept; - - /** Cast to non-const. - * - * The RefPtr can't be cast with the usual notation so instead you can use - * @code - * ptr_unconst = RefPtr::cast_const(ptr_const); - * @endcode - */ - template - static inline RefPtr cast_const(const RefPtr& src) noexcept; - - /** Compare based on the underlying instance address. - * - * This is needed in code that requires an ordering on - * RefPtr instances, e.g. std::set >. - * - * Without these, comparing two RefPtr instances - * is still syntactically possible, but the result is semantically - * wrong, as p1 REL_OP p2 is interpreted as (bool)p1 REL_OP (bool)p2. - */ - inline bool operator<(const RefPtr& src) const noexcept; - - /// See operator<(). - inline bool operator<=(const RefPtr& src) const noexcept; - - /// See operator<(). - inline bool operator>(const RefPtr& src) const noexcept; - - /// See operator<(). - inline bool operator>=(const RefPtr& src) const noexcept; - -private: - T_CppObject* pCppObject_; -}; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -// RefPtr<>::operator->() comes first here since it's used by other methods. -// If it would come after them it wouldn't be inlined. - -template -inline T_CppObject* RefPtr::operator->() const noexcept -{ - return pCppObject_; -} - -template -inline RefPtr::RefPtr() noexcept : pCppObject_(nullptr) -{ -} - -template -inline RefPtr::~RefPtr() noexcept -{ - if (pCppObject_) - pCppObject_->unreference(); // This could cause pCppObject to be deleted. -} - -template -inline RefPtr::RefPtr(T_CppObject* pCppObject) noexcept : pCppObject_(pCppObject) -{ -} - -template -inline RefPtr::RefPtr(const RefPtr& src) noexcept : pCppObject_(src.pCppObject_) -{ - if (pCppObject_) - pCppObject_->reference(); -} - -template -inline RefPtr::RefPtr(RefPtr&& src) noexcept : pCppObject_(src.pCppObject_) -{ - src.pCppObject_ = nullptr; -} - -template -template -inline RefPtr::RefPtr(RefPtr&& src) noexcept : pCppObject_(src.release()) -{ -} - -// The templated ctor allows copy construction from any object that's -// castable. Thus, it does downcasts: -// base_ref = derived_ref -template -template -inline RefPtr::RefPtr(const RefPtr& src) noexcept : - // A different RefPtr<> will not allow us access to pCppObject_. We need - // to add a get_underlying() for this, but that would encourage incorrect - // use, so we use the less well-known operator->() accessor: - pCppObject_(src.operator->()) -{ - if (pCppObject_) - pCppObject_->reference(); -} - -template -inline void -RefPtr::swap(RefPtr& other) noexcept -{ - T_CppObject* const temp = pCppObject_; - pCppObject_ = other.pCppObject_; - other.pCppObject_ = temp; -} - -template -inline RefPtr& -RefPtr::operator=(const RefPtr& src) noexcept -{ - // In case you haven't seen the swap() technique to implement copy - // assignment before, here's what it does: - // - // 1) Create a temporary RefPtr<> instance via the copy ctor, thereby - // increasing the reference count of the source object. - // - // 2) Swap the internal object pointers of *this and the temporary - // RefPtr<>. After this step, *this already contains the new pointer, - // and the old pointer is now managed by temp. - // - // 3) The destructor of temp is executed, thereby unreferencing the - // old object pointer. - // - // This technique is described in Herb Sutter's "Exceptional C++", and - // has a number of advantages over conventional approaches: - // - // - Code reuse by calling the copy ctor. - // - Strong exception safety for free. - // - Self assignment is handled implicitely. - // - Simplicity. - // - It just works and is hard to get wrong; i.e. you can use it without - // even thinking about it to implement copy assignment whereever the - // object data is managed indirectly via a pointer, which is very common. - - RefPtr temp(src); - this->swap(temp); - return *this; -} - -template -inline RefPtr& -RefPtr::operator=(RefPtr&& src) noexcept -{ - RefPtr temp(std::move(src)); - this->swap(temp); - src.pCppObject_ = nullptr; - - return *this; -} - -template -template -inline RefPtr& -RefPtr::operator=(RefPtr&& src) noexcept -{ - if (pCppObject_) - pCppObject_->unreference(); - pCppObject_ = src.release(); - - return *this; -} - -template -template -inline RefPtr& -RefPtr::operator=(const RefPtr& src) noexcept -{ - RefPtr temp(src); - this->swap(temp); - return *this; -} - -template -inline bool -RefPtr::operator==(const RefPtr& src) const noexcept -{ - return (pCppObject_ == src.pCppObject_); -} - -template -inline bool -RefPtr::operator!=(const RefPtr& src) const noexcept -{ - return (pCppObject_ != src.pCppObject_); -} - -template -inline RefPtr::operator bool() const noexcept -{ - return (pCppObject_ != nullptr); -} - -#ifndef GLIBMM_DISABLE_DEPRECATED -template -inline void -RefPtr::clear() noexcept -{ - reset(); -} -#endif // GLIBMM_DISABLE_DEPRECATED - -template -inline void -RefPtr::reset() noexcept -{ - RefPtr temp; // swap with an empty RefPtr<> to clear *this - this->swap(temp); -} - -template -inline T_CppObject* -RefPtr::release() noexcept -{ - T_CppObject* tmp = pCppObject_; - pCppObject_ = nullptr; - return tmp; -} - -template -template -inline RefPtr -RefPtr::cast_dynamic(const RefPtr& src) noexcept -{ - T_CppObject* const pCppObject = dynamic_cast(src.operator->()); - - if (pCppObject) - pCppObject->reference(); - - return RefPtr(pCppObject); -} - -template -template -inline RefPtr -RefPtr::cast_static(const RefPtr& src) noexcept -{ - T_CppObject* const pCppObject = static_cast(src.operator->()); - - if (pCppObject) - pCppObject->reference(); - - return RefPtr(pCppObject); -} - -template -template -inline RefPtr -RefPtr::cast_const(const RefPtr& src) noexcept -{ - T_CppObject* const pCppObject = const_cast(src.operator->()); - - if (pCppObject) - pCppObject->reference(); - - return RefPtr(pCppObject); -} - -template -inline bool -RefPtr::operator<(const RefPtr& src) const noexcept -{ - return (pCppObject_ < src.pCppObject_); -} - -template -inline bool -RefPtr::operator<=(const RefPtr& src) const noexcept -{ - return (pCppObject_ <= src.pCppObject_); -} - -template -inline bool -RefPtr::operator>(const RefPtr& src) const noexcept -{ - return (pCppObject_ > src.pCppObject_); -} +using RefPtr = std::shared_ptr; -template -inline bool -RefPtr::operator>=(const RefPtr& src) const noexcept +/* This would not be useful, + * because application code should not new these objects anyway. + * And it is not useful inside glibmm or gtkmm code because + * the constructors are protected, so can't be called from this utilility + * function. + * +template +RefPtr +make_refptr(T_Arg... arg) { - return (pCppObject_ >= src.pCppObject_); + return RefPtr(new T_CppObject(arg...)); } +*/ -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -/** @relates Glib::RefPtr */ +/** Create a RefPtr<> to an instance of any class that has reference() and + * unreference() methods, and whose destructor is noexcept (the default for destructors). + * + * In gtkmm, that is anything derived from Glib::ObjectBase, such as + * Gdk::Pixbuf. + * + * Normal application code should not need to use this. However, this is necessary + * when implementing create() methods for derived Glib::ObjectBase-derived + * (not Gtk::Widget-derived) classes, such as derived Gtk::TreeModels. + */ template -inline void -swap(RefPtr& lhs, RefPtr& rhs) noexcept +RefPtr +make_refptr_for_instance(T_CppObject* object) { - lhs.swap(rhs); + return RefPtr(object, &RefPtrDeleter); } } // namespace Glib diff --git a/glib/glibmm/signalproxy.cc b/glib/glibmm/signalproxy.cc index 04ab68d..9da33cc 100644 --- a/glib/glibmm/signalproxy.cc +++ b/glib/glibmm/signalproxy.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -42,19 +43,7 @@ SignalProxyNormal::~SignalProxyNormal() noexcept } sigc::slot_base& -SignalProxyNormal::connect_(const sigc::slot_base& slot, bool after) -{ - return connect_impl_(info_->callback, slot, after); -} - -sigc::slot_base& -SignalProxyNormal::connect_notify_(const sigc::slot_base& slot, bool after) -{ - return connect_impl_(info_->notify_callback, slot, after); -} - -sigc::slot_base& -SignalProxyNormal::connect_impl_(GCallback callback, const sigc::slot_base& slot, bool after) +SignalProxyNormal::connect_impl_(bool notify, const sigc::slot_base& slot, bool after) { // create a proxy to hold our connection info auto pConnectionNode = new SignalProxyConnectionNode(slot, obj_->gobj()); @@ -62,8 +51,9 @@ SignalProxyNormal::connect_impl_(GCallback callback, const sigc::slot_base& slot // connect it to glib // pConnectionNode will be passed in the data argument to the callback. pConnectionNode->connection_id_ = g_signal_connect_data(obj_->gobj(), info_->signal_name, - callback, pConnectionNode, &SignalProxyConnectionNode::destroy_notify_handler, - static_cast((after) ? G_CONNECT_AFTER : 0)); + notify ? info_->notify_callback : info_->callback, pConnectionNode, + &SignalProxyConnectionNode::destroy_notify_handler, + static_cast(after ? G_CONNECT_AFTER : 0)); return pConnectionNode->slot_; } @@ -100,7 +90,7 @@ SignalProxyNormal::slot0_void_callback(GObject* self, void* data) try { if (sigc::slot_base* const slot = data_to_slot(data)) - (*static_cast*>(slot))(); + (*static_cast*>(slot))(); } catch (...) { @@ -109,9 +99,9 @@ SignalProxyNormal::slot0_void_callback(GObject* self, void* data) } } -// SignalProxyDetailed implementation: +// SignalProxyDetailedBase implementation: -SignalProxyDetailed::SignalProxyDetailed( +SignalProxyDetailedBase::SignalProxyDetailedBase( Glib::ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name) : SignalProxyBase(obj), info_(info), @@ -120,12 +110,12 @@ SignalProxyDetailed::SignalProxyDetailed( { } -SignalProxyDetailed::~SignalProxyDetailed() noexcept +SignalProxyDetailedBase::~SignalProxyDetailedBase() noexcept { } sigc::slot_base& -SignalProxyDetailed::connect_impl_(bool notify, const sigc::slot_base& slot, bool after) +SignalProxyDetailedBase::connect_impl_(bool notify, const sigc::slot_base& slot, bool after) { // create a proxy to hold our connection info auto pConnectionNode = new SignalProxyConnectionNode(slot, obj_->gobj()); @@ -141,7 +131,7 @@ SignalProxyDetailed::connect_impl_(bool notify, const sigc::slot_base& slot, boo } sigc::slot_base& -SignalProxyDetailed::connect_impl_(bool notify, sigc::slot_base&& slot, bool after) +SignalProxyDetailedBase::connect_impl_(bool notify, sigc::slot_base&& slot, bool after) { // create a proxy to hold our connection info auto pConnectionNode = new SignalProxyConnectionNode(std::move(slot), obj_->gobj()); @@ -157,7 +147,7 @@ SignalProxyDetailed::connect_impl_(bool notify, sigc::slot_base&& slot, bool aft } void -SignalProxyDetailed::emission_stop() +SignalProxyDetailedBase::emission_stop() { g_signal_stop_emission_by_name(obj_->gobj(), detailed_name_.c_str()); } diff --git a/glib/glibmm/signalproxy.h b/glib/glibmm/signalproxy.h index 8820d40..c537ea5 100644 --- a/glib/glibmm/signalproxy.h +++ b/glib/glibmm/signalproxy.h @@ -16,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ extern "C" { @@ -46,7 +47,7 @@ struct SignalProxyInfo #endif // DOXYGEN_SHOULD_SKIP_THIS -// This base class is used by SignalProxyNormal, SignalProxyDetailed and SignalProxyProperty. +// This base class is used by SignalProxyNormal, SignalProxyDetailedBase and SignalProxyProperty. class SignalProxyBase { public: @@ -66,7 +67,7 @@ protected: ObjectBase* obj_; private: - SignalProxyBase& operator=(const SignalProxyBase&); // not implemented + SignalProxyBase& operator=(const SignalProxyBase&) = delete; }; // Shared portion of a Signal without detail @@ -78,7 +79,7 @@ private: * the template derivatives, which serve as gatekeepers for the * types allowed on a particular signal. * - * For signals with a detailed name (signal_name::detail_name) see SignalProxyDetailed. + * For signals with a detailed name (signal_name::detail_name) see SignalProxyDetailedBase. */ class SignalProxyNormal : public SignalProxyBase { @@ -89,7 +90,7 @@ public: void emission_stop(); #ifndef DOXYGEN_SHOULD_SKIP_THIS - // This callback for SignalProxy + // This callback for SignalProxy // is defined here to avoid code duplication. static void slot0_void_callback(GObject*, void* data); #endif @@ -102,28 +103,20 @@ protected: */ SignalProxyNormal(Glib::ObjectBase* obj, const SignalProxyInfo* info); - /** Connects a generic signal handler to a signal. - * This is called by connect() in derived SignalProxy classes. + /** Connects a signal handler to a signal. + * This is called by connect() and connect_notify() in derived SignalProxy classes. * + * @param notify Whether this method is called by connect_notify() or by connect(). * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). * @param after Whether this signal handler should be called before or after the default signal * handler. - */ - sigc::slot_base& connect_(const sigc::slot_base& slot, bool after); - - /** Connects a signal handler without a return value to a signal. - * This is called by connect_notify() in derived SignalProxy classes. * - * @param slot The signal handler, which should have a @c void return type, - * usually created with sigc::mem_fun() or sigc::ptr_fun(). - * @param after Whether this signal handler should be called before or after the default signal - * handler. + * @newin{2,52} */ - sigc::slot_base& connect_notify_(const sigc::slot_base& slot, bool after); + sigc::slot_base& connect_impl_(bool notify, const sigc::slot_base& slot, bool after); /** Connects a signal handler to a signal. - * @see connect_(const sigc::slot_base& slot, bool after) and - * connect_notify_(const sigc::slot_base& slot, bool after). + * @see connect_impl_(bool notify, const sigc::slot_base& slot, bool after). * * @newin{2,48} */ @@ -132,42 +125,56 @@ protected: private: const SignalProxyInfo* info_; - // TODO: We could maybe replace both connect_() and connect_notify_() with this in future, because - // they don't do anything extra. - /** This is called by connect_() and connect_notify_(). - */ - sigc::slot_base& connect_impl_(GCallback callback, const sigc::slot_base& slot, bool after); - // no copy assignment - SignalProxyNormal& operator=(const SignalProxyNormal&); + SignalProxyNormal& operator=(const SignalProxyNormal&) = delete; }; /**** Glib::SignalProxy ***************************************************/ +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template +class SignalProxy; +#endif // DOXYGEN_SHOULD_SKIP_THIS + /** Proxy for signals with any number of arguments. * Use the connect() or connect_notify() method, with sigc::mem_fun() or sigc::ptr_fun() * to connect signal handlers to signals. + * + * This is the primary template. There is a specialization for signal handlers + * that return @c void. The specialization has no %connect_notify() method, and + * the @a after parameter in its %connect() method has a default value. */ template -class SignalProxy : public SignalProxyNormal +class SignalProxy : public SignalProxyNormal { public: - using SlotType = sigc::slot; - using VoidSlotType = sigc::slot; + using SlotType = sigc::slot; + using VoidSlotType = sigc::slot; SignalProxy(ObjectBase* obj, const SignalProxyInfo* info) : SignalProxyNormal(obj, info) {} /** Connects a signal handler to a signal. * - * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * For instance, connect(sigc::mem_fun(*this, &TheClass::on_something), false); + * + * For some signal handlers that return a value, it can make a big difference + * whether you connect before or after the default signal handler. + * Examples: + * - Gio::Application::signal_command_line() calls only one signal handler. + * A handler connected after the default handler will never be called. + * - X event signals, such as Gtk::Widget::signal_button_press_event(), stop + * calling signal handlers as soon as a called handler returns true. + * If the default handler returns true, a handler connected after it + * will not be called. * * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). * @param after Whether this signal handler should be called before or after the default signal * handler. + * @return A sigc::connection. */ - sigc::connection connect(const SlotType& slot, bool after = true) + sigc::connection connect(const SlotType& slot, bool after) { - return sigc::connection(connect_(slot, after)); + return sigc::connection(connect_impl_(false, slot, after)); } /** Connects a signal handler to a signal. @@ -175,7 +182,7 @@ public: * * @newin{2,48} */ - sigc::connection connect(SlotType&& slot, bool after = true) + sigc::connection connect(SlotType&& slot, bool after) { return sigc::connection(connect_impl_(false, std::move(slot), after)); } @@ -185,27 +192,23 @@ public: * * For instance, connect_notify( sigc::mem_fun(*this, &TheClass::on_something) ); * - * If the signal requires signal handlers with a @c void return type, - * the only difference between connect() and connect_notify() is the default - * value of @a after. - * * If the signal requires signal handlers with a return value of type T, - * connect_notify() binds return T() to the connected signal handler. + * %connect_notify() binds return T() to the connected signal handler. * For instance, if the return type is @c bool, the following two calls are equivalent. * @code - * connect_notify( sigc::mem_fun(*this, &TheClass::on_something) ); - * connect( sigc::bind_return(sigc::mem_fun(*this, &TheClass::on_something), false), false - * ); + * connect_notify(sigc::mem_fun(*this, &TheClass::on_something)); + * connect(sigc::bind_return(sigc::mem_fun(*this, &TheClass::on_something), false), false); * @endcode * * @param slot The signal handler, which should have a @c void return type, * usually created with sigc::mem_fun() or sigc::ptr_fun(). * @param after Whether this signal handler should be called before or after the default signal * handler. + * @return A sigc::connection. */ sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) { - return sigc::connection(connect_notify_(slot, after)); + return sigc::connection(connect_impl_(true, slot, after)); } /** Connects a signal handler without a return value to a signal. @@ -219,28 +222,47 @@ public: } }; -/* Templates below has been added to avoid API break, and should not be - * used in a newly created code. SignalProxy class should be used instead - * of SignalProxy# class. +/** Proxy for signals with any number of arguments. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() + * to connect signal handlers to signals. + * + * This is a specialization for signal handlers that return @c void. */ -template -using SignalProxy0 = SignalProxy; -template -using SignalProxy1 = SignalProxy; -template -using SignalProxy2 = SignalProxy; -template -using SignalProxy3 = SignalProxy; -template -using SignalProxy4 = SignalProxy; -template -using SignalProxy5 = SignalProxy; -template -using SignalProxy6 = SignalProxy; - -// TODO: When we can break ABI, consider renaming -// SignalProxyDetailed => SignalProxyDetailedBase -// SignalProxyDetailedAnyType => SignalProxyDetailed +template +class SignalProxy : public SignalProxyNormal +{ +public: + using SlotType = sigc::slot; + + SignalProxy(ObjectBase* obj, const SignalProxyInfo* info) : SignalProxyNormal(obj, info) {} + + /** Connects a signal handler to a signal. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * By default, the signal handler will be called after the default signal handler. + * This is usually fine for signal handlers that don't return a value. + * + * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal + * handler. + * @return A sigc::connection. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { + return sigc::connection(connect_impl_(false, slot, after)); + } + + /** Connects a signal handler to a signal. + * @see connect(const SlotType& slot, bool after). + * + * @newin{2,48} + */ + sigc::connection connect(SlotType&& slot, bool after = true) + { + return sigc::connection(connect_impl_(false, std::move(slot), after)); + } +}; // Shared portion of a Signal with detail /** The SignalProxy provides an API similar to sigc::signal that can be used to @@ -251,10 +273,10 @@ using SignalProxy6 = SignalProxy; * the template derivatives, which serve as gatekeepers for the * types allowed on a particular signal. */ -class SignalProxyDetailed : public SignalProxyBase +class SignalProxyDetailedBase : public SignalProxyBase { public: - ~SignalProxyDetailed() noexcept; + ~SignalProxyDetailedBase() noexcept; /// Stops the current signal emission (not in libsigc++) void emission_stop(); @@ -266,11 +288,11 @@ protected: * and the C callbacks that should be called by glib. * @param detail_name The detail name, if any. */ - SignalProxyDetailed( + SignalProxyDetailedBase( Glib::ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name); /** Connects a signal handler to a signal. - * This is called by connect() and connect_notify() in derived SignalProxyDetailedAnyType classes. + * This is called by connect() and connect_notify() in derived SignalProxyDetailed classes. * * @param notify Whether this method is called by connect_notify() or by connect(). * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). @@ -291,35 +313,57 @@ private: const Glib::ustring detailed_name_; // signal_name[::detail_name] // no copy assignment - SignalProxyDetailed& operator=(const SignalProxyDetailed&); + SignalProxyDetailedBase& operator=(const SignalProxyDetailedBase&) = delete; }; +/**** Glib::SignalProxyDetailed **********************************************/ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +template +class SignalProxyDetailed; +#endif // DOXYGEN_SHOULD_SKIP_THIS + /** Proxy for signals with any number of arguments and possibly a detailed name. * Use the connect() or connect_notify() method, with sigc::mem_fun() or sigc::ptr_fun() * to connect signal handlers to signals. + * + * This is the primary template. There is a specialization for signal handlers + * that return @c void. The specialization has no %connect_notify() method, and + * the @a after parameter in its %connect() method has a default value. */ template -class SignalProxyDetailedAnyType : public SignalProxyDetailed +class SignalProxyDetailed : public SignalProxyDetailedBase { public: - using SlotType = sigc::slot; - using VoidSlotType = sigc::slot; + using SlotType = sigc::slot; + using VoidSlotType = sigc::slot; - SignalProxyDetailedAnyType( + SignalProxyDetailed( ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name) - : SignalProxyDetailed(obj, info, detail_name) + : SignalProxyDetailedBase(obj, info, detail_name) { } /** Connects a signal handler to a signal. * - * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * For instance, connect(sigc::mem_fun(*this, &TheClass::on_something), false); + * + * For some signal handlers that return a value, it can make a big difference + * whether you connect before or after the default signal handler. + * Examples: + * - Gio::Application::signal_command_line() calls only one signal handler. + * A handler connected after the default handler will never be called. + * - X event signals, such as Gtk::Widget::signal_button_press_event(), stop + * calling signal handlers as soon as a called handler returns true. + * If the default handler returns true, a handler connected after it + * will not be called. * * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). * @param after Whether this signal handler should be called before or after the default signal * handler. + * @return A sigc::connection. */ - sigc::connection connect(const SlotType& slot, bool after = true) + sigc::connection connect(const SlotType& slot, bool after) { return sigc::connection(connect_impl_(false, slot, after)); } @@ -329,7 +373,7 @@ public: * * @newin{2,48} */ - sigc::connection connect(SlotType&& slot, bool after = true) + sigc::connection connect(SlotType&& slot, bool after) { return sigc::connection(connect_impl_(false, std::move(slot), after)); } @@ -339,23 +383,19 @@ public: * * For instance, connect_notify( sigc::mem_fun(*this, &TheClass::on_something) ); * - * If the signal requires signal handlers with a @c void return type, - * the only difference between connect() and connect_notify() is the default - * value of @a after. - * * If the signal requires signal handlers with a return value of type T, - * connect_notify() binds return T() to the connected signal handler. + * %connect_notify() binds return T() to the connected signal handler. * For instance, if the return type is @c bool, the following two calls are equivalent. * @code - * connect_notify( sigc::mem_fun(*this, &TheClass::on_something) ); - * connect( sigc::bind_return(sigc::mem_fun(*this, &TheClass::on_something), false), false - * ); + * connect_notify(sigc::mem_fun(*this, &TheClass::on_something)); + * connect(sigc::bind_return(sigc::mem_fun(*this, &TheClass::on_something), false), false); * @endcode * * @param slot The signal handler, which should have a @c void return type, * usually created with sigc::mem_fun() or sigc::ptr_fun(). * @param after Whether this signal handler should be called before or after the default signal * handler. + * @return A sigc::connection. */ sigc::connection connect_notify(const VoidSlotType& slot, bool after = false) { @@ -373,24 +413,51 @@ public: } }; -/* Templates below has been added to avoid API break, and should not be - * used in a newly created code. SignalProxyDetailedAnyType class should be - * used instead of SignalProxyDetailed# class. +/** Proxy for signals with any number of arguments and possibly a detailed name. + * Use the connect() method, with sigc::mem_fun() or sigc::ptr_fun() + * to connect signal handlers to signals. + * + * This is a specialization for signal handlers that return @c void. */ -template -using SignalProxyDetailed0 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed1 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed2 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed3 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed4 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed5 = SignalProxyDetailedAnyType; -template -using SignalProxyDetailed6 = SignalProxyDetailedAnyType; +template +class SignalProxyDetailed : public SignalProxyDetailedBase +{ +public: + using SlotType = sigc::slot; + + SignalProxyDetailed( + ObjectBase* obj, const SignalProxyInfo* info, const Glib::ustring& detail_name) + : SignalProxyDetailedBase(obj, info, detail_name) + { + } + + /** Connects a signal handler to a signal. + * + * For instance, connect( sigc::mem_fun(*this, &TheClass::on_something) ); + * + * By default, the signal handler will be called after the default signal handler. + * This is usually fine for signal handlers that don't return a value. + * + * @param slot The signal handler, usually created with sigc::mem_fun() or sigc::ptr_fun(). + * @param after Whether this signal handler should be called before or after the default signal + * handler. + * @return A sigc::connection. + */ + sigc::connection connect(const SlotType& slot, bool after = true) + { + return sigc::connection(connect_impl_(false, slot, after)); + } + + /** Connects a signal handler to a signal. + * @see connect(const SlotType& slot, bool after). + * + * @newin{2,48} + */ + sigc::connection connect(SlotType&& slot, bool after = true) + { + return sigc::connection(connect_impl_(false, std::move(slot), after)); + } +}; } // namespace Glib diff --git a/glib/glibmm/signalproxy_connectionnode.cc b/glib/glibmm/signalproxy_connectionnode.cc index 2d51630..8603e76 100644 --- a/glib/glibmm/signalproxy_connectionnode.cc +++ b/glib/glibmm/signalproxy_connectionnode.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -40,8 +41,8 @@ SignalProxyConnectionNode::SignalProxyConnectionNode(sigc::slot_base&& slot, GOb // notify is a message coming up from the slot to be passed back to Gtk+ // disconnect is a message coming up from the Gtk+ to be passed down to SigC++ // static -void* -SignalProxyConnectionNode::notify(void* data) +void +SignalProxyConnectionNode::notify(sigc::notifiable* data) { // notification from libsigc++. SignalProxyConnectionNode* conn = static_cast(data); @@ -72,8 +73,6 @@ SignalProxyConnectionNode::notify(void* data) g_signal_handler_disconnect(o, connection_id); } } - - return nullptr; // apparently unused in libsigc++ } // static diff --git a/glib/glibmm/signalproxy_connectionnode.h b/glib/glibmm/signalproxy_connectionnode.h index 30da5c0..3099269 100644 --- a/glib/glibmm/signalproxy_connectionnode.h +++ b/glib/glibmm/signalproxy_connectionnode.h @@ -16,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -36,7 +37,7 @@ namespace Glib * It lives between the layer of Gtk+ and libsigc++. * It is very much an internal class. */ -class SignalProxyConnectionNode +class SignalProxyConnectionNode : public sigc::notifiable { public: /** @param slot The signal handler for the glib signal. @@ -55,7 +56,7 @@ public: * This callback is registered in the slot. * @param data The SignalProxyConnectionNode object (@p this). */ - static void* notify(void* data); + static void notify(sigc::notifiable* data); /** Callback that is executed when the glib closure is destroyed. * @param data The SignalProxyConnectionNode object (@p this). diff --git a/glib/glibmm/slisthandle.h b/glib/glibmm/slisthandle.h deleted file mode 100644 index 7b95279..0000000 --- a/glib/glibmm/slisthandle.h +++ /dev/null @@ -1,410 +0,0 @@ -#ifndef _GLIBMM_SLISTHANDLE_H -#define _GLIBMM_SLISTHANDLE_H - -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include -#include - -namespace Glib -{ - -namespace Container_Helpers -{ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/* Create and fill a GSList as efficient as possible. - * This requires bidirectional iterators. - */ -template -GSList* -create_slist(Bi pbegin, Bi pend, Tr) -{ - GSList* head = nullptr; - - while (pend != pbegin) - { - // Use & to force a warning if the iterator returns a temporary object. - const void* const item = Tr::to_c_type(*&*--pend); - head = g_slist_prepend(head, const_cast(item)); - } - - return head; -} - -/* Create a GSList from a 0-terminated input sequence. - * Build it in reverse order and reverse the whole list afterwards, - * because appending to the list would be horribly inefficient. - */ -template -GSList* -create_slist(For pbegin, Tr) -{ - GSList* head = nullptr; - - while (*pbegin) - { - // Use & to force a warning if the iterator returns a temporary object. - const void* const item = Tr::to_c_type(*&*pbegin); - head = g_slist_prepend(head, const_cast(item)); - ++pbegin; - } - - return g_slist_reverse(head); -} - -/* Convert from any container that supports bidirectional iterators. - */ -template -struct SListSourceTraits -{ - static GSList* get_data(const Cont& cont) - { - return Glib::Container_Helpers::create_slist(cont.begin(), cont.end(), Tr()); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -/* Convert from a 0-terminated array. The Cont - * argument must be a pointer to the first element. - */ -template -struct SListSourceTraits -{ - static GSList* get_data(const Cont* array) - { - return (array) ? Glib::Container_Helpers::create_slist(array, Tr()) : nullptr; - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -template -struct SListSourceTraits : SListSourceTraits -{ -}; - -/* Convert from a 0-terminated array. The Cont argument must be a pointer - * to the first element. For consistency, the array must be 0-terminated, - * even though the array size is known at compile time. - */ -template -struct SListSourceTraits -{ - static GSList* get_data(const Cont* array) - { - return Glib::Container_Helpers::create_slist(array, array + (N - 1), Tr()); - } - - static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW; -}; - -template -struct SListSourceTraits : SListSourceTraits -{ -}; - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -/** - * @ingroup ContHelpers - */ -template -class SListHandleIterator -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - 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); - - inline value_type operator*() const; - inline SListHandleIterator& operator++(); - inline const SListHandleIterator operator++(int); - - inline bool operator==(const SListHandleIterator& rhs) const; - inline bool operator!=(const SListHandleIterator& rhs) const; - -private: - const GSList* node_; -}; - -} // namespace Container_Helpers - -// TODO: Remove this when we can break glibmm API. -/** This is an intermediate type. When a method takes this, or returns this, you - * should use a standard C++ container of your choice, such as std::list or - * std::vector. - * - * However, this is not used in new API. We now prefer to just use std::vector, - * which is less flexibile, but makes the API clearer. - * @ingroup ContHandles - */ -template > -class SListHandle -{ -public: - using CppType = typename Tr::CppType; - using CType = typename Tr::CType; - - using value_type = CppType; - using size_type = std::size_t; - using difference_type = std::ptrdiff_t; - - using const_iterator = Glib::Container_Helpers::SListHandleIterator; - using iterator = Glib::Container_Helpers::SListHandleIterator; - - template - inline SListHandle(const Cont& container); - - // Take over ownership of a GSList created by GTK+ functions. - inline SListHandle(GSList* glist, Glib::OwnershipType ownership); - - // Copying clears the ownership flag of the source handle. - inline SListHandle(const SListHandle& other); - - ~SListHandle() noexcept; - - inline const_iterator begin() const; - inline const_iterator end() const; - - template - inline operator std::vector() const; - template - inline operator std::deque() const; - template - inline operator std::list() const; - - template - inline void assign_to(Cont& container) const; - template - inline void copy(Out pdest) const; - - inline GSList* data() const; - inline std::size_t size() const; - inline bool empty() const; - -private: - GSList* pslist_; - mutable Glib::OwnershipType ownership_; - - // No copy assignment. - SListHandle& operator=(const SListHandle&); -}; - -/***************************************************************************/ -/* Inline implementation */ -/***************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -namespace Container_Helpers -{ - -/**** Glib::Container_Helpers::SListHandleIterator<> ***********************/ - -template -inline SListHandleIterator::SListHandleIterator(const GSList* node) : node_(node) -{ -} - -template -inline typename SListHandleIterator::value_type SListHandleIterator::operator*() const -{ - return Tr::to_cpp_type(static_cast(node_->data)); -} - -template -inline SListHandleIterator& SListHandleIterator::operator++() -{ - node_ = node_->next; - return *this; -} - -template -inline const SListHandleIterator SListHandleIterator::operator++(int) -{ - const SListHandleIterator tmp(*this); - node_ = node_->next; - return tmp; -} - -template -inline bool -SListHandleIterator::operator==(const SListHandleIterator& rhs) const -{ - return (node_ == rhs.node_); -} - -template -inline bool -SListHandleIterator::operator!=(const SListHandleIterator& rhs) const -{ - return (node_ != rhs.node_); -} - -} // namespace Container_Helpers - -/**** Glib::SListHandle<> **************************************************/ - -template -template -inline SListHandle::SListHandle(const Cont& container) -: pslist_(Glib::Container_Helpers::SListSourceTraits::get_data(container)), - ownership_(Glib::Container_Helpers::SListSourceTraits::initial_ownership) -{ -} - -template -inline SListHandle::SListHandle(GSList* gslist, Glib::OwnershipType ownership) -: pslist_(gslist), ownership_(ownership) -{ -} - -template -inline SListHandle::SListHandle(const SListHandle& other) -: pslist_(other.pslist_), ownership_(other.ownership_) -{ - other.ownership_ = Glib::OWNERSHIP_NONE; -} - -template -SListHandle::~SListHandle() noexcept -{ - if (ownership_ != Glib::OWNERSHIP_NONE) - { - if (ownership_ != Glib::OWNERSHIP_SHALLOW) - { - // Deep ownership: release each container element. - for (GSList* node = pslist_; node != nullptr; node = node->next) - Tr::release_c_type(static_cast(node->data)); - } - g_slist_free(pslist_); - } -} - -template -inline typename SListHandle::const_iterator -SListHandle::begin() const -{ - return Glib::Container_Helpers::SListHandleIterator(pslist_); -} - -template -inline typename SListHandle::const_iterator -SListHandle::end() const -{ - return Glib::Container_Helpers::SListHandleIterator(nullptr); -} - -template -template -inline SListHandle::operator std::vector() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::vector(this->begin(), this->end()); -#else - std::vector temp; - temp.reserve(this->size()); - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline SListHandle::operator std::deque() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::deque(this->begin(), this->end()); -#else - std::deque temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline SListHandle::operator std::list() const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - return std::list(this->begin(), this->end()); -#else - std::list temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - return temp; -#endif -} - -template -template -inline void -SListHandle::assign_to(Cont& container) const -{ -#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS - container.assign(this->begin(), this->end()); -#else - Cont temp; - Glib::Container_Helpers::fill_container(temp, this->begin(), this->end()); - container.swap(temp); -#endif -} - -template -template -inline void -SListHandle::copy(Out pdest) const -{ - std::copy(this->begin(), this->end(), pdest); -} - -template -inline GSList* -SListHandle::data() const -{ - return pslist_; -} - -template -inline std::size_t -SListHandle::size() const -{ - return g_slist_length(pslist_); -} - -template -inline bool -SListHandle::empty() const -{ - return (pslist_ == nullptr); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} // namespace Glib - -#endif /* _GLIBMM_SLISTHANDLE_H */ diff --git a/glib/glibmm/streamiochannel.cc b/glib/glibmm/streamiochannel.cc deleted file mode 100644 index f82a279..0000000 --- a/glib/glibmm/streamiochannel.cc +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include //For Source -#include -#include -#include - -namespace Glib -{ - -#ifndef GLIBMM_DISABLE_DEPRECATED - -// static -Glib::RefPtr -StreamIOChannel::create(std::istream& stream) -{ - return Glib::RefPtr(new StreamIOChannel(&stream, nullptr)); -} - -// static -Glib::RefPtr -StreamIOChannel::create(std::ostream& stream) -{ - return Glib::RefPtr(new StreamIOChannel(nullptr, &stream)); -} - -// static -Glib::RefPtr -StreamIOChannel::create(std::iostream& stream) -{ - return Glib::RefPtr(new StreamIOChannel(&stream, &stream)); -} - -StreamIOChannel::StreamIOChannel(std::istream* stream_in, std::ostream* stream_out) -: stream_in_(stream_in), stream_out_(stream_out) -{ - get_flags_vfunc(); // initialize GIOChannel flag bits -} - -StreamIOChannel::~StreamIOChannel() noexcept -{ -} - -IOStatus -StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read) -{ - g_return_val_if_fail(stream_in_ != nullptr, IO_STATUS_ERROR); - - stream_in_->clear(); - stream_in_->read(buf, count); - bytes_read = stream_in_->gcount(); - - if (stream_in_->eof()) - return IO_STATUS_EOF; - - if (stream_in_->fail()) - { - throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Reading from stream failed"); - } - - return IO_STATUS_NORMAL; -} - -IOStatus -StreamIOChannel::write_vfunc(const char* buf, gsize count, gsize& bytes_written) -{ - g_return_val_if_fail(stream_out_ != nullptr, IO_STATUS_ERROR); - - bytes_written = 0; - - stream_out_->clear(); - stream_out_->write(buf, count); - - if (stream_out_->fail()) - { - throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Writing to stream failed"); - } - - bytes_written = count; // all or nothing ;) - - return IO_STATUS_NORMAL; -} - -IOStatus -StreamIOChannel::seek_vfunc(gint64 offset, SeekType type) -{ - std::ios::seekdir direction = std::ios::beg; - - switch (type) - { - case SEEK_TYPE_SET: - direction = std::ios::beg; - break; - case SEEK_TYPE_CUR: - direction = std::ios::cur; - break; - case SEEK_TYPE_END: - direction = std::ios::end; - break; - } - - bool failed = false; - - if (stream_in_) - { - stream_in_->clear(); - stream_in_->seekg(offset, direction); - failed = stream_in_->fail(); - } - if (stream_out_) - { - stream_out_->clear(); - stream_out_->seekp(offset, direction); - failed = (failed || stream_out_->fail()); - } - - if (failed) - { - throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Seeking into stream failed"); - } - - return Glib::IO_STATUS_NORMAL; -} - -IOStatus -StreamIOChannel::close_vfunc() -{ - bool failed = false; - - if (std::fstream* const fstream = dynamic_cast(stream_in_)) - { - fstream->clear(); - fstream->close(); - failed = fstream->fail(); - } - else if (std::ifstream* const ifstream = dynamic_cast(stream_in_)) - { - ifstream->clear(); - ifstream->close(); - failed = ifstream->fail(); - } - else if (std::ofstream* const ofstream = dynamic_cast(stream_out_)) - { - ofstream->clear(); - ofstream->close(); - failed = ofstream->fail(); - } - else - { - throw Glib::Error( - G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Attempt to close non-file stream"); - } - - if (failed) - { - throw Glib::Error(G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, "Failed to close stream"); - } - - return IO_STATUS_NORMAL; -} - -IOStatus StreamIOChannel::set_flags_vfunc(IOFlags) -{ - return IO_STATUS_NORMAL; -} - -IOFlags -StreamIOChannel::get_flags_vfunc() -{ - gobj()->is_seekable = 1; - gobj()->is_readable = (stream_in_ != nullptr); - gobj()->is_writeable = (stream_out_ != nullptr); - - IOFlags flags = IO_FLAG_IS_SEEKABLE; - - if (stream_in_) - flags |= IO_FLAG_IS_READABLE; - if (stream_out_) - flags |= IO_FLAG_IS_WRITEABLE; - - return flags; -} - -Glib::RefPtr StreamIOChannel::create_watch_vfunc(IOCondition) -{ - g_warning("Glib::StreamIOChannel::create_watch_vfunc() not implemented"); - return Glib::RefPtr(); -} - -#endif // GLIBMM_DISABLE_DEPRECATED - -} // namespace Glib diff --git a/glib/glibmm/streamiochannel.h b/glib/glibmm/streamiochannel.h deleted file mode 100644 index 28a1ae7..0000000 --- a/glib/glibmm/streamiochannel.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef _GLIBMM_STREAMIOCHANNEL_H -#define _GLIBMM_STREAMIOCHANNEL_H - -#include -#include -#include - -namespace Glib -{ - -#ifndef GLIBMM_DISABLE_DEPRECATED - -/** @deprecated This whole class was deprecated in glibmm 2.2 - See the Glib::IOChannel - * documentation for an explanation. - */ -class StreamIOChannel : public Glib::IOChannel -{ -public: - ~StreamIOChannel() noexcept override; - - static Glib::RefPtr create(std::istream& stream); - static Glib::RefPtr create(std::ostream& stream); - static Glib::RefPtr create(std::iostream& stream); - -protected: - std::istream* stream_in_; - std::ostream* stream_out_; - - StreamIOChannel(std::istream* stream_in, std::ostream* stream_out); - - IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read) override; - IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written) override; - IOStatus seek_vfunc(gint64 offset, SeekType type) override; - IOStatus close_vfunc() override; - IOStatus set_flags_vfunc(IOFlags flags) override; - IOFlags get_flags_vfunc() override; - Glib::RefPtr create_watch_vfunc(IOCondition cond) override; -}; - -#endif //#GLIBMM_DISABLE_DEPRECATED - -} // namespace Glib - -#endif /* _GLIBMM_STREAMIOCHANNEL_H */ diff --git a/glib/glibmm/stringutils.cc b/glib/glibmm/stringutils.cc index f6ce8fa..329b1b0 100644 --- a/glib/glibmm/stringutils.cc +++ b/glib/glibmm/stringutils.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* Copyright (C) 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/stringutils.h b/glib/glibmm/stringutils.h index e6659e2..a81d770 100644 --- a/glib/glibmm/stringutils.h +++ b/glib/glibmm/stringutils.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_STRINGUTILS_H #define _GLIBMM_STRINGUTILS_H +/* $Id$ */ + /* Copyright (C) 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -14,7 +17,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc deleted file mode 100644 index 7bc93dd..0000000 --- a/glib/glibmm/threadpool.cc +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#ifndef GLIBMM_DISABLE_DEPRECATED - -#include -#include -#include -#include -#include - -namespace Glib -{ - -// internal -class ThreadPool::SlotList -{ -public: - SlotList(); - ~SlotList() noexcept; - - // noncopyable - SlotList(const ThreadPool::SlotList&) = delete; - ThreadPool::SlotList& operator=(const ThreadPool::SlotList&) = delete; - - sigc::slot* push(const sigc::slot& slot); - sigc::slot pop(sigc::slot* slot_ptr); - - void lock_and_unlock(); - -private: - Glib::Threads::Mutex mutex_; - std::list> list_; -}; - -ThreadPool::SlotList::SlotList() -{ -} - -ThreadPool::SlotList::~SlotList() noexcept -{ -} - -sigc::slot* -ThreadPool::SlotList::push(const sigc::slot& slot) -{ - Threads::Mutex::Lock lock(mutex_); - - list_.emplace_back(slot); - return &list_.back(); -} - -sigc::slot -ThreadPool::SlotList::pop(sigc::slot* slot_ptr) -{ - sigc::slot slot; - - { - Threads::Mutex::Lock lock(mutex_); - - std::list>::iterator pslot = list_.begin(); - while (pslot != list_.end() && slot_ptr != &*pslot) - ++pslot; - - if (pslot != list_.end()) - { - slot = *pslot; - list_.erase(pslot); - } - } - - return slot; -} - -void -ThreadPool::SlotList::lock_and_unlock() -{ - mutex_.lock(); - mutex_.unlock(); -} - -} // namespace Glib - -namespace -{ - -static void -call_thread_entry_slot(void* data, void* user_data) -{ - try - { - Glib::ThreadPool::SlotList* const slot_list = - static_cast(user_data); - - sigc::slot slot(slot_list->pop(static_cast*>(data))); - - slot(); - } - catch (Glib::Threads::Thread::Exit&) - { - // Just exit from the thread. The Thread::Exit exception - // is our sane C++ replacement of g_thread_exit(). - } - catch (...) - { - Glib::exception_handlers_invoke(); - } -} - -} // anonymous namespace - -namespace Glib -{ - -ThreadPool::ThreadPool(int max_threads, bool exclusive) -: gobject_(nullptr), slot_list_(new SlotList()) -{ - GError* error = nullptr; - - gobject_ = g_thread_pool_new(&call_thread_entry_slot, slot_list_, max_threads, exclusive, &error); - - if (error) - { - delete slot_list_; - slot_list_ = nullptr; - Glib::Error::throw_exception(error); - } -} - -ThreadPool::~ThreadPool() noexcept -{ - if (gobject_) - g_thread_pool_free(gobject_, 1, 1); - - if (slot_list_) - { - slot_list_->lock_and_unlock(); - delete slot_list_; - } -} - -void -ThreadPool::push(const sigc::slot& slot) -{ - sigc::slot* const slot_ptr = slot_list_->push(slot); - - GError* error = nullptr; - g_thread_pool_push(gobject_, slot_ptr, &error); - - if (error) - { - slot_list_->pop(slot_ptr); - Glib::Error::throw_exception(error); - } -} - -void -ThreadPool::set_max_threads(int max_threads) -{ - GError* error = nullptr; - g_thread_pool_set_max_threads(gobject_, max_threads, &error); - - if (error) - Glib::Error::throw_exception(error); -} - -int -ThreadPool::get_max_threads() const -{ - return g_thread_pool_get_max_threads(gobject_); -} - -unsigned int -ThreadPool::get_num_threads() const -{ - return g_thread_pool_get_num_threads(gobject_); -} - -unsigned int -ThreadPool::unprocessed() const -{ - return g_thread_pool_unprocessed(gobject_); -} - -bool -ThreadPool::get_exclusive() const -{ - g_return_val_if_fail(gobject_ != nullptr, false); - - return gobject_->exclusive; -} - -void -ThreadPool::shutdown(bool immediately) -{ - if (gobject_) - { - g_thread_pool_free(gobject_, immediately, 1); - gobject_ = nullptr; - } - - if (slot_list_) - { - slot_list_->lock_and_unlock(); - delete slot_list_; - slot_list_ = nullptr; - } -} - -// static -void -ThreadPool::set_max_unused_threads(int max_threads) -{ - g_thread_pool_set_max_unused_threads(max_threads); -} - -// static -int -ThreadPool::get_max_unused_threads() -{ - return g_thread_pool_get_max_unused_threads(); -} - -// static -unsigned int -ThreadPool::get_num_unused_threads() -{ - return g_thread_pool_get_num_unused_threads(); -} - -// static -void -ThreadPool::stop_unused_threads() -{ - g_thread_pool_stop_unused_threads(); -} - -} // namespace Glib - -#endif // GLIBMM_DISABLE_DEPRECATED diff --git a/glib/glibmm/threadpool.h b/glib/glibmm/threadpool.h deleted file mode 100644 index 684fcbc..0000000 --- a/glib/glibmm/threadpool.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef _GLIBMM_THREADPOOL_H -#define _GLIBMM_THREADPOOL_H - -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include - -#ifndef GLIBMM_DISABLE_DEPRECATED - -#include - -extern "C" { -using GThreadPool = struct _GThreadPool; -} - -namespace Glib -{ - -/** @defgroup ThreadPools Thread Pools - * Pools of threads to execute work concurrently. - * - * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14. - * - * @{ - */ - -// TODO: Is std::async() an appropriate replacement to mention for this deprecated API? - -/** A pool of threads to execute work concurrently. - * - * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14. - */ -class ThreadPool -{ -public: - /** Constructs a new thread pool. - * Whenever you call ThreadPool::push(), either a new thread is created or an - * unused one is reused. At most @a max_threads threads are running - * concurrently for this thread pool. @a max_threads = -1 allows - * unlimited threads to be created for this thread pool. - * - * The parameter @a exclusive determines, whether the thread pool owns all - * threads exclusive or whether the threads are shared globally. If @a - * exclusive is true, @a max_threads threads are started immediately - * and they will run exclusively for this thread pool until it is destroyed - * by ~ThreadPool(). If @a exclusive is false, threads are created - * when needed and shared between all non-exclusive thread pools. This - * implies that @a max_threads may not be -1 for exclusive thread pools. - * - * @param max_threads The maximal number of threads to execute concurrently - * in the new thread pool, -1 means no limit. - * @param exclusive Should this thread pool be exclusive? - * @throw Glib::ThreadError An error can only occur when @a exclusive is - * set to true and not all @a max_threads threads could be created. - */ - explicit ThreadPool(int max_threads = -1, bool exclusive = false); - virtual ~ThreadPool() noexcept; - - // See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. - // TODO: At the next ABI break, consider changing const sigc::slot& slot - // to const std::function& func, if it can be assumed that all supported - // compilers understand the C++11 template class std::function<>. - /** Inserts @a slot into the list of tasks to be executed by the pool. - * When the number of currently running threads is lower than the maximal - * allowed number of threads, a new thread is started (or reused). Otherwise - * @a slot stays in the queue until a thread in this pool finishes its - * previous task and processes @a slot. - * - * Because sigc::trackable is not thread-safe, if the slot represents a - * non-static class method and is created by sigc::mem_fun(), the class concerned - * should not derive from sigc::trackable. You can use, say, boost::bind() or, - * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun(). - * - * @param slot A new task for the thread pool. - * @throw Glib::ThreadError An error can only occur when a new thread - * couldn't be created. In that case @a slot is simply appended to the - * queue of work to do. - */ - void push(const sigc::slot& slot); - - /** Sets the maximal allowed number of threads for the pool. - * A value of -1 means that the maximal number of threads is unlimited. - * Setting @a max_threads to 0 means stopping all work for pool. It is - * effectively frozen until @a max_threads is set to a non-zero value again. - * - * A thread is never terminated while it is still running. Instead the - * maximal number of threads only has effect for the allocation of new - * threads in ThreadPool::push(). A new thread is allocated whenever the - * number of currently running threads in the pool is smaller than the - * maximal number. - * - * @param max_threads A new maximal number of threads for the pool. - * @throw Glib::ThreadError An error can only occur when a new thread - * couldn't be created. - */ - void set_max_threads(int max_threads); - - /** Returns the maximal number of threads for the pool. - * @return The maximal number of threads. - */ - int get_max_threads() const; - - /** Returns the number of threads currently running in the pool. - * @return The number of threads currently running. - */ - unsigned int get_num_threads() const; - - /** Returns the number of tasks still unprocessed in the pool. - * @return The number of unprocessed tasks. - */ - unsigned int unprocessed() const; - - /** Returns whether all threads are exclusive to this pool. - * @return Whether all threads are exclusive to this pool. - */ - bool get_exclusive() const; - - /** Frees all resources allocated for the pool. - * If @a immediately is true, no new task is processed. Otherwise the - * pool is not freed before the last task is processed. Note however, that no - * thread of this pool is interrupted while processing a task. Instead at least - * all still running threads can finish their tasks before the pool is freed. - * - * This method does not return before all tasks to be processed (dependent on - * @a immediately, whether all or only the currently running) are ready. - * After calling shutdown() the pool must not be used anymore. - * - * @param immediately Should the pool shut down immediately? - */ - void shutdown(bool immediately = false); - - /** Sets the maximal number of unused threads to @a max_threads. - * If @a max_threads is -1, no limit is imposed on the number of unused threads. - * @param max_threads Maximal number of unused threads. - */ - static void set_max_unused_threads(int max_threads); - - /** Returns the maximal allowed number of unused threads. - * @return The maximal number of unused threads. - */ - static int get_max_unused_threads(); - - /** Returns the number of currently unused threads. - * @return The number of currently unused threads. - */ - static unsigned int get_num_unused_threads(); - - /** Stops all currently unused threads. - * This does not change the maximal number of unused threads. This function can - * be used to regularly stop all unused threads e.g. from Glib::signal_timeout(). - */ - static void stop_unused_threads(); - - GThreadPool* gobj() { return gobject_; } - const GThreadPool* gobj() const { return gobject_; } - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - class SlotList; -#endif - -private: - GThreadPool* gobject_; - SlotList* slot_list_; - - ThreadPool(const ThreadPool&); - ThreadPool& operator=(const ThreadPool&); -}; - -/** @} group ThreadPools */ - -/***************************************************************************/ -/* inline implementation */ -/***************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/**** Glib::Private ********************************************************/ - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} // namespace Glib - -#endif // GLIBMM_DISABLE_DEPRECATED - -#endif /* _GLIBMM_THREADPOOL_H */ diff --git a/glib/glibmm/timer.cc b/glib/glibmm/timer.cc index 7f32b18..ad3bd6b 100644 --- a/glib/glibmm/timer.cc +++ b/glib/glibmm/timer.cc @@ -13,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/timer.h b/glib/glibmm/timer.h index fcee92b..2559ffa 100644 --- a/glib/glibmm/timer.h +++ b/glib/glibmm/timer.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_TIMER_H #define _GLIBMM_TIMER_H +/* $Id$ */ + /* timer.h * * Copyright (C) 2002 The gtkmm Development Team @@ -16,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ extern "C" { diff --git a/glib/glibmm/timeval.cc b/glib/glibmm/timeval.cc index c8bb9a9..63e93c5 100644 --- a/glib/glibmm/timeval.cc +++ b/glib/glibmm/timeval.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* timeval.cc * * Copyright (C) 2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/timeval.h b/glib/glibmm/timeval.h index e67a9e0..11b3c44 100644 --- a/glib/glibmm/timeval.h +++ b/glib/glibmm/timeval.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_TIMEVAL_H #define _GLIBMM_TIMEVAL_H +/* $Id$ */ + /* timeval.h * * Copyright (C) 2002 The gtkmm Development Team @@ -16,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/ustring.cc b/glib/glibmm/ustring.cc index c9895fb..d05e986 100644 --- a/glib/glibmm/ustring.cc +++ b/glib/glibmm/ustring.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -1218,6 +1219,12 @@ ustring::validate(ustring::const_iterator& first_invalid) const return (is_valid != 0); } +ustring +ustring::make_valid() const +{ + return ustring(g_utf8_make_valid(string_.data(), string_.size())); +} + bool ustring::is_ascii() const { diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h index 532a78f..0aee963 100644 --- a/glib/glibmm/ustring.h +++ b/glib/glibmm/ustring.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -183,7 +184,9 @@ gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_P * If you're using std::ostringstream to build strings for display in the * user interface, you must convert the result back to UTF-8 as shown below: * @code - * std::locale::global(std::locale("")); // set the global locale to the user's preferred locale + * std::locale::global(std::locale("")); // Set the global locale to the user's preferred locale. + * // Usually unnecessary here, because Glib::init() + * // does it for you. * std::ostringstream output; * output << percentage << " % done"; * label->set_text(Glib::locale_to_utf8(output.str())); @@ -593,6 +596,12 @@ public: /*! Check whether the string is valid UTF-8. */ bool validate(const_iterator& first_invalid) const; + /*! Return a copy that is a valid UTF-8 string replacing invalid bytes in the + * original with Unicode replacement character (U+FFFD). + * If the string is valid - return it's copy. + */ + ustring make_valid() const; + /*! Check whether the string is plain 7-bit ASCII. @par * Unlike any other ustring method, is_ascii() is safe to use on invalid * UTF-8 strings. If the string isn't valid UTF-8, it cannot be valid @@ -602,7 +611,7 @@ public: bool is_ascii() const; /*! "Normalize" the %Unicode character representation of the string. */ - ustring normalize(NormalizeMode mode = NORMALIZE_DEFAULT_COMPOSE) const; + ustring normalize(NormalizeMode mode = NormalizeMode::DEFAULT_COMPOSE) const; //! @} //! @name Character case conversion. diff --git a/glib/glibmm/utility.cc b/glib/glibmm/utility.cc index 4c21660..172ff7a 100644 --- a/glib/glibmm/utility.cc +++ b/glib/glibmm/utility.cc @@ -1,3 +1,7 @@ +// -*- c++ -*- + +/* $Id$ */ + /* Copyright (C) 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/utility.h b/glib/glibmm/utility.h index eaf4c15..5e17183 100644 --- a/glib/glibmm/utility.h +++ b/glib/glibmm/utility.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -24,65 +25,11 @@ #ifndef DOXYGEN_SHOULD_SKIP_THIS -#ifndef GLIBMM_DISABLE_DEPRECATED -/* Occasionally, a struct variable has to be initialized after its definition, - * i.e. when using structs as class member data. For convenience, the macro - * GLIBMM_INITIALIZE_STRUCT(Var, Type) is provided. It even avoids creating - * a temporary if the compiler is GCC. - * - * @deprecated Use e.g. std::memset() instead. - * It's not used any more in the code generated by _CLASS_BOXEDTYPE_STATIC. - * It generates compiler warnings if __STRICT_ANSI__ is defined. - */ -#if ((__GNUC__ >= 3) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) && !defined(__STRICT_ANSI__) - -#define GLIBMM_INITIALIZE_STRUCT(Var, Type) __builtin_memset(&(Var), 0, sizeof(Type)) - -#else - -// TODO: This causes warnings like this: -//"missing initializer for member" -#define GLIBMM_INITIALIZE_STRUCT(Var, Type) \ - G_STMT_START \ - { \ - Type const temp_initializer__ = { \ - 0, \ - }; \ - (Var) = temp_initializer__; \ - } \ - G_STMT_END - -#endif -#endif // GLIBMM_DISABLE_DEPRECATED - namespace Glib { // These are used by gmmproc-generated type conversions: -#ifndef GLIBMM_DISABLE_DEPRECATED -/** Helper to deal with memory allocated - * by GLib functions in an exception-safe manner. - * - * @deprecated Use make_unique_ptr_gfree() instead. - */ -template -class ScopedPtr -{ -private: - T* ptr_; - ScopedPtr(const ScopedPtr&); - ScopedPtr& operator=(const ScopedPtr&); - -public: - ScopedPtr() : ptr_(nullptr) {} - explicit ScopedPtr(T* ptr) : ptr_(ptr) {} - ~ScopedPtr() noexcept { g_free(ptr_); } - T* get() const { return ptr_; } - T** addr() { return &ptr_; } -}; -#endif // GLIBMM_DISABLE_DEPRECATED - /** Helper to deal with memory allocated * by GLib functions in an exception-safe manner. * @@ -95,17 +42,6 @@ make_unique_ptr_gfree(T* p) return std::unique_ptr(p, &g_free); } -// TODO: Deprecate this? We don't use it ourselves. -/** Removes the const nature of a ptr - * - */ -template -inline T* -unconst(const T* t) -{ - return const_cast(t); -} - // Convert const gchar* to ustring, while treating NULL as empty string. inline Glib::ustring convert_const_gchar_ptr_to_ustring(const char* str) diff --git a/glib/glibmm/value.cc b/glib/glibmm/value.cc index 3eece8f..893bb85 100644 --- a/glib/glibmm/value.cc +++ b/glib/glibmm/value.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -134,7 +138,7 @@ Glib::RefPtr ValueBase_Object::get_object_copy() const { GObject* const data = static_cast(g_value_get_object(&gobject_)); - return Glib::RefPtr(Glib::wrap_auto(data, true)); + return Glib::make_refptr_for_instance(Glib::wrap_auto(data, true)); } GParamSpec* diff --git a/glib/glibmm/value.h b/glib/glibmm/value.h index fc8205c..142e187 100644 --- a/glib/glibmm/value.h +++ b/glib/glibmm/value.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -139,7 +140,6 @@ protected: class ValueBase_Enum : public ValueBase { public: - using CType = gint; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -160,7 +160,6 @@ protected: class ValueBase_Flags : public ValueBase { public: - using CType = guint; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -181,7 +180,6 @@ protected: class ValueBase_String : public ValueBase { public: - using CType = const gchar*; static GType value_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -215,31 +213,53 @@ class Value_Boxed : public ValueBase_Boxed { public: using CppType = T; - using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_type(); } void set(const CppType& data) { set_boxed(data.gobj()); } - CppType get() const { return CppType(static_cast(get_boxed())); } + CppType get() const { return CppType(static_cast(get_boxed())); } }; // More spec-compliant compilers (such as Tru64) need this to be near Glib::Object instead. #ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION +namespace Traits { + +template +struct HasGetBaseType; + +template +struct HasGetBaseType { + template + struct Check; + + template + static std::true_type + Test(Check*); + + template + static std::false_type Test(...); + + static const bool value = decltype(Test(0))::value; + //using type = decltype(Test(0)); +}; + +} // namespace Traits + /** Partial specialization for RefPtr<> to Glib::Object. * @ingroup glibmmValue */ template -class Value> : public ValueBase_Object +class Value, typename std::enable_if::value>::type> +: public ValueBase_Object { public: using CppType = Glib::RefPtr; - using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } - void set(const CppType& data) { set_object(data.operator->()); } - CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } + void set(const CppType& data) { set_object(const_cast*>(data.get())); } + CppType get() const { return std::dynamic_pointer_cast(get_object_copy()); } }; // The SUN Forte Compiler has a problem with this: @@ -248,18 +268,19 @@ public: /** Partial specialization for RefPtr<> to const Glib::Object. * @ingroup glibmmValue */ +/* template -class Value> : public ValueBase_Object +class Value, typename std::enable_if::value>::type> : public ValueBase_Object { public: using CppType = Glib::RefPtr; - using CType = typename T::BaseObjectType*; static GType value_type() { return T::get_base_type(); } - void set(const CppType& data) { set_object(const_cast(data.operator->())); } - CppType get() const { return Glib::RefPtr::cast_dynamic(get_object_copy()); } + void set(const CppType& data) { set_object(const_cast(data.get())); } + CppType get() const { return std::dynamic_pointer_cast(get_object_copy()); } }; +*/ #endif // GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS #endif // GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION @@ -310,7 +331,7 @@ class Value_Enum : public ValueBase_Enum public: using CppType = T; - void set(CppType data) { set_enum(data); } + void set(CppType data) { set_enum(static_cast(data)); } CppType get() const { return CppType(get_enum()); } }; @@ -323,7 +344,7 @@ class Value_Flags : public ValueBase_Flags public: using CppType = T; - void set(CppType data) { set_flags(data); } + void set(CppType data) { set_flags(static_cast(data)); } CppType get() const { return CppType(get_flags()); } }; diff --git a/glib/glibmm/value_custom.cc b/glib/glibmm/value_custom.cc index 1526070..69354ef 100644 --- a/glib/glibmm/value_custom.cc +++ b/glib/glibmm/value_custom.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* Copyright 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/value_custom.h b/glib/glibmm/value_custom.h index d2ea01c..0284888 100644 --- a/glib/glibmm/value_custom.h +++ b/glib/glibmm/value_custom.h @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GLIBMM_VALUE_CUSTOM_H @@ -56,12 +57,12 @@ GType custom_pointer_type_register(const char* type_name); /** * @ingroup glibmmValue */ -template +template class Value_Pointer : public ValueBase_Object { public: + using T = std::remove_cv_t>; using CppType = PtrT; - using CType = void*; static inline GType value_type() G_GNUC_CONST; @@ -95,12 +96,11 @@ private: * cannot ensure that no exceptions will be thrown, consider using either * a normal pointer or a smart pointer to hold your objects indirectly. */ -template +template class Value : public ValueBase_Boxed { public: using CppType = T; - using CType = T*; static GType value_type() G_GNUC_CONST; @@ -120,8 +120,8 @@ private: * No attempt is made to manage the memory associated with the * pointer, you must take care of that yourself. */ -template -class Value : public Value_Pointer +template +class Value : public Value_Pointer { }; @@ -130,37 +130,37 @@ class Value : public Value_Pointer * No attempt is made to manage the memory associated with the * pointer, you must take care of that yourself. */ -template -class Value : public Value_Pointer +template +class Value : public Value_Pointer { }; #ifndef DOXYGEN_SHOULD_SKIP_THIS -/**** Glib::Value_Pointer *****************************************/ +/**** Glib::Value_Pointer *****************************************/ /** Implementation for Glib::Object pointers **/ // static -template +template inline GType -Value_Pointer::value_type_(Glib::Object*) +Value_Pointer::value_type_(Glib::Object*) { return T::get_base_type(); } -template +template inline void -Value_Pointer::set_(PtrT data, Glib::Object*) +Value_Pointer::set_(PtrT data, Glib::Object*) { set_object(const_cast(data)); } // More spec-compliant compilers (such as Tru64) need this to be near Glib::Object instead. #ifdef GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION -template +template inline PtrT -Value_Pointer::get_(Glib::Object*) const +Value_Pointer::get_(Glib::Object*) const { return dynamic_cast(get_object()); } @@ -169,9 +169,9 @@ Value_Pointer::get_(Glib::Object*) const /** Implementation for custom pointers **/ // static -template +template GType -Value_Pointer::value_type_(void*) +Value_Pointer::value_type_(void*) { static GType custom_type = 0; @@ -181,16 +181,16 @@ Value_Pointer::value_type_(void*) return custom_type; } -template +template inline void -Value_Pointer::set_(PtrT data, void*) +Value_Pointer::set_(PtrT data, void*) { gobject_.data[0].v_pointer = const_cast(data); } -template +template inline PtrT -Value_Pointer::get_(void*) const +Value_Pointer::get_(void*) const { return static_cast(gobject_.data[0].v_pointer); } @@ -198,25 +198,25 @@ Value_Pointer::get_(void*) const /** Public forwarding interface **/ // static -template +template inline GType -Value_Pointer::value_type() +Value_Pointer::value_type() { // Dispatch to the specific value_type_() overload. - return Value_Pointer::value_type_(static_cast(nullptr)); + return Value_Pointer::value_type_(static_cast(nullptr)); } -template +template inline void -Value_Pointer::set(PtrT data) +Value_Pointer::set(PtrT data) { // Dispatch to the specific set_() overload. this->set_(data, static_cast(nullptr)); } -template +template inline PtrT -Value_Pointer::get() const +Value_Pointer::get() const { // Dispatch to the specific get_() overload. return this->get_(static_cast(nullptr)); @@ -225,29 +225,29 @@ Value_Pointer::get() const /**** Glib::Value *******************************************************/ // Static data, specific to each template instantiation. -template -GType Value::custom_type_ = 0; +template +GType Value::custom_type_ = 0; -template +template inline void -Value::set(const typename Value::CppType& data) +Value::set(const typename Value::CppType& data) { // Assume the value is already default-initialized. See value_init_func(). *static_cast(gobject_.data[0].v_pointer) = data; } -template -inline typename Value::CppType -Value::get() const +template +inline typename Value::CppType +Value::get() const { // Assume the pointer is not NULL. See value_init_func(). return *static_cast(gobject_.data[0].v_pointer); } // static -template +template GType -Value::value_type() +Value::value_type() { if (!custom_type_) { @@ -258,26 +258,26 @@ Value::value_type() } // static -template +template void -Value::value_init_func(GValue* value) +Value::value_init_func(GValue* value) { // Never store a NULL pointer (unless we're out of memory). value->data[0].v_pointer = new (std::nothrow) T(); } // static -template +template void -Value::value_free_func(GValue* value) +Value::value_free_func(GValue* value) { delete static_cast(value->data[0].v_pointer); } // static -template +template void -Value::value_copy_func(const GValue* src_value, GValue* dest_value) +Value::value_copy_func(const GValue* src_value, GValue* dest_value) { // Assume the source is not NULL. See value_init_func(). const T& source = *static_cast(src_value->data[0].v_pointer); diff --git a/glib/glibmm/vectorutils.cc b/glib/glibmm/vectorutils.cc index b4cac1e..8a8e711 100644 --- a/glib/glibmm/vectorutils.cc +++ b/glib/glibmm/vectorutils.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/vectorutils.h b/glib/glibmm/vectorutils.h index f68903d..6ea434a 100644 --- a/glib/glibmm/vectorutils.h +++ b/glib/glibmm/vectorutils.h @@ -1,3 +1,4 @@ +// -*- c++ -*- #ifndef _GLIBMM_VECTORUTILS_H #define _GLIBMM_VECTORUTILS_H @@ -14,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include diff --git a/glib/glibmm/weakref.h b/glib/glibmm/weakref.h deleted file mode 100644 index f4226cf..0000000 --- a/glib/glibmm/weakref.h +++ /dev/null @@ -1,465 +0,0 @@ -#ifndef _GLIBMM_WEAKREF_H -#define _GLIBMM_WEAKREF_H - -/* Copyright (C) 2015 The glibmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include -#include -#include // std::is_base_of<> -#include // std::swap<>, std::forward<> - -namespace Glib -{ - -/** WeakRef<> is a weak reference smartpointer. - * - * WeakRef can store a pointer to any class that is derived from Glib::ObjectBase, - * and whose reference() method is noexcept. - * In glibmm and gtkmm, that is anything derived from Glib::ObjectBase. - * - * Unlike a RefPtr, a WeakRef does not contribute to the reference counting of - * the underlying object. - * - * @newin{2,46} - */ -template -class WeakRef -{ - static_assert(std::is_base_of::value, - "Glib::WeakRef can be used only for classes derived from Glib::ObjectBase."); - -public: - /** Default constructor. - * - * Create an empty weak reference. - */ - inline WeakRef() noexcept; - - /// Copy constructor. - inline WeakRef(const WeakRef& src) noexcept; - - /// Move constructor. - inline WeakRef(WeakRef&& src) noexcept; - - /// Copy constructor from different, but castable type. - template - inline WeakRef(const WeakRef& src) noexcept; - - /// Move constructor from different, but castable type. - template - inline WeakRef(WeakRef&& src) noexcept; - - /** Constructor from a RefPtr of the same or a castable type. - * - * Create a weak reference from a RefPtr of the same or a castable type. - * If the RefPtr references nothing, an empty weak reference will be constructed. - */ - template - inline WeakRef(const RefPtr& src) noexcept; - - /// Destructor. - inline ~WeakRef() noexcept; - - /// Swap the contents of two WeakRef<>. - inline void swap(WeakRef& other) noexcept; - - /// Copy assignment operator. - inline WeakRef& operator=(const WeakRef& src) noexcept; - - /// Move assignment operator. - inline WeakRef& operator=(WeakRef&& src) noexcept; - - /// Copy assignment from different, but castable type. - template - inline WeakRef& operator=(const WeakRef& src) noexcept; - - /// Move assignment from different, but castable type. - template - inline WeakRef& operator=(WeakRef&& src) noexcept; - - /// Assignment from a RefPtr of the same or a castable type. - template - inline WeakRef& operator=(const RefPtr& src) noexcept; - - /** Test whether the WeakRef<> points to any underlying instance. - * - * Mimics usage of ordinary pointers: - * @code - * if (ptr) - * do_something(); - * @endcode - * - * In a multi-threaded program a true return value can become - * obsolete at any time, even before the caller has a chance to test it, - * because the underlying instance may lose its last reference in another - * thread. Use get() if this is not acceptable. - */ - inline explicit operator bool() const noexcept; - - /** Create a strong reference to the underlying object. - * - * This is a thread-safe way to acquire a strong reference to the underlying - * object. If the WeakRef is empty, the returned RefPtr will reference nothing. - */ - inline RefPtr get() const noexcept; - - /// Make this WeakRef empty. - inline void reset() noexcept; - - /** Dynamic cast to derived class. - * - * The WeakRef can't be cast with the usual notation so instead you can use - * @code - * ptr_derived = Glib::WeakRef::cast_dynamic(ptr_base); - * @endcode - */ - template - static inline WeakRef cast_dynamic(const WeakRef& src) noexcept; - - /** Static cast to derived class. - * - * The WeakRef can't be cast with the usual notation so instead you can use - * @code - * ptr_derived = Glib::WeakRef::cast_static(ptr_base); - * @endcode - */ - template - static inline WeakRef cast_static(const WeakRef& src) noexcept; - - /** Cast to non-const. - * - * The WeakRef can't be cast with the usual notation so instead you can use - * @code - * ptr_nonconst = Glib::WeakRef::cast_const(ptr_const); - * @endcode - */ - template - static inline WeakRef cast_const(const WeakRef& src) noexcept; - -private: - // Let all instantiations of WeakRef access private data. - template - friend class WeakRef; - - // If pCppObject != nullptr && gobject == nullptr, - // then the caller holds a strong reference. - void set(T_CppObject* pCppObject, GWeakRef* gobject) noexcept; - - // WeakRef owns *gobject_, but it does not own *pCppObject_. - // Invariant: (!pCppObject_ || gobject_), - // i.e. if pCppObject_ != nullptr then also gobject_ != nullptr. - T_CppObject* pCppObject_; - GWeakRef* gobject_; - - // Some methods would be simpler if gobject_ were a GWeakRef instead of - // a GWeakRef*, but then the move constructor and the move assignment - // operation would not be efficient. - -}; // end class WeakRef - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -template -WeakRef::WeakRef() noexcept : pCppObject_(nullptr), gobject_(nullptr) -{ -} - -template -WeakRef::WeakRef(const WeakRef& src) noexcept : pCppObject_(src.pCppObject_), - gobject_(nullptr) -{ - if (pCppObject_) - { - // We must own a strong reference to the underlying GObject while - // calling g_weak_ref_init(). - gpointer ptr = g_weak_ref_get(src.gobject_); - if (ptr) - { - gobject_ = new GWeakRef; - g_weak_ref_init(gobject_, pCppObject_->gobj()); - g_object_unref(ptr); - } - else - pCppObject_ = nullptr; - } -} - -template -WeakRef::WeakRef(WeakRef&& src) noexcept : pCppObject_(src.pCppObject_), - gobject_(src.gobject_) -{ - src.pCppObject_ = nullptr; - src.gobject_ = nullptr; -} - -// The templated ctor allows copy construction from any object that's -// castable. Thus, it does downcasts: -// base_ref = derived_ref -template -template -WeakRef::WeakRef(const WeakRef& src) noexcept - : pCppObject_(src.pCppObject_), - gobject_(nullptr) -{ - if (pCppObject_) - { - // We must own a strong reference to the underlying GObject while - // calling g_weak_ref_init(). - gpointer ptr = g_weak_ref_get(src.gobject_); - if (ptr) - { - gobject_ = new GWeakRef; - g_weak_ref_init(gobject_, pCppObject_->gobj()); - g_object_unref(ptr); - } - else - pCppObject_ = nullptr; - } -} - -// The templated ctor allows move construction from any object that's -// castable. Thus, it does downcasts: -// base_ref = std::move(derived_ref) -template -template -WeakRef::WeakRef(WeakRef&& src) noexcept : pCppObject_(src.pCppObject_), - gobject_(src.gobject_) -{ - src.pCppObject_ = nullptr; - src.gobject_ = nullptr; -} - -template -template -WeakRef::WeakRef(const RefPtr& src) noexcept - : pCppObject_(src.operator->()), - gobject_(nullptr) -{ - if (pCppObject_) - { - gobject_ = new GWeakRef; - g_weak_ref_init(gobject_, pCppObject_->gobj()); - } -} - -template -WeakRef::~WeakRef() noexcept -{ - if (gobject_) - { - g_weak_ref_clear(gobject_); - delete gobject_; - } -} - -template -void -WeakRef::swap(WeakRef& other) noexcept -{ - std::swap(pCppObject_, other.pCppObject_); - std::swap(gobject_, other.gobject_); -} - -template -WeakRef& -WeakRef::operator=(const WeakRef& src) noexcept -{ - set(src.pCppObject_, src.gobject_); - return *this; -} - -template -WeakRef& -WeakRef::operator=(WeakRef&& src) noexcept -{ - // See RefPtr for an explanation of the swap() technique to implement - // copy assignment and move assignment. - // This technique is inefficient for copy assignment of WeakRef, - // because it involves copy construction + destruction, i.e. in a typical - // case g_weak_ref_init() + g_weak_ref_clear(), when a g_weak_ref_set() - // would be enough. For move assignment, the swap technique is fine. - WeakRef temp(std::forward>(src)); - this->swap(temp); - return *this; -} - -template -template -WeakRef& -WeakRef::operator=(const WeakRef& src) noexcept -{ - set(src.pCppObject_, src.gobject_); - return *this; -} - -template -template -WeakRef& -WeakRef::operator=(WeakRef&& src) noexcept -{ - WeakRef temp(std::forward>(src)); - this->swap(temp); - return *this; -} - -template -template -WeakRef& -WeakRef::operator=(const RefPtr& src) noexcept -{ - T_CppObject* pCppObject = src.operator->(); - set(pCppObject, nullptr); - return *this; -} - -template -WeakRef::operator bool() const noexcept -{ - if (!pCppObject_) - return false; - - gpointer ptr = g_weak_ref_get(gobject_); - if (!ptr) - return false; - - g_object_unref(ptr); - return true; -} - -template -RefPtr -WeakRef::get() const noexcept -{ - RefPtr ret; - - if (!pCppObject_) - return ret; - - gpointer ptr = g_weak_ref_get(gobject_); - if (!ptr) - return ret; - - // A RefPtr constructed from pointer expects reference to be done externally. - pCppObject_->reference(); - ret = RefPtr(pCppObject_); - - g_object_unref(ptr); - - return ret; -} - -template -void -WeakRef::reset() noexcept -{ - set(nullptr, nullptr); -} - -template -template -WeakRef -WeakRef::cast_dynamic(const WeakRef& src) noexcept -{ - WeakRef ret; - - if (!src.pCppObject_) - return ret; - - gpointer ptr = g_weak_ref_get(src.gobject_); - if (!ptr) - return ret; - - // Don't call dynamic_cast<>() unless we know that the referenced object - // still exists. - T_CppObject* const pCppObject = dynamic_cast(src.pCppObject_); - ret.set(pCppObject, nullptr); - g_object_unref(ptr); - - return ret; -} - -template -template -WeakRef -WeakRef::cast_static(const WeakRef& src) noexcept -{ - T_CppObject* const pCppObject = static_cast(src.pCppObject_); - - WeakRef ret; - ret.set(pCppObject, src.gobject_); - return ret; -} - -template -template -WeakRef -WeakRef::cast_const(const WeakRef& src) noexcept -{ - T_CppObject* const pCppObject = const_cast(src.pCppObject_); - - WeakRef ret; - ret.set(pCppObject, src.gobject_); - return ret; -} - -template -void -WeakRef::set(T_CppObject* pCppObject, GWeakRef* gobject) noexcept -{ - // We must own a strong reference to the underlying GObject while - // calling g_weak_ref_init() or g_weak_ref_set(). - // If pCppObject != nullptr && gobject == nullptr, - // then the caller holds a strong reference. - - // An aim with this moderately complicated method is to keep the same - // GWeakRef, calling g_weak_ref_set() when possible, instead of using swap(), - // which implies creating a new WeakRef, swapping with *this, and deleting - // the new WeakRef. - - gpointer ptr = nullptr; - if (pCppObject && gobject) - ptr = g_weak_ref_get(gobject); - - pCppObject_ = (ptr || !gobject) ? pCppObject : nullptr; - if (pCppObject_ && !gobject_) - { - gobject_ = new GWeakRef; - g_weak_ref_init(gobject_, pCppObject_->gobj()); - } - else if (gobject_) - g_weak_ref_set(gobject_, pCppObject_ ? pCppObject_->gobj() : nullptr); - - if (ptr) - g_object_unref(ptr); -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -/** Swap the contents of two WeakRef<>. - * @relates Glib::WeakRef - */ -template -inline void -swap(WeakRef& lhs, WeakRef& rhs) noexcept -{ - lhs.swap(rhs); -} - -} // namespace Glib - -#endif // _GLIBMM_WEAKREF_H diff --git a/glib/glibmm/wrap.cc b/glib/glibmm/wrap.cc index 3e78c3b..ee9ca79 100644 --- a/glib/glibmm/wrap.cc +++ b/glib/glibmm/wrap.cc @@ -1,3 +1,6 @@ +// -*- c++ -*- +/* $Id$ */ + /* wrap.cc * * Copyright (C) 1998-2002 The gtkmm Development Team @@ -13,7 +16,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -212,7 +216,7 @@ wrap_auto(GObject* object, bool take_copy) Glib::RefPtr wrap(GObject* object, bool take_copy /* = false */) { - return Glib::RefPtr(dynamic_cast(wrap_auto(object, take_copy))); + return Glib::make_refptr_for_instance(dynamic_cast(wrap_auto(object, take_copy))); } } /* namespace Glib */ diff --git a/glib/glibmm/wrap.h b/glib/glibmm/wrap.h index dfa4c96..eec39bb 100644 --- a/glib/glibmm/wrap.h +++ b/glib/glibmm/wrap.h @@ -14,7 +14,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/glibmm/wrap_init.h b/glib/glibmm/wrap_init.h index df27023..f53ae41 100644 --- a/glib/glibmm/wrap_init.h +++ b/glib/glibmm/wrap_init.h @@ -1,6 +1,9 @@ +// -*- c++ -*- #ifndef _GLIBMM_WRAP_INIT_H #define _GLIBMM_WRAP_INIT_H +/* $Id$ */ + /* wrap_init.h * * Copyright 2002 The gtkmm Development Team @@ -16,7 +19,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/balancedtree.hg b/glib/src/balancedtree.hg index ce69ace..6d02c39 100644 --- a/glib/src/balancedtree.hg +++ b/glib/src/balancedtree.hg @@ -11,7 +11,8 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -19,7 +20,8 @@ _DEFS(glibmm,glib) #include #include #include -#include +#include +#include #include namespace Glib @@ -56,8 +58,8 @@ class BalancedTree { _CLASS_GENERIC(BalancedTree, GTree) public: - using TraverseFunc = sigc::slot; - using CompareFunc = sigc::slot; + using TraverseFunc = sigc::slot; + using CompareFunc = sigc::slot; protected: BalancedTree() : @@ -66,7 +68,7 @@ protected: gobject_ = g_tree_new_full(on_compare_tree, &key_compare_slot, on_destroy_key, on_destroy_value); } - BalancedTree(const CompareFunc &key_compare_slot_) : + explicit BalancedTree(const CompareFunc &key_compare_slot_) : key_compare_slot(key_compare_slot_) { gobject_ = g_tree_new_full(on_compare_tree, &key_compare_slot, on_destroy_key, on_destroy_value); @@ -77,12 +79,12 @@ protected: public: static Glib::RefPtr< BalancedTree > create() { - return Glib::RefPtr< BalancedTree >(new BalancedTree()); + return Glib::make_refptr_for_instance< BalancedTree >(new BalancedTree()); } static Glib::RefPtr< BalancedTree > create(const CompareFunc &key_compare_slot) { - return Glib::RefPtr< BalancedTree >(new BalancedTree(key_compare_slot)); + return Glib::make_refptr_for_instance< BalancedTree >(new BalancedTree(key_compare_slot)); } ~BalancedTree() @@ -234,8 +236,8 @@ public: */ V* search(const CompareFunc &search_func, const K& key) { - sigc::slot real_slot = sigc::ptr_fun(on_compare_key); - sigc::slot bound_slot = sigc::bind(real_slot, search_func, key); + sigc::slot real_slot = sigc::ptr_fun(on_compare_key); + sigc::slot bound_slot = sigc::bind(real_slot, search_func, key); gpointer value = g_tree_search(gobj(), c_callback_search, reinterpret_cast(&bound_slot)); return reinterpret_cast(value); @@ -277,7 +279,7 @@ private: /// Wrapper for invoking GCompareFunc. static gint c_callback_search(gconstpointer a, gconstpointer b) { - const sigc::slot* slot = reinterpret_cast *>(b); + const auto slot = reinterpret_cast *>(b); return (*slot)(*reinterpret_cast(a)); } diff --git a/glib/src/binding.ccg b/glib/src/binding.ccg index 576b64f..dfad8a6 100644 --- a/glib/src/binding.ccg +++ b/glib/src/binding.ccg @@ -14,6 +14,8 @@ * License along with this library. If not, see . */ +using Flags = Glib::Binding::Flags; + #include #include @@ -80,7 +82,7 @@ namespace Glib // static Glib::RefPtr Binding::bind_property_value(const PropertyProxy_Base& source_property, - const PropertyProxy_Base& target_property, BindingFlags flags, const SlotTransform& transform_to, + const PropertyProxy_Base& target_property, Flags flags, const SlotTransform& transform_to, const SlotTransform& transform_from) { GBinding* binding = nullptr; @@ -112,7 +114,7 @@ Binding::bind_property_value(const PropertyProxy_Base& source_property, // either the source object or the target object is finalized. // The GBinding object must not be destroyed while there are RefPtrs around. g_object_ref(binding); - return Glib::RefPtr(new Binding(binding)); + return Glib::make_refptr_for_instance(new Binding(binding)); } void diff --git a/glib/src/binding.hg b/glib/src/binding.hg index b30cba1..c99c8ca 100644 --- a/glib/src/binding.hg +++ b/glib/src/binding.hg @@ -24,7 +24,6 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Glib { -_WRAP_ENUM(BindingFlags, GBindingFlags, newin "2,44") /** Bind two object properties. * @@ -101,12 +100,14 @@ class Binding : public Glib::Object _CLASS_GOBJECT(Binding, GBinding, G_BINDING, Glib::Object, GObject) public: + _WRAP_ENUM(Flags, GBindingFlags, newin "2,44") + /** For instance,
* bool on_transform_to(const GValue* from_value, GValue* to_value); * * @return true if the transformation was successful, and false otherwise. */ - using SlotTransform = sigc::slot; + 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. @@ -140,7 +141,7 @@ public: static Glib::RefPtr bind_property_value( const PropertyProxy_Base& source_property, const PropertyProxy_Base& target_property, - BindingFlags flags = BINDING_DEFAULT, + Flags flags = Flags::DEFAULT, const SlotTransform& transform_to = SlotTransform(), const SlotTransform& transform_from = SlotTransform()); @@ -161,7 +162,7 @@ public: static Glib::RefPtr bind_property( const PropertyProxy_Base& source_property, const PropertyProxy_Base& target_property, - BindingFlags flags = BINDING_DEFAULT) + Flags flags = Flags::DEFAULT) { return bind_property_value(source_property, target_property, flags); } @@ -183,7 +184,7 @@ public: * stored in a Glib::Value object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to
- * sigc::slot. + * sigc::slot. * * @see bind_property_value() * @@ -193,10 +194,10 @@ public: static Glib::RefPtr bind_property( const PropertyProxy& source_property, const PropertyProxy& target_property, - BindingFlags flags, + Flags flags, const T_functor_to& transform_to) { - sigc::slot slot_transform_to = transform_to; + sigc::slot slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, slot_transform_to.empty() ? SlotTransform() : TransformProp(slot_transform_to)); @@ -219,7 +220,7 @@ public: * stored in a Glib::Value object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to
- * sigc::slot. + * sigc::slot. * * @see bind_property_value() * @@ -229,10 +230,10 @@ public: static Glib::RefPtr bind_property( const PropertyProxy& source_property, const PropertyProxy_WriteOnly& target_property, - BindingFlags flags, + Flags flags, const T_functor_to& transform_to) { - sigc::slot slot_transform_to = transform_to; + sigc::slot slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, slot_transform_to.empty() ? SlotTransform() : TransformProp(slot_transform_to)); @@ -255,7 +256,7 @@ public: * stored in a Glib::Value object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to
- * sigc::slot. + * sigc::slot. * * @see bind_property_value() * @@ -265,10 +266,10 @@ public: static Glib::RefPtr bind_property( const PropertyProxy_ReadOnly& source_property, const PropertyProxy& target_property, - BindingFlags flags, + Flags flags, const T_functor_to& transform_to) { - sigc::slot slot_transform_to = transform_to; + sigc::slot slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, slot_transform_to.empty() ? SlotTransform() : TransformProp(slot_transform_to)); @@ -291,7 +292,7 @@ public: * stored in a Glib::Value object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to
- * sigc::slot. + * sigc::slot. * * @see bind_property_value() * @@ -301,10 +302,10 @@ public: static Glib::RefPtr bind_property( const PropertyProxy_ReadOnly& source_property, const PropertyProxy_WriteOnly& target_property, - BindingFlags flags, + Flags flags, const T_functor_to& transform_to) { - sigc::slot slot_transform_to = transform_to; + sigc::slot slot_transform_to = transform_to; return bind_property_value(source_property, target_property, flags, slot_transform_to.empty() ? SlotTransform() : TransformProp(slot_transform_to)); @@ -329,10 +330,10 @@ public: * stored in a Glib::Value object. * @tparam T_functor_to Type of functor that translates from the source to the target. * Must be convertible to
- * sigc::slot. + * sigc::slot. * @tparam T_functor_from Type of functor that translates from the target to the source. * Must be convertible to
- * sigc::slot. + * sigc::slot. * * @see bind_property_value() * @@ -342,12 +343,12 @@ public: static Glib::RefPtr bind_property( const PropertyProxy& source_property, const PropertyProxy& target_property, - BindingFlags flags, + Flags flags, const T_functor_to& transform_to, const T_functor_from& transform_from) { - sigc::slot slot_transform_to = transform_to; - sigc::slot slot_transform_from = transform_from; + sigc::slot slot_transform_to = transform_to; + sigc::slot slot_transform_from = transform_from; return bind_property_value(source_property, target_property, flags, slot_transform_to.empty() ? SlotTransform() : TransformProp(slot_transform_to), @@ -360,7 +361,7 @@ public: _WRAP_METHOD(Glib::RefPtr get_target(), g_binding_get_target, refreturn, newin "2,44") _WRAP_METHOD(Glib::RefPtr get_target() const, g_binding_get_target, refreturn, constversion, newin "2,44") _WRAP_METHOD(Glib::ustring get_target_property() const, g_binding_get_target_property, newin "2,44") - _WRAP_METHOD(BindingFlags get_flags() const, g_binding_get_flags, newin "2,44") + _WRAP_METHOD(Flags get_flags() const, g_binding_get_flags, newin "2,44") /** Explicitly releases the binding between the source and the target * property expressed by this Binding instance. @@ -374,7 +375,7 @@ public: void unbind(); _IGNORE(g_binding_unbind) - _WRAP_PROPERTY("flags", Glib::BindingFlags, newin "2,44") + _WRAP_PROPERTY("flags", Flags, newin "2,44") _WRAP_PROPERTY("source", Glib::RefPtr, newin "2,44") _WRAP_PROPERTY("source-property", Glib::ustring, newin "2,44") _WRAP_PROPERTY("target", Glib::RefPtr, newin "2,44") @@ -391,13 +392,12 @@ private: // The functor TransformProp can be implicitly converted to a SlotTransform // and used in a call to bind_property_value(). template - class TransformProp : public sigc::functor_base + class TransformProp { public: - using result_type = bool; - using SlotTypedTransform = sigc::slot; + using SlotTypedTransform = sigc::slot; - TransformProp(const SlotTypedTransform& slot) : typed_transform(slot) {} + explicit TransformProp(const SlotTypedTransform& slot) : typed_transform(slot) {} bool operator()(const GValue* from_value, GValue* to_value) { diff --git a/glib/src/bytearray.ccg b/glib/src/bytearray.ccg index 003c58b..2cb910c 100644 --- a/glib/src/bytearray.ccg +++ b/glib/src/bytearray.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace diff --git a/glib/src/bytearray.hg b/glib/src/bytearray.hg index 9dac5e2..3ed2d69 100644 --- a/glib/src/bytearray.hg +++ b/glib/src/bytearray.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -57,7 +58,7 @@ public: * int compare(const guint8* first, const guint8* second); * */ - using SlotCompare = sigc::slot; + using SlotCompare = sigc::slot; _WRAP_METHOD(static Glib::RefPtr create(), g_byte_array_new) @@ -103,7 +104,7 @@ class Value< Glib::RefPtr > : public ValueBase_Boxed public: static GType value_type() { return Glib::ByteArray::get_type(); } void set(const Glib::RefPtr& array) { set_boxed(Glib::unwrap(array)); } - Glib::RefPtr get() { return Glib::RefPtr(reinterpret_cast(get_boxed())); } + Glib::RefPtr get() { return make_refptr_for_instance(reinterpret_cast(get_boxed())); } }; #endif /* DOXYGEN_SHOULD_SKIP_THIS */ diff --git a/glib/src/bytes.ccg b/glib/src/bytes.ccg index bc43f2d..0ff936a 100644 --- a/glib/src/bytes.ccg +++ b/glib/src/bytes.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Glib diff --git a/glib/src/bytes.hg b/glib/src/bytes.hg index 867b99c..b4b1f2a 100644 --- a/glib/src/bytes.hg +++ b/glib/src/bytes.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -20,7 +21,6 @@ _DEFS(glibmm,glib) #include #include #include -#include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/glib/src/checksum.ccg b/glib/src/checksum.ccg index f38e2fc..0db13da 100644 --- a/glib/src/checksum.ccg +++ b/glib/src/checksum.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,7 +21,7 @@ namespace Glib { -Checksum::Checksum(ChecksumType type) : gobject_(g_checksum_new((GChecksumType)type)) +Checksum::Checksum(Type type) : gobject_(g_checksum_new((GChecksumType)type)) { } @@ -30,13 +31,13 @@ Checksum::operator bool() const } gssize -Checksum::get_length(ChecksumType checksum_type) +Checksum::get_length(Type checksum_type) { return g_checksum_type_get_length((GChecksumType)checksum_type); } std::string -Checksum::compute_checksum(ChecksumType checksum_type, const std::string& data) +Checksum::compute_checksum(Type checksum_type, const std::string& data) { return Glib::convert_return_gchar_ptr_to_ustring( g_compute_checksum_for_string(((GChecksumType)checksum_type), data.c_str(), data.size())); diff --git a/glib/src/checksum.hg b/glib/src/checksum.hg index a4a4d49..9394eb2 100644 --- a/glib/src/checksum.hg +++ b/glib/src/checksum.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -42,16 +43,16 @@ class Checksum _IGNORE(g_checksum_copy, g_checksum_free) public: - _WRAP_ENUM(ChecksumType, GChecksumType, NO_GTYPE) + _WRAP_ENUM(Type, GChecksumType, NO_GTYPE) -#m4 _CONVERSION(`ChecksumType', `GChecksumType', `(($2)$3)') +#m4 _CONVERSION(`Type', `GChecksumType', `(static_cast<$2>($3))') /** Creates a new Checksum, using the checksum algorithm @a checksum_type. * If the checksum_type is not known, then operator bool() will return false. * * @param checksum_type Checksum type, one of defined above. */ - explicit Checksum(ChecksumType checksum_type); + explicit Checksum(Type checksum_type); /** Returns true if the Checksum object is valid. * This will return false, for instance, if an unsupported checksum type was provided to the constructor. @@ -60,9 +61,7 @@ public: _WRAP_METHOD(void reset(), g_checksum_reset) - //TODO: length should really be gssize, not gsize, when we can break ABI: -#m4 _CONVERSION(`gsize',`gssize',`(gssize)($3)') - _WRAP_METHOD(void update(const guchar* data, gsize length), g_checksum_update) + _WRAP_METHOD(void update(const guchar* data, gssize length), g_checksum_update) /** Feeds data into an existing Checksum. * The checksum must still be open, that is get_string() or get_digest() must not have been called on the checksum. @@ -76,26 +75,25 @@ public: _WRAP_METHOD(std::string get_string() const, g_checksum_get_string) - _WRAP_METHOD(static std::string compute_checksum(ChecksumType checksum_type, const guchar* data, gsize length), g_compute_checksum_for_data) + _WRAP_METHOD(static std::string compute_checksum(Type checksum_type, const guchar* data, gsize length), g_compute_checksum_for_data) /** Computes the checksum of a string. * - * @param checksum_type A ChecksumType + * @param checksum_type A Type * @param str The string to compute the checksum of. * @result The checksum as a hexadecimal string. */ - static std::string compute_checksum(ChecksumType checksum_type, const std::string& str); + static std::string compute_checksum(Type checksum_type, const std::string& str); _IGNORE(g_compute_checksum_for_string) //We don't use _WRAP_METHOD because this is not really a GCheckSum function: /** Gets the length in bytes of digests of type @a checksum_type. * - * @param checksum_type A ChecksumType. + * @param checksum_type A Type. * @result The checksum length, or -1 if @a checksum_type is not supported. */ - static gssize get_length(ChecksumType checksum_type); + static gssize get_length(Type checksum_type); }; } //namespace Glib - diff --git a/glib/src/convert.ccg b/glib/src/convert.ccg index cd08eac..6a84847 100644 --- a/glib/src/convert.ccg +++ b/glib/src/convert.ccg @@ -1,3 +1,5 @@ +// -*- c++ -*- + /* Copyright (C) 2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -11,7 +13,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include //For g_assert() in glib >= 2.15.0 diff --git a/glib/src/convert.hg b/glib/src/convert.hg index 9c211bc..408ceb3 100644 --- a/glib/src/convert.hg +++ b/glib/src/convert.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/date.ccg b/glib/src/date.ccg index 7e62718..7aac7a4 100644 --- a/glib/src/date.ccg +++ b/glib/src/date.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //#include //For g_assert() in glib >= 2.15.0 @@ -75,24 +76,6 @@ Date::set_parse(const Glib::ustring& str) g_date_set_parse(&gobject_, str.c_str()); } -_DEPRECATE_IFDEF_START - -// Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32) -// That would make the set_time() method overload impossible. -#ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 -void -Date::set_time(GTime time) -{ - // This method, and the C function g_date_set_time() that it wraps, are deprecated. - //(::time_t is used here instead of std::time_t, since the C function is declared - // with ::time_t. It's not important. The C++ standard requires that ::time_t - // and std::time_t shall be identical when both are defined.) - g_date_set_time_t(&gobject_, static_cast(time)); -} -#endif // GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 - -_DEPRECATE_IFDEF_END - void Date::set_time(std::time_t timet) { @@ -247,12 +230,22 @@ Date::get_weekday() const return (Date::Weekday)g_date_get_weekday(&gobject_); } +int Date::get_weekday_as_int() const +{ + return g_date_get_weekday(&gobject_); +} + Date::Month Date::get_month() const { return (Date::Month)g_date_get_month(&gobject_); } +int Date::get_month_as_int() const +{ + return g_date_get_month(&gobject_); +} + Date::Year Date::get_year() const { diff --git a/glib/src/date.hg b/glib/src/date.hg index 64d4e9e..1f674c1 100644 --- a/glib/src/date.hg +++ b/glib/src/date.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -36,9 +37,9 @@ public: 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) - _WRAP_ENUM(DMY, GDateDMY, s#^DATE_##, NO_GTYPE) + _WRAP_ENUM(Month, GDateMonth, NO_GTYPE) + _WRAP_ENUM(Weekday, GDateWeekday, NO_GTYPE) + _WRAP_ENUM(DMY, GDateDMY, NO_GTYPE) static const Day BAD_DAY = 0; static const Year BAD_YEAR = 0; @@ -108,24 +109,6 @@ public: */ void set_parse (const Glib::ustring& str); - - _DEPRECATE_IFDEF_START - - //Avoid a build problem in the case that std::time_t is equivalent to gint32 (GTime is also gint32) - //That would make the set_time() method overload impossible. - #ifdef GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 - /** Sets the value of a date from a GTime value. - * - * @param time GTime value to set. - * - * @deprecated Please use set_time(std::time_t) or set_time(const GTimeVal&). - */ - void set_time(GTime time); - #endif //GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32 - - _DEPRECATE_IFDEF_END - - /** Sets the value of a date from a std::time_t value. * * @param timet std::time_t value to set @@ -294,11 +277,21 @@ public: */ Weekday get_weekday() const; + /** Returns the day of the week for a Date. The date must be valid. + * @return Day of the week as an int. Monday=1 .. Sunday=7. + */ + int get_weekday_as_int() const; + /** Returns the month of the year. The date must be valid. * @return Month of the year as a Date::Month. */ Month get_month() const; + /** Returns the month of the year. The date must be valid. + * @return Month of the year as an int. January=1 .. December=12. + */ + int get_month_as_int() const; + /** Returns the year of a Date. The date must be valid. * @return Year in which the date falls. */ diff --git a/glib/src/datetime.ccg b/glib/src/datetime.ccg index fbad36e..d47f05c 100644 --- a/glib/src/datetime.ccg +++ b/glib/src/datetime.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/datetime.hg b/glib/src/datetime.hg index 6665950..8a4a4a8 100644 --- a/glib/src/datetime.hg +++ b/glib/src/datetime.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/enums.ccg b/glib/src/enums.ccg index 55b57e0..f3c6be6 100644 --- a/glib/src/enums.ccg +++ b/glib/src/enums.ccg @@ -11,5 +11,6 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ diff --git a/glib/src/enums.hg b/glib/src/enums.hg index 656f285..290ee4b 100644 --- a/glib/src/enums.hg +++ b/glib/src/enums.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/filelist.am b/glib/src/filelist.am index bab18c1..162eec3 100644 --- a/glib/src/filelist.am +++ b/glib/src/filelist.am @@ -36,12 +36,9 @@ glibmm_files_any_hg = \ regex.hg \ shell.hg \ spawn.hg \ - thread.hg \ - threads.hg \ timezone.hg \ unicode.hg \ uriutils.hg \ - valuearray.hg \ variant.hg \ variantdict.hg \ variantiter.hg \ diff --git a/glib/src/fileutils.ccg b/glib/src/fileutils.ccg index 777aa9d..eabe8e2 100644 --- a/glib/src/fileutils.ccg +++ b/glib/src/fileutils.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/fileutils.hg b/glib/src/fileutils.hg index 3abb38b..e660ca5 100644 --- a/glib/src/fileutils.hg +++ b/glib/src/fileutils.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -62,146 +63,79 @@ _WRAP_GERROR(FileError, GFileError, G_FILE_ERROR, NO_GTYPE, s#^PERM$#NOT_OWNER# ) -/** @enum FileError::Code - * Values corresponding to errno codes returned from file operations - * on UNIX. - * Unlike errno codes, FileError::Code values are available on all - * systems, even Windows. The exact meaning of each code depends on what sort - * of file operation you were performing; the UNIX documentation gives more - * details. The following error code descriptions come from the GNU C Library - * manual, and are under the copyright of that manual. - * - * It's not very portable to make detailed assumptions about exactly which - * errors will be returned from a given operation. Some errors don't occur on - * some systems, etc., sometimes there are subtle differences in when a system - * will report a given error, etc. - */ - /** @var FileError::Code FileError::EXISTS - * (EEXIST) Operation not permitted; only the owner of the file (or - * other resource) or processes with special privileges can perform the operation. - *

- */ -/** @var FileError::Code FileError::IS_DIRECTORY - * (EISDIR) File is a directory; you cannot open a directory for writing, - * or create or remove hard links to it. - *

- */ -/** @var FileError::Code FileError::ACCESS_DENIED - * (EACCES) Permission denied; the file permissions do not allow the - * attempted operation. - *

- */ -/** @var FileError::Code FileError::NAME_TOO_LONG - * (ENAMETOOLONG) Filename too long. - *

- */ -/** @var FileError::Code FileError::NO_SUCH_ENTITY - * (ENOENT) No such file or directory. This is a "file doesn't exist" - * error for ordinary files that are referenced in contexts where they are expected - * to already exist. - *

- */ -/** @var FileError::Code FileError::NOT_DIRECTORY - * (ENOTDIR) A file that isn't a directory was specified when a directory - * is required. - *

- */ -/** @var FileError::Code FileError::NO_SUCH_DEVICE - * (ENXIO) No such device or address. The system tried to use the device - * represented by a file you specified, and it couldn't find the device. This can - * mean that the device file was installed incorrectly, or that the physical device - * is missing or not correctly attached to the computer. - *

- */ -/** @var FileError::Code FileError::NOT_DEVICE - * (ENODEV) This file is of a type that doesn't support mapping. - *

- */ -/** @var FileError::Code FileError::READONLY_FILESYSTEM - * (EROFS) The directory containing the new link can't be modified - * because it's on a read-only file system. - *

- */ -/** @var FileError::Code FileError::TEXT_FILE_BUSY - * (ETXTBSY) Text file busy. - *

- */ -/** @var FileError::Code FileError::FAULTY_ADDRESS - * (EFAULT) You passed in a pointer to bad memory. (Glib won't - * reliably return this, don't pass in pointers to bad memory.) - *

- */ -/** @var FileError::Code FileError::SYMLINK_LOOP - * (ELOOP) Too many levels of symbolic links were encountered in - * looking up a file name. This often indicates a cycle of symbolic links. - *

- */ -/** @var FileError::Code FileError::NO_SPACE_LEFT - * (ENOSPC) No space left on device; write operation on a file failed - * because the disk is full. - *

- */ -/** @var FileError::Code FileError::NOT_ENOUGH_MEMORY - * (ENOMEM) No memory available. The system cannot allocate more - * virtual memory because its capacity is full. - *

- */ -/** @var FileError::Code FileError::TOO_MANY_OPEN_FILES - * (EMFILE) The current process has too many files open and can't - * open any more. Duplicate descriptors do count toward this limit. - *

- */ -/** @var FileError::Code FileError::FILE_TABLE_OVERFLOW - * (ENFILE) There are too many distinct file openings in the - * entire system. - *

- */ -/** @var FileError::Code FileError::BAD_FILE_DESCRIPTOR - * (EBADF) Bad file descriptor; for example, I/O on a descriptor - * that has been closed or reading from a descriptor open only for writing - * (or vice versa). - *

- */ -/** @var FileError::Code FileError::INVALID_ARGUMENT - * (EINVAL) Invalid argument. This is used to indicate various kinds - * of problems with passing the wrong argument to a library function. - *

- */ -/** @var FileError::Code FileError::BROKEN_PIPE - * (EPIPE) Broken pipe; there is no process reading from the other - * end of a pipe. Every library function that returns this error code also - * generates a SIGPIPE signal; this signal terminates the program - * if not handled or blocked. Thus, your program will never actually see - * this code unless it has handled or blocked SIGPIPE. - *

- */ -/** @var FileError::Code FileError::TRYAGAIN - * (EAGAIN) Resource temporarily unavailable; the call might work - * if you try again later. - * We used TRYAGAIN instead of TRY_AGAIN, because that is a defined as a macro by a Unix header. - *

- */ -/** @var FileError::Code FileError::INTERRUPTED - * (EINTR) Interrupted function call; an asynchronous signal occurred - * and prevented completion of the call. When this happens, you should try - * the call again. - *

- */ -/** @var FileError::Code FileError::IO_ERROR - * (EIO) Input/output error; usually used for physical read or write - * errors. I.e. the disk or other physical device hardware is returning errors. - *

- */ -/** @var FileError::Code FileError::NOT_OWNER - * (EPERM) Operation not permitted; only the owner of the file (or other - * resource) or processes with special privileges can perform the operation. - *

- */ -/** @var FileError::Code FileError::FAILED - * Does not correspond to a UNIX error code; this is the standard "failed for - * unspecified reason" error code present in all Glib::Error error code - * enumerations. Returned if no specific code applies. + * (EEXIST) + * + * @var FileError::Code FileError::IS_DIRECTORY + * (EISDIR) + * + * @var FileError::Code FileError::ACCESS_DENIED + * (EACCES) + * + * @var FileError::Code FileError::NAME_TOO_LONG + * (ENAMETOOLONG) + * + * @var FileError::Code FileError::NO_SUCH_ENTITY + * (ENOENT) + * + * @var FileError::Code FileError::NOT_DIRECTORY + * (ENOTDIR) + * + * @var FileError::Code FileError::NO_SUCH_DEVICE + * (ENXIO) + * + * @var FileError::Code FileError::NOT_DEVICE + * (ENODEV) + * + * @var FileError::Code FileError::READONLY_FILESYSTEM + * (EROFS) + * + * @var FileError::Code FileError::TEXT_FILE_BUSY + * (ETXTBSY) + * + * @var FileError::Code FileError::FAULTY_ADDRESS + * (EFAULT) + * + * @var FileError::Code FileError::SYMLINK_LOOP + * (ELOOP) + * + * @var FileError::Code FileError::NO_SPACE_LEFT + * (ENOSPC) + * + * @var FileError::Code FileError::NOT_ENOUGH_MEMORY + * (ENOMEM) + * + * @var FileError::Code FileError::TOO_MANY_OPEN_FILES + * (EMFILE) + * + * @var FileError::Code FileError::FILE_TABLE_OVERFLOW + * (ENFILE) + * + * @var FileError::Code FileError::BAD_FILE_DESCRIPTOR + * (EBADF) + * + * @var FileError::Code FileError::INVALID_ARGUMENT + * (EINVAL) + * + * @var FileError::Code FileError::BROKEN_PIPE + * (EPIPE) + * + * @var FileError::Code FileError::TRYAGAIN + * (EAGAIN) + * + * We use TRYAGAIN instead of TRY_AGAIN, because that is defined as a macro by a Unix header. + * + * @var FileError::Code FileError::INTERRUPTED + * (EINTR) + * + * @var FileError::Code FileError::IO_ERROR + * (EIO) + * + * @var FileError::Code FileError::NOT_OWNER + * (EPERM) + * + * @var FileError::Code FileError::FAILED + * Returned if no specific code applies. */ class Dir; diff --git a/glib/src/glib_docs_override.xml b/glib/src/glib_docs_override.xml index 469c90a..f9eba41 100644 --- a/glib/src/glib_docs_override.xml +++ b/glib/src/glib_docs_override.xml @@ -1,8 +1,23 @@ + + - + + + + + + + + + + + + + + diff --git a/glib/src/glib_extra_objects.defs b/glib/src/glib_extra_objects.defs index cfb6876..2171e9e 100644 --- a/glib/src/glib_extra_objects.defs +++ b/glib/src/glib_extra_objects.defs @@ -44,6 +44,11 @@ (gtype-id "G_TYPE_MATCH_INFO") ) +(define-object NodeTree + (in-module "Glib") + (c-name "GNode") +) + (define-object Object (in-module "Glib") (c-name "GObject") @@ -73,6 +78,11 @@ (c-name "GTimeZone") ) +(define-object Tree + (in-module "Glib") + (c-name "GTree") +) + (define-object Variant (in-module "Glib") (c-name "GVariant") diff --git a/glib/src/glib_signals.defs b/glib/src/glib_signals.defs index 2748e77..d65d39e 100644 --- a/glib/src/glib_signals.defs +++ b/glib/src/glib_signals.defs @@ -25,7 +25,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property target-property @@ -35,7 +34,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "") ) (define-property flags @@ -45,7 +43,6 @@ (readable #t) (writable #t) (construct-only #t) - (default-value "G_BINDING_DEFAULT") ) ;; GBytes is neither a GObject nor a GInterface. Not checked for signals and properties. diff --git a/glib/src/iochannel.ccg b/glib/src/iochannel.ccg index b9d100f..187db24 100644 --- a/glib/src/iochannel.ccg +++ b/glib/src/iochannel.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -34,9 +35,7 @@ namespace // g_io_channel_new_file(). Neither is there a way to hook up a wrapper // object in an existing GIOChannel, nor exists any destroy notification. // -// So that means: If the IOChannel is implemented in C++ -- that is, our -// GlibmmIOChannel backend is used -- we use the GIOChannel reference -// counting mechanism. If the IOChannel backend is unknown, then the +// So that means: If the IOChannel backend is unknown (normal case), then the // wrapper instance holds always exactly one reference to the GIOChannel. // The wrapper object itself is then managed via our own refcounting // mechanism. To do that a utility class ForeignIOChannel is introduced to @@ -75,51 +74,8 @@ ForeignIOChannel::unreference() const namespace Glib { -class GlibmmIOChannel -{ -public: - GIOChannel base; - Glib::IOChannel* wrapper; - - static const GIOFuncs vfunc_table; - - static GIOStatus io_read( - GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err); - - static GIOStatus io_write( - GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err); - - static GIOStatus io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err); - static GIOStatus io_close(GIOChannel* channel, GError** err); - - static GSource* io_create_watch(GIOChannel* channel, GIOCondition condition); - static void io_free(GIOChannel* channel); - - static GIOStatus io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err); - static GIOFlags io_get_flags(GIOChannel* channel); -}; - -// static -const GIOFuncs GlibmmIOChannel::vfunc_table = { - &GlibmmIOChannel::io_read, &GlibmmIOChannel::io_write, &GlibmmIOChannel::io_seek, - &GlibmmIOChannel::io_close, &GlibmmIOChannel::io_create_watch, &GlibmmIOChannel::io_free, - &GlibmmIOChannel::io_set_flags, &GlibmmIOChannel::io_get_flags, -}; - /**** GLib::IOChannel ******************************************************/ -/* Construct a custom C++-implemented IOChannel. GlibmmIOChannel is an - * extended GIOChannel struct which allows us to hook up a pointer to this - * persistent wrapper instance. - */ -IOChannel::IOChannel() : gobject_(static_cast(g_malloc(sizeof(GlibmmIOChannel)))) -{ - g_io_channel_init(gobject_); - gobject_->funcs = const_cast(&GlibmmIOChannel::vfunc_table); - - reinterpret_cast(gobject_)->wrapper = this; -} - IOChannel::IOChannel(IOChannel&& other) noexcept : sigc::trackable(std::move(other)), gobject_(std::move(other.gobject_)) { @@ -145,9 +101,7 @@ IOChannel::operator=(IOChannel&& other) noexcept */ IOChannel::IOChannel(GIOChannel* gobject, bool take_copy) : gobject_(gobject) { - // This ctor should never be called for GlibmmIOChannel instances. g_assert(gobject != nullptr); - g_assert(gobject->funcs != &GlibmmIOChannel::vfunc_table); if (take_copy) g_io_channel_ref(gobject_); @@ -158,19 +112,6 @@ IOChannel::release_gobject() { if (gobject_) { - // Check whether this IOChannel is implemented in C++, i.e. whether it - // uses our GlibmmIOChannel forwarding backend. Normally, this will never - // be true because the wrapper should only be deleted in the io_free() - // callback, which clears gobject_ before deleting. But in case the ctor - // of a derived class threw an exception the GIOChannel must be destroyed - // prematurely. - // - if (gobject_->funcs == &GlibmmIOChannel::vfunc_table) - { - // Disconnect the wrapper object so that it won't be deleted twice. - reinterpret_cast(gobject_)->wrapper = nullptr; - } - const auto tmp_gobject = gobject_; gobject_ = nullptr; @@ -335,56 +276,7 @@ IOChannel::get_line_term() const Glib::RefPtr IOChannel::create_watch(IOCondition condition) { - // The corresponding unreference() takes place in the dtor - // of the Glib::RefPtr object below. - reference(); - return IOSource::create(Glib::RefPtr(this), condition); -} - -IOStatus -IOChannel::read_vfunc(char*, gsize, gsize&) -{ - g_assert_not_reached(); - return IO_STATUS_ERROR; -} - -IOStatus -IOChannel::write_vfunc(const char*, gsize, gsize&) -{ - g_assert_not_reached(); - return IO_STATUS_ERROR; -} - -IOStatus IOChannel::seek_vfunc(gint64, SeekType) -{ - g_assert_not_reached(); - return IO_STATUS_ERROR; -} - -IOStatus -IOChannel::close_vfunc() -{ - g_assert_not_reached(); - return IO_STATUS_ERROR; -} - -Glib::RefPtr IOChannel::create_watch_vfunc(IOCondition) -{ - g_assert_not_reached(); - return Glib::RefPtr(); -} - -IOStatus IOChannel::set_flags_vfunc(IOFlags) -{ - g_assert_not_reached(); - return IO_STATUS_ERROR; -} - -IOFlags -IOChannel::get_flags_vfunc() -{ - g_assert_not_reached(); - return IOFlags(0); + return IOSource::create(gobj(), condition); } void @@ -406,180 +298,11 @@ wrap(GIOChannel* gobject, bool take_copy) if (gobject) { - if (gobject->funcs == &GlibmmIOChannel::vfunc_table) - { - cpp_object = reinterpret_cast(gobject)->wrapper; - - if (take_copy && cpp_object) - cpp_object->reference(); - } - else - { - cpp_object = new ForeignIOChannel(gobject, take_copy); - cpp_object->reference(); // the refcount is initially 0 - } - } - - return Glib::RefPtr(cpp_object); -} - -/**** Glib::GlibmmIOChannel ************************************************/ - -GIOStatus -GlibmmIOChannel::io_read( - GIOChannel* channel, char* buf, gsize count, gsize* bytes_read, GError** err) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOStatus)wrapper->read_vfunc(buf, count, *bytes_read); - } - catch (Glib::Error& error) - { - error.propagate(err); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return G_IO_STATUS_ERROR; -} - -GIOStatus -GlibmmIOChannel::io_write( - GIOChannel* channel, const char* buf, gsize count, gsize* bytes_written, GError** err) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOStatus)wrapper->write_vfunc(buf, count, *bytes_written); - } - catch (Glib::Error& error) - { - error.propagate(err); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return G_IO_STATUS_ERROR; -} - -GIOStatus -GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOStatus)wrapper->seek_vfunc(offset, (SeekType)type); - } - catch (Glib::Error& error) - { - error.propagate(err); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return G_IO_STATUS_ERROR; -} - -GIOStatus -GlibmmIOChannel::io_close(GIOChannel* channel, GError** err) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOStatus)wrapper->close_vfunc(); - } - catch (Glib::Error& error) - { - error.propagate(err); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return G_IO_STATUS_ERROR; -} - -// static -GSource* -GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - const auto source = wrapper->create_watch_vfunc((IOCondition)condition); - return (source) ? source->gobj_copy() : nullptr; - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return nullptr; -} - -// static -void -GlibmmIOChannel::io_free(GIOChannel* channel) -{ - if (IOChannel* const wrapper = reinterpret_cast(channel)->wrapper) - { - wrapper->gobject_ = nullptr; - delete wrapper; - } - - g_free(channel); -} - -GIOStatus -GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOStatus)wrapper->set_flags_vfunc((IOFlags)flags); - } - catch (Glib::Error& error) - { - error.propagate(err); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return G_IO_STATUS_ERROR; -} - -// static -GIOFlags -GlibmmIOChannel::io_get_flags(GIOChannel* channel) -{ - const auto wrapper = reinterpret_cast(channel)->wrapper; - - try - { - return (GIOFlags)wrapper->get_flags_vfunc(); - } - catch (...) - { - Glib::exception_handlers_invoke(); + cpp_object = new ForeignIOChannel(gobject, take_copy); + cpp_object->reference(); // the refcount is initially 0 } - return GIOFlags(0); + return Glib::make_refptr_for_instance(cpp_object); } } // namespace Glib diff --git a/glib/src/iochannel.hg b/glib/src/iochannel.hg index 5df0ebc..7a3ade1 100644 --- a/glib/src/iochannel.hg +++ b/glib/src/iochannel.hg @@ -11,13 +11,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) #include -#include //For the GIOChannel enum values. +#include //For the GIOCondition enum values. #include #include #include @@ -34,18 +35,19 @@ namespace Glib class Source; class IOSource; -_WRAP_ENUM(SeekType, GSeekType, NO_GTYPE, s#^SEEK_#SEEK_TYPE_#) -_WRAP_ENUM(IOStatus, GIOStatus, NO_GTYPE) +_WRAP_ENUM(SeekType, GSeekType, NO_GTYPE) +_WRAP_ENUM(IOStatus, GIOStatus, NO_GTYPE, s#^EOF$#ENDOFFILE#) _WRAP_ENUM(IOFlags, GIOFlags, NO_GTYPE) -/** A bitwise combination representing an I/O condition to watch for on an +/** @enum IOCondition + * A bitwise combination representing an I/O condition to watch for on an * event source. * The flags correspond to those used by the %poll() system call * on UNIX (see man 2 poll). To test for individual flags, do * something like this: * @code - * if((condition & Glib::IO_OUT) != 0) + * if ((condition & Glib::IOCondition::OUT) == Glib::IOCondition::OUT) * do_some_output(); * @endcode */ @@ -202,8 +204,8 @@ public: /** Reads all the remaining data from the file. * @retval str The resulting string. - * @return Glib::IO_STATUS_NORMAL on success. This function never - * returns Glib::IO_STATUS_EOF. + * @return Glib::IOStatus::NORMAL on success. This function never + * returns Glib::IOStatus::ENDOFFILE. * @throw Glib::IOChannelError * @throw Glib::ConvertError */ @@ -213,7 +215,7 @@ public: /** Write a string to the I/O channel. * Note that this method does not return the number of characters written. * If the channel is blocking and the returned value is - * Glib::IO_STATUS_NORMAL, the whole string was written. + * Glib::IOStatus::NORMAL, the whole string was written. * @param str the string to write. * @return The status of the operation. * @throw Glib::IOChannelError @@ -242,14 +244,14 @@ public: /** Seek the I/O channel to a specific position. * @param offset The offset in bytes from the position specified by @a type. - * @param type A SeekType. The type Glib::SEEK_TYPE_CUR is only allowed in + * @param type A SeekType. The type Glib::SeekType::CUR is only allowed in * those cases where a call to set_encoding() is allowed. See the * documentation for set_encoding() for details. * @return The status of the operation. * @throw Glib::IOChannelError * @throw Glib::ConvertError */ - _WRAP_METHOD(IOStatus seek(gint64 offset, SeekType type = SEEK_TYPE_SET), + _WRAP_METHOD(IOStatus seek(gint64 offset, SeekType type = SeekType::SET), g_io_channel_seek_position, errthrow) /** Flush the buffers of the I/O channel. @@ -305,10 +307,10 @@ public: * * A buffered channel can only be set unbuffered if the channel's internal * buffers have been flushed. Newly created channels or channels which have - * returned Glib::IO_STATUS_EOF not require such a flush. For write-only + * returned Glib::IOStatus::ENDOFFILE not require such a flush. For write-only * channels, a call to flush() is sufficient. For all other channels, the * buffers may be flushed by a call to seek(). This includes the possibility - * of seeking with seek type Glib::SEEK_TYPE_CUR and an offset of zero. Note + * of seeking with seek type Glib::SeekType::CUR and an offset of zero. Note * that this means that socket-based channels cannot be set unbuffered once * they have had data read from them. * @@ -361,21 +363,21 @@ public: * -# The channel is a file, and the file pointer was just repositioned by a * call to seek_position(). (This flushes all the internal buffers.) * -# The current encoding is "" or UTF-8. - * -# One of the read methods has just returned Glib::IO_STATUS_EOF (or, in - * the case of read_to_end(), Glib::IO_STATUS_NORMAL). - * -# The read() method has returned Glib::IO_STATUS_AGAIN or thrown + * -# One of the read methods has just returned Glib::IOStatus::ENDOFFILE (or, in + * the case of read_to_end(), Glib::IOStatus::NORMAL). + * -# The read() method has returned Glib::IOStatus::AGAIN or thrown * a Glib::Error exception. This may be useful in the case of * ConvertError::ILLEGAL_SEQUENCE. Returning one of these statuses * from read_line() or read_to_end() does not guarantee that * the encoding can be changed. * * Channels which do not meet one of the above conditions cannot call - * seek_position() with a seek type of Glib::SEEK_TYPE_CUR and, if they + * seek_position() with a seek type of Glib::SeekType::CUR and, if they * are "seekable", cannot call write() after calling one of the API * "read" methods. * * @param encoding The encoding name, or "" for binary. - * @return Glib::IO_STATUS_NORMAL if the encoding was successfully set. + * @return Glib::IOStatus::NORMAL if the encoding was successfully set. * @throw Glib::IOChannelError */ IOStatus set_encoding(const std::string& encoding = std::string()); @@ -418,61 +420,12 @@ public: protected: GIOChannel* gobject_; - /** Constructor that should be used by derived classes. - * Use this constructor if you want to inherit from IOChannel. - * It will set up a GIOChannel that will call the vfuncs of your - * class even if it is being used from C code, and it will keep - * a reference to the C++ code while the GIOChannel exists. - */ - IOChannel(); _IGNORE(g_io_channel_init) #ifndef DOXYGEN_SHOULD_SKIP_THIS IOChannel(GIOChannel* gobject, bool take_copy); #endif - //We don't put GLIBMM_DISABLE_DEPRECATED around these deprecated methods - //because they are virtual and that would make the ABI dependent on the ifdef. - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOStatus read_vfunc(char* buf, gsize count, gsize& bytes_read); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOStatus write_vfunc(const char* buf, gsize count, gsize& bytes_written); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOStatus seek_vfunc(gint64 offset, SeekType type); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOStatus close_vfunc(); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOStatus set_flags_vfunc(IOFlags flags); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual IOFlags get_flags_vfunc(); - - /** - * @deprecated Custom Glib::IOChannel implementation was never really supported. - */ - virtual Glib::RefPtr create_watch_vfunc(IOCondition cond); - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - friend class Glib::GlibmmIOChannel; -#endif - private: void release_gobject(); }; diff --git a/glib/src/keyfile.ccg b/glib/src/keyfile.ccg index 08572fd..ce14bed 100644 --- a/glib/src/keyfile.ccg +++ b/glib/src/keyfile.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Glib @@ -60,7 +61,7 @@ KeyFile::~KeyFile() } bool -KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags) +KeyFile::load_from_data(const Glib::ustring& data, Flags flags) { GError* gerror = nullptr; @@ -74,7 +75,7 @@ KeyFile::load_from_data(const Glib::ustring& data, KeyFileFlags flags) } bool -KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags) +KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, Flags flags) { GError* gerror = nullptr; char* full_path_c = nullptr; @@ -94,14 +95,14 @@ KeyFile::load_from_data_dirs(const std::string& file, std::string& full_path, Ke } bool -KeyFile::load_from_dirs(const std::string& file, const Glib::ArrayHandle& search_dirs, - std::string& full_path, KeyFileFlags flags) +KeyFile::load_from_dirs(const std::string& file, const std::vector& search_dirs, + std::string& full_path, Flags flags) { GError* gerror = nullptr; char* full_path_c = nullptr; const gboolean result = - g_key_file_load_from_dirs(gobj(), file.c_str(), const_cast(search_dirs.data()), + g_key_file_load_from_dirs(gobj(), file.c_str(), const_cast(Glib::ArrayHandler::vector_to_array(search_dirs).data()), &full_path_c, static_cast(unsigned(flags)), &gerror); if (gerror) @@ -133,16 +134,16 @@ KeyFile::to_data() return Glib::convert_return_gchar_ptr_to_ustring(str); } -Glib::ArrayHandle +std::vector KeyFile::get_groups() const { gsize length = 0; char** const array = g_key_file_get_groups(const_cast(gobj()), &length); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_DEEP); } -Glib::ArrayHandle +std::vector KeyFile::get_keys(const Glib::ustring& group_name) const { gsize length = 0; @@ -154,7 +155,7 @@ KeyFile::get_keys(const Glib::ustring& group_name) const if (gerror) Glib::Error::throw_exception(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_DEEP); } Glib::ustring @@ -246,7 +247,7 @@ KeyFile::set_double(const Glib::ustring& key, double value) if (err) \ Glib::Error::throw_exception(err) -Glib::ArrayHandle +std::vector KeyFile::get_string_list( const Glib::ustring& group_name, const Glib::ustring& key GLIBMM_ERROR_ARG) const { @@ -258,10 +259,10 @@ KeyFile::get_string_list( GLIBMM_THROW(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_DEEP); } -Glib::ArrayHandle +std::vector KeyFile::get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale GLIBMM_ERROR_ARG) const { @@ -273,10 +274,10 @@ KeyFile::get_locale_string_list(const Glib::ustring& group_name, const Glib::ust GLIBMM_THROW(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_DEEP); } -Glib::ArrayHandle +std::vector KeyFile::get_boolean_list( const Glib::ustring& group_name, const Glib::ustring& key GLIBMM_ERROR_ARG) const { @@ -288,10 +289,10 @@ KeyFile::get_boolean_list( GLIBMM_THROW(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_SHALLOW); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW); } -Glib::ArrayHandle +std::vector KeyFile::get_integer_list( const Glib::ustring& group_name, const Glib::ustring& key GLIBMM_ERROR_ARG) const { @@ -303,10 +304,10 @@ KeyFile::get_integer_list( GLIBMM_THROW(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_SHALLOW); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW); } -Glib::ArrayHandle +std::vector KeyFile::get_double_list( const Glib::ustring& group_name, const Glib::ustring& key GLIBMM_ERROR_ARG) const { @@ -317,47 +318,47 @@ KeyFile::get_double_list( const_cast(gobj()), group_name.c_str(), key.c_str(), &length, &gerror); GLIBMM_THROW(gerror); - return Glib::ArrayHandle(array, length, Glib::OWNERSHIP_SHALLOW); + return Glib::ArrayHandler::array_to_vector(array, length, Glib::OWNERSHIP_SHALLOW); } void KeyFile::set_string_list(const Glib::ustring& group_name, const Glib::ustring& key, - const Glib::ArrayHandle& list) + const std::vector& list) { g_key_file_set_string_list( - gobj(), Glib::c_str_or_nullptr(group_name), key.c_str(), list.data(), list.size()); + gobj(), Glib::c_str_or_nullptr(group_name), key.c_str(), Glib::ArrayHandler::vector_to_array(list).data(), list.size()); } void KeyFile::set_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, - const Glib::ustring& locale, const Glib::ArrayHandle& list) + const Glib::ustring& locale, const std::vector& list) { g_key_file_set_locale_string_list(gobj(), Glib::c_str_or_nullptr(group_name), key.c_str(), - locale.c_str(), list.data(), list.size()); + locale.c_str(), Glib::ArrayHandler::vector_to_array(list).data(), list.size()); } void KeyFile::set_integer_list( - const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list) + const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list) { g_key_file_set_integer_list(gobj(), Glib::c_str_or_nullptr(group_name), key.c_str(), - const_cast(list.data()), list.size()); + const_cast(Glib::ArrayHandler::vector_to_array(list).data()), list.size()); } void KeyFile::set_double_list( - const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list) + const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list) { g_key_file_set_double_list( - gobj(), group_name.c_str(), key.c_str(), const_cast(list.data()), list.size()); + gobj(), group_name.c_str(), key.c_str(), const_cast(Glib::ArrayHandler::vector_to_array(list).data()), list.size()); } void KeyFile::set_boolean_list( - const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list) + const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list) { g_key_file_set_boolean_list(gobj(), Glib::c_str_or_nullptr(group_name), key.c_str(), - const_cast(list.data()), list.size()); + const_cast(Glib::ArrayHandler::vector_to_array(list).data()), list.size()); } Glib::ustring diff --git a/glib/src/keyfile.hg b/glib/src/keyfile.hg index 23e9028..e33b1d8 100644 --- a/glib/src/keyfile.hg +++ b/glib/src/keyfile.hg @@ -11,17 +11,18 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) #include #include -#include #include #include #include +#include #ifndef DOXYGEN_SHOULD_SKIP_THIS extern "C" { typedef struct _GKeyFile GKeyFile; } @@ -30,8 +31,6 @@ extern "C" { typedef struct _GKeyFile GKeyFile; } namespace Glib { - _WRAP_ENUM(KeyFileFlags, GKeyFileFlags, NO_GTYPE) - /** Exception class for KeyFile errors. */ _WRAP_GERROR(KeyFileError, GKeyFileError, G_KEY_FILE_ERROR, NO_GTYPE) @@ -96,6 +95,8 @@ class KeyFile _CLASS_GENERIC(KeyFile, GKeyFile) public: + _WRAP_ENUM(Flags, GKeyFileFlags, NO_GTYPE) + //TODO: GKeyFile now seems to be a reference-counted type. //TODO: Maybe replace all the get_*/set_* methods with some generic get/set @@ -127,7 +128,7 @@ public: KeyFile(GKeyFile* castitem, bool takes_ownership = false); public: - _WRAP_METHOD(bool load_from_file(const std::string& file, KeyFileFlags flags = Glib::KEY_FILE_NONE), g_key_file_load_from_file, errthrow) + _WRAP_METHOD(bool load_from_file(const std::string& file, Flags flags = Flags::NONE), g_key_file_load_from_file, errthrow) /** Loads a KeyFile from memory * @param data The data to use as a KeyFile @@ -135,17 +136,15 @@ public: * @return true if the KeyFile was successfully loaded, false otherwise * @throw Glib::KeyFileError */ - bool load_from_data(const Glib::ustring& data, KeyFileFlags flags = Glib::KEY_FILE_NONE); + bool load_from_data(const Glib::ustring& data, Flags flags = Flags::NONE); _IGNORE(g_key_file_load_from_data) -#m4 _CONVERSION(`const Glib::ArrayHandle&', `const gchar**', `const_cast($3.data())') -#m4 _CONVERSION(`Glib::ArrayHandle&', `gchar**', `const_cast($3.data())') +#m4 _CONVERSION(`const std::vector& ', `const gchar**', `const_cast($3.data())') - _WRAP_METHOD(bool load_from_dirs(const std::string& file, const Glib::ArrayHandle& search_dirs, Glib::ArrayHandle& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE), - g_key_file_load_from_dirs, errthrow, deprecated "Use the load_from_dirs() method that takes a std::string& full_path.") + _IGNORE(g_key_file_load_from_dirs) _WRAP_METHOD_DOCS_ONLY(g_key_file_load_from_dirs) - bool load_from_dirs(const std::string& file, const Glib::ArrayHandle& search_dirs, std::string& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE); + bool load_from_dirs(const std::string& file, const std::vector& search_dirs, std::string& full_path, Flags flags = Flags::NONE); /** Looks for a KeyFile named @a file in the paths returned from * g_get_user_data_dir() and g_get_system_data_dirs() and loads them @@ -158,7 +157,7 @@ public: * @throw Glib::KeyFileError * @throw Glib::FileError */ - bool load_from_data_dirs(const std::string& file, std::string& full_path, KeyFileFlags flags = Glib::KEY_FILE_NONE); + bool load_from_data_dirs(const std::string& file, std::string& full_path, Flags flags = Flags::NONE); _IGNORE(g_key_file_load_from_data_dirs) /** Outputs the KeyFile as a string @@ -175,7 +174,7 @@ public: /** Gets a list of all groups in the KeyFile * @returns A list containing the names of the groups */ - Glib::ArrayHandle get_groups() const; + std::vector get_groups() const; _IGNORE(g_key_file_get_groups) /** Gets a list of all keys from the group @a group_name. @@ -183,7 +182,7 @@ public: * @returns A list containing the names of the keys in @a group_name * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_keys(const Glib::ustring& group_name) const; + std::vector get_keys(const Glib::ustring& group_name) const; _IGNORE(g_key_file_get_keys) _WRAP_METHOD(bool has_group(const Glib::ustring& group_name) const, g_key_file_has_group) @@ -280,7 +279,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; + std::vector get_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; _IGNORE(g_key_file_get_string_list) /** Returns the values associated with @a key under @a group_name @@ -290,7 +289,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; + std::vector get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key) const; /** Returns the values associated with @a key under @a group_name * translated into @a locale, if available. @@ -300,7 +299,7 @@ public: * @return A list containing the values requested * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const; + std::vector get_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale) const; _IGNORE(g_key_file_get_locale_string_list) /** Returns the values associated with @a key under @a group_name @@ -309,7 +308,7 @@ public: * @return A list of booleans * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key) const; + std::vector get_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key) const; _IGNORE(g_key_file_get_boolean_list) /** Returns the values associated with @a key under @a group_name @@ -318,7 +317,7 @@ public: * @return A list of integers * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key) const; + std::vector get_integer_list(const Glib::ustring& group_name, const Glib::ustring& key) const; _IGNORE(g_key_file_get_integer_list) /** Returns the values associated with @a key under @a group_name @@ -327,7 +326,7 @@ public: * @return A list of doubles * @throw Glib::KeyFileError */ - Glib::ArrayHandle get_double_list(const Glib::ustring& group_name, const Glib::ustring& key) const; + std::vector get_double_list(const Glib::ustring& group_name, const Glib::ustring& key) const; _IGNORE(g_key_file_get_double_list) /** Get comment from top of file @@ -361,7 +360,7 @@ public: * @param key The name of a key * @param list A list holding objects of type Glib::ustring */ - void set_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list); + void set_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list); _IGNORE(g_key_file_set_string_list) /** Sets a list of string values for the @a key under @a group_name and marks @@ -372,7 +371,7 @@ public: * @param locale A locale * @param list A list holding objects of type Glib::ustring */ - void set_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const Glib::ArrayHandle& list); + void set_locale_string_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ustring& locale, const std::vector& list); _IGNORE(g_key_file_set_locale_string_list) /** Sets a list of booleans for the @a key under @a group_name. @@ -381,7 +380,7 @@ public: * @param key The name of a key * @param list A list holding object of type bool */ - void set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list); + void set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list); _IGNORE(g_key_file_set_boolean_list) /** Sets a list of integers for the @a key under @a group_name. @@ -390,7 +389,7 @@ public: * @param key The name of a key * @param list A list holding object of type int */ - void set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list); + void set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list); _IGNORE(g_key_file_set_integer_list) /** Sets a list of doubles for the @a key under @a group_name. @@ -401,7 +400,7 @@ public: * * @newin{2,14} */ - void set_double_list(const Glib::ustring& group_name, const Glib::ustring& key, const Glib::ArrayHandle& list); + void set_double_list(const Glib::ustring& group_name, const Glib::ustring& key, const std::vector& list); _IGNORE(g_key_file_set_double_list) diff --git a/glib/src/markup.ccg b/glib/src/markup.ccg index 408b168..4e2bf54 100644 --- a/glib/src/markup.ccg +++ b/glib/src/markup.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/markup.hg b/glib/src/markup.hg index bd1d24b..6f745f5 100644 --- a/glib/src/markup.hg +++ b/glib/src/markup.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -109,17 +110,7 @@ using Error = Glib::MarkupError; */ Glib::ustring escape_text(const Glib::ustring& text); - -/** There are no flags right now. Pass Glib::Markup::ParseFlags(0) for - * the flags argument to all functions (this should be the default argument - * anyway). - */ -_WRAP_ENUM(ParseFlags, GMarkupParseFlags, NO_GTYPE, s#^MARKUP_##) - -/*! @var Markup::ParseFlags DO_NOT_USE_THIS_UNSUPPORTED_FLAG - * Flag you should not use. - */ - +_WRAP_ENUM(ParseFlags, GMarkupParseFlags, NO_GTYPE) /** Binary predicate used by Markup::Parser::AttributeMap. * @ingroup Markup diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg index f11326d..579bcca 100644 --- a/glib/src/miscutils.ccg +++ b/glib/src/miscutils.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -74,7 +75,7 @@ unsetenv(const std::string& variable) g_unsetenv(variable.c_str()); } -Glib::ArrayHandle +std::vector listenv() { char** value = g_listenv(); @@ -83,7 +84,7 @@ listenv() { ++end; } - return Glib::ArrayHandle(value, end - value, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(value, end - value, Glib::OWNERSHIP_DEEP); } std::string @@ -116,14 +117,6 @@ get_current_dir() return convert_return_gchar_ptr_to_stdstring(g_get_current_dir()); } -#ifndef GLIBMM_DISABLE_DEPRECATED -std::string -get_user_special_dir(GUserDirectory directory) -{ - return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir(directory)); -} -#endif // GLIBMM_DISABLE_DEPRECATED - std::string get_user_special_dir(UserDirectory directory) { @@ -209,10 +202,10 @@ path_get_dirname(const std::string& filename) } std::string -build_filename(const Glib::ArrayHandle& elements) +build_filename(const std::vector& elements) { return convert_return_gchar_ptr_to_stdstring( - g_build_filenamev(const_cast(elements.data()))); + g_build_filenamev(const_cast(Glib::ArrayHandler::vector_to_array(elements).data()))); } std::string @@ -283,10 +276,10 @@ build_filename(const std::string& elem1, const std::string& elem2, const std::st } std::string -build_path(const std::string& separator, const Glib::ArrayHandle& elements) +build_path(const std::string& separator, const std::vector& elements) { return convert_return_gchar_ptr_to_stdstring( - g_build_pathv(separator.c_str(), const_cast(elements.data()))); + g_build_pathv(separator.c_str(), const_cast(Glib::ArrayHandler::vector_to_array(elements).data()))); } std::string diff --git a/glib/src/miscutils.hg b/glib/src/miscutils.hg index 5b0ba58..336b13c 100644 --- a/glib/src/miscutils.hg +++ b/glib/src/miscutils.hg @@ -11,17 +11,18 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) -#include #include +#include namespace Glib { -_WRAP_ENUM(UserDirectory, GUserDirectory, NO_GTYPE) +_WRAP_ENUM(UserDirectory, GUserDirectory, NO_GTYPE, s#^DIRECTORY_##) _WRAP_ENUM(FormatSizeFlags, GFormatSizeFlags, NO_GTYPE) /** @defgroup MiscUtils Miscellaneous Utility Functions @@ -139,7 +140,7 @@ void unsetenv(const std::string& variable); * @return Array of environment names (The generic ArrayHandle will be * implicitly converted to any STL compatible container type). */ -Glib::ArrayHandle listenv(); +std::vector listenv(); /** Gets the user name of the current user. * @@ -181,28 +182,6 @@ std::string get_tmp_dir(); */ std::string get_current_dir(); -#ifndef GLIBMM_DISABLE_DEPRECATED -/** Returns the full path of a special directory using its logical id. - * - * On Unix this is done using the XDG special user directories. - * For compatibility with existing practise, G_USER_DIRECTORY_DESKTOP - * falls back to `$HOME/Desktop` when XDG special user directories have - * not been set up. - * - * Depending on the platform, the user might be able to change the path - * of the special directory without requiring the session to restart; GLib - * will not reflect any change once the special directories are loaded. - * - * @param directory The logical id of special directory. - * @return The path to the specified special directory, or an empty string - * if the logical id was not found. - * - * @newin{2,14} - * @deprecated Use get_user_special_dir(Glib::UserDirectory directory) instead. - */ -std::string get_user_special_dir(GUserDirectory directory); -#endif // GLIBMM_DISABLE_DEPRECATED - /** Returns the full path of a special directory using its logical id. * * On Unix this is done using the XDG special user directories. @@ -305,7 +284,7 @@ std::string path_get_dirname(const std::string& filename); * Any STL compatible container type is accepted. * @return The resulting path. */ -std::string build_filename(const Glib::ArrayHandle& elements); +std::string build_filename(const std::vector& elements); /** Creates a filename from two elements using the correct separator for filenames. * No attempt is made to force the resulting filename to be an absolute path. @@ -471,7 +450,7 @@ std::string build_filename(const std::string& elem1, const std::string& elem2, * @return The resulting path. */ std::string build_path(const std::string& separator, - const Glib::ArrayHandle& elements); + const std::vector& elements); /** Locates the first executable named @a program in the user's path, in the * same way that execvp() would locate it. @@ -502,7 +481,7 @@ std::string find_program_in_path(const std::string& program); * 3292528 bytes will be converted into the string "3.2 MB". * * The prefix units base is 1000 (i.e. 1 kB is 1000 bytes), unless the - * Glib::FORMAT_SIZE_IEC_UNITS flag is set. + * Glib::FormatSizeFlags::IEC_UNITS flag is set. * * @param size A size in bytes. * @param flags Flags to modify the output. @@ -510,7 +489,7 @@ std::string find_program_in_path(const std::string& program); * * @newin{2,46} */ -Glib::ustring format_size(guint64 size, FormatSizeFlags flags = FORMAT_SIZE_DEFAULT); +Glib::ustring format_size(guint64 size, FormatSizeFlags flags = FormatSizeFlags::DEFAULT); /** @} group MiscUtils */ diff --git a/glib/src/module.ccg b/glib/src/module.ccg index 139e913..37ead86 100644 --- a/glib/src/module.ccg +++ b/glib/src/module.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,7 +21,7 @@ namespace Glib { -Module::Module(const std::string& file_name, ModuleFlags flags) +Module::Module(const std::string& file_name, Flags flags) : gobject_(g_module_open(file_name.c_str(), (GModuleFlags)flags)) { } diff --git a/glib/src/module.hg b/glib/src/module.hg index d1af3bb..bb6f428 100644 --- a/glib/src/module.hg +++ b/glib/src/module.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -25,8 +26,6 @@ extern "C" { typedef struct _GModule GModule; } namespace Glib { -_WRAP_ENUM(ModuleFlags, GModuleFlags, NO_GTYPE) - //TODO: Replace get_last_error() with exceptions? //Provide operator()? @@ -44,6 +43,8 @@ class Module public: + _WRAP_ENUM(Flags, GModuleFlags, NO_GTYPE) + /** Opens a module. * * First of all it tries to open file_name as a module. If that @@ -68,7 +69,7 @@ public: * @param file_name The library filename to open * @param flags Flags to configure the load process */ - explicit Module(const std::string& file_name, ModuleFlags flags = ModuleFlags(0)); + explicit Module(const std::string& file_name, Flags flags = Flags(0)); Module(const Module&) = delete; Module& operator=(const Module&) = delete; diff --git a/glib/src/nodetree.hg b/glib/src/nodetree.hg index cdd526b..72cf86d 100644 --- a/glib/src/nodetree.hg +++ b/glib/src/nodetree.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -20,30 +21,16 @@ _DEFS(glibmm,glib) #include #include +#include +#include #include #include #include -#include #include namespace Glib { -//Hand-written, instead of using _WRAP_ENUM, -//because the C enum values don't have a prefix. - -/** Specifies the type of traveral performed by methods such as NodeTree::_traverse() and NodeTree::find(). - * - * @ingroup glibmmEnums - */ -enum TraverseType -{ - TRAVERSE_IN_ORDER = G_IN_ORDER, /*!< Visits a node's left child first, then the node itself, then its right child. This is the one to use if you want the output sorted according to the compare function. */ - TRAVERSE_PRE_ORDER = G_PRE_ORDER, /*!< Visits a node, then its children. */ - TRAVERSE_POST_ORDER = G_POST_ORDER, /*!< Visits the node's children, then the node itself. */ - TRAVERSE_LEVEL_ORDER = G_LEVEL_ORDER /*!< For NodeTree, it vists the root node first, then its children, then its grandchildren, and so on. Note that this is less efficient than the other orders. This is not implemented for Glib::Tree. */ -}; - /** N-ary Trees - trees of data with any number of branches * The NodeTree class and its associated functions provide an N-ary tree data structure, in which nodes in the tree can contain arbitrary data. * @@ -68,8 +55,10 @@ class NodeTree { _CLASS_GENERIC(NodeTree, GNode) public: - using TraverseFunc = sigc::slot&>; - using ForeachFunc = sigc::slot&>; + _WRAP_ENUM(TraverseType, GTraverseType, NO_GTYPE) + + using TraverseFunc = sigc::slot&)>; + using ForeachFunc = sigc::slot&)>; private: static NodeTree* wrap(GNode* node) @@ -281,18 +270,19 @@ public: } _IGNORE(g_node_get_root) - + // Can't use _WRAP_ENUM for a Flags-type enum in a template class. + // gmmproc would get the bitwise operators wrong. /** Specifies which nodes are visited during several of the NodeTree methods, * including traverse() and find(). * * @ingroup glibmmEnums */ - enum TraverseFlags + enum class TraverseFlags { - TRAVERSE_LEAVES = G_TRAVERSE_LEAVES, /*!< Only leaf nodes should be visited. */ - TRAVERSE_NON_LEAVES = G_TRAVERSE_NON_LEAVES, /*!< Only non-leaf nodes should be visited. */ - TRAVERSE_ALL = G_TRAVERSE_ALL, /*!< All nodes should be visited. */ - TRAVERSE_MASK = G_TRAVERSE_MASK /*!< A mask of all traverse flags. */ + LEAVES = G_TRAVERSE_LEAVES, /*!< Only leaf nodes should be visited. */ + NON_LEAVES = G_TRAVERSE_NON_LEAVES, /*!< Only non-leaf nodes should be visited. */ + ALL = G_TRAVERSE_ALL, /*!< All nodes should be visited. */ + MASK = G_TRAVERSE_MASK /*!< A mask of all traverse flags. */ }; /** Traverses a tree starting at the current node. @@ -308,7 +298,7 @@ public: * If max_depth is 2, the root and its children are visited. And so on. * @param func the slot to invoke for each visited child */ - void traverse(const TraverseFunc& func, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL, int max_depth = -1) + void traverse(const TraverseFunc& func, TraverseType order = TraverseType::IN_ORDER, TraverseFlags flags = TraverseFlags::ALL, int max_depth = -1) { TraverseFunc func_copy = func; g_node_traverse(gobj(), (GTraverseType)order, (GTraverseFlags)flags, max_depth, c_callback_traverse, reinterpret_cast(&func_copy)); @@ -321,7 +311,7 @@ public: * @param flags Wwhich types of children are to be visited. * @param func The slot to invoke for each visited node. */ - void foreach(const ForeachFunc& func, TraverseFlags flags = TRAVERSE_ALL) + void foreach(const ForeachFunc& func, TraverseFlags flags = TraverseFlags::ALL) { ForeachFunc func_copy = func; g_node_children_foreach(gobj(), (GTraverseFlags)flags, c_callback_foreach, reinterpret_cast(&func_copy)); @@ -330,16 +320,16 @@ public: /** Finds the first child of a NodeTree with the given data. * - * @param flags Which types of children are to be visited, one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES. + * @param flags Which types of children are to be visited, one of TraverseFlags::ALL, TraverseFlags::LEAVES or TraverseFlags::NON_LEAVES. * @param the_data The data for which to search. * @return the found child, or nullptr if the data is not found */ - NodeTree* find_child(const T& the_data, TraverseFlags flags = TRAVERSE_ALL) + NodeTree* find_child(const T& the_data, TraverseFlags flags = TraverseFlags::ALL) { - sigc::slot real_slot = sigc::ptr_fun(on_compare_child); + sigc::slot real_slot = sigc::ptr_fun(on_compare_child); GNode* child = nullptr; - using type_foreach_gnode_slot = sigc::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)); @@ -349,11 +339,11 @@ public: /** Finds the first child of a NodeTree with the given data. * - * @param flags Which types of children are to be visited, one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES. + * @param flags Which types of children are to be visited, one of TraverseFlags::ALL, TraverseFlags::LEAVES or TraverseFlags::NON_LEAVES. * @param the_data The data for which to search. * @return the found child, or nullptr if the data is not found */ - const NodeTree* find_child(const T& the_data, TraverseFlags flags = TRAVERSE_ALL) const + const NodeTree* find_child(const T& the_data, TraverseFlags flags = TraverseFlags::ALL) const { return const_cast*>(this)->find_child(flags, the_data); } @@ -362,18 +352,18 @@ public: /** Finds a node in a tree. * - * @param order The order in which nodes are visited: IN_ORDER, TRAVERSE_PRE_ORDER, TRAVERSE_POST_ORDER, or TRAVERSE_LEVEL_ORDER - * @param flags Which types of children are to be visited: one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES. + * @param order The order in which nodes are visited: TraverseType::IN_ORDER, TraverseType::PRE_ORDER, TraverseType::POST_ORDER, or TraverseType::LEVEL_ORDER + * @param flags Which types of children are to be visited: one of TraverseFlags::ALL, TraverseFlags::LEAVES or TraverseFlags::NON_LEAVES. * @param the_data The data for which to search. * @return The found node, or nullptr if the data is not found. */ - NodeTree* find(const T& the_data, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL) + NodeTree* find(const T& the_data, TraverseType order = TraverseType::IN_ORDER, TraverseFlags flags = TraverseFlags::ALL) { //We use a sigc::slot for the C callback, so we can bind some extra data. - sigc::slot real_slot = sigc::ptr_fun(on_compare_node); + sigc::slot real_slot = sigc::ptr_fun(on_compare_node); GNode* child = nullptr; - using type_traverse_gnode_slot = sigc::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)); @@ -388,7 +378,7 @@ public: * @param the_data The data for which to search. * @return The found node, or nullptr if the data is not found. */ - const NodeTree* find(const T& the_data, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL) const + const NodeTree* find(const T& the_data, TraverseType order = TraverseType::IN_ORDER, TraverseFlags flags = TraverseFlags::ALL) const { return const_cast*>(this)->find(order, flags, the_data); } @@ -591,10 +581,10 @@ public: /** Gets the number of nodes in a tree. * - * @param flags Which types of children are to be counted: one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES + * @param flags Which types of children are to be counted: one of TraverseFlags::ALL, TraverseFlags::LEAVES or TraverseFlags::NON_LEAVES * @return The number of nodes in the tree. */ - guint node_count(TraverseFlags flags = TRAVERSE_ALL) const + guint node_count(TraverseFlags flags = TraverseFlags::ALL) const { return g_node_n_nodes(const_cast(gobj()), (GTraverseFlags)flags); } @@ -731,7 +721,7 @@ private: } } - /// Wrapper for invoking a sigc::slot (Internal use). + /// Wrapper for invoking a sigc::slot (Internal use). static void c_callback_foreach_compare_child(GNode* node, gpointer data) { const ForeachFunc* slot = reinterpret_cast(data); @@ -749,7 +739,7 @@ private: return FALSE; } - /// Wrapper for invoking a sigc::slot (Internal use). + /// Wrapper for invoking a sigc::slot (Internal use). static gboolean c_callback_traverse_compare_node(GNode* node, gpointer data) { const TraverseFunc* slot = reinterpret_cast(data); diff --git a/glib/src/optioncontext.ccg b/glib/src/optioncontext.ccg index 2b44a73..a6132d0 100644 --- a/glib/src/optioncontext.ccg +++ b/glib/src/optioncontext.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -93,15 +94,15 @@ OptionContext::~OptionContext() void OptionContext::add_group(OptionGroup& group) { - // Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later. - g_option_context_add_group(gobj(), (group).gobj_give_ownership()); + // GObjectContext takes ownership of the GOptionGroup, unrefing it later. + g_option_context_add_group(gobj(), group.gobj_copy()); } void OptionContext::set_main_group(OptionGroup& group) { - // Strangely, GObjectContext actually takes ownership of the GOptionGroup, deleting it later. - g_option_context_set_main_group(gobj(), (group).gobj_give_ownership()); + // GObjectContext takes ownership of the GOptionGroup, unrefing it later. + g_option_context_set_main_group(gobj(), group.gobj_copy()); } /* diff --git a/glib/src/optioncontext.hg b/glib/src/optioncontext.hg index c40c41d..0f86e6e 100644 --- a/glib/src/optioncontext.hg +++ b/glib/src/optioncontext.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -199,7 +200,7 @@ public: * This function is used to translate user-visible strings, for --help output. * The function takes an untranslated string and returns a translated string */ - using SlotTranslate = sigc::slot; + using SlotTranslate = sigc::slot; /** * Sets the function which is used to translate user-visible diff --git a/glib/src/optionentry.ccg b/glib/src/optionentry.ccg index 3d320b3..705e373 100644 --- a/glib/src/optionentry.ccg +++ b/glib/src/optionentry.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,6 +21,8 @@ namespace Glib { +using Flags = OptionEntry::Flags; + OptionEntry::OptionEntry() { gobject_ = g_new0(GOptionEntry, 1); diff --git a/glib/src/optionentry.hg b/glib/src/optionentry.hg index d1f1ecc..c64d13b 100644 --- a/glib/src/optionentry.hg +++ b/glib/src/optionentry.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -44,17 +45,7 @@ class OptionEntry _CLASS_GENERIC(OptionEntry, GOptionEntry) public: - //Copied from goption.h, instead of generated, so that we can put it inside the class. - enum Flags - { - FLAG_HIDDEN = 1 << 0, - FLAG_IN_MAIN = 1 << 1, - FLAG_REVERSE = 1 << 2, - FLAG_NO_ARG = 1 << 3, - FLAG_FILENAME = 1 << 4, - FLAG_OPTIONAL_ARG = 1 << 5, - FLAG_NOALIAS = 1 << 6 - } GOptionFlags; + _WRAP_ENUM(Flags, GOptionFlags, NO_GTYPE) OptionEntry(); OptionEntry(const OptionEntry& src); @@ -75,13 +66,15 @@ public: _MEMBER_GET(short_name, short_name, gchar, gchar) _MEMBER_SET(short_name, short_name, gchar, gchar) - _MEMBER_GET(flags, flags, int, int) +#m4 _CONVERSION(`int',`Flags',`static_cast($3)') + _MEMBER_GET(flags, flags, Flags, int) +#m4 _CONVERSION(`Flags',`int',`static_cast($3)') /** Set one or more OptionEntry::Flags. - * Do not set FLAG_FILENAME. Character encoding is chosen when the OptionEntry + * Do not set Flags::FILENAME. Character encoding is chosen when the OptionEntry * is added to an OptionGroup. */ - _MEMBER_SET(flags, flags, int, int) + _MEMBER_SET(flags, flags, Flags, int) _MEMBER_GET(description, description, Glib::ustring, const char*) diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index 95177ce..0bd922f 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -11,14 +11,14 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include -//#include #include // g_malloc #include // std::memset() @@ -84,7 +84,7 @@ g_callback_pre_parse( try { - return option_group->on_pre_parse(cppContext, *option_group); + return option_group->on_pre_parse(cppContext); } catch (Glib::Error& err) { @@ -99,18 +99,25 @@ g_callback_pre_parse( static void g_callback_error( - GOptionContext* context, GOptionGroup* /* group */, gpointer data, GError** /* TODO error */) + GOptionContext* context, GOptionGroup* /* group */, gpointer data, GError** error) { - // TODO GError** error is input data containing information on an error that - // has occurred before this function is called. When API can be broken, - // the function prototype of on_error ought to be changed to - // void on_error(OptionContext& context, Error& error). + // GError** error is input data containing information on an error that + // has occurred before this function is called. OptionContext cppContext(context, false /* take_ownership */); auto option_group = static_cast(data); - if (option_group) - return option_group->on_error(cppContext, *option_group); + if (option_group && error && *error) + { + try + { + Error::throw_exception(g_error_copy(*error)); + } + catch (const Error& err) + { + return option_group->on_error(cppContext, err); + } + } } const gchar* @@ -167,7 +174,7 @@ OptionGroup::post_parse_callback( try { - return option_group->on_post_parse(cppContext, *option_group); + return option_group->on_post_parse(cppContext); } catch (Glib::Error& err) { @@ -269,8 +276,7 @@ OptionGroup::option_arg_callback( OptionGroup::OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description) : gobject_(g_option_group_new(name.c_str(), description.c_str(), help_description.c_str(), - this /* user_data */, nullptr /* destroy_func */)), - has_ownership_(true) + this /* user_data */, nullptr /* destroy_func */)) { // g_callback_pre_parse(), post_parse_callback(), g_callback_error(), and // option_arg_callback() depend on user_data being this. The first three @@ -283,35 +289,11 @@ OptionGroup::OptionGroup(const Glib::ustring& name, const Glib::ustring& descrip g_option_group_set_error_hook(gobj(), &g_callback_error); } -OptionGroup::OptionGroup(GOptionGroup* castitem) : gobject_(castitem), has_ownership_(true) +OptionGroup::OptionGroup(GOptionGroup* castitem) : gobject_(castitem) { // Always takes ownership - never takes copy. } -OptionGroup::OptionGroup(OptionGroup&& other) noexcept - : map_entries_(std::move(other.map_entries_)), - gobject_(std::move(other.gobject_)), - has_ownership_(std::move(other.has_ownership_)) -{ - other.gobject_ = nullptr; - other.has_ownership_ = false; -} - -OptionGroup& -OptionGroup::operator=(OptionGroup&& other) noexcept -{ - release_gobject(); - - map_entries_ = std::move(other.map_entries_); - gobject_ = std::move(other.gobject_); - has_ownership_ = std::move(other.has_ownership_); - - other.gobject_ = nullptr; - other.has_ownership_ = false; - - return *this; -} - void OptionGroup::release_gobject() noexcept { @@ -322,7 +304,7 @@ OptionGroup::release_gobject() noexcept cpp_entry.release_c_arg(); } - if (has_ownership_ && gobject_) + if (gobject_) { g_option_group_unref(gobj()); gobject_ = nullptr; @@ -396,7 +378,7 @@ OptionGroup::add_entry_filename(const OptionEntry& entry, vecstrings& arg) } // When the command argument value is to be parsed by a user-supplied function -// (indicated by G_OPTION_ARG_CALLBACK), the FLAG_FILENAME in 'entry' is ignored. +// (indicated by G_OPTION_ARG_CALLBACK), the OptionEntry::Flags::FILENAME in 'entry' is ignored. // set_c_arg_default() clears or sets it as required in a copy of 'entry'. // // The glib API is inconsistent here. The choice between UTF-8 and filename @@ -404,7 +386,7 @@ OptionGroup::add_entry_filename(const OptionEntry& entry, vecstrings& arg) // G_OPTION_ARG_STRING_ARRAY, and G_OPTION_ARG_FILENAME_ARRAY, which in glibmm // are set by OptionGroup::add_entry[_filename]. But when a callback function // is chosen, there is only G_OPTION_ARG_CALLBACK, and the encoding is chosen -// with G_OPTION_FLAG_FILENAME. We do this automatiically in set_c_arg_default(). +// with OptionEntry::Flags::FILENAME. We do this automatiically in set_c_arg_default(). // Other option flags are set by OptionEntry::set_flags(). void @@ -482,19 +464,19 @@ OptionGroup::add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_typ } bool -OptionGroup::on_pre_parse(OptionContext& /* context */, OptionGroup& /* group */) +OptionGroup::on_pre_parse(OptionContext& /* context */) { return true; } bool -OptionGroup::on_post_parse(OptionContext& /* context */, OptionGroup& /* group */) +OptionGroup::on_post_parse(OptionContext& /* context */) { return true; } void -OptionGroup::on_error(OptionContext& /* context */, OptionGroup& /* group */) +OptionGroup::on_error(OptionContext& /* context */, const Error& /* error */) { } @@ -639,15 +621,15 @@ OptionGroup::CppOptionEntry::set_c_arg_default(void* cpp_arg) { // No value to set here. The arg pointer is a function pointer. - // Set or clear FLAG_FILENAME in *entry_. + // Set or clear OptionEntry::Flags::FILENAME in *entry_. const OptionArgCallback* const option_arg = static_cast(cpp_arg); if (option_arg->is_filename_option()) { - entry_->set_flags(entry_->get_flags() | OptionEntry::FLAG_FILENAME); + entry_->set_flags(entry_->get_flags() | OptionEntry::Flags::FILENAME); } else { - entry_->set_flags(entry_->get_flags() & ~OptionEntry::FLAG_FILENAME); + entry_->set_flags(entry_->get_flags() & ~OptionEntry::Flags::FILENAME); } break; } @@ -777,7 +759,7 @@ OptionGroup::CppOptionEntry::convert_c_to_cpp() typed_cpp_arg->clear(); // The C array is null-terminated. - // Glib::StringArrayHandle array_handle(*typed_arg, Glib::OWNERSHIP_NONE); + // std::vector array_handle(*typed_arg, Glib::OWNERSHIP_NONE); // The SUN Forte compiler complains about this: // "optiongroup.cc", line 354: Error: Cannot assign Glib::ArrayHandle(Glib::wrap_auto(cobj, false /* take_copy */)); - // for(Glib::StringArrayHandle::iterator iter = array_handle.begin(); iter != + // for(auto iter = array_handle.begin(); iter != // array_handle.end(); ++iter) //{ // typed_cpp_arg->emplace_back(*iter); @@ -847,10 +829,9 @@ OptionGroup::CppOptionEntry::convert_c_to_cpp() } GOptionGroup* -OptionGroup::gobj_give_ownership() +OptionGroup::gobj_copy() const { - has_ownership_ = false; - return gobj(); + return g_option_group_ref(gobject_); } } // namespace Glib diff --git a/glib/src/optiongroup.hg b/glib/src/optiongroup.hg index c1c8b40..5fbdcbf 100644 --- a/glib/src/optiongroup.hg +++ b/glib/src/optiongroup.hg @@ -11,11 +11,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) +#include #include #include #include @@ -36,8 +38,16 @@ class OptionEntry; class OptionContext; #endif //DOXYGEN_SHOULD_SKIP_THIS -//TODO: GOptionGroup is now refcounted. See https://bugzilla.gnome.org/show_bug.cgi?id=743349 -//When we can break API/ABI, make Glib::OptionGroup refcounted. _CLASS_OPAQUE_REFCOUNTED? +// GOptionGroup is now refcounted. See https://bugzilla.gnome.org/show_bug.cgi?id=743349 +// But Glib::OptionGroup can't be a _CLASS_OPAQUE_REFCOUNTED, because it has +// other data members than gobject_. The memory management would be more involved +// if Glib::OptionGroup were refcounted. It would need a separate refcount for the +// wrapper, like in Glib::IOChannel and Glib::Source. It's easier and good enough +// to let Glib::OptionGroup remain non-refcounted. GOptionGroup's refcount still helps. +// E.g. when GOptionContext takes ownership of a GOptionGroup, it's given a ref. +// A drawback with this approach is that it's possible to have more than one wrapper +// for one GOptionGroup, each wrapper with its own ref. + /** An OptionGroup defines the options in a single group. * Libraries which need to parse commandline options are expected to provide a function that allows their OptionGroups to * be added to the application's OptionContext. @@ -48,17 +58,17 @@ class OptionGroup public: /** For example Glib::ustring on_translate(const Glib::ustring& original);. */ - using SlotTranslate = sigc::slot; + using SlotTranslate = sigc::slot; /** For example bool on_option_arg_string(const Glib::ustring& option_name, * const Glib::ustring& value, bool has_value);. */ - using SlotOptionArgString = sigc::slot; + using SlotOptionArgString = sigc::slot; /** For example bool on_option_arg_filename(const Glib::ustring& option_name, * const std::string& value, bool has_value);. */ - using SlotOptionArgFilename = sigc::slot; + using SlotOptionArgFilename = sigc::slot; OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description = Glib::ustring()); @@ -68,16 +78,21 @@ public: explicit OptionGroup(GOptionGroup* castitem); _IGNORE(g_option_group_new, g_option_group_ref) - OptionGroup(OptionGroup&& other) noexcept; - OptionGroup& operator=(OptionGroup&& other) noexcept; + // OptionGroup can't be copied or moved. The underlying GOptionGroup contains + // a pointer to the wrapper, set in the call to g_option_group_new(). + // That pointer can't be changed. + OptionGroup(const OptionGroup& other) = delete; + OptionGroup& operator=(const OptionGroup& other) = delete; + OptionGroup(OptionGroup&& other) = delete; + OptionGroup& operator=(OptionGroup&& other) = delete; virtual ~OptionGroup(); _IGNORE(g_option_group_free, g_option_group_unref) - virtual bool on_pre_parse(OptionContext& context, OptionGroup& group); - virtual bool on_post_parse(OptionContext& context, OptionGroup& group); - virtual void on_error(OptionContext& context, OptionGroup& group); + virtual bool on_pre_parse(OptionContext& context); + virtual bool on_post_parse(OptionContext& context); + virtual void on_error(OptionContext& context, const Error& error); _IGNORE(g_option_group_set_parse_hooks, g_option_group_set_error_hook) void add_entry(const OptionEntry& entry); @@ -166,9 +181,14 @@ public: _WRAP_METHOD(void set_translation_domain(const Glib::ustring& domain), g_option_group_set_translation_domain) + /// Provides access to the underlying C instance. GOptionGroup* gobj() { return gobject_; } + + /// Provides access to the underlying C instance. const GOptionGroup* gobj() const { return gobject_; } - GOptionGroup* gobj_give_ownership(); + + /// Provides access to the underlying C instance. The caller is responsible for unrefing it. + GOptionGroup* gobj_copy() const; protected: @@ -200,11 +220,10 @@ protected: gpointer data, GError** error); //Map of entry names to CppOptionEntry: - typedef std::map type_map_entries; + using type_map_entries = std::map; type_map_entries map_entries_; GOptionGroup* gobject_; - bool has_ownership_; //Whether the gobject_ belongs to this C++ instance. #endif //DOXYGEN_SHOULD_SKIP_THIS private: diff --git a/glib/src/regex.ccg b/glib/src/regex.ccg index 9ceb1a3..1014971 100644 --- a/glib/src/regex.ccg +++ b/glib/src/regex.ccg @@ -11,17 +11,21 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +using CompileFlags = Glib::Regex::CompileFlags; +using MatchFlags = Glib::Regex::MatchFlags; + namespace Glib { Glib::RefPtr Regex::create( - const Glib::ustring& pattern, RegexCompileFlags compile_options, RegexMatchFlags match_options) + const Glib::ustring& pattern, CompileFlags compile_options, MatchFlags match_options) { GError* gerror = nullptr; auto regex = g_regex_new( @@ -43,7 +47,7 @@ Regex::escape_string(const Glib::ustring& string) bool Regex::match( - const Glib::ustring& string, Glib::MatchInfo& match_info, RegexMatchFlags match_options) + const Glib::ustring& string, Glib::MatchInfo& match_info, MatchFlags match_options) { GMatchInfo* ginfo = nullptr; bool const result = static_cast( @@ -53,14 +57,14 @@ Regex::match( } bool -Regex::match(const Glib::ustring& string, RegexMatchFlags match_options) +Regex::match(const Glib::ustring& string, MatchFlags match_options) { return g_regex_match(gobj(), string.c_str(), (GRegexMatchFlags)(match_options), nullptr); } bool Regex::match(const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options) + MatchFlags match_options) { GError* gerror = nullptr; GMatchInfo* ginfo = nullptr; @@ -77,7 +81,7 @@ Regex::match(const Glib::ustring& string, int start_position, Glib::MatchInfo& m bool Regex::match(const Glib::ustring& string, gssize string_len, int start_position, - Glib::MatchInfo& match_info, RegexMatchFlags match_options) + Glib::MatchInfo& match_info, MatchFlags match_options) { GError* gerror = nullptr; GMatchInfo* ginfo = nullptr; @@ -93,7 +97,7 @@ Regex::match(const Glib::ustring& string, gssize string_len, int start_position, } bool -Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) +Regex::match(const Glib::ustring& string, int start_position, MatchFlags match_options) { GError* gerror = nullptr; bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position, @@ -106,7 +110,7 @@ Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags ma bool Regex::match( - const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) + const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options) { GError* gerror = nullptr; bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position, @@ -119,7 +123,7 @@ Regex::match( bool Regex::match_all( - const Glib::ustring& string, Glib::MatchInfo& match_info, RegexMatchFlags match_options) + const Glib::ustring& string, Glib::MatchInfo& match_info, MatchFlags match_options) { GMatchInfo* ginfo = nullptr; bool const result = static_cast(g_regex_match_all( @@ -129,14 +133,14 @@ Regex::match_all( } bool -Regex::match_all(const Glib::ustring& string, RegexMatchFlags match_options) +Regex::match_all(const Glib::ustring& string, MatchFlags match_options) { return g_regex_match_all(gobj(), string.c_str(), ((GRegexMatchFlags)(match_options)), nullptr); } bool Regex::match_all(const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options) + MatchFlags match_options) { GError* gerror = nullptr; GMatchInfo* ginfo = nullptr; @@ -153,7 +157,7 @@ Regex::match_all(const Glib::ustring& string, int start_position, Glib::MatchInf bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position, - Glib::MatchInfo& match_info, RegexMatchFlags match_options) + Glib::MatchInfo& match_info, MatchFlags match_options) { GError* gerror = nullptr; GMatchInfo* ginfo = nullptr; @@ -169,7 +173,7 @@ Regex::match_all(const Glib::ustring& string, gssize string_len, int start_posit } bool -Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options) +Regex::match_all(const Glib::ustring& string, int start_position, MatchFlags match_options) { GError* gerror = nullptr; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, @@ -182,7 +186,7 @@ Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlag bool Regex::match_all( - const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options) + const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options) { GError* gerror = nullptr; bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, @@ -195,7 +199,7 @@ Regex::match_all( Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, - RegexMatchFlags match_options) + MatchFlags match_options) { GError* gerror = nullptr; auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), @@ -208,7 +212,7 @@ Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustr Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_position, - const Glib::ustring& replacement, RegexMatchFlags match_options) + const Glib::ustring& replacement, MatchFlags match_options) { GError* gerror = nullptr; auto retvalue = @@ -220,12 +224,12 @@ Regex::replace_literal(const Glib::ustring& string, int start_position, return retvalue; } -Glib::StringArrayHandle -Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, +std::vector +Regex::split(const Glib::ustring& string, int start_position, MatchFlags match_options, int max_tokens) const { GError* gerror = nullptr; - auto retvalue = Glib::StringArrayHandle( + auto retvalue = Glib::ArrayHandler::array_to_vector( g_regex_split_full(const_cast(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP); @@ -235,50 +239,50 @@ Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags ma return retvalue; } -MatchInfo::MatchInfo() : gobject_(nullptr), take_ownership(false) +MatchInfo::MatchInfo() : gobject_(nullptr), take_ownership_(false) { } -MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_the_ownership) -: gobject_(castitem), take_ownership(take_the_ownership) +MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_ownership) +: gobject_(castitem), take_ownership_(take_ownership) { } MatchInfo::MatchInfo(MatchInfo&& other) noexcept : gobject_(std::move(other.gobject_)), - take_ownership(std::move(other.take_ownership)) + take_ownership_(std::move(other.take_ownership_)) { other.gobject_ = nullptr; - other.take_ownership = false; + other.take_ownership_ = false; } MatchInfo& MatchInfo::operator=(MatchInfo&& other) noexcept { - if (take_ownership && gobject_) + if (take_ownership_ && gobject_) g_match_info_free(gobject_); gobject_ = std::move(other.gobject_); - take_ownership = std::move(other.take_ownership); + take_ownership_ = std::move(other.take_ownership_); other.gobject_ = nullptr; - other.take_ownership = false; + other.take_ownership_ = false; return *this; } void -MatchInfo::set_gobject(GMatchInfo* castitem, bool take_the_ownership) +MatchInfo::set_gobject(GMatchInfo* castitem, bool take_ownership) { - if (gobject_ && this->take_ownership) + if (gobject_ && this->take_ownership_) g_match_info_free(gobject_); gobject_ = castitem; - this->take_ownership = take_the_ownership; + this->take_ownership_ = take_ownership; } MatchInfo::~MatchInfo() { - if (take_ownership && gobject_) + if (take_ownership_ && gobject_) g_match_info_free(gobject_); } diff --git a/glib/src/regex.hg b/glib/src/regex.hg index de07fab..73eedf3 100644 --- a/glib/src/regex.hg +++ b/glib/src/regex.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -20,8 +21,8 @@ _DEFS(glibmm,glib) #include #include #include -#include #include +#include #ifndef DOXYGEN_SHOULD_SKIP_THIS typedef struct _GRegex GRegex; @@ -30,8 +31,6 @@ typedef struct _GRegex GRegex; namespace Glib { -_WRAP_ENUM(RegexCompileFlags, GRegexCompileFlags, NO_GTYPE) -_WRAP_ENUM(RegexMatchFlags, GRegexMatchFlags, NO_GTYPE) /** Exception class for Regex */ @@ -98,7 +97,10 @@ class Regex final _IGNORE(g_regex_ref, g_regex_unref) public: - static Glib::RefPtr create(const Glib::ustring& pattern, RegexCompileFlags compile_options = static_cast(0), RegexMatchFlags match_options = static_cast(0)); + _WRAP_ENUM(CompileFlags, GRegexCompileFlags, NO_GTYPE) + _WRAP_ENUM(MatchFlags, GRegexMatchFlags, NO_GTYPE) + + static Glib::RefPtr create(const Glib::ustring& pattern, CompileFlags compile_options = static_cast(0), MatchFlags match_options = static_cast(0)); _WRAP_METHOD(Glib::ustring get_pattern() const, g_regex_get_pattern) _WRAP_METHOD(int get_max_backref() const, g_regex_get_max_backref) @@ -106,29 +108,29 @@ public: _WRAP_METHOD(bool get_has_cr_or_lf() const, g_regex_get_has_cr_or_lf) _WRAP_METHOD(int get_max_lookbehind() const, g_regex_get_max_lookbehind) _WRAP_METHOD(int get_string_number(const Glib::ustring& name) const, g_regex_get_string_number) - _WRAP_METHOD(RegexCompileFlags get_compile_flags() const, g_regex_get_compile_flags) - _WRAP_METHOD(RegexMatchFlags get_match_flags() const, g_regex_get_match_flags) + _WRAP_METHOD(CompileFlags get_compile_flags() const, g_regex_get_compile_flags) + _WRAP_METHOD(MatchFlags get_match_flags() const, g_regex_get_match_flags) static Glib::ustring escape_string(const Glib::ustring& string); - _WRAP_METHOD(static bool match_simple(const Glib::ustring& pattern, const Glib::ustring& string, RegexCompileFlags compile_options = static_cast(0), RegexMatchFlags match_options = static_cast(0)), g_regex_match_simple) + _WRAP_METHOD(static bool match_simple(const Glib::ustring& pattern, const Glib::ustring& string, CompileFlags compile_options = static_cast(0), MatchFlags match_options = static_cast(0)), g_regex_match_simple) _WRAP_METHOD_DOCS_ONLY(g_regex_match) bool match( const Glib::ustring& string, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); /// A match() method not requiring a Glib::MatchInfo. - bool match(const Glib::ustring& string, RegexMatchFlags match_options = static_cast(0)); + bool match(const Glib::ustring& string, MatchFlags match_options = static_cast(0)); /// A match() method with a start position and a Glib::MatchInfo. bool match( const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); _WRAP_METHOD_DOCS_ONLY(g_regex_match_full) @@ -137,33 +139,33 @@ public: gssize string_len, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); /// A match() method with a start position not requiring a Glib::MatchInfo. - bool match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options); + bool match(const Glib::ustring& string, int start_position, MatchFlags match_options); /** A match() method with a string length and start position not requiring a * Glib::MatchInfo. */ - bool match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options); + bool match(const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options); _WRAP_METHOD_DOCS_ONLY(g_regex_match_all) bool match_all( const Glib::ustring& string, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); /// A match_all() method not requiring a Glib::MatchInfo. - bool match_all(const Glib::ustring& string, RegexMatchFlags match_options = static_cast(0)); + bool match_all(const Glib::ustring& string, MatchFlags match_options = static_cast(0)); /// A match_all() method with a start positon and a Glib::MatchInfo. bool match_all( const Glib::ustring& string, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); _WRAP_METHOD_DOCS_ONLY(g_regex_match_all_full, errthrow) @@ -173,35 +175,34 @@ public: gssize string_len, int start_position, Glib::MatchInfo& match_info, - RegexMatchFlags match_options = static_cast(0) + MatchFlags match_options = static_cast(0) ); /** A match_all() method with a start position not requiring a * Glib::MatchInfo. */ - bool match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options); + bool match_all(const Glib::ustring& string, int start_position, MatchFlags match_options); /** A match_all() method with a start position and a string length not * requiring a Glib::MatchInfo. */ - bool match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options); - -#m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)') + bool match_all(const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options); - _WRAP_METHOD(static Glib::StringArrayHandle split_simple(const Glib::ustring& pattern, const Glib::ustring& string, RegexCompileFlags compile_options = static_cast(0), RegexMatchFlags match_options = static_cast(0)), g_regex_split_simple) - _WRAP_METHOD(Glib::StringArrayHandle split(const Glib::ustring& string, RegexMatchFlags match_options = static_cast(0)), g_regex_split) +#m4 _CONVERSION(`gchar**',`std::vector',`Glib::ArrayHandler::array_to_vector($3, Glib::OWNERSHIP_DEEP)') + _WRAP_METHOD(static std::vector split_simple(const Glib::ustring& pattern, const Glib::ustring& string, CompileFlags compile_options = static_cast(0), MatchFlags match_options = static_cast(0)), g_regex_split_simple) + _WRAP_METHOD(std::vector split(const Glib::ustring& string, MatchFlags match_options = static_cast(0)), g_regex_split) - _WRAP_METHOD(Glib::StringArrayHandle split(const gchar* string, gssize string_len, int start_position, RegexMatchFlags match_options = static_cast(0), int max_tokens = 0) const, g_regex_split_full, errthrow) + _WRAP_METHOD(std::vector split(const gchar* string, gssize string_len, int start_position, MatchFlags match_options = static_cast(0), int max_tokens = 0) const, g_regex_split_full, errthrow) - Glib::StringArrayHandle split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const; + std::vector split(const Glib::ustring& string, int start_position, MatchFlags match_options, int max_tokens) const; - _WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast(0)), g_regex_replace, errthrow) - Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options); + _WRAP_METHOD(Glib::ustring replace(const gchar* string, gssize string_len, int start_position, const Glib::ustring& replacement, MatchFlags match_options = static_cast(0)), g_regex_replace, errthrow) + Glib::ustring replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, MatchFlags match_options); - _WRAP_METHOD(Glib::ustring replace_literal(const gchar *string, gssize string_len, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options = static_cast(0)), g_regex_replace_literal, errthrow) - Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options); + _WRAP_METHOD(Glib::ustring replace_literal(const gchar *string, gssize string_len, int start_position, const Glib::ustring& replacement, MatchFlags match_options = static_cast(0)), g_regex_replace_literal, errthrow) + Glib::ustring replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, MatchFlags match_options); - _WRAP_METHOD(Glib::ustring replace_eval(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options, GRegexEvalCallback eval, gpointer user_data), g_regex_replace_eval, errthrow) + _WRAP_METHOD(Glib::ustring replace_eval(const Glib::ustring& string, gssize string_len, int start_position, MatchFlags match_options, GRegexEvalCallback eval, gpointer user_data), g_regex_replace_eval, errthrow) _WRAP_METHOD(static bool check_replacement(const Glib::ustring& replacement, gboolean* has_references), g_regex_check_replacement, errthrow) }; @@ -221,10 +222,9 @@ public: /** C object constructor. * @param castitem The C object. - * @param take_the_ownership Whether to destroy the C object with the wrapper or - * not. + * @param take_ownership Whether to destroy the C object with the wrapper or not. */ - explicit MatchInfo(GMatchInfo* castitem, bool take_the_ownership = true); //TODO: Rename to take_ownership when we can rename the member variable. + explicit MatchInfo(GMatchInfo* castitem, bool take_ownership = true); MatchInfo(const MatchInfo& other) = delete; MatchInfo& operator=(const MatchInfo& other) = delete; @@ -270,11 +270,11 @@ public: _WRAP_METHOD(bool fetch_named_pos(const Glib::ustring& name, int& start_pos, int& end_pos), g_match_info_fetch_named_pos) - _WRAP_METHOD(Glib::StringArrayHandle fetch_all(), g_match_info_fetch_all) + _WRAP_METHOD(std::vector fetch_all(), g_match_info_fetch_all) protected: GMatchInfo* gobject_; // The C object. - bool take_ownership; // Bool signaling ownership. //TODO: Give this a _ suffix when we can break API. + bool take_ownership_; // Bool signaling ownership. protected: // So that Glib::Regex::match() can set the C object. diff --git a/glib/src/shell.ccg b/glib/src/shell.ccg index 901a63b..10b4b4f 100644 --- a/glib/src/shell.ccg +++ b/glib/src/shell.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -21,7 +22,7 @@ namespace Glib /**** shell utility functions **********************************************/ -Glib::ArrayHandle +std::vector shell_parse_argv(const std::string& command_line) { char** argv = nullptr; @@ -33,7 +34,7 @@ shell_parse_argv(const std::string& command_line) if (error) Glib::Error::throw_exception(error); - return Glib::ArrayHandle(argv, argc, Glib::OWNERSHIP_DEEP); + return Glib::ArrayHandler::array_to_vector(argv, argc, Glib::OWNERSHIP_DEEP); } std::string diff --git a/glib/src/shell.hg b/glib/src/shell.hg index 6f0e2fc..8b3b91e 100644 --- a/glib/src/shell.hg +++ b/glib/src/shell.hg @@ -11,15 +11,16 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) -#include #include #include #include +#include namespace Glib { @@ -46,7 +47,7 @@ _WRAP_GERROR(ShellError, GShellError, G_SHELL_ERROR, NO_GTYPE) * converted to any STL compatible container type). * @throw Glib::ShellError */ -Glib::ArrayHandle shell_parse_argv(const std::string& command_line); +std::vector shell_parse_argv(const std::string& command_line); /** Quotes a string so that the shell (/bin/sh) will interpret the quoted * string to mean @a unquoted_string. If you pass a filename to the shell, diff --git a/glib/src/spawn.ccg b/glib/src/spawn.ccg index 221c4da..74c8016 100644 --- a/glib/src/spawn.ccg +++ b/glib/src/spawn.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -63,7 +64,7 @@ namespace Glib void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle& argv, const Glib::ArrayHandle& envp, + const std::vector& argv, const std::vector& envp, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, Pid* child_pid, int* standard_input, int* standard_output, int* standard_error) { @@ -72,7 +73,7 @@ spawn_async_with_pipes(const std::string& working_directory, GError* gerror = nullptr; g_spawn_async_with_pipes(Glib::c_str_or_nullptr(working_directory), - const_cast(argv.data()), const_cast(envp.data()), + const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), const_cast(Glib::ArrayHandler::vector_to_array(envp).data()), static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, child_pid, standard_input, standard_output, standard_error, &gerror); @@ -83,7 +84,7 @@ spawn_async_with_pipes(const std::string& working_directory, void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle& argv, SpawnFlags flags, + const std::vector& argv, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, Pid* child_pid, int* standard_input, int* standard_output, int* standard_error) { @@ -92,7 +93,7 @@ spawn_async_with_pipes(const std::string& working_directory, GError* gerror = nullptr; g_spawn_async_with_pipes(Glib::c_str_or_nullptr(working_directory), - const_cast(argv.data()), nullptr, static_cast(unsigned(flags)), + const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), nullptr, static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, child_pid, standard_input, standard_output, standard_error, &gerror); @@ -101,16 +102,16 @@ spawn_async_with_pipes(const std::string& working_directory, } void -spawn_async(const std::string& working_directory, const Glib::ArrayHandle& argv, - const Glib::ArrayHandle& envp, SpawnFlags flags, +spawn_async(const std::string& working_directory, const std::vector& argv, + const std::vector& envp, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, Pid* child_pid) { const bool setup_slot = !child_setup.empty(); auto child_setup_ = child_setup; GError* gerror = nullptr; - g_spawn_async(Glib::c_str_or_nullptr(working_directory), const_cast(argv.data()), - const_cast(envp.data()), static_cast(unsigned(flags)), + g_spawn_async(Glib::c_str_or_nullptr(working_directory), const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), + const_cast(Glib::ArrayHandler::vector_to_array(envp).data()), static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, child_pid, &gerror); @@ -119,14 +120,14 @@ spawn_async(const std::string& working_directory, const Glib::ArrayHandle& argv, +spawn_async(const std::string& working_directory, const std::vector& argv, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, Pid* child_pid) { const bool setup_slot = !child_setup.empty(); auto child_setup_ = child_setup; GError* gerror = nullptr; - g_spawn_async(Glib::c_str_or_nullptr(working_directory), const_cast(argv.data()), nullptr, + g_spawn_async(Glib::c_str_or_nullptr(working_directory), const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), nullptr, static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, child_pid, &gerror); @@ -135,8 +136,8 @@ spawn_async(const std::string& working_directory, const Glib::ArrayHandle& argv, - const Glib::ArrayHandle& envp, SpawnFlags flags, +spawn_sync(const std::string& working_directory, const std::vector& argv, + const std::vector& envp, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, std::string* standard_output, std::string* standard_error, int* exit_status) { @@ -146,8 +147,8 @@ spawn_sync(const std::string& working_directory, const Glib::ArrayHandle(argv.data()), - const_cast(envp.data()), static_cast(unsigned(flags)), + g_spawn_sync(Glib::c_str_or_nullptr(working_directory), const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), + const_cast(Glib::ArrayHandler::vector_to_array(envp).data()), static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, (standard_output) ? &pch_buf_standard_output : nullptr, (standard_error) ? &pch_buf_standard_error : nullptr, exit_status, &gerror); @@ -162,7 +163,7 @@ spawn_sync(const std::string& working_directory, const Glib::ArrayHandle& argv, +spawn_sync(const std::string& working_directory, const std::vector& argv, SpawnFlags flags, const SlotSpawnChildSetup& child_setup, std::string* standard_output, std::string* standard_error, int* exit_status) { @@ -173,7 +174,7 @@ spawn_sync(const std::string& working_directory, const Glib::ArrayHandle(argv.data()), nullptr, + g_spawn_sync(Glib::c_str_or_nullptr(working_directory), const_cast(Glib::ArrayHandler::vector_to_array(argv).data()), nullptr, static_cast(unsigned(flags)), (setup_slot) ? &child_setup_callback : nullptr, (setup_slot) ? &child_setup_ : nullptr, (standard_output) ? &pch_buf_standard_output : nullptr, (standard_error) ? &pch_buf_standard_error : nullptr, exit_status, &gerror); diff --git a/glib/src/spawn.hg b/glib/src/spawn.hg index f0a8506..85d7ed2 100644 --- a/glib/src/spawn.hg +++ b/glib/src/spawn.hg @@ -11,16 +11,17 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) #include -#include #include #include #include +#include namespace Glib { @@ -41,7 +42,7 @@ _WRAP_GERROR(SpawnError, GSpawnError, G_SPAWN_ERROR, NO_GTYPE, s#^2BIG$#TOOBIG#) /** For instance,
* void on_child_setup(); */ -using SlotSpawnChildSetup = sigc::slot; +using SlotSpawnChildSetup = sigc::slot; /** Executes a child program asynchronously (your program will not * block waiting for the child to exit). The child program is @@ -49,7 +50,7 @@ using SlotSpawnChildSetup = sigc::slot; * The first string in @a argv is of * course the name of the program to execute. By default, the name of * the program must be a full path; the PATH shell variable - * will only be searched if you pass the SPAWN_SEARCH_PATH flag. + * will only be searched if you pass the SpawnFlags::SEARCH_PATH flag. * * On Windows, note that all the string or string vector arguments to * this function and the other spawn*() functions are in UTF-8, the @@ -91,7 +92,7 @@ using SlotSpawnChildSetup = sigc::slot; * the child's environment. * * @a flags should be the bitwise OR of any flags you want to affect the - * function's behaviour. The SPAWN_DO_NOT_REAP_CHILD flags means that + * function's behaviour. The SpawnFlags::DO_NOT_REAP_CHILD flags means that * the child will not automatically be reaped; you must use a * ChildWatch source to be notified about the death of the child * process. Eventually you must call spawn_close_pid() on the @@ -105,19 +106,19 @@ using SlotSpawnChildSetup = sigc::slot; * PAWN_LEAVE_DESCRIPTORS_OPEN means that the parent's open file * descriptors will be inherited by the child; otherwise all * descriptors except stdin/stdout/stderr will be closed before - * calling exec() in the child. SPAWN_SEARCH_PATH + * calling exec() in the child. SpawnFlags::SEARCH_PATH * means that argv[0] need not be an absolute path, it * will be looked for in the user's PATH. - * SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will + * SpawnFlags::STDOUT_TO_DEV_NULL means that the child's standard output will * be discarded, instead of going to the same location as the parent's * standard output. If you use this flag, @a standard_output must be nullptr. - * SPAWN_STDERR_TO_DEV_NULL means that the child's standard error + * SpawnFlags::STDERR_TO_DEV_NULL means that the child's standard error * will be discarded, instead of going to the same location as the parent's * standard error. If you use this flag, @a standard_error must be nullptr. - * SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's + * SpawnFlags::CHILD_INHERITS_STDIN means that the child will inherit the parent's * standard input (by default, the child's standard input is attached to * /dev/null). If you use this flag, @a standard_input must be nullptr. - * G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @a argv is + * SpawnFlags::FILE_AND_ARGV_ZERO means that the first element of @a argv is * the file to execute, while the remaining elements are the * actual argument vector to pass to the file. Normally * spawn_async_with_pipes() uses argv[0] as the file to execute, and @@ -140,9 +141,9 @@ using SlotSpawnChildSetup = sigc::slot; * If non-nullptr, @a child_pid will on Unix be filled with the child's * process ID. You can use the process ID to send signals to the * child, or to use child_watch_add() (or waitpid()) if you specified the - * SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @a child_pid will be + * SpawnFlags::DO_NOT_REAP_CHILD flag. On Windows, @a child_pid will be * filled with a handle to the child process only if you specified the - * SPAWN_DO_NOT_REAP_CHILD flag. You can then access the child + * SpawnFlags::DO_NOT_REAP_CHILD flag. You can then access the child * process using the Win32 API, for example wait for its termination * with the WaitFor*() functions, or examine its * exit code with GetExitCodeProcess(). You should close the handle @@ -156,14 +157,14 @@ using SlotSpawnChildSetup = sigc::slot; * pipe won't be created. * * If @a standard_input is nullptr, the child's standard input is attached to - * /dev/null unless SPAWN_CHILD_INHERITS_STDIN is set. + * /dev/null unless SpawnFlags::CHILD_INHERITS_STDIN is set. * * If @a standard_error is nullptr, the child's standard error goes to the same - * location as the parent's standard error unless SPAWN_STDERR_TO_DEV_NULL + * location as the parent's standard error unless SpawnFlags::STDERR_TO_DEV_NULL * is set. * * If @a standard_output is nullptr, the child's standard output goes to the same - * location as the parent's standard output unless SPAWN_STDOUT_TO_DEV_NULL + * location as the parent's standard output unless SpawnFlags::STDOUT_TO_DEV_NULL * is set. * * If @a child_pid is not nullptr and an error does not occur then the returned @@ -192,9 +193,9 @@ using SlotSpawnChildSetup = sigc::slot; * and @a standard_error will not be filled with valid values. */ void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle& argv, - const Glib::ArrayHandle& envp, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + const std::vector& envp, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), Pid* child_pid = nullptr, int* standard_input = nullptr, @@ -219,8 +220,8 @@ void spawn_async_with_pipes(const std::string& working_directory, * and @a standard_error will not be filled with valid values. */ void spawn_async_with_pipes(const std::string& working_directory, - const Glib::ArrayHandle& argv, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), Pid* child_pid = nullptr, int* standard_input = nullptr, @@ -249,9 +250,9 @@ void spawn_async_with_pipes(const std::string& working_directory, * to users. */ void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle& argv, - const Glib::ArrayHandle& envp, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + const std::vector& envp, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), Pid* child_pid = nullptr); @@ -269,21 +270,21 @@ void spawn_async(const std::string& working_directory, * to users. */ void spawn_async(const std::string& working_directory, - const Glib::ArrayHandle& argv, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), Pid* child_pid = nullptr); /** Executes a child synchronously (waits for the child to exit before returning). * All output from the child is stored in @a standard_output and @a standard_error, * if those parameters are non-nullptr. Note that you must set the - * SPAWN_STDOUT_TO_DEV_NULL and SPAWN_STDERR_TO_DEV_NULL flags when + * SpawnFlags::STDOUT_TO_DEV_NULL and SpawnFlags::STDERR_TO_DEV_NULL flags when * passing nullptr for @a standard_output and @a standard_error. * If @a exit_status is non-nullptr, the exit status of the child is stored * there as it would be returned by waitpid(); standard UNIX macros such * as WIFEXITED() and WEXITSTATUS() must be used to evaluate the exit status. * Note that this function calls waitpid() even if @a exit_status is nullptr, and - * does not accept the SPAWN_DO_NOT_REAP_CHILD flag. + * does not accept the SpawnFlags::DO_NOT_REAP_CHILD flag. * If an error occurs, no data is returned in @a standard_output, * @a standard_error, or @a exit_status. * @@ -307,9 +308,9 @@ void spawn_async(const std::string& working_directory, * and @a standard_error will not be filled with valid values. */ void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle& argv, - const Glib::ArrayHandle& envp, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + const std::vector& envp, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), std::string* standard_output = nullptr, std::string* standard_error = nullptr, @@ -332,8 +333,8 @@ void spawn_sync(const std::string& working_directory, * and @a standard_error will not be filled with valid values. */ void spawn_sync(const std::string& working_directory, - const Glib::ArrayHandle& argv, - SpawnFlags flags = SPAWN_DEFAULT, + const std::vector& argv, + SpawnFlags flags = SpawnFlags::DEFAULT, const SlotSpawnChildSetup& child_setup = SlotSpawnChildSetup(), std::string* standard_output = nullptr, std::string* standard_error = nullptr, @@ -342,8 +343,8 @@ void spawn_sync(const std::string& working_directory, /** A simple version of spawn_async() that parses a command line with * shell_parse_argv() and passes it to spawn_async(). It runs a * command line in the background. Unlike spawn_async(), the - * SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note - * that SPAWN_SEARCH_PATH can have security implications, so + * SpawnFlags::SEARCH_PATH flag is enabled, other flags are not. Note + * that SpawnFlags::SEARCH_PATH can have security implications, so * consider using spawn_async() directly if appropriate. * * The same concerns on Windows apply as for spawn_command_line_sync(). @@ -361,8 +362,8 @@ void spawn_command_line_async(const std::string& command_line); /** A simple version of spawn_sync() with little-used parameters * removed, taking a command line instead of an argument vector. See * spawn_sync() for full details. @a command_line will be parsed by - * shell_parse_argv(). Unlike spawn_sync(), the SPAWN_SEARCH_PATH flag - * is enabled. Note that SPAWN_SEARCH_PATH can have security + * shell_parse_argv(). Unlike spawn_sync(), the SpawnFlags::SEARCH_PATH flag + * is enabled. Note that SpawnFlags::SEARCH_PATH can have security * implications, so consider using spawn_sync() directly if * appropriate. * diff --git a/glib/src/template.macros.m4 b/glib/src/template.macros.m4 index 5679546..1a24059 100644 --- a/glib/src/template.macros.m4 +++ b/glib/src/template.macros.m4 @@ -17,7 +17,8 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see . +dnl License along with this library; if not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dnl dnl----------------------------------------------------------------------- dnl Recursion prevention. (Don't attempt to understand why this works!) diff --git a/glib/src/thread.ccg b/glib/src/thread.ccg deleted file mode 100644 index d6e81cf..0000000 --- a/glib/src/thread.ccg +++ /dev/null @@ -1,426 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include - -namespace -{ - -extern "C" { - -static void* -call_thread_entry_slot(void* data) -{ - const auto slot = reinterpret_cast(data); - - try - { - // Recreate the specific slot, and drop the reference obtained by create(). - (*static_cast*>(slot))(); - } - catch (Glib::Thread::Exit&) - { - // Just exit from the thread. The Thread::Exit exception - // is our sane C++ replacement of g_thread_exit(). - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - delete slot; - return nullptr; -} - -} // extern "C" - -} // anonymous namespace - -namespace Glib -{ - -// This was always meant as an internal method. It is no longer called, -// and no longer needs to be called. We are keeping it just to avoid -// breaking ABI, though hopefully nobody is using it anyway. -// TODO: Remove this when we can break ABI. -void -thread_init_impl() -{ - // Make sure the exception map is initialized before creating any thread. - Glib::Error::register_init(); -} - -/**** Glib::Thread *********************************************************/ - -// static -Thread* -Thread::create(const sigc::slot& slot, bool /* joinable */) -{ - // Make a copy of slot on the heap - const auto slot_copy = new sigc::slot(slot); - - GError* error = nullptr; - - const auto thread = g_thread_try_new(nullptr, &call_thread_entry_slot, slot_copy, &error); - - if (error) - { - delete slot_copy; - // Glib::Error::throw_exception() will probably wrap G_THREAD_ERROR in a - // Glib::Threads::ThreadError instance, but we want a Glib::ThreadError. - if (error->domain == G_THREAD_ERROR) - throw Glib::ThreadError(error); - else - Glib::Error::throw_exception(error); - } - - return reinterpret_cast(thread); -} - -// static -Thread* -Thread::create(const sigc::slot& slot, unsigned long stack_size, bool joinable, bool bound, - ThreadPriority priority) -{ - // Make a copy of slot on the heap - const auto slot_copy = new sigc::slot(slot); - - GError* error = nullptr; - - const auto thread = g_thread_create_full(&call_thread_entry_slot, slot_copy, stack_size, joinable, - bound, (GThreadPriority)priority, &error); - - if (error) - { - delete slot_copy; - // Glib::Error::throw_exception() will probably wrap G_THREAD_ERROR in a - // Glib::Threads::ThreadError instance, but we want a Glib::ThreadError. - if (error->domain == G_THREAD_ERROR) - throw Glib::ThreadError(error); - else - Glib::Error::throw_exception(error); - } - - return reinterpret_cast(thread); -} - -// static -Thread* -Thread::self() -{ - return reinterpret_cast(g_thread_self()); -} - -void -Thread::join() -{ - g_thread_join(&gobject_); -} - -bool -Thread::joinable() const -{ - return true; // An appropriate result now that this is deprecated because all threads are now - // joinable. -} - -void -Thread::set_priority(ThreadPriority priority) -{ - g_thread_set_priority(&gobject_, (GThreadPriority)priority); -} - -ThreadPriority -Thread::get_priority() const -{ - return THREAD_PRIORITY_NORMAL; // An appropriate result now that this is deprecated because the - // priority concept has been removed. -} - -void -thread_init(GThreadFunctions* /* vtable */) -{ - // g_thread_init() is deprecated and now does nothing, - // so we do not even call it. That avoids a need to link to gthread-2.0, - // which contains the empty g_thread_init() implementation. - // g_thread_init(vtable); - - Glib::thread_init_impl(); -} - -bool -thread_supported() -{ - // MSVC++ needs the != 0 to avoid an int -> bool cast warning. - return (g_thread_supported() != 0); -} - -// static -void -Thread::yield() -{ - g_thread_yield(); -} - -Thread* -wrap(GThread* gobject) -{ - return reinterpret_cast(gobject); -} - -/**** Glib::StaticMutex ****************************************************/ - -void -StaticMutex::lock() -{ - g_static_mutex_lock(&gobject_); -} - -bool -StaticMutex::trylock() -{ - return g_static_mutex_trylock(&gobject_); -} - -void -StaticMutex::unlock() -{ - g_static_mutex_unlock(&gobject_); -} - -StaticMutex::operator Mutex&() -{ - // If GStaticMutex is implemented as struct (e.g. on Linux), its first struct - // member (runtime_mutex) is a GMutex pointer. If the gthread implementation - // is native (i.e. the vtable pointer passed to g_thread_init() was 0), then - // the runtime_mutex pointer is unused, and the rest of the GStaticMutex - // struct resembles the mutex data. - // - // On Win32, GStaticMutex is just a typedef to struct _GMutex*. Either way, - // the first sizeof(GMutex*) bytes of GStaticMutex always resemble a GMutex - // pointer. The gthread implementation relies on that, and we'll also do so. - - GMutex*& runtime_mutex = reinterpret_cast(gobject_); - - // Fortunately, it cannot hurt if we set this to the GMutex pointer returned - // by g_static_mutex_get_mutex(). Either we just overwrite it with the same - // value, or it was unused anyway. Doing that allows casting the pointer - // location to a Glib::Mutex reference (its only data member is a GMutex*). - - runtime_mutex = g_static_mutex_get_mutex(&gobject_); - - return reinterpret_cast(runtime_mutex); -} - -/**** Glib::Mutex **********************************************************/ - -Mutex::Mutex() -: gobject_(g_mutex_new()) // TODO: Use a statically-allocated GMutext instead, with g_mutex_init(). -{ -} - -Mutex::~Mutex() -{ - g_mutex_free(gobject_); -} - -void -Mutex::lock() -{ - g_mutex_lock(gobject_); -} - -bool -Mutex::trylock() -{ - return g_mutex_trylock(gobject_); -} - -void -Mutex::unlock() -{ - g_mutex_unlock(gobject_); -} - -/**** Glib::StaticRecMutex *************************************************/ - -void -StaticRecMutex::lock() -{ - g_static_rec_mutex_lock(&gobject_); -} - -bool -StaticRecMutex::trylock() -{ - return g_static_rec_mutex_trylock(&gobject_); -} - -void -StaticRecMutex::unlock() -{ - g_static_rec_mutex_unlock(&gobject_); -} - -void -StaticRecMutex::lock_full(unsigned int depth) -{ - g_static_rec_mutex_lock_full(&gobject_, depth); -} - -unsigned int -StaticRecMutex::unlock_full() -{ - return g_static_rec_mutex_unlock_full(&gobject_); -} - -StaticRecMutex::operator RecMutex&() -{ - return static_cast(*this); -} - -/**** Glib::RecMutex *******************************************************/ - -RecMutex::RecMutex() -{ - g_static_rec_mutex_init(&gobject_); -} - -RecMutex::~RecMutex() -{ - g_static_rec_mutex_free(&gobject_); -} - -/**** Glib::StaticRWLock ***************************************************/ - -void -StaticRWLock::reader_lock() -{ - g_static_rw_lock_reader_lock(&gobject_); -} - -bool -StaticRWLock::reader_trylock() -{ - return g_static_rw_lock_reader_trylock(&gobject_); -} - -void -StaticRWLock::reader_unlock() -{ - g_static_rw_lock_reader_unlock(&gobject_); -} - -void -StaticRWLock::writer_lock() -{ - g_static_rw_lock_writer_lock(&gobject_); -} - -bool -StaticRWLock::writer_trylock() -{ - return g_static_rw_lock_writer_trylock(&gobject_); -} - -void -StaticRWLock::writer_unlock() -{ - g_static_rw_lock_writer_unlock(&gobject_); -} - -StaticRWLock::operator RWLock&() -{ - return static_cast(*this); -} - -/**** Glib::RWLock *********************************************************/ - -RWLock::RWLock() -{ - g_static_rw_lock_init(&gobject_); - - // GLib doesn't have GRWLock, only GStaticRWLock. Force initialization - // of the mutex and the condition variables now, to mimic the behaviour - // of a (hypothetical) GRWLock. - - if (g_static_mutex_get_mutex(&gobject_.mutex)) - { - gobject_.read_cond = g_cond_new(); - gobject_.write_cond = g_cond_new(); - } -} - -RWLock::~RWLock() -{ - g_static_rw_lock_free(&gobject_); -} - -/**** Glib::Cond ***********************************************************/ - -Cond::Cond() : gobject_(g_cond_new()) -{ -} - -Cond::~Cond() -{ - g_cond_free(gobject_); -} - -void -Cond::signal() -{ - g_cond_signal(gobject_); -} - -void -Cond::broadcast() -{ - g_cond_broadcast(gobject_); -} - -void -Cond::wait(Mutex& mutex) -{ - g_cond_wait(gobject_, mutex.gobj()); -} - -bool -Cond::timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time) -{ - return g_cond_timed_wait(gobject_, mutex.gobj(), const_cast(&abs_time)); -} - -void* -StaticPrivate_get_helper(GStaticPrivate* private_key) -{ - return g_static_private_get(private_key); -} - -void -StaticPrivate_set_helper(GStaticPrivate* private_key, gpointer data, GDestroyNotify notify) -{ - return g_static_private_set(private_key, data, notify); -} - -GPrivate* -GPrivate_new_helper(GDestroyNotify notify) -{ - return g_private_new(notify); -} - -} // namespace Glib diff --git a/glib/src/thread.hg b/glib/src/thread.hg deleted file mode 100644 index 8763f87..0000000 --- a/glib/src/thread.hg +++ /dev/null @@ -1,1084 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -_DEFS(glibmm,glib) -_CONFIGINCLUDE(glibmmconfig.h) - -_IS_DEPRECATED // This whole file is deprecated. - -#m4 _PUSH(SECTION_CC_PRE_INCLUDES) -//Stop the compiler warnings about using the deprecated API; -#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 -#m4 _POP() - -// We use GThreadFunctions in the (deprecated) API, so we must temporarily undef G_DISABLE_DEPRECATED. -// Temporarily undef G_DISABLE_DEPRECATED, redefining it later if appropriate. -#if defined(G_DISABLE_DEPRECATED) && !defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) -//Stop the deprecation ifdef guards around the API declarations: -#undef G_DISABLE_DEPRECATED -#define GLIBMM_G_DISABLE_DEPRECATED_UNDEFED 1 -#endif - -#include - -// Redefine G_DISABLE_DEPRECATED if it was defined before we temporarily undefed it: -#if defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED) -#define G_DISABLE_DEPRECATED 1 -#undef GLIBMM_G_DISABLE_DEPRECATED_UNDEFED -#endif - - -#include -#include -#include - -#include - -/* Shadow THREAD_PRIORITY_NORMAL macro (from winbase.h). - */ -#if defined(THREAD_PRIORITY_NORMAL) && !defined(GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL) -enum { GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL = THREAD_PRIORITY_NORMAL }; -#undef THREAD_PRIORITY_NORMAL -enum { THREAD_PRIORITY_NORMAL = GLIBMM_MACRO_DEFINITION_THREAD_PRIORITY_NORMAL }; -#define THREAD_PRIORITY_NORMAL THREAD_PRIORITY_NORMAL -#define GLIBMM_MACRO_SHADOW_THREAD_PRIORITY_NORMAL 1 -#endif - - -/** Initializer macro for Glib::StaticRecMutex. - * @relates Glib::StaticRecMutex - * @hideinitializer - * - * @deprecated Glib::StaticRecMutex is deprecated in favour of Glib::Threads::RecMutex, which can be used statically. - */ -#define GLIBMM_STATIC_REC_MUTEX_INIT { G_STATIC_REC_MUTEX_INIT } - -/** Initializer macro for Glib::StaticRWLock. - * @relates Glib::StaticRWLock - * @hideinitializer - * - * @deprecated Glib::StaticRWLock is deprecated in favour of Glib::Threads::RWLock, which can be used statically. - */ -#define GLIBMM_STATIC_RW_LOCK_INIT { G_STATIC_RW_LOCK_INIT } - -/** Initializer macro for Glib::StaticPrivate. - * @relates Glib::StaticPrivate - * @hideinitializer - * - * @deprecated Glib::StaticPrivate is deprecated in favour of Glib::Threads::Private, which can be used statically. - */ -#define GLIBMM_STATIC_PRIVATE_INIT { G_STATIC_PRIVATE_INIT } - -namespace Glib -{ - -/** @deprecated Thread priorities no longer have any effect. - */ -_WRAP_ENUM(ThreadPriority, GThreadPriority, NO_GTYPE) - -/*! @var ThreadPriority THREAD_PRIORITY_LOW - * A priority lower than normal. - */ -/*! @var ThreadPriority THREAD_PRIORITY_NORMAL - * The default priority. - */ -/*! @var ThreadPriority THREAD_PRIORITY_HIGH - * A priority higher than normal. - */ -/*! @var ThreadPriority THREAD_PRIORITY_URGENT - * The highest priority. - */ - -/** Initializes the GLib thread system. - * @deprecated Calling thread_init() is no longer necessary and no longer has any effect. - */ -void thread_init(GThreadFunctions* vtable = nullptr); - -/** Returns whether the thread system is initialized. - * @return @c true, if the thread system is initialized. - * @deprecated This is no longer useful, because the thread system is always initialized. - */ -bool thread_supported(); - -/** - * @deprecated Use Glib::Threads::NotLock instead. - */ -enum NotLock { NOT_LOCK }; - -/** - * @deprecated Use Glib::Threads::TryLock instead. - */ -enum TryLock { TRY_LOCK }; - -class Mutex; -class RecMutex; -class RWLock; - -struct StaticRecMutex; -struct StaticRWLock; - - -/** Exception class for thread-related errors. - * @deprecated Use Glib::Threads::ThreadError instead. - */ -_WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE) - - -/** Represents a running thread. - * An instance of this class can only be obtained with create(), self(), - * or wrap(GThread*). It's not possible to delete a Thread object. If the - * thread is @em not joinable, its resources will be freed automatically - * when it exits. Otherwise, if the thread @em is joinable, you must call - * join() to avoid a memory leak. - * - * @note g_thread_exit() is not wrapped, because that function exits a thread - * without any cleanup. That's especially dangerous in C++ code, since the - * destructors of automatic objects won't be invoked. Instead, you can throw - * a Thread::Exit exception, which will be caught by the internal thread - * entry function. - * - * @note You might have noticed that the thread entry slot doesn't have the - * usual void* return value. If you want to return any data from your thread - * you can pass an additional output argument to the thread's entry slot. - * - * @deprecated Use Glib::Threads::Thread instead. - */ -class Thread -{ -public: - - Thread(const Thread&) = delete; - Thread& operator=(const Thread&) = delete; - - class Exit; - - //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. - /** Creates a new thread with the priority THREAD_PRIORITY_NORMAL. - * If @a joinable is @c true, you can wait for this thread's termination by - * calling join(). Otherwise the thread will just disappear, when ready. - * - * The new thread executes the function or method @a slot points to. You can - * pass additional arguments using sigc::bind(). If the thread was created - * successfully, it is returned, otherwise a ThreadError exception is thrown. - * - * Because sigc::trackable is not thread safe, if the slot represents a - * non-static class method (that is, it is created by sigc::mem_fun()), the - * class concerned should not derive from sigc::trackable. - * - * @param slot A slot to execute in the new thread. - * @param joinable This parameter is now ignored because Threads are now always joinable. - * @return The new Thread* on success. - * @throw Glib::ThreadError - */ - static Thread* create(const sigc::slot& slot, bool joinable = true); - - /** Returns the Thread* corresponding to the calling thread. - * @return The current thread. - */ - static Thread* self(); - - /** Waits until the thread finishes. - * Waits until the thread finishes, i.e. the slot, as given to create(), - * returns or g_thread_exit() is called by the thread. (Calling - * g_thread_exit() in a C++ program should be avoided.) All resources of - * the thread including the Glib::Thread object are released. The thread - * must have been created with joinable = true. - */ - void join(); - - //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. - /** Creates a new thread with the priority @a priority. The stack gets the - * size @a stack_size or the default value for the current platform, if - * @a stack_size is 0. - * - * If @a joinable is @c true, you can wait for this thread's termination by - * calling join(). Otherwise the thread will just disappear, when ready. - * If @a bound is @c true, this thread will be scheduled in the system scope, - * otherwise the implementation is free to do scheduling in the process - * scope. The first variant is more expensive resource-wise, but generally - * faster. On some systems (e.g. Linux) all threads are bound. - * - * The new thread executes the function or method @a slot points to. You can - * pass additional arguments using sigc::bind(). If the thread was created - * successfully, it is returned. - * - * Because sigc::trackable is not thread safe, if the slot represents a - * non-static class method (that is, it is created by sigc::mem_fun()), the - * class concerned should not derive from sigc::trackable. - * - * @note It is not guaranteed, that threads with different priorities really - * behave accordingly. On some systems (e.g. Linux) only root can increase - * priorities. On other systems (e.g. Solaris) there doesn't seem to be - * different scheduling for different priorities. All in all try to avoid - * being dependent on priorities. Use Glib::THREAD_PRIORITY_NORMAL - * here as a default. - * - * @note Only use the extended - * create(const sigc::slot&, unsigned long, bool, bool, ThreadPriority) - * function, when you really can't use the simple - * create(const sigc::slot&, bool) - * instead. The latter overload does not take @a stack_size, @a bound and - * @a priority as arguments, as they should only be used for cases, where - * it is inevitable. - * - * @param slot A slot to execute in the new thread. - * @param stack_size A stack size for the new thread, or 0. - * @param joinable Should this thread be joinable? - * @param bound Should this thread be bound to a system thread? - * @param priority A priority for the thread. - * @return The new Thread* on success. - * @throw Glib::ThreadError - * - * @deprecated Use the simpler create() method instead, because all Threads - * are now joinable, and bounds and priority parameters now have no effect. - */ - static Thread* create(const sigc::slot& slot, unsigned long stack_size, - bool joinable, bool bound, ThreadPriority priority); - - /** Returns whether the thread is joinable. - * @return Whether the thread is joinable. - * - * @deprecated All threads are now joinable. - */ - bool joinable() const; - - /** Changes the priority of the thread to @a priority. - * @note It is not guaranteed, that threads with different priorities really - * behave accordingly. On some systems (e.g. Linux) only @c root can - * increase priorities. On other systems (e.g. Solaris) there doesn't seem - * to be different scheduling for different priorities. All in all try to - * avoid being dependent on priorities. - * @param priority A new priority for the thread. - * - * @deprecated Thread priorities no longer have any effect. - */ - void set_priority(ThreadPriority priority); - - /** Returns the priority of the thread. - * @return The thread's priority. - * - * @deprecated Thread priorities no longer have any effect. - */ - ThreadPriority get_priority() const; - - /** Gives way to other threads waiting to be scheduled. - * This function is often used as a method to make busy wait less evil. But - * in most cases, you will encounter, there are better methods to do that. - * So in general you shouldn't use this function. - */ - static void yield(); - - GThread* gobj() { return &gobject_; } - const GThread* gobj() const { return &gobject_; } - -private: - GThread gobject_; - - // Glib::Thread can neither be constructed nor deleted. - Thread(); - void operator delete(void*, std::size_t); -}; - -/** %Exception class used to exit from a thread. - * @code - * throw Glib::Thread::Exit(); - * @endcode - * Write this if you want to exit from a thread created by Thread::create(). - * Of course you must make sure not to catch Thread::Exit by accident, i.e. - * when using catch(...) somewhere in your code. - * - * @deprecated Use Glib::Threads::Thread::Exit instead. - */ -class Thread::Exit -{}; - - -//TODO: Make sure that Glib::wrap() uses Glib::Threads::wrap() instead. - -/** @relates Glib::Thread - * - * @deprecated Use Glib::Threads::wrap(GThread*) instead. - */ -Thread* wrap(GThread* gobject); - -struct StaticMutex; - -/** Like Glib::Mutex, but can be defined at compile time. - * Use @c GLIBMM_STATIC_MUTEX_INIT to initialize a StaticMutex: - * @code - * Glib::StaticMutex mutex = GLIBMM_STATIC_MUTEX_INIT; - * @endcode - * - * A StaticMutex can be used without calling Glib::thread_init(), it will - * silently do nothing then. That will also work when using the implicit - * conversion to Mutex&, thus you can safely use Mutex::Lock with a - * StaticMutex. - * - * @deprecated Use Glib::Threads::Mutex instead, which can be used statically. - */ -struct StaticMutex -{ - void lock(); - bool trylock(); - void unlock(); - - operator Mutex&(); - - GStaticMutex* gobj() { return &gobject_; } - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. - GStaticMutex gobject_; -#endif -}; - -/** Initializer macro for Glib::StaticMutex. - * @relates Glib::StaticMutex - * @hideinitializer - * - * @deprecated Glib::StaticMutex is deprecated in favour of Glib::Threads::Mutex, which can be used statically. - */ -#define GLIBMM_STATIC_MUTEX_INIT { G_STATIC_MUTEX_INIT } - -/** Represents a mutex (mutual exclusion). - * It can be used to protect data against shared access. Try to use - * Mutex::Lock instead of calling lock() and unlock() directly -- - * it will make your life much easier. - * - * @note Glib::Mutex is not recursive, i.e. a thread will deadlock, if it - * already has locked the mutex while calling lock(). Use Glib::RecMutex - * instead, if you need recursive mutexes. - * - * @deprecated Use Glib::Threads::Mutex instead. - */ -class Mutex -{ -public: - class Lock; - - Mutex(); - - Mutex(const Mutex&) = delete; - Mutex& operator=(const Mutex&) = delete; - - ~Mutex(); - - /** Locks the mutex. - * If mutex is already locked by another thread, the current thread will - * block until mutex is unlocked by the other thread. - * @see Mutex::Lock - */ - void lock(); - - /** Tries to lock the mutex. - * If the mutex is already locked by another thread, it immediately returns - * @c false. Otherwise it locks the mutex and returns @c true. - * @return Whether the mutex could be locked. - * @see Mutex::Lock - */ - bool trylock(); - - /** Unlocks the mutex. - * If another thread is blocked in a lock() call for this mutex, it will be - * woken and can lock the mutex itself. - * @see Mutex::Lock - */ - void unlock(); - - GMutex* gobj() { return gobject_; } - -private: - GMutex* gobject_; -}; - -/** Utility class for exception-safe mutex locking. - * @par Usage example: - * @code - * { - * Glib::Mutex::Lock lock (mutex); // calls mutex.lock() - * do_something(); - * } // the destructor calls mutex.unlock() - * @endcode - * As you can see, the compiler takes care of the unlocking. This is not - * only exception safe but also much less error-prone. You could even - * return while still holding the lock and it will be released - * properly. - * - * @deprecated Use Glib::Threads::Mutex::Lock instead. - */ -class Mutex::Lock -{ -public: - explicit inline Lock(Mutex& mutex); - inline Lock(Mutex& mutex, NotLock); - inline Lock(Mutex& mutex, TryLock); - inline ~Lock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - Mutex& mutex_; - bool locked_; - - -}; - - -/** Like Glib::RecMutex, but can be defined at compile time. - * Use @c GLIBMM_STATIC_REC_MUTEX_INIT to initialize a StaticRecMutex: - * @code - * Glib::StaticRecMutex mutex = GLIBMM_STATIC_REC_MUTEX_INIT; - * @endcode - * A StaticRecMutex can be used without calling Glib::thread_init(), it will - * silently do nothing then. That will also work when using the implicit - * conversion to RecMutex&, thus you can safely use RecMutex::Lock with a - * StaticRecMutex. - * - * @deprecated Use Glib::Threads::RecMutex instead, which can be used statically. - */ -struct StaticRecMutex -{ - void lock(); - bool trylock(); - void unlock(); - - void lock_full(unsigned int depth); - unsigned int unlock_full(); - - operator RecMutex&(); - - GStaticRecMutex* gobj() { return &gobject_; } - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. - GStaticRecMutex gobject_; -#endif -}; - -/** - * - * @deprecated Use Glib::Threads::RecMutex instead. - */ -class RecMutex : public StaticRecMutex -{ -public: - class Lock; - - RecMutex(); - ~RecMutex(); - -private: - // noncopyable - RecMutex(const RecMutex&); - RecMutex& operator=(const RecMutex&); -}; - -/** Utility class for exception-safe locking of recursive mutexes. - * - * @deprecated Use Glib::Threads::RecMutex instead. - */ -class RecMutex::Lock -{ -public: - explicit inline Lock(RecMutex& mutex); - inline Lock(RecMutex& mutex, NotLock); - inline Lock(RecMutex& mutex, TryLock); - - Lock(const RecMutex::Lock&) = delete; - RecMutex::Lock& operator=(const RecMutex::Lock&) = delete; - - inline ~Lock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RecMutex& mutex_; - bool locked_; -}; - - -/** Like Glib::RWLock, but can be defined at compile time. - * Use @c GLIBMM_STATIC_RW_LOCK_INIT to initialize a StaticRWLock: - * @code - * Glib::StaticRWLock rw_lock = GLIBMM_STATIC_RW_LOCK_INIT; - * @endcode - * A StaticRWLock can be used without calling Glib::thread_init(), it will - * silently do nothing then. That will also work when using the implicit - * conversion to RWLock&, thus you can safely use RWLock::ReaderLock and - * RWLock::WriterLock with a StaticRWLock. - * - * @deprecated Use Glib::Threads::RWLock instead, which can be used statically. - */ -struct StaticRWLock -{ - void reader_lock(); - bool reader_trylock(); - void reader_unlock(); - - void writer_lock(); - bool writer_trylock(); - void writer_unlock(); - - operator RWLock&(); - - GStaticRWLock* gobj() { return &gobject_; } - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. - GStaticRWLock gobject_; -#endif -}; - -/** - * - * @deprecated Use Glib::Threads::RWLock instead. - */ -class RWLock : public StaticRWLock -{ -public: - class ReaderLock; - class WriterLock; - - RWLock(); - - RWLock(const RWLock&) = delete; - RWLock& operator=(const RWLock&) = delete; - - ~RWLock(); -}; - -/** Utility class for exception-safe locking of read/write locks. - * - * @deprecated Use Glib::Threads::RWLock::ReaderLock instead. - */ -class RWLock::ReaderLock -{ -public: - explicit inline ReaderLock(RWLock& rwlock); - inline ReaderLock(RWLock& rwlock, NotLock); - inline ReaderLock(RWLock& rwlock, TryLock); - - ReaderLock(const RWLock::ReaderLock&) = delete; - RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete; - - inline ~ReaderLock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RWLock& rwlock_; - bool locked_; -}; - -/** Utility class for exception-safe locking of read/write locks. - * - * @deprecated Use Glib::Threads::RWLock::WriterLock instead. - */ -class RWLock::WriterLock -{ -public: - explicit inline WriterLock(RWLock& rwlock); - inline WriterLock(RWLock& rwlock, NotLock); - inline WriterLock(RWLock& rwlock, TryLock); - - WriterLock(const RWLock::WriterLock&) = delete; - RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete; - - inline ~WriterLock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RWLock& rwlock_; - bool locked_; -}; - -/** An opaque data structure to represent a condition. - * A @a Cond is an object that threads can block on, if they find a certain - * condition to be false. If other threads change the state of this condition - * they can signal the @a Cond, such that the waiting thread is woken up. - * @par Usage example: - * @code - * Glib::Cond data_cond; - * Glib::Mutex data_mutex; - * void* current_data = nullptr; - * - * void push_data(void* data) - * { - * Glib::Mutex::Lock lock (data_mutex); - * - * current_data = data; - * data_cond.signal(); - * } - * - * void* pop_data() - * { - * Glib::Mutex::Lock lock (data_mutex); - * - * while (!current_data) - * data_cond.wait(data_mutex); - * - * void *const data = current_data; - * current_data = nullptr; - * - * return data; - * } - * @endcode - * - * @deprecated Use Glib::Threads::Cond instead. - */ -class Cond -{ -public: - Cond(); - - Cond(const Cond&) = delete; - Cond& operator=(const Cond&) = delete; - - ~Cond(); - - /** If threads are waiting for this @a Cond, exactly one of them is woken up. - * It is good practice to hold the same lock as the waiting thread, while calling - * this method, though not required. - * - */ - void signal(); - - /** If threads are waiting for this @a Cond, all of them are woken up. - * It is good practice to hold the same lock as the waiting thread, while calling - * this method, though not required. - */ - void broadcast(); - - /** Waits until this thread is woken up on this @a Cond. - * The mutex is unlocked before falling asleep and locked again before resuming. - * - * @param mutex a @a Mutex that is currently locked. - * - * @note It is important to use the @a wait() and @a timed_wait() methods - * only inside a loop, which checks for the condition to be true as it is not - * guaranteed that the waiting thread will find it fulfilled, even if the signaling - * thread left the condition in that state. This is because another thread can have - * altered the condition, before the waiting thread got the chance to be woken up, - * even if the condition itself is protected by a @a Mutex. - */ - void wait(Mutex& mutex); - - /** Waits until this thread is woken up on this @a Cond, but not longer than until the time, that is specified by @a abs_time. - * The mutex is unlocked before falling asleep and locked again before resuming. - * - * @param mutex a @a Mutex that is currently locked. - * @param abs_time a max time to wait. - * - * @note It is important to use the @a wait() and @a timed_wait() methods - * only inside a loop, which checks for the condition to be true as it is not - * guaranteed that the waiting thread will find it fulfilled, even if the signaling - * thread left the condition in that state. This is because another thread can have - * altered the condition, before the waiting thread got the chance to be woken up, - * even if the condition itself is protected by a @a Mutex. - */ - bool timed_wait(Mutex& mutex, const Glib::TimeVal& abs_time); - - GCond* gobj() { return gobject_; } - -private: - GCond* gobject_; -}; - - -/** Thread-local data pointer. - * - * @deprecated Use Glib::Threads::Private instead, which can be used statically. - */ -template -struct StaticPrivate -{ - using DestroyNotifyFunc = void (*) (void*); - - static void delete_ptr(void* data); - - inline T* get(); - inline void set(T* data, DestroyNotifyFunc notify_func = &StaticPrivate::delete_ptr); - - GStaticPrivate* gobj() { return &gobject_; } - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - // Must be public to allow initialization at compile time. - GStaticPrivate gobject_; -#endif -}; - -/** Thread-local data pointer. - * - * @deprecated Use Glib::Threads::Private instead. - */ -template -class Private -{ -public: - - Private(const Private&) = delete; - Private& operator=(const Private&) = delete; - - using DestructorFunc = void (*) (void*); - - static void delete_ptr(void* data); - - explicit inline Private(DestructorFunc destructor_func = &Private::delete_ptr); - inline T* get(); - inline void set(T* data); - - GPrivate* gobj() { return gobject_; } - -private: - GPrivate* gobject_; -}; - -/** @} group Threads */ - -/*! A glibmm thread example. - * @example thread/thread.cc - */ - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/***************************************************************************/ -/* inline implementation */ -/***************************************************************************/ - -// internal -/** @deprecated This was always for internal glibmm use and is now unecessary even inside glibmm. - */ -void thread_init_impl(); - -/**** Glib::Mutex::Lock ****************************************************/ - -inline -Mutex::Lock::Lock(Mutex& mutex) -: - mutex_ (mutex), - locked_ (true) -{ - mutex_.lock(); -} - -inline -Mutex::Lock::Lock(Mutex& mutex, NotLock) -: - mutex_ (mutex), - locked_ (false) -{} - -inline -Mutex::Lock::Lock(Mutex& mutex, TryLock) -: - mutex_ (mutex), - locked_ (mutex.trylock()) -{} - -inline -Mutex::Lock::~Lock() -{ - if(locked_) - mutex_.unlock(); -} - -inline -void Mutex::Lock::acquire() -{ - mutex_.lock(); - locked_ = true; -} - -inline -bool Mutex::Lock::try_acquire() -{ - locked_ = mutex_.trylock(); - return locked_; -} - -inline -void Mutex::Lock::release() -{ - mutex_.unlock(); - locked_ = false; -} - -inline -bool Mutex::Lock::locked() const -{ - return locked_; -} - - -/**** Glib::RecMutex::Lock *************************************************/ - -inline -RecMutex::Lock::Lock(RecMutex& mutex) -: - mutex_ (mutex), - locked_ (true) -{ - mutex_.lock(); -} - -inline -RecMutex::Lock::Lock(RecMutex& mutex, NotLock) -: - mutex_ (mutex), - locked_ (false) -{} - -inline -RecMutex::Lock::Lock(RecMutex& mutex, TryLock) -: - mutex_ (mutex), - locked_ (mutex.trylock()) -{} - -inline -RecMutex::Lock::~Lock() -{ - if(locked_) - mutex_.unlock(); -} - -inline -void RecMutex::Lock::acquire() -{ - mutex_.lock(); - locked_ = true; -} - -inline -bool RecMutex::Lock::try_acquire() -{ - locked_ = mutex_.trylock(); - return locked_; -} - -inline -void RecMutex::Lock::release() -{ - mutex_.unlock(); - locked_ = false; -} - -inline -bool RecMutex::Lock::locked() const -{ - return locked_; -} - - -/**** Glib::RWLock::ReaderLock *********************************************/ - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock) -: - rwlock_ (rwlock), - locked_ (true) -{ - rwlock_.reader_lock(); -} - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock, NotLock) -: - rwlock_ (rwlock), - locked_ (false) -{} - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock, TryLock) -: - rwlock_ (rwlock), - locked_ (rwlock.reader_trylock()) -{} - -inline -RWLock::ReaderLock::~ReaderLock() -{ - if(locked_) - rwlock_.reader_unlock(); -} - -inline -void RWLock::ReaderLock::acquire() -{ - rwlock_.reader_lock(); - locked_ = true; -} - -inline -bool RWLock::ReaderLock::try_acquire() -{ - locked_ = rwlock_.reader_trylock(); - return locked_; -} - -inline -void RWLock::ReaderLock::release() -{ - rwlock_.reader_unlock(); - locked_ = false; -} - -inline -bool RWLock::ReaderLock::locked() const -{ - return locked_; -} - - -/**** Glib::RWLock::WriterLock *********************************************/ - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock) -: - rwlock_ (rwlock), - locked_ (true) -{ - rwlock_.writer_lock(); -} - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock, NotLock) -: - rwlock_ (rwlock), - locked_ (false) -{} - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock, TryLock) -: - rwlock_ (rwlock), - locked_ (rwlock.writer_trylock()) -{} - -inline -RWLock::WriterLock::~WriterLock() -{ - if(locked_) - rwlock_.writer_unlock(); -} - -inline -void RWLock::WriterLock::acquire() -{ - rwlock_.writer_lock(); - locked_ = true; -} - -inline -bool RWLock::WriterLock::try_acquire() -{ - locked_ = rwlock_.writer_trylock(); - return locked_; -} - -inline -void RWLock::WriterLock::release() -{ - rwlock_.writer_unlock(); - locked_ = false; -} - -inline -bool RWLock::WriterLock::locked() const -{ - return locked_; -} - - -/**** Glib::StaticPrivate **************************************************/ - -// static -template -void StaticPrivate::delete_ptr(void* data) -{ - delete static_cast(data); -} - -/** This is only for use by glibmm itself. - */ -void* StaticPrivate_get_helper(GStaticPrivate *private_key); - -template inline -T* StaticPrivate::get() -{ - return static_cast(StaticPrivate_get_helper(&gobject_)); -} - -/** This is only for use by glibmm itself. - */ -void StaticPrivate_set_helper(GStaticPrivate *private_key, gpointer data, GDestroyNotify notify); - -template inline -void StaticPrivate::set(T* data, typename StaticPrivate::DestroyNotifyFunc notify_func) -{ - StaticPrivate_set_helper(&gobject_, data, notify_func); -} - - -/**** Glib::Private ********************************************************/ - -// static -template -void Private::delete_ptr(void* data) -{ - delete static_cast(data); -} - -/** This is only for use by glibmm itself. - */ -GPrivate* GPrivate_new_helper(GDestroyNotify notify); - -template inline -Private::Private(typename Private::DestructorFunc destructor_func) -: - gobject_ (GPrivate_new_helper(destructor_func)) -{} - -template inline -T* Private::get() -{ - return static_cast(g_private_get(gobject_)); -} - -template inline -void Private::set(T* data) -{ - g_private_set(gobject_, data); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} // namespace Glib - diff --git a/glib/src/threads.ccg b/glib/src/threads.ccg deleted file mode 100644 index a478433..0000000 --- a/glib/src/threads.ccg +++ /dev/null @@ -1,301 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include - -/* Why reinterpret_cast(gobject) is needed: - * - * A Thread instance is in fact always a GThread instance. - * Unfortunately, GThread cannot be a member of Thread, - * because it is an opaque struct. Also, the C interface does not provide - * any hooks to install a destroy notification handler, thus we cannot - * wrap it dynamically either. - * - * The cast works because Thread does not have any member data, and - * it is impossible to derive from it. This is ensured by not implementing - * the (private) default constructor. - * This trick is used also in classes declared as _CLASS_OPAQUE_REFCOUNTED. - */ - -namespace -{ - -extern "C" { - -static void* -call_thread_entry_slot(void* data) -{ - const auto slot = reinterpret_cast(data); - - try - { - // Recreate the specific slot. - (*static_cast*>(slot))(); - } - catch (Glib::Threads::Thread::Exit&) - { - // Just exit from the thread. The Threads::Thread::Exit exception - // is our sane C++ replacement of g_thread_exit(). - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - delete slot; - return nullptr; -} - -} // extern "C" - -} // anonymous namespace - -namespace Glib -{ - -namespace Threads -{ - -/**** Glib::Threads::Thread ************************************************/ - -// static -Thread* -Thread::create(const sigc::slot& slot, const std::string& name) -{ - // Make a copy of slot on the heap. - const auto slot_copy = new sigc::slot(slot); - - GError* error = nullptr; - auto thread = g_thread_try_new( - name.empty() ? nullptr : name.c_str(), &call_thread_entry_slot, slot_copy, &error); - - if (error) - { - delete slot_copy; - Glib::Error::throw_exception(error); - } - if (!thread) - { - delete slot_copy; - } - return reinterpret_cast(thread); -} - -// static -Thread* -Thread::create(const sigc::slot& slot) -{ - return create(slot, std::string()); -} - -// static -Thread* -Thread::self() -{ - return reinterpret_cast(g_thread_self()); -} - -void -Thread::join() -{ - g_thread_join(reinterpret_cast(this)); -} - -// static -void -Thread::yield() -{ - g_thread_yield(); -} - -GThread* -Thread::gobj() -{ - return reinterpret_cast(this); -} - -const GThread* -Thread::gobj() const -{ - return reinterpret_cast(this); -} - -Thread* -wrap(GThread* gobject) -{ - return reinterpret_cast(gobject); -} - -/**** Glib::Threads::Mutex *************************************************/ - -Mutex::Mutex() -{ - g_mutex_init(&gobject_); -} - -Mutex::~Mutex() -{ - g_mutex_clear(&gobject_); -} - -void -Mutex::lock() -{ - g_mutex_lock(&gobject_); -} - -bool -Mutex::trylock() -{ - return g_mutex_trylock(&gobject_); -} - -void -Mutex::unlock() -{ - g_mutex_unlock(&gobject_); -} - -Mutex* -wrap(GMutex* gobject) -{ - return reinterpret_cast(gobject); -} - -/**** Glib::Threads::RecMutex **********************************************/ - -RecMutex::RecMutex() -{ - g_rec_mutex_init(&gobject_); -} - -RecMutex::~RecMutex() -{ - g_rec_mutex_clear(&gobject_); -} - -void -RecMutex::lock() -{ - g_rec_mutex_lock(&gobject_); -} - -bool -RecMutex::trylock() -{ - return g_rec_mutex_trylock(&gobject_); -} - -void -RecMutex::unlock() -{ - g_rec_mutex_unlock(&gobject_); -} - -RecMutex* -wrap(GRecMutex* gobject) -{ - return reinterpret_cast(gobject); -} - -/**** Glib::Threads::RWLock ************************************************/ - -void -RWLock::reader_lock() -{ - g_rw_lock_reader_lock(&gobject_); -} - -bool -RWLock::reader_trylock() -{ - return g_rw_lock_reader_trylock(&gobject_); -} - -void -RWLock::reader_unlock() -{ - g_rw_lock_reader_unlock(&gobject_); -} - -void -RWLock::writer_lock() -{ - g_rw_lock_writer_lock(&gobject_); -} - -bool -RWLock::writer_trylock() -{ - return g_rw_lock_writer_trylock(&gobject_); -} - -void -RWLock::writer_unlock() -{ - g_rw_lock_writer_unlock(&gobject_); -} - -RWLock::RWLock() -{ - g_rw_lock_init(&gobject_); -} - -RWLock::~RWLock() -{ - g_rw_lock_clear(&gobject_); -} - -/**** Glib::Threads::Cond **************************************************/ - -Cond::Cond() -{ - g_cond_init(&gobject_); -} - -Cond::~Cond() -{ - g_cond_clear(&gobject_); -} - -void -Cond::signal() -{ - g_cond_signal(&gobject_); -} - -void -Cond::broadcast() -{ - g_cond_broadcast(&gobject_); -} - -void -Cond::wait(Mutex& mutex) -{ - g_cond_wait(&gobject_, mutex.gobj()); -} - -bool -Cond::wait_until(Mutex& mutex, gint64 end_time) -{ - return g_cond_wait_until(&gobject_, mutex.gobj(), end_time); -} - -} // namespace Threads - -} // namespace Glib diff --git a/glib/src/threads.hg b/glib/src/threads.hg deleted file mode 100644 index 86d7a17..0000000 --- a/glib/src/threads.hg +++ /dev/null @@ -1,931 +0,0 @@ -/* Copyright (C) 2002 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -_DEFS(glibmm,glib) -_CONFIGINCLUDE(glibmmconfig.h) - -_IS_DEPRECATED // This whole file is deprecated. - -#m4 _PUSH(SECTION_CC_PRE_INCLUDES) -// Don't let glibmm.h include thread.h. Pretend that it's already included. -// glib.h can then be included with G_DISABLE_DEPRECATED defined, and -// the compiler can react if deprecated glib functions are used. -#define _GLIBMM_THREAD_H -#m4 _POP() - -#include -#include -#include -#include -#include - -namespace Glib -{ - -/** - * @deprecated The entire Glib::Threads API is deprecated in favor of the - * standard C++ concurrency API in C++11 and C++14. - */ -namespace Threads -{ -//The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the Threads sub-namespace -_GMMPROC_EXTRA_NAMESPACE(Threads) - -/** @defgroup Threads Threads - * %Thread abstraction; including threads, different mutexes, - * conditions and thread private data. - * - * @deprecated The entire Glib::Threads API is deprecated in favor of the - * standard C++ concurrency API in C++11 and C++14. - * @{ - */ - -/// @deprecated Please use std::lock_guard or std::unique_lock instead. -enum NotLock { NOT_LOCK }; - -/// @deprecated Please use std::lock_guard or std::unique_lock instead. -enum TryLock { TRY_LOCK }; - -class Mutex; -class RecMutex; -class RWLock; - -/** %Exception class for thread-related errors. - * - * @deprecated Please use std::lock_guard or std::unique_lock instead. - */ -_WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE) - - -/** Represents a running thread. - * An instance of this class can only be obtained with create(), self(), - * or wrap(GThread*). It's not possible to delete a Thread object. - * You must call join() to avoid a memory leak. - * - * @note g_thread_exit() is not wrapped, because that function exits a thread - * without any cleanup. That's especially dangerous in C++ code, since the - * destructors of automatic objects won't be invoked. Instead, you can throw - * a Threads::Thread::Exit exception, which will be caught by the internal thread - * entry function. - * - * @note The thread entry slot doesn't have the void* return value that a - * GThreadFunc has. If you want to return any data from your thread, - * you can pass an additional output argument to the thread's entry slot. - * - * @deprecated Please use std::thread instead. - */ -class Thread -{ -public: - - Thread(const Thread&) = delete; - Thread& operator=(const Thread&) = delete; - - class Exit; - - //See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue. - // TODO: At the next ABI break, consider changing const sigc::slot& slot - // to const std::function& func, if it can be assumed that all supported - // compilers understand the C++11 template class std::function<>. - /** Creates a new thread. - * You can wait for this thread's termination by calling join(). - * - * The new thread executes the function or method @a slot points to. You can - * pass additional arguments using sigc::bind(). If the thread was created - * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown. - * - * Because sigc::trackable is not thread-safe, if the slot represents a - * non-static class method and is created by sigc::mem_fun(), the class concerned - * should not derive from sigc::trackable. You can use, say, boost::bind() or, - * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun(). - * - * @param slot A slot to execute in the new thread. - * @return The new Thread* on success. - * @throw Glib::Threads::ThreadError - */ - static Thread* create(const sigc::slot& slot); - - // TODO: At next ABI break, remove the single parameter create - // method and default name to std::string() - - /** Creates a new named thread. - * You can wait for this thread's termination by calling join(). - * - * The new thread executes the function or method @a slot points to. You can - * pass additional arguments using sigc::bind(). If the thread was created - * successfully, it is returned, otherwise a Threads::ThreadError exception is thrown. - * - * Because sigc::trackable is not thread-safe, if the slot represents a - * non-static class method and is created by sigc::mem_fun(), the class concerned - * should not derive from sigc::trackable. You can use, say, boost::bind() or, - * in C++11, std::bind() or a C++11 lambda expression instead of sigc::mem_fun(). - * - * The @a name can be useful for discriminating threads in a debugger. - * It is not used for other purposes and does not have to be unique. - * Some systems restrict the length of @a name to 16 bytes. - * - * @param slot A slot to execute in the new thread. - * @param name A name for the new thread. - * @return The new Thread* on success. - * @throw Glib::Threads::ThreadError - * - * @newin{2,36} - */ - static Thread* create(const sigc::slot& slot, const std::string& name); - - /** Returns the Thread* corresponding to the calling thread. - * @return The current thread. - */ - static Thread* self(); - - /** Waits until the thread finishes. - * Waits until the thread finishes, i.e. the slot, as given to create(), - * returns or g_thread_exit() is called by the thread. (Calling - * g_thread_exit() in a C++ program should be avoided.) All resources of - * the thread including the Glib::Threads::Thread object are released. - */ - void join(); - - /** Gives way to other threads waiting to be scheduled. - * This function is often used as a method to make busy wait less evil. But - * in most cases, you will encounter, there are better methods to do that. - * So in general you shouldn't use this function. - */ - static void yield(); - - GThread* gobj(); - const GThread* gobj() const; - -private: - // Glib::Thread can neither be constructed nor deleted. - Thread(); - void operator delete(void*, std::size_t); -}; - -/** %Exception class used to exit from a thread. - * @code - * throw Glib::Threads::Thread::Exit(); - * @endcode - * Write this if you want to exit from a thread created by Threads::Thread::create(). - * Of course you must make sure not to catch Threads::Thread::Exit by accident, i.e. - * when using catch(...) somewhere in your code. - * - * @deprecated Please use std::thread instead. - */ -class Thread::Exit -{}; - -/** A C++ wrapper for the C object. - * - * @param gobject The C instance. - * @return The C++ wrapper. - * - * @relates Glib::Threads::Thread - * - * @deprecated Please use std::thread instead. - */ -Thread* wrap(GThread* gobject); - -/** Represents a mutex (mutual exclusion). - * It can be used to protect data against shared access. Try to use - * Mutex::Lock instead of calling lock() and unlock() directly -- - * it will make your life much easier. - * - * @note Glib::Threads::Mutex is not recursive, i.e. a thread will deadlock, if it - * already has locked the mutex while calling lock(). Use Glib::Threads::RecMutex - * instead, if you need recursive mutexes. - * - * @deprecated Please use std::mutex instead. - */ -class Mutex -{ -public: - class Lock; - - Mutex(); - - Mutex(const Mutex&) = delete; - Mutex& operator=(const Mutex&) = delete; - - ~Mutex(); - - /** Locks the mutex. - * If mutex is already locked by another thread, the current thread will - * block until mutex is unlocked by the other thread. - * @see Mutex::Lock - */ - void lock(); - - /** Tries to lock the mutex. - * If the mutex is already locked by another thread, it immediately returns - * @c false. Otherwise it locks the mutex and returns @c true. - * @return Whether the mutex could be locked. - * @see Mutex::Lock - */ - bool trylock(); - - /** Unlocks the mutex. - * If another thread is blocked in a lock() call for this mutex, it will be - * woken and can lock the mutex itself. - * @see Mutex::Lock - */ - void unlock(); - - GMutex* gobj() { return &gobject_; } - -private: - GMutex gobject_; -}; - -/** Utility class for exception-safe mutex locking. - * @par Usage example: - * @code - * { - * Glib::Threads::Mutex::Lock lock(mutex); // calls mutex.lock() - * do_something(); - * } // the destructor calls mutex.unlock() - * @endcode - * As you can see, the compiler takes care of the unlocking. This is not - * only exception-safe but also much less error-prone. You could even - * return while still holding the lock and it will be released - * properly. - * - * @deprecated Please use std::lock_guard or std::unique_lock instead. - */ -class Mutex::Lock -{ -public: - explicit inline Lock(Mutex& mutex); - inline Lock(Mutex& mutex, NotLock); - inline Lock(Mutex& mutex, TryLock); - - Lock(const Mutex::Lock&) = delete; - Mutex::Lock& operator=(const Mutex::Lock&) = delete; - - inline ~Lock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - Mutex& mutex_; - bool locked_; -}; - -/** A C++ wrapper for the C object. - * Do not use operator delete on the returned pointer. If the caller owns the - * GMutex object, the caller must destroy it in the same way as if this function - * had not been called. - * - * @param gobject The C instance. - * @result The GMutex* cast to a Glib::Threads::Mutex*. - * - * @relates Glib::Threads::Mutex - */ -Mutex* wrap(GMutex* gobject); - -/** This represents a recursive mutex. - * It is similar to a Mutex with the difference - * that it is possible to lock a RecMutex multiple times in the same - * thread without deadlock. When doing so, care has to be taken to - * unlock the recursive mutex as often as it has been locked. - * - * @deprecated Please use std::recursive_mutex instead. - */ -class RecMutex -{ -public: - class Lock; - - RecMutex(); - - RecMutex(const RecMutex&) = delete; - RecMutex& operator=(const RecMutex&) = delete; - - ~RecMutex(); - - void lock(); - bool trylock(); - void unlock(); - - GRecMutex* gobj() { return &gobject_; } - -private: - GRecMutex gobject_; -}; - -/** Utility class for exception-safe locking of recursive mutexes. - * - * @deprecated Please use std::lock_guard or std::unique_lock instead. - */ -class RecMutex::Lock -{ -public: - explicit inline Lock(RecMutex& mutex); - inline Lock(RecMutex& mutex, NotLock); - inline Lock(RecMutex& mutex, TryLock); - - Lock(const RecMutex::Lock&) = delete; - RecMutex::Lock& operator=(const RecMutex::Lock&) = delete; - - inline ~Lock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RecMutex& mutex_; - bool locked_; -}; - -/** A C++ wrapper for the C object. - * Do not use operator delete on the returned pointer. If the caller owns the - * GRecMutex object, the caller must destroy it in the same way as if this function - * had not been called. - * - * @param gobject The C instance. - * @result The GRecMutex* cast to a Glib::Threads::RecMutex*. - * - * @relates Glib::Threads::RecMutex - */ -RecMutex* wrap(GRecMutex* gobject); - -/** This represents a reader-writer lock. - * It is similar to a Mutex in that it allows - * multiple threads to coordinate access to a shared resource. - * - * The difference to a mutex is that a reader-writer lock discriminates - * between read-only ('reader') and full ('writer') access. While only - * one thread at a time is allowed write access (by holding the 'writer' - * lock via writer_lock()), multiple threads can gain - * simultaneous read-only access (by holding the 'reader' lock via - * reader_lock()). - * - * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex. - */ -class RWLock -{ -public: - class ReaderLock; - class WriterLock; - - RWLock(); - - RWLock(const RWLock&) = delete; - RWLock& operator=(const RWLock&) = delete; - - ~RWLock(); - - void reader_lock(); - bool reader_trylock(); - void reader_unlock(); - - void writer_lock(); - bool writer_trylock(); - void writer_unlock(); - - GRWLock* gobj() { return &gobject_; } - -private: - GRWLock gobject_; -}; - -/** Utility class for exception-safe locking of read/write locks. - * - * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex. - */ -class RWLock::ReaderLock -{ -public: - explicit inline ReaderLock(RWLock& rwlock); - inline ReaderLock(RWLock& rwlock, NotLock); - inline ReaderLock(RWLock& rwlock, TryLock); - - ReaderLock(const RWLock::ReaderLock&) = delete; - RWLock::ReaderLock& operator=(const RWLock::ReaderLock&) = delete; - - inline ~ReaderLock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RWLock& rwlock_; - bool locked_; -}; - -/** Utility class for exception-safe locking of read/write locks. - * - * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex. - */ -class RWLock::WriterLock -{ -public: - explicit inline WriterLock(RWLock& rwlock); - inline WriterLock(RWLock& rwlock, NotLock); - inline WriterLock(RWLock& rwlock, TryLock); - - WriterLock(const RWLock::WriterLock&) = delete; - RWLock::WriterLock& operator=(const RWLock::WriterLock&) = delete; - - inline ~WriterLock(); - - inline void acquire(); - inline bool try_acquire(); - inline void release(); - inline bool locked() const; - -private: - RWLock& rwlock_; - bool locked_; -}; - -/** An opaque data structure to represent a condition. - * A @a Cond is an object that threads can block on, if they find a certain - * condition to be false. If other threads change the state of this condition - * they can signal the @a Cond, such that the waiting thread is woken up. - * - * @deprecated Please use std::condition_variable instead. - * - * @par Usage example: - * @code - * Glib::Threads::Cond data_cond; - * Glib::Threads::Mutex data_mutex; - * void* current_data = nullptr; - * - * void push_data(void* data) - * { - * Glib::Threads::Mutex::Lock lock(data_mutex); - * - * current_data = data; - * data_cond.signal(); - * } - * - * void* pop_data() - * { - * Glib::Threads::Mutex::Lock lock(data_mutex); - * - * while (!current_data) - * data_cond.wait(data_mutex); - * - * void* const data = current_data; - * current_data = nullptr; - * - * return data; - * } - * @endcode - */ -class Cond -{ -public: - Cond(); - - Cond(const Cond&) = delete; - Cond& operator=(const Cond&) = delete; - - ~Cond(); - - /** If threads are waiting for this @a Cond, exactly one of them is woken up. - * It is good practice to hold the same lock as the waiting thread, while calling - * this method, though not required. - */ - void signal(); - - /** If threads are waiting for this @a Cond, all of them are woken up. - * It is good practice to hold the same lock as the waiting threads, while calling - * this method, though not required. - */ - void broadcast(); - - /** Waits until this thread is woken up on this @a Cond. - * The mutex is unlocked before falling asleep and locked again before resuming. - * - * @param mutex A @a Mutex that is currently locked. - * - * @note It is important to use the @a wait() and @a wait_until() methods - * only inside a loop, which checks for the condition to be true as it is not - * guaranteed that the waiting thread will find it fulfilled, even if the signaling - * thread left the condition in that state. This is because another thread can have - * altered the condition, before the waiting thread got the chance to be woken up, - * even if the condition itself is protected by a @a Mutex. - */ - void wait(Mutex& mutex); - - /** Waits until this thread is woken up on this @a Cond, but not longer - * than until the time specified by @a end_time. - * The mutex is unlocked before falling asleep and locked again before resuming. - * - * @par Usage example: - * Extending the example presented in the documentation of class Cond. - * @code - * void* pop_data_timed() - * { - * Glib::Threads::Mutex::Lock lock(data_mutex); - * - * // Wait at most 5 seconds. - * const gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND; - * while (!current_data) - * if (!data_cond.wait_until(data_mutex, end_time) - * return nullptr; // timeout - * - * void* const data = current_data; - * current_data = nullptr; - * - * return data; - * } - * @endcode - * The end time is calculated once, before entering the loop, and reused. - * This is the motivation behind the use of absolute time. If a relative time - * of 5 seconds were passed directly to the call and a spurious wakeup - * occurred, the program would have to start over waiting again, which would - * lead to a total wait time of more than 5 seconds. - * - * @param mutex A @a Mutex that is currently locked. - * @param end_time The monotonic time to wait until, in microseconds. - * See g_get_monotonic_time(). - * @return true if the condition variable was signalled (or in the case - * of a spurious wakeup), false if @a end_time has passed. - * - * @note It is important to use the @a wait() and @a wait_until() methods - * only inside a loop, which checks for the condition to be true as it is not - * guaranteed that the waiting thread will find it fulfilled, even if the signaling - * thread left the condition in that state. This is because another thread can have - * altered the condition, before the waiting thread got the chance to be woken up, - * even if the condition itself is protected by a @a Mutex. - */ - bool wait_until(Mutex& mutex, gint64 end_time); - - GCond* gobj() { return &gobject_; } - -private: - GCond gobject_; -}; - -/** Thread-local data pointer. - * - * It is recommended that all instances of this class are statically allocated. - * The first time an instance is used (get(), set() or replace() is called) - * glib allocates a scarce OS resource that cannot be deallocated. - * - * @deprecated Please use the thread_local keyword instead. - */ -template -class Private -{ -public: - Private(const Private&) = delete; - Private& operator=(const Private&) = delete; - - using DestructorFunc = void (*) (void*); - - /** Deletes static_cast(data) - */ - static void delete_ptr(void* data); - - /** Constructor. - * - * @param destructor_func Function pointer, or nullptr. If @a destructor_func is not nullptr - * and the stored data pointer is not nullptr, this function is called when replace() - * is called and when the thread exits. - */ - explicit inline Private(DestructorFunc destructor_func = &Private::delete_ptr); - - /** Gets the pointer stored in the calling thread. - * - * @return If no value has yet been set in this thread, nullptr is returned. - */ - inline T* get(); - - /** Sets the pointer in the calling thread without calling destructor_func(). - */ - inline void set(T* data); - - /** Sets the pointer in the calling thread and calls destructor_func(). - * If a function pointer (and not nullptr) was specified in the constructor, and - * the stored data pointer before the call to replace() is not nullptr, then - * destructor_func() is called with this old pointer value. - * - * @newin{2,32} - */ - inline void replace(T* data); - - GPrivate* gobj() { return gobject_; } - -private: - GPrivate gobject_; -}; - -/** @} group Threads */ - -/*! A glibmm thread example. - * @example thread/thread.cc - */ - - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -/***************************************************************************/ -/* inline implementation */ -/***************************************************************************/ - -/**** Glib::Threads::Mutex::Lock *******************************************/ - -inline -Mutex::Lock::Lock(Mutex& mutex) -: - mutex_ (mutex), - locked_ (true) -{ - mutex_.lock(); -} - -inline -Mutex::Lock::Lock(Mutex& mutex, NotLock) -: - mutex_ (mutex), - locked_ (false) -{} - -inline -Mutex::Lock::Lock(Mutex& mutex, TryLock) -: - mutex_ (mutex), - locked_ (mutex.trylock()) -{} - -inline -Mutex::Lock::~Lock() -{ - if(locked_) - mutex_.unlock(); -} - -inline -void Mutex::Lock::acquire() -{ - mutex_.lock(); - locked_ = true; -} - -inline -bool Mutex::Lock::try_acquire() -{ - locked_ = mutex_.trylock(); - return locked_; -} - -inline -void Mutex::Lock::release() -{ - mutex_.unlock(); - locked_ = false; -} - -inline -bool Mutex::Lock::locked() const -{ - return locked_; -} - - -/**** Glib::Threads::RecMutex::Lock ****************************************/ - -inline -RecMutex::Lock::Lock(RecMutex& mutex) -: - mutex_ (mutex), - locked_ (true) -{ - mutex_.lock(); -} - -inline -RecMutex::Lock::Lock(RecMutex& mutex, NotLock) -: - mutex_ (mutex), - locked_ (false) -{} - -inline -RecMutex::Lock::Lock(RecMutex& mutex, TryLock) -: - mutex_ (mutex), - locked_ (mutex.trylock()) -{} - -inline -RecMutex::Lock::~Lock() -{ - if(locked_) - mutex_.unlock(); -} - -inline -void RecMutex::Lock::acquire() -{ - mutex_.lock(); - locked_ = true; -} - -inline -bool RecMutex::Lock::try_acquire() -{ - locked_ = mutex_.trylock(); - return locked_; -} - -inline -void RecMutex::Lock::release() -{ - mutex_.unlock(); - locked_ = false; -} - -inline -bool RecMutex::Lock::locked() const -{ - return locked_; -} - - -/**** Glib::Threads::RWLock::ReaderLock ************************************/ - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock) -: - rwlock_ (rwlock), - locked_ (true) -{ - rwlock_.reader_lock(); -} - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock, NotLock) -: - rwlock_ (rwlock), - locked_ (false) -{} - -inline -RWLock::ReaderLock::ReaderLock(RWLock& rwlock, TryLock) -: - rwlock_ (rwlock), - locked_ (rwlock.reader_trylock()) -{} - -inline -RWLock::ReaderLock::~ReaderLock() -{ - if(locked_) - rwlock_.reader_unlock(); -} - -inline -void RWLock::ReaderLock::acquire() -{ - rwlock_.reader_lock(); - locked_ = true; -} - -inline -bool RWLock::ReaderLock::try_acquire() -{ - locked_ = rwlock_.reader_trylock(); - return locked_; -} - -inline -void RWLock::ReaderLock::release() -{ - rwlock_.reader_unlock(); - locked_ = false; -} - -inline -bool RWLock::ReaderLock::locked() const -{ - return locked_; -} - - -/**** Glib::Threads::RWLock::WriterLock ************************************/ - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock) -: - rwlock_ (rwlock), - locked_ (true) -{ - rwlock_.writer_lock(); -} - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock, NotLock) -: - rwlock_ (rwlock), - locked_ (false) -{} - -inline -RWLock::WriterLock::WriterLock(RWLock& rwlock, TryLock) -: - rwlock_ (rwlock), - locked_ (rwlock.writer_trylock()) -{} - -inline -RWLock::WriterLock::~WriterLock() -{ - if(locked_) - rwlock_.writer_unlock(); -} - -inline -void RWLock::WriterLock::acquire() -{ - rwlock_.writer_lock(); - locked_ = true; -} - -inline -bool RWLock::WriterLock::try_acquire() -{ - locked_ = rwlock_.writer_trylock(); - return locked_; -} - -inline -void RWLock::WriterLock::release() -{ - rwlock_.writer_unlock(); - locked_ = false; -} - -inline -bool RWLock::WriterLock::locked() const -{ - return locked_; -} - -/**** Glib::Threads::Private ********************************************/ - -// static -template -void Private::delete_ptr(void* data) -{ - delete static_cast(data); -} - -template inline -Private::Private(typename Private::DestructorFunc destructor_func) -{ - // gobject_ = G_PRIVATE_INIT(destructor_func); - // does not compile with --enable-warnings=fatal. - // GPrivate is a struct, and G_PRIVATE_INIT is an initializer of type { ... }. - // G_PRIVATE_INIT can be used only in initializations. - const GPrivate temp = G_PRIVATE_INIT(destructor_func); - gobject_ = temp; -} - -template inline -T* Private::get() -{ - return static_cast(g_private_get(&gobject_)); -} - -template inline -void Private::set(T* data) -{ - g_private_set(&gobject_, data); -} - -template inline -void Private::replace(T* data) -{ - g_private_replace(&gobject_, data); -} - -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -} //namespace Threads - -} // namespace Glib diff --git a/glib/src/timezone.ccg b/glib/src/timezone.ccg index 7faf86e..ad11205 100644 --- a/glib/src/timezone.ccg +++ b/glib/src/timezone.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/timezone.hg b/glib/src/timezone.hg index 1a03376..80e95d5 100644 --- a/glib/src/timezone.hg +++ b/glib/src/timezone.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/unicode.ccg b/glib/src/unicode.ccg index aac6cd6..be4c2b5 100644 --- a/glib/src/unicode.ccg +++ b/glib/src/unicode.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/unicode.hg b/glib/src/unicode.hg index b3d65f5..b3c50bb 100644 --- a/glib/src/unicode.hg +++ b/glib/src/unicode.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/uriutils.ccg b/glib/src/uriutils.ccg index 4650c0c..c34848b 100644 --- a/glib/src/uriutils.ccg +++ b/glib/src/uriutils.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/uriutils.hg b/glib/src/uriutils.hg index 05358a4..a1a6f89 100644 --- a/glib/src/uriutils.hg +++ b/glib/src/uriutils.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) diff --git a/glib/src/value_basictypes.cc.m4 b/glib/src/value_basictypes.cc.m4 index 6dd549f..82b2233 100644 --- a/glib/src/value_basictypes.cc.m4 +++ b/glib/src/value_basictypes.cc.m4 @@ -15,7 +15,8 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see . +dnl License along with this library; if not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) @@ -47,7 +48,7 @@ $1 Value<$1>::get() const GParamSpec* Value<$1>::create_param_spec(const Glib::ustring& name) const { return create_param_spec(name, Glib::ustring(), Glib::ustring(), - Glib::PARAM_READWRITE); + Glib::ParamFlags::READWRITE); } GParamSpec* Value<$1>::create_param_spec(const Glib::ustring& name, const Glib::ustring& nick, @@ -77,9 +78,6 @@ G_GNUC_EXTENSION typedef long long long_long; G_GNUC_EXTENSION typedef unsigned long long unsigned_long_long; GLIB_VALUE_BASIC(bool, boolean) -#ifndef GLIBMM_DISABLE_DEPRECATED -GLIB_VALUE_BASIC(char, char, -128, 127) -#endif // GLIBMM_DISABLE_DEPRECATED GLIB_VALUE_BASIC(signed char, schar, -128, 127) GLIB_VALUE_BASIC(unsigned char, uchar, 0, 255) GLIB_VALUE_BASIC(int, int, G_MININT, G_MAXINT) diff --git a/glib/src/value_basictypes.h.m4 b/glib/src/value_basictypes.h.m4 index 5381b8b..56097ac 100644 --- a/glib/src/value_basictypes.h.m4 +++ b/glib/src/value_basictypes.h.m4 @@ -15,7 +15,8 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see . +dnl License along with this library; if not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) @@ -33,7 +34,6 @@ class Value<$1> : public ValueBase { public: using CppType = $1; - using CType = g$2; static GType value_type() G_GNUC_CONST; @@ -66,10 +66,6 @@ divert[]dnl namespace Glib { GLIB_VALUE_BASIC(bool, boolean) -#ifndef GLIBMM_DISABLE_DEPRECATED -/// @deprecated Use Value instead. -GLIB_VALUE_BASIC(char, char) -#endif // GLIBMM_DISABLE_DEPRECATED /// @newin{2,44} GLIB_VALUE_BASIC(signed char, int8) GLIB_VALUE_BASIC(unsigned char, uchar) diff --git a/glib/src/valuearray.ccg b/glib/src/valuearray.ccg deleted file mode 100644 index 7776acb..0000000 --- a/glib/src/valuearray.ccg +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (C) 2002-2009 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include - -static int -ValueArray_Compare_glibmm_callback(gconstpointer a, gconstpointer b, gpointer user_data) -{ - Glib::ValueArray::SlotCompare* the_slot = static_cast(user_data); - - try - { - return (*the_slot)( - *reinterpret_cast(a), *reinterpret_cast(b)); - } - catch (...) - { - Glib::exception_handlers_invoke(); - } - - return 0; -} - -namespace Glib -{ - -ValueArray::ValueArray() : gobject_(g_value_array_new(0)) -{ -} - -ValueArray::ValueArray(guint n_preallocated) : gobject_(g_value_array_new(n_preallocated)) -{ -} - -bool -ValueArray::get_nth(guint index, Glib::ValueBase& value) -{ - const auto g_value = g_value_array_get_nth(gobj(), index); - - if (g_value) - { - value.init(g_value); - return true; - } - else - return false; -} - -Glib::ValueArray& -ValueArray::append(const Glib::ValueBase& value) -{ - g_value_array_append(gobj(), value.gobj()); - return *this; -} - -Glib::ValueArray& -ValueArray::prepend(const Glib::ValueBase& value) -{ - g_value_array_prepend(gobj(), value.gobj()); - return *this; -} - -Glib::ValueArray& -ValueArray::insert(guint index, const Glib::ValueBase& value) -{ - g_value_array_insert(gobj(), index, value.gobj()); - return *this; -} - -Glib::ValueArray& -ValueArray::remove(guint index) -{ - g_value_array_remove(gobj(), index); - return *this; -} - -Glib::ValueArray& -ValueArray::sort(const SlotCompare& compare_func) -{ - SlotCompare slot_copy(compare_func); - g_value_array_sort_with_data(gobj(), &ValueArray_Compare_glibmm_callback, &slot_copy); - return *this; -} - -} // Glib namespace diff --git a/glib/src/valuearray.hg b/glib/src/valuearray.hg deleted file mode 100644 index 1e9bed0..0000000 --- a/glib/src/valuearray.hg +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 2002-2009 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -_CONFIGINCLUDE(glibmmconfig.h) - -_DEFS(glibmm,glib) - -#include -#include -#include - -#m4 _PUSH(SECTION_CC_PRE_INCLUDES) -#undef G_DISABLE_DEPRECATED -#define GLIB_DISABLE_DEPRECATION_WARNINGS 1 -#m4 _POP() - -_IS_DEPRECATED // This whole file is deprecated. - -namespace Glib -{ - -/** A container structure to maintain an array of generic values. - * The prime purpose of a ValueArray is for it to be used as an object property - * that holds an array of values. A ValueArray wraps an array of ValueBase - * elements. - * - * @newin{2,22} - * - * @deprecated Use std::vector or std::vector< Glib::Value<> > - * instead of Glib::ValueArray. - */ -class ValueArray -{ - _CLASS_BOXEDTYPE(ValueArray, GValueArray, NONE, g_value_array_copy, g_value_array_free) - _IGNORE(g_value_array_copy, g_value_array_free) - _CUSTOM_DEFAULT_CTOR - -public: - /** For example, - * int on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2);. - * The compare function should return -1 if v1 < v2, 0 if v1 == v2, and 1 if - * v1 > v2. - */ - using SlotCompare = sigc::slot; - - /** Default constructor. Constructs a new array with no pre-allocation. - */ - ValueArray(); - - /** Constructs a new array with pre-allocation. - */ - ValueArray(guint n_preallocated); - - /** Return the value at @a index contained in the value array. - * @param index Index of the value of interest. - * @param value An uninitialized ValueBase in which to store the result. If - * the get is successful, @a value will be valid, otherwise it will remain - * uninitialized. - * @return whether the get was successful or not. - */ - bool get_nth(guint index, Glib::ValueBase& value); - _IGNORE(g_value_array_get_nth) - - _WRAP_METHOD_DOCS_ONLY(g_value_array_append) - Glib::ValueArray& append(const Glib::ValueBase& value); - - _WRAP_METHOD_DOCS_ONLY(g_value_array_prepend) - Glib::ValueArray& prepend(const Glib::ValueBase& value); - - _WRAP_METHOD_DOCS_ONLY(g_value_array_insert) - Glib::ValueArray& insert(guint index, const Glib::ValueBase& value); - - _WRAP_METHOD_DOCS_ONLY(g_value_array_remove) - Glib::ValueArray& remove(guint index); - - _WRAP_METHOD_DOCS_ONLY(g_value_array_sort) - Glib::ValueArray& sort(const SlotCompare& compare_func); - _IGNORE(g_value_array_sort_with_data) -}; - -} //namespace Glib diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index a645143..fd0cb22 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -244,16 +245,9 @@ VariantContainerBase::get_iter(const VariantType& container_variant_type) const /****************** Specializations ***********************************/ -_DEPRECATE_IFDEF_START -VariantBase::operator const void*() const -{ - return gobj() ? GINT_TO_POINTER(1) : nullptr; -} -_DEPRECATE_IFDEF_END - VariantBase::operator bool() const { - return gobj() ? GINT_TO_POINTER(1) : nullptr; + return gobj(); } void @@ -330,30 +324,6 @@ Variant::get() const return convert_const_gchar_ptr_to_ustring(g_variant_get_string(gobject_, nullptr)); } -// Variant makes sense for multiple types. -// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string -template <> -Variant -VariantBase::cast_dynamic>(const VariantBase& v) noexcept(false) -{ - if (!v.gobj()) - { - return Variant(); - } - - const VariantType vtype = v.get_type(); - if (vtype.equal(VARIANT_TYPE_STRING) || vtype.equal(VARIANT_TYPE_OBJECT_PATH) || - vtype.equal(VARIANT_TYPE_SIGNATURE)) - { - return Variant(const_cast(v.gobj()), true); - } - else - { - // std::cerr << "vtype=" << v.get_type_string() << std::endl; - throw std::bad_cast(); - } -} - /*--------------------Variant---------------------*/ Variant::Variant() : VariantStringBase() @@ -443,30 +413,6 @@ Variant::create(const std::string& data) return result; } -// Variant makes sense for multiple types. -// See http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string -template <> -Variant -VariantBase::cast_dynamic>(const VariantBase& v) noexcept(false) -{ - if (!v.gobj()) - { - return Variant(); - } - - const VariantType vtype = v.get_type(); - if (vtype.equal(VARIANT_TYPE_STRING) || vtype.equal(VARIANT_TYPE_BYTESTRING) || - vtype.equal(VARIANT_TYPE_OBJECT_PATH) || vtype.equal(VARIANT_TYPE_SIGNATURE)) - { - return Variant(const_cast(v.gobj()), true); - } - else - { - // std::cerr << "vtype=" << v.get_type_string() << std::endl; - throw std::bad_cast(); - } -} - std::string Variant::get() const { diff --git a/glib/src/variant.hg b/glib/src/variant.hg index f4503e2..0824ce2 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -29,7 +30,6 @@ _DEFS(glibmm,glib) #include #include #include -#include namespace Glib { @@ -97,29 +97,6 @@ class VariantBase g_variant_get, g_variant_get_va) public: -_DEPRECATE_IFDEF_START - /** This typedef is just to make it more obvious that - * our operator const void* should be used like operator bool(). - * - * @deprecated Use the explicit operator bool() instead. - */ - using BoolExpr = const void*; - - /** Test whether the Variant has an underlying instance. - * - * Mimics usage of pointers: - * @code - * if (variant) - * do_something(); - * @endcode - * - * @deprecated Use the explicit operator bool() instead. - * - * @newin{2,36} - */ - operator BoolExpr() const; -_DEPRECATE_IFDEF_END - /** Test whether the Variant has an underlying instance. * * @newin{2,50} @@ -148,7 +125,6 @@ _DEPRECATE_IFDEF_END _WRAP_METHOD(GVariantClass classify() const, g_variant_classify) _WRAP_METHOD(gsize get_size() const, g_variant_get_size) - _WRAP_METHOD(gconstpointer get_data(), g_variant_get_data, deprecated "Use the const version instead.") _WRAP_METHOD(gconstpointer get_data() const, g_variant_get_data, newin "2,46") _WRAP_METHOD(Glib::RefPtr get_data_as_bytes() const, g_variant_get_data_as_bytes, newin "2,46") _WRAP_METHOD(void store(gpointer data) const, g_variant_store) @@ -593,11 +569,6 @@ public: _IGNORE(g_variant_get_string, g_variant_dup_string) }; -//TODO: When we can break ABI, remove this template specialization. -template<> -Variant VariantBase::cast_dynamic< Variant >(const VariantBase& v) -noexcept(false); - /** Specialization of Variant containing a Glib::DBusObjectPathString, * for variants of type object path. * @newin{2,54} @@ -734,11 +705,6 @@ public: _IGNORE(g_variant_get_bytestring, g_variant_dup_bytestring) }; -//TODO: When we can break ABI, remove this template specialization. -template<> -Variant VariantBase::cast_dynamic< Variant >(const VariantBase& v) -noexcept(false); - /** Specialization of Variant containing a dictionary entry. See also * Variant< std::map >. * @newin{2,28} @@ -1135,7 +1101,7 @@ public: }; /** Specialization of Variant containing a tuple. - * @newin{2,54} + * @newin{2,52} * @ingroup Variant */ template @@ -1161,13 +1127,13 @@ public: /** Creates a new Variant containing a tuple. * @param data The tuple to use for creation. * @return The new Variant holding a tuple. - * @newin{2,54} + * @newin{2,52} */ static Variant> create(const std::tuple& data); /** Gets the VariantType. * @return The VariantType. - * @newin{2,54} + * @newin{2,52} */ static const VariantType& variant_type() G_GNUC_CONST; @@ -1178,7 +1144,7 @@ public: * @param index The index of the element. * @return The tuple element at index @a index. * @throw std::out_of_range - * @newin{2,54} + * @newin{2,52} */ template T get_child(gsize index) const; @@ -1188,13 +1154,13 @@ public: /** Gets the tuple of the Variant. * @return The tuple. - * @newin{2,54} + * @newin{2,52} */ std::tuple get() const; /** Gets a VariantIter of the Variant. * @return The VariantIter. - * @newin{2,54} + * @newin{2,52} */ VariantIter get_iter() const; }; @@ -1497,78 +1463,17 @@ const VariantType& Variant>::variant_type() // expands the variadic template parameters using swallow = int[]; // ensures left to right order - swallow{(expander(Variant::variant_type()))...}; + (void)swallow{(expander(Variant::variant_type()))...}; static auto type = VariantType::create_tuple(types); return type; } -#ifndef DOXYGEN_SHOULD_SKIP_THIS namespace detail { -// std::index_sequence and std::index_sequence_for are new in C++14, -// but this version of glibmm requires only C++11. -// The following code replaces std::index_sequence and std::index_sequence_for -// until we can require C++14 support. -// See https://bugzilla.gnome.org/show_bug.cgi?id=787648 - - /// Class template integer_sequence - template - struct integer_sequence - { - typedef T value_type; - static constexpr std::size_t size() { return sizeof...(Idx); } - }; - - // Concatenates two integer_sequences. - template struct iseq_cat; - - template - struct iseq_cat, integer_sequence> - { - using type = integer_sequence; - }; - - // Builds an integer_sequence. - template - struct make_intseq - : iseq_cat::type, - typename make_intseq::type> - { }; - - template - struct make_intseq - { - typedef integer_sequence type; - }; - - template - struct make_intseq - { - typedef integer_sequence type; - }; - - /// Alias template make_integer_sequence - template - using make_integer_sequence = typename make_intseq::type; - - /// Alias template index_sequence - template - using index_sequence = integer_sequence; - - /// Alias template make_index_sequence - template - using make_index_sequence = make_integer_sequence; - - /// Alias template index_sequence_for - template - using index_sequence_for = make_index_sequence; - -// End of code that replaces std::index_sequence and std::index_sequence_for - template void expand_tuple(std::vector &variants, const Tuple & t, - detail::index_sequence) + std::index_sequence) { using swallow = int[]; // ensures left to right order auto expander = [&variants](const VariantBase &variant) -> int @@ -1579,7 +1484,6 @@ void expand_tuple(std::vector &variants, const Tuple & t, (void)swallow {(expander(Variant::type>::create(std::get(t))))...}; } } // namespace detail -#endif // DOXYGEN_SHOULD_SKIP_THIS template Variant> @@ -1587,7 +1491,7 @@ Variant>::create(const std::tuple& data) { // create a vector containing all tuple values as variants std::vector variants; - detail::expand_tuple(variants, data, detail::index_sequence_for{}); + detail::expand_tuple(variants, data, std::index_sequence_for{}); using var_ptr = GVariant*; var_ptr* const var_array = new var_ptr[sizeof... (Types)]; @@ -1619,7 +1523,6 @@ Variant Variant>::get_child_variant(gsize index) const return entry; } -#ifndef DOXYGEN_SHOULD_SKIP_THIS namespace detail { // swallows any argument @@ -1631,14 +1534,13 @@ constexpr int any_arg(T&& arg) } template -void assign_tuple(std::vector &variants, Tuple & t, detail::index_sequence) +void assign_tuple(std::vector &variants, Tuple & t, std::index_sequence) { int i = 0; using swallow = int[]; // ensures left to right order (void)swallow {(any_arg(std::get(t) = VariantBase::cast_dynamic::type > >(variants[i++]).get()))...}; } } // namespace detail -#endif // DOXYGEN_SHOULD_SKIP_THIS template std::tuple Variant>::get() const @@ -1653,8 +1555,8 @@ std::tuple Variant>::get() const variants.push_back(variant); return i++; }; - swallow{(expander(get_child_variant(i)))...}; - detail::assign_tuple(variants, data, detail::index_sequence_for{}); + (void)swallow{(expander(get_child_variant(i)))...}; + detail::assign_tuple(variants, data, std::index_sequence_for{}); return data; } diff --git a/glib/src/variant_basictypes.cc.m4 b/glib/src/variant_basictypes.cc.m4 index ecdfc73..4247da8 100644 --- a/glib/src/variant_basictypes.cc.m4 +++ b/glib/src/variant_basictypes.cc.m4 @@ -17,7 +17,8 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see . +dnl License along with this library; if not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) diff --git a/glib/src/variant_basictypes.h.m4 b/glib/src/variant_basictypes.h.m4 index 5415177..959a8e5 100644 --- a/glib/src/variant_basictypes.h.m4 +++ b/glib/src/variant_basictypes.h.m4 @@ -17,7 +17,8 @@ dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see . +dnl License along with this library; if not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. include(template.macros.m4) diff --git a/glib/src/variantdict.ccg b/glib/src/variantdict.ccg index 18224f6..6e069a3 100644 --- a/glib/src/variantdict.ccg +++ b/glib/src/variantdict.ccg @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include diff --git a/glib/src/variantdict.hg b/glib/src/variantdict.hg index 1f9a5a1..5974953 100644 --- a/glib/src/variantdict.hg +++ b/glib/src/variantdict.hg @@ -1,18 +1,19 @@ /* * Copyright (C) 2014 The glibmm Development Team * - * This library is free software; you can redistribute it and/or + * This library is free software, ) you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * License as published by the Free Software Foundation, ) either + * version 2.1 of the License, or(at your option) any later version. * * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY, ) without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library, ) if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include diff --git a/glib/src/variantiter.ccg b/glib/src/variantiter.ccg index f921b6c..cd06bac 100644 --- a/glib/src/variantiter.ccg +++ b/glib/src/variantiter.ccg @@ -1,17 +1,18 @@ /* Copyright(C) 2010 The glibmm Development Team * - * This library is free software; you can redistribute it and/or + * This library is free software, ) you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * License as published by the Free Software Foundation, ) either + * version 2.1 of the License, or(at your option) any later version. * * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY, ) without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library, ) if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -20,7 +21,7 @@ namespace Glib { -VariantIter::VariantIter(const VariantBase& variant) +VariantIter::VariantIter(const VariantContainerBase& variant) : gobject_(g_variant_iter_new(const_cast(variant.gobj()))) { } diff --git a/glib/src/variantiter.hg b/glib/src/variantiter.hg index 401bc4a..28f9517 100644 --- a/glib/src/variantiter.hg +++ b/glib/src/variantiter.hg @@ -1,17 +1,18 @@ /* Copyright(C) 2010 The glibmm Development Team * - * This library is free software; you can redistribute it and/or + * This library is free software, ) you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * License as published by the Free Software Foundation, ) either + * version 2.1 of the License, or(at your option) any later version. * * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY, ) without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library, ) if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -27,7 +28,7 @@ class VariantContainerBase; //because g_iter_value_get_next_value() both gets a value and changes the iterator. //GtkTextIter allows us to go forward and then separately get the current value. /** VariantIter - An opaque data structure used to iterate through - * VariantBase containers such as arrays. + * VariantContainerBase containers such as arrays. * @newin{2,28} */ class VariantIter @@ -35,8 +36,7 @@ class VariantIter _CLASS_OPAQUE_COPYABLE(VariantIter, GVariantIter, NONE, g_variant_iter_copy, g_variant_iter_free) _IGNORE(g_variant_iter_copy, g_variant_iter_free) public: - //TODO: The variant parameter should be a VariantContainerBase. - explicit VariantIter(const VariantBase& variant); + explicit VariantIter(const VariantContainerBase& variant); _WRAP_METHOD(gsize init(const VariantContainerBase& value), g_variant_iter_init) diff --git a/glib/src/varianttype.ccg b/glib/src/varianttype.ccg index ff1784f..1bac94d 100644 --- a/glib/src/varianttype.ccg +++ b/glib/src/varianttype.ccg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/glib/src/varianttype.hg b/glib/src/varianttype.hg index 4a8a355..de8b970 100644 --- a/glib/src/varianttype.hg +++ b/glib/src/varianttype.hg @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ _DEFS(glibmm,glib) @@ -165,8 +166,6 @@ public: // g_variant_type_value() because they don't do that already. #m4 _CONVERSION(`const GVariantType*',`VariantType',`Glib::wrap(const_cast($3), true)') _WRAP_METHOD(VariantType element() const, g_variant_type_element) - _WRAP_METHOD(VariantType first() const, g_variant_type_first, deprecated "Use get_item_types() instead.") - _WRAP_METHOD(VariantType next () const, g_variant_type_next, deprecated "Use get_item_types() instead.") _WRAP_METHOD(gsize n_items() const, g_variant_type_n_items) _WRAP_METHOD(VariantType key() const, g_variant_type_key) _WRAP_METHOD(VariantType value() const, g_variant_type_value) @@ -186,6 +185,7 @@ public: * @return The item types of this %VariantType, or an empty vector. */ std::vector get_item_types() const; + _IGNORE(g_variant_type_first, g_variant_type_next) // This function is part of unexposed API in gvarianttypeinfo.{h,c} for an // also unexposed GVariantTypeInfo structure of glib. diff --git a/tests/Makefile.am b/tests/Makefile.am index 2cb35ab..7e04968 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -22,6 +22,7 @@ check_PROGRAMS = \ giomm_ioerror_and_iodbuserror/test \ giomm_memoryinputstream/test \ giomm_simple/test \ + giomm_stream_vfuncs/test \ giomm_asyncresult_sourceobject/test \ giomm_tls_client/test \ giomm_listmodel/test \ @@ -33,22 +34,21 @@ check_PROGRAMS = \ glibmm_interface_move/test \ glibmm_mainloop/test \ glibmm_nodetree/test \ + glibmm_object/test \ glibmm_object_move/test \ + glibmm_objectbase/test \ glibmm_objectbase_move/test \ glibmm_ustring_compose/test \ glibmm_ustring_format/test \ glibmm_value/test \ - glibmm_valuearray/test \ glibmm_variant/test \ glibmm_vector/test \ glibmm_bool_vector/test \ - glibmm_bool_arrayhandle/test \ glibmm_null_vectorutils/test \ - glibmm_null_containerhandle/test \ glibmm_refptr/test \ glibmm_refptr_sigc_bind/test \ - glibmm_weakref/test \ - glibmm_bytearray/test + glibmm_bytearray/test \ + glibmm_ustring_make_valid/test TESTS = $(check_PROGRAMS) @@ -56,8 +56,9 @@ glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib) giomm_includes = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio) local_cppflags = -I$(top_builddir) $(glibmm_includes) $(giomm_includes) +cxxflags_disable_deprecated = $(GLIBMM_WXXFLAGS) -DGLIBMM_DISABLE_DEPRECATED -DGIOMM_DISABLE_DEPRECATED AM_CPPFLAGS = $(local_cppflags) $(GIOMM_CFLAGS) -AM_CXXFLAGS = $(GLIBMM_WXXFLAGS) -DGLIBMM_DISABLE_DEPRECATED -DGIOMM_DISABLE_DEPRECATED +AM_CXXFLAGS = $(GLIBMM_WXXFLAGS) $(cxxflags_disable_deprecated) local_libglibmm = $(top_builddir)/glib/glibmm/libglibmm-$(GLIBMM_API_VERSION).la @@ -78,6 +79,9 @@ giomm_memoryinputstream_test_LDADD = $(giomm_ldadd) giomm_simple_test_SOURCES = giomm_simple/main.cc giomm_simple_test_LDADD = $(giomm_ldadd) +giomm_stream_vfuncs_test_SOURCES = giomm_stream_vfuncs/main.cc +giomm_stream_vfuncs_test_LDADD = $(giomm_ldadd) + giomm_asyncresult_sourceobject_test_SOURCES = giomm_asyncresult_sourceobject/main.cc giomm_asyncresult_sourceobject_test_LDADD = $(giomm_ldadd) @@ -96,25 +100,30 @@ glibmm_interface_implementation_test_SOURCES = glibmm_interface_implementation/m glibmm_interface_implementation_test_LDADD = $(giomm_ldadd) glibmm_interface_move_test_SOURCES = glibmm_interface_move/main.cc +glibmm_interface_move_test_CXXFLAGS = $(GLIBMM_INTERFACE_TEST_WXXFLAGS) $(cxxflags_disable_deprecated) + glibmm_mainloop_test_SOURCES = glibmm_mainloop/main.cc glibmm_nodetree_test_SOURCES = glibmm_nodetree/main.cc -glibmm_object_move_test_SOURCES = glibmm_object_move/main.cc -glibmm_objectbase_move_test_SOURCES = glibmm_objectbase_move/main.cc +glibmm_object_test_SOURCES = glibmm_object/main.cc \ + glibmm_object/test_derived_object.h +glibmm_object_move_test_SOURCES = glibmm_object_move/main.cc \ + glibmm_object/test_derived_object.h +glibmm_objectbase_test_SOURCES = glibmm_objectbase/main.cc \ + glibmm_objectbase/test_derived_objectbase.h \ + glibmm_object/test_derived_object.h +glibmm_objectbase_move_test_SOURCES = glibmm_objectbase_move/main.cc \ + glibmm_objectbase/test_derived_objectbase.h \ + glibmm_object/test_derived_object.h glibmm_ustring_compose_test_SOURCES = glibmm_ustring_compose/main.cc glibmm_ustring_format_test_SOURCES = glibmm_ustring_format/main.cc -glibmm_value_test_SOURCES = glibmm_value/glibmm_value.cc glibmm_value/main.cc -glibmm_valuearray_test_SOURCES = glibmm_valuearray/main.cc +glibmm_value_test_SOURCES = glibmm_value/main.cc glibmm_variant_test_SOURCES = glibmm_variant/main.cc glibmm_vector_test_SOURCES = glibmm_vector/main.cc glibmm_vector_test_LDADD = $(giomm_ldadd) glibmm_bool_vector_test_SOURCES = glibmm_bool_vector/main.cc -glibmm_bool_arrayhandle_test_SOURCES = glibmm_bool_arrayhandle/main.cc glibmm_null_vectorutils_test_SOURCES = glibmm_null_vectorutils/main.cc glibmm_null_vectorutils_test_LDADD = $(giomm_ldadd) -glibmm_null_containerhandle_test_SOURCES = glibmm_null_containerhandle/main.cc -glibmm_null_containerhandle_test_LDADD = $(giomm_ldadd) glibmm_refptr_test_SOURCES = glibmm_refptr/main.cc glibmm_refptr_sigc_bind_test_SOURCES = glibmm_refptr_sigc_bind/main.cc -glibmm_weakref_test_SOURCES = glibmm_weakref/main.cc -glibmm_weakref_test_LDADD = $(giomm_ldadd) glibmm_bytearray_test_SOURCES = glibmm_bytearray/main.cc +glibmm_ustring_make_valid_test_SOURCES = glibmm_ustring_make_valid/main.cc diff --git a/tests/giomm_listmodel/main.cc b/tests/giomm_listmodel/main.cc index f40a943..1024a05 100644 --- a/tests/giomm_listmodel/main.cc +++ b/tests/giomm_listmodel/main.cc @@ -39,7 +39,7 @@ void test_store_boundaries() { auto store = Gio::ListStore::create(); auto item = Gio::MenuItem::create("", ""); - auto weakref_item = Glib::WeakRef(item); + std::weak_ptr weakref_item = item; // Remove an item from an empty list. store->remove(0); @@ -84,7 +84,7 @@ void test_store_boundaries() store.reset(); item.reset(); - if (weakref_item) + if (weakref_item.lock()) { result = EXIT_FAILURE; std::cerr << "test_store_boundaries(), 10: weakref_item is not null" << std::endl; @@ -116,16 +116,16 @@ void test_store_refcounts() const std::size_t n_items = 10; std::vector> items; - std::vector> weakref_items; + std::vector> weakref_items; for (std::size_t i = 0; i < n_items; ++i) { items.push_back(Gio::MenuItem::create("", "")); - weakref_items.push_back(Glib::WeakRef(items[i])); + weakref_items.emplace_back(items[i]); store->append(items[i]); } check_store_refcounts_n_items(2, store, n_items); - if (store->get_item(3).operator->() != items[3].operator->()) + if (store->get_item(3).get() != items[3].get()) { result = EXIT_FAILURE; std::cerr << "test_store_refcounts(), 3: get_item(3) != items[3]" << std::endl; @@ -134,25 +134,15 @@ void test_store_refcounts() for (std::size_t i = 0; i < n_items; ++i) { items[i].reset(); - if (!weakref_items[i]) - { - result = EXIT_FAILURE; - std::cerr << "test_store_refcounts(), 4: weakref_items[" << i << "] is null" << std::endl; - } } store->remove(4); - if (weakref_items[4]) - { - result = EXIT_FAILURE; - std::cerr << "test_store_refcounts(), 5: weakref_items[4] is not null" << std::endl; - } check_store_refcounts_n_items(6, store, n_items-1); store.reset(); for (std::size_t i = 0; i < n_items; ++i) { - if (weakref_items[i]) + if (weakref_items[i].lock()) { result = EXIT_FAILURE; std::cerr << "test_store_refcounts(), 7: weakref_items[" << i << "] is not null" << std::endl; @@ -178,8 +168,8 @@ gint32 get_next_number() int compare_items1(const Glib::RefPtr& a, const Glib::RefPtr& b) { - const auto action_a = Glib::RefPtr::cast_dynamic(a); - const auto action_b = Glib::RefPtr::cast_dynamic(b); + const auto action_a = std::dynamic_pointer_cast(a); + const auto action_b = std::dynamic_pointer_cast(b); if (!action_a || !action_b) { result = EXIT_FAILURE; @@ -228,7 +218,7 @@ void test_store_sorted1() result = EXIT_FAILURE; std::cerr << "test_store_sorted1(), 2: i=" << i << ", items are not equal" << std::endl; } - if (a.operator->() == b.operator->()) + if (a.get() == b.get()) { result = EXIT_FAILURE; std::cerr << "test_store_sorted1(), 3: i=" << i << ", items are the same" << std::endl; @@ -237,7 +227,7 @@ void test_store_sorted1() if (i > 0) { auto c = store->get_item(i * 2 - 1); - if (c.operator->() == a.operator->() || c.operator->() == b.operator->()) + if (c.get() == a.get() || c.get() == b.get()) { result = EXIT_FAILURE; std::cerr << "test_store_sorted1(), 4: i=" << i << ", items are the same" << std::endl; @@ -255,12 +245,12 @@ void test_store_sorted1() class MyObject : public Glib::Object { protected: - MyObject(int id) : m_id(id) {} + explicit MyObject(int id) : m_id(id) {} public: static Glib::RefPtr create(int id) { - return Glib::RefPtr(new MyObject(id)); + return Glib::make_refptr_for_instance(new MyObject(id)); } int get_id() const { return m_id; } @@ -311,7 +301,7 @@ void test_store_sorted2() result = EXIT_FAILURE; std::cerr << "test_store_sorted2(), 2: i=" << i << ", items are not equal" << std::endl; } - if (a.operator->() == b.operator->()) + if (a.get() == b.get()) { result = EXIT_FAILURE; std::cerr << "test_store_sorted2(), 3: i=" << i << ", items are the same" << std::endl; @@ -320,7 +310,7 @@ void test_store_sorted2() if (i > 0) { auto c = store->get_item(i * 2 - 1); - if (c.operator->() == a.operator->() || c.operator->() == b.operator->()) + if (c.get() == a.get() || c.get() == b.get()) { result = EXIT_FAILURE; std::cerr << "test_store_sorted2(), 4: i=" << i << ", items are the same" << std::endl; diff --git a/tests/giomm_stream_vfuncs/main.cc b/tests/giomm_stream_vfuncs/main.cc new file mode 100644 index 0000000..df1cde2 --- /dev/null +++ b/tests/giomm_stream_vfuncs/main.cc @@ -0,0 +1,170 @@ +/* Copyright (C) 2016 The giomm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ + +#include +#include +#include +#include + +// A simple custom stream that base64 encodes data. +// Do not copy it to your code, because it's very slow. +class Base64OutputStream : public Gio::FilterOutputStream +{ +public: + unsigned get_column_width() const { return column_width; } + void set_column_width(unsigned cw) { column_width = cw; } + static Glib::RefPtr create(const Glib::RefPtr& base_stream) + { + return Glib::make_refptr_for_instance(new Base64OutputStream(base_stream)); + } + +protected: + explicit Base64OutputStream(const Glib::RefPtr& base_stream) + : Gio::FilterOutputStream(base_stream), column(0), bit_count(0), bit_buffer(0), column_width(72) {} + + gssize write_vfunc(const void* buffer, gsize count, const Glib::RefPtr& cancellable) override + { + char const *byte = (char const *) buffer; + for (unsigned i = 0; i < count; ++i, ++byte) + { + // kindergarten implementation, because the object is not performance :) + bit_buffer <<= 8; + bit_buffer |= (*byte & 0xff); + bit_count += 8; + + if (bit_count == 24) + { + clear_pending(); // TODO why is this necessary to avoid an outstanding op. exception? + flush(cancellable); + set_pending(); + bit_count = 0; + } + + if (cancellable && cancellable->is_cancelled()) + throw Gio::Error(Gio::Error::CANCELLED, "Operation cancelled"); + } + return count; + } + + bool flush_vfunc(const Glib::RefPtr& cancellable) override + { + if (bit_count != 24) + return true; + char to_write[5]; + gsize len = 4; + + for (unsigned i=0; i<4; ++i) + { + unsigned index = (bit_buffer & (0x3f<<(i*6))) >> (i*6); + to_write[3-i] = base64_encode_str[index]; + } + column += 4; + // Yes, I know this is completely wrong. + if (column >= column_width) + { + column = 0; + to_write[4] = '\n'; + ++len; + } + + get_base_stream()->write(&to_write, len, cancellable); + + bit_count = 0; + bit_buffer = 0; + + return true; + } + + bool close_vfunc(const Glib::RefPtr& cancellable) override + { + char to_write[5] = "===="; + //get any last bytes (1 or 2) out of the buffer + switch (bit_count) + { + case 16: + bit_buffer <<= 2; //pad to make 18 bits + to_write[0] = base64_encode_str[(bit_buffer & (0x3f << 12)) >> 12]; + to_write[1] = base64_encode_str[(bit_buffer & (0x3f << 6)) >> 6]; + to_write[2] = base64_encode_str[bit_buffer & 0x3f]; + break; + + case 8: + bit_buffer <<= 4; //pad to make 12 bits + to_write[0] = base64_encode_str[(bit_buffer & (0x3f << 6)) >> 6]; + to_write[1] = base64_encode_str[bit_buffer & 0x3f]; + break; + } + + if (bit_count > 0) + { + get_base_stream()->write(&to_write, 5, cancellable); + } + else + { + // null terminate output + get_base_stream()->write("", 1, cancellable); + } + if (get_close_base_stream()) + get_base_stream()->close(cancellable); + + return true; + } + +private: + static char const *const base64_encode_str; + unsigned column; + unsigned bit_count; + unsigned bit_buffer; + unsigned column_width; +}; + +char const *const Base64OutputStream::base64_encode_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +int main(int, char**) +{ + Glib::init(); + Gio::init(); + + try + { + char result[256]; + Glib::RefPtr memory_chunk = Gio::MemoryOutputStream::create(result, 256, nullptr, nullptr); + Glib::RefPtr base64 = Base64OutputStream::create(memory_chunk); + + std::string data = "Custom GIO streams are cool!"; + + base64->set_close_base_stream(true); + base64->write(data); + base64->close(); + + const std::string base64_should_be("Q3VzdG9tIEdJTyBzdHJlYW1zIGFyZSBjb29sIQ=="); + std::cout << "Original data: " << data << std::endl; + std::cout << "base64-encoded data: " << result << std::endl; + std::cout << "base64 should be: " << base64_should_be << std::endl; + if (base64_should_be != result) + { + std::cout << "Not correct!" << std::endl; + return EXIT_FAILURE; + } + } + catch (Gio::Error e) + { + std::cout << "Gio error: " << e.what() << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/tests/giomm_tls_client/main.cc b/tests/giomm_tls_client/main.cc index 5f13325..703de75 100644 --- a/tests/giomm_tls_client/main.cc +++ b/tests/giomm_tls_client/main.cc @@ -77,7 +77,7 @@ main(int, char**) << std::endl; auto socket = Gio::Socket::create( - first_inet_address->get_family(), Gio::SOCKET_TYPE_STREAM, Gio::SOCKET_PROTOCOL_TCP); + first_inet_address->get_family(), Gio::Socket::Type::STREAM, Gio::Socket::Protocol::TCP); auto address = Gio::InetSocketAddress::create(first_inet_address, 443); @@ -98,7 +98,7 @@ main(int, char**) << address->get_port() << "." << std::endl; } - auto conn = Glib::RefPtr::cast_dynamic(Gio::SocketConnection::create(socket)); + auto conn = std::dynamic_pointer_cast(Gio::SocketConnection::create(socket)); if (!conn || !conn->is_connected()) { @@ -115,7 +115,7 @@ main(int, char**) { auto tls_connection = Gio::TlsClientConnection::create(conn, address); - tls_connection->signal_accept_certificate().connect(sigc::ptr_fun(&on_accept_certificate)); + tls_connection->signal_accept_certificate().connect(sigc::ptr_fun(&on_accept_certificate), false); tls_connection->handshake(); diff --git a/tests/glibmm_bool_arrayhandle/main.cc b/tests/glibmm_bool_arrayhandle/main.cc deleted file mode 100644 index 5144d26..0000000 --- a/tests/glibmm_bool_arrayhandle/main.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2011 The glibmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ -#include -#include - -#include - -#include - -// Use this line if you want debug output: -// std::ostream& ostr = std::cout; - -// This seems nicer and more useful than putting an ifdef around the use of std::cout: -std::stringstream debug; -std::ostream& ostr = debug; - -const unsigned int magic_limit(5); - -void -setup_rand() -{ - static bool setup(false); - - if (!setup) - { - std::srand(std::time(nullptr)); - setup = true; - } -} - -gboolean* -c_get_bool_array() -{ - gboolean* array(static_cast(g_malloc((magic_limit + 1) * sizeof(gboolean)))); - - setup_rand(); - for (unsigned int iter(0); iter < magic_limit; ++iter) - { - array[iter] = std::rand() % 2 ? TRUE : FALSE; - } - array[magic_limit] = FALSE; - return array; -} - -void -c_print_bool_array(gboolean* array) -{ - for (unsigned int iter(0); iter < magic_limit; ++iter) - { - ostr << iter << ": " << (array[iter] ? "TRUE" : "FALSE") << "\n"; - } -} - -Glib::ArrayHandle -cxx_get_bool_array() -{ - return Glib::ArrayHandle(c_get_bool_array(), magic_limit, Glib::OWNERSHIP_SHALLOW); -} - -void -cxx_print_bool_array(const Glib::ArrayHandle& array) -{ - c_print_bool_array(const_cast(array.data())); -} - -int -main() -{ - Glib::init(); - - std::vector v(cxx_get_bool_array()); - std::list l(cxx_get_bool_array()); - std::deque d(cxx_get_bool_array()); - - ostr << "vector:\n"; - cxx_print_bool_array(v); - ostr << "list:\n"; - cxx_print_bool_array(l); - ostr << "deque:\n"; - cxx_print_bool_array(d); - - return EXIT_SUCCESS; -} diff --git a/tests/glibmm_bool_vector/main.cc b/tests/glibmm_bool_vector/main.cc index 0752318..79b286c 100644 --- a/tests/glibmm_bool_vector/main.cc +++ b/tests/glibmm_bool_vector/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include diff --git a/tests/glibmm_date/main.cc b/tests/glibmm_date/main.cc index 1e6411d..e92559c 100644 --- a/tests/glibmm_date/main.cc +++ b/tests/glibmm_date/main.cc @@ -17,7 +17,7 @@ main(int, char**) date.subtract_days(1); date.add_years(1); - ostr << "The date a year and a month from yesterday will be: " << date.get_month() << "/" + ostr << "The date a year and a month from yesterday will be: " << date.get_month_as_int() << "/" << (int)date.get_day() << "/" << date.get_year() << "." << std::endl; Glib::Date copy_date(date); @@ -25,7 +25,7 @@ main(int, char**) assigned_date = copy_date; - ostr << "The copied date is: " << copy_date.get_month() << "/" << (int)copy_date.get_day() << "/" + ostr << "The copied date is: " << copy_date.get_month_as_int() << "/" << (int)copy_date.get_day() << "/" << copy_date.get_year() << "." << std::endl; return EXIT_SUCCESS; diff --git a/tests/glibmm_interface_move/main.cc b/tests/glibmm_interface_move/main.cc index c097cbb..b1888fd 100644 --- a/tests/glibmm_interface_move/main.cc +++ b/tests/glibmm_interface_move/main.cc @@ -20,6 +20,13 @@ static void test_Iface_init(gpointer) GType test_Iface_get_type(void) { + // Avoid compiler warnings about unused functions. + // TODO: With C++17, use [[maybe unused]]. + (void)TEST_IFACE; + (void)TEST_IS_IFACE; + (void)TEST_IFACE_GET_IFACE; + (void)glib_autoptr_cleanup_TestIface; + static GType type = 0; if (!type) @@ -109,7 +116,7 @@ class TestInterface : public Glib::Interface protected: using CppClassType = TestInterface_Class; - TestInterface() : Glib::Interface(derived_interface_class_.init()) {} + TestInterface() : Glib::Interface(derived_interface_class_.init()), i_(0) {} public: // A real application would never make the constructor public. @@ -187,7 +194,7 @@ public: // A real application would never make the constructor public. // It would instead have a protected constructor and a public create() method. - DerivedObject(int i) + explicit DerivedObject(int i) : Glib::ObjectBase(nullptr), Glib::Object(Glib::ConstructParams(derived_object_class_.init())), i_(i) diff --git a/tests/glibmm_nodetree/main.cc b/tests/glibmm_nodetree/main.cc index 0554c48..fee12ff 100644 --- a/tests/glibmm_nodetree/main.cc +++ b/tests/glibmm_nodetree/main.cc @@ -14,7 +14,6 @@ node_build_string(type_nodetree_string& node, std::string& string) int main() { - std::list alma; std::string tstring, cstring; type_nodetree_string* root; type_nodetree_string* node; @@ -50,16 +49,16 @@ main() g_assert(root->depth() == 1); g_assert(root->get_max_height() == 4); g_assert(node_G->first_child()->next_sibling()->depth() == 4); - g_assert(root->node_count(type_nodetree_string::TRAVERSE_LEAVES) == 7); - g_assert(root->node_count(type_nodetree_string::TRAVERSE_NON_LEAVES) == 4); - g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) == 11); + g_assert(root->node_count(type_nodetree_string::TraverseFlags::LEAVES) == 7); + g_assert(root->node_count(type_nodetree_string::TraverseFlags::NON_LEAVES) == 4); + g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) == 11); g_assert(node_F->get_max_height() == 3); g_assert(node_G->child_count() == 4); - g_assert(root->find_child("F", type_nodetree_string::TRAVERSE_ALL) == node_F); + g_assert(root->find_child("F", type_nodetree_string::TraverseFlags::ALL) == node_F); g_assert( - root->find("I", Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_NON_LEAVES) == NULL); + root->find("I", type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::NON_LEAVES) == NULL); g_assert( - root->find("J", Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_LEAVES) == node_J); + root->find("J", type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::LEAVES) == node_J); for (guint i = 0; i < node_B->child_count(); i++) { @@ -84,28 +83,28 @@ main() tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_PRE_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::PRE_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == "ABCDEFGHIJK"); tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_POST_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::POST_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == "CDEBHIJKGFA"); tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == "CBDEAHGIJKF"); tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == "ABFCDEGHIJK"); tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_LEAVES, -1); + type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::LEAVES, -1); g_assert(tstring == "CDEHIJK"); tstring.clear(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_PRE_ORDER, type_nodetree_string::TRAVERSE_NON_LEAVES, -1); + type_nodetree_string::TraverseType::PRE_ORDER, type_nodetree_string::TraverseFlags::NON_LEAVES, -1); g_assert(tstring == "ABFG"); tstring.clear(); @@ -113,18 +112,18 @@ main() node_G->reverse_children(); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == "ABFEDCGKJIH"); tstring.clear(); node = new type_nodetree_string(*root); // A deep copy. - g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) == - node->node_count(type_nodetree_string::TRAVERSE_ALL)); + g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) == + node->node_count(type_nodetree_string::TraverseFlags::ALL)); g_assert(root->get_max_height() == node->get_max_height()); root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)), - Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); node->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(cstring)), - Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1); + type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1); g_assert(tstring == cstring); delete node; @@ -143,7 +142,7 @@ main() node = node->first_child()->next_sibling(); } g_assert(root->get_max_height() > 100); - g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) == 1 + 2048); + g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) == 1 + 2048); delete root; diff --git a/tests/glibmm_null_containerhandle/main.cc b/tests/glibmm_null_containerhandle/main.cc deleted file mode 100644 index 513daca..0000000 --- a/tests/glibmm_null_containerhandle/main.cc +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2011 The gtkmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include -#include - -#include -#include - -int -main() -{ - Gio::init(); - using CrePtr = Glib::RefPtr; - - std::vector v1(Glib::ArrayHandle(nullptr, Glib::OWNERSHIP_DEEP)); - std::vector v2(Glib::ArrayHandle(nullptr, 5, Glib::OWNERSHIP_DEEP)); - std::vector v3(Glib::ListHandle(nullptr, Glib::OWNERSHIP_DEEP)); - std::vector v4(Glib::SListHandle(nullptr, Glib::OWNERSHIP_DEEP)); - std::vector v5(Glib::ArrayHandle(nullptr, Glib::OWNERSHIP_DEEP)); - std::vector v6(Glib::ArrayHandle(nullptr, 5, Glib::OWNERSHIP_DEEP)); - - if (v1.empty() && v2.empty() && v3.empty() && v4.empty() && v5.empty() && v6.empty()) - { - return 0; - } - return 1; -} diff --git a/tests/glibmm_null_vectorutils/main.cc b/tests/glibmm_null_vectorutils/main.cc index 533451f..b658b39 100644 --- a/tests/glibmm_null_vectorutils/main.cc +++ b/tests/glibmm_null_vectorutils/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/tests/glibmm_object/main.cc b/tests/glibmm_object/main.cc new file mode 100644 index 0000000..925b875 --- /dev/null +++ b/tests/glibmm_object/main.cc @@ -0,0 +1,23 @@ +#include "test_derived_object.h" +#include +#include +#include + +static void +test_object() +{ + GObject* gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr)); + DerivedObject derived(gobject, 5); + // std::cout << "debug: gobj(): " << derived.gobj() << std::endl; + g_assert(derived.gobj() == gobject); +} + +int +main(int, char**) +{ + Glib::init(); + + test_object(); + + return EXIT_SUCCESS; +} diff --git a/tests/glibmm_object/test_derived_object.h b/tests/glibmm_object/test_derived_object.h new file mode 100644 index 0000000..4c506b2 --- /dev/null +++ b/tests/glibmm_object/test_derived_object.h @@ -0,0 +1,60 @@ +#ifndef _GLIBMM_TEST_DERIVED_OBJECT_H +#define _GLIBMM_TEST_DERIVED_OBJECT_H + +#include + +// A basic derived GObject, just to test Glib::Object. +typedef struct +{ + GObject parent; +} TestDerived; + +typedef struct +{ + GObjectClass parent; +} TestDerivedClass; + +#define TEST_TYPE_DERIVED (test_derived_get_type()) +#define TEST_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_DERIVED, TestDerived)) +#define TEST_DERIVED_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST((cls), TEST_TYPE_DERIVED, TestDerivedClass)) +#define TEST_DERIVED_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_DERIVED, TestDerivedClass)) + +static void +test_derived_class_init(TestDerivedClass*) +{ +} +static void +test_derived_init(TestDerived*) +{ +} + +G_DEFINE_TYPE(TestDerived, test_derived, G_TYPE_OBJECT) + +class DerivedObject : public Glib::Object +{ +public: + // A real application would never make the constructor public. + // It would instead have a protected constructor and a public create() method. + DerivedObject(GObject* gobject, int i) : Glib::Object(gobject), i_(i) {} + + DerivedObject(const DerivedObject& src) = delete; + DerivedObject& operator=(const DerivedObject& src) = delete; + + DerivedObject(DerivedObject&& src) noexcept : Glib::Object(std::move(src)), i_(std::move(src.i_)) + { + } + + DerivedObject& operator=(DerivedObject&& src) noexcept + { + Glib::Object::operator=(std::move(src)); + i_ = std::move(src.i_); + + return *this; + } + + int i_; +}; + +#endif // _GLIBMM_TEST_DERIVED_OBJECT_H diff --git a/tests/glibmm_object_move/main.cc b/tests/glibmm_object_move/main.cc index 4f34cb7..1383b74 100644 --- a/tests/glibmm_object_move/main.cc +++ b/tests/glibmm_object_move/main.cc @@ -1,61 +1,8 @@ +#include "../glibmm_object/test_derived_object.h" #include #include #include -// A basic derived GObject, just to test Glib::Object. -typedef struct -{ - GObject parent; -} TestDerived; - -typedef struct -{ - GObjectClass parent; -} TestDerivedClass; - -#define TEST_TYPE_DERIVED (test_derived_get_type()) -#define TEST_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_DERIVED, TestDerived)) -#define TEST_DERIVED_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST((cls), TEST_TYPE_DERIVED, TestDerivedClass)) -#define TEST_DERIVED_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_DERIVED, TestDerivedClass)) - -static void -test_derived_class_init(TestDerivedClass*) -{ -} -static void -test_derived_init(TestDerived*) -{ -} - -G_DEFINE_TYPE(TestDerived, test_derived, G_TYPE_OBJECT) - -class DerivedObject : public Glib::Object -{ -public: - // A real application would never make the constructor public. - // It would instead have a protected constructor and a public create() method. - DerivedObject(GObject* gobject, int i) : Glib::Object(gobject), i_(i) {} - - DerivedObject(const DerivedObject& src) = delete; - DerivedObject& operator=(const DerivedObject& src) = delete; - - DerivedObject(DerivedObject&& src) noexcept : Glib::Object(std::move(src)), i_(std::move(src.i_)) - { - } - - DerivedObject& operator=(DerivedObject&& src) noexcept - { - Glib::Object::operator=(std::move(src)); - i_ = std::move(src.i_); - - return *this; - } - - int i_; -}; - static void test_object_move_constructor() { diff --git a/tests/glibmm_objectbase/main.cc b/tests/glibmm_objectbase/main.cc new file mode 100644 index 0000000..9ccf52e --- /dev/null +++ b/tests/glibmm_objectbase/main.cc @@ -0,0 +1,24 @@ +#include "test_derived_objectbase.h" +#include "../glibmm_object/test_derived_object.h" +#include +#include +#include + +static void +test_objectbase() +{ + GObject* gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr)); + DerivedObjectBase derived(gobject, 5); + // std::cout << "debug: gobj(): " << derived.gobj() << std::endl; + g_assert(derived.gobj() == gobject); +} + +int +main(int, char**) +{ + Glib::init(); + + test_objectbase(); + + return EXIT_SUCCESS; +} diff --git a/tests/glibmm_objectbase/test_derived_objectbase.h b/tests/glibmm_objectbase/test_derived_objectbase.h new file mode 100644 index 0000000..a4a509a --- /dev/null +++ b/tests/glibmm_objectbase/test_derived_objectbase.h @@ -0,0 +1,36 @@ +#ifndef _GLIBMM_TEST_DERIVED_OBJECTBASE_H +#define _GLIBMM_TEST_DERIVED_OBJECTBASE_H + +#include + +class DerivedObjectBase : public Glib::ObjectBase +{ +public: + // A real application would never make the constructor public. + // It would instead have a protected constructor and a public create() method. + DerivedObjectBase(GObject* gobject, int i) : Glib::ObjectBase(nullptr), i_(i) + { + Glib::ObjectBase::initialize(gobject); + } + + DerivedObjectBase(const DerivedObjectBase& src) = delete; + DerivedObjectBase& operator=(const DerivedObjectBase& src) = delete; + + DerivedObjectBase(DerivedObjectBase&& src) noexcept : Glib::ObjectBase(std::move(src)), + i_(std::move(src.i_)) + { + ObjectBase::initialize_move(src.gobject_, &src); + } + + DerivedObjectBase& operator=(DerivedObjectBase&& src) noexcept + { + Glib::ObjectBase::operator=(std::move(src)); + i_ = std::move(src.i_); + + return *this; + } + + int i_; +}; + +#endif // _GLIBMM_TEST_DERIVED_OBJECTBASE_H diff --git a/tests/glibmm_objectbase_move/main.cc b/tests/glibmm_objectbase_move/main.cc index 697f3cf..79bab6a 100644 --- a/tests/glibmm_objectbase_move/main.cc +++ b/tests/glibmm_objectbase_move/main.cc @@ -1,66 +1,9 @@ +#include "../glibmm_objectbase/test_derived_objectbase.h" +#include "../glibmm_object/test_derived_object.h" #include #include #include -// A basic derived GObject, just to test Glib::ObjectBase. -typedef struct -{ - GObject parent; -} TestDerived; - -typedef struct -{ - GObjectClass parent; -} TestDerivedClass; - -#define TEST_TYPE_DERIVED (test_derived_get_type()) -#define TEST_DERIVED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_DERIVED, TestDerived)) -#define TEST_DERIVED_CLASS(cls) \ - (G_TYPE_CHECK_CLASS_CAST((cls), TEST_TYPE_DERIVED, TestDerivedClass)) -#define TEST_DERIVED_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), TEST_TYPE_DERIVED, TestDerivedClass)) - -static void -test_derived_class_init(TestDerivedClass*) -{ -} -static void -test_derived_init(TestDerived*) -{ -} - -G_DEFINE_TYPE(TestDerived, test_derived, G_TYPE_OBJECT) - -class DerivedObjectBase : public Glib::ObjectBase -{ -public: - // A real application would never make the constructor public. - // It would instead have a protected constructor and a public create() method. - DerivedObjectBase(GObject* gobject, int i) : Glib::ObjectBase(nullptr), i_(i) - { - Glib::ObjectBase::initialize(gobject); - } - - DerivedObjectBase(const DerivedObjectBase& src) = delete; - DerivedObjectBase& operator=(const DerivedObjectBase& src) = delete; - - DerivedObjectBase(DerivedObjectBase&& src) noexcept : Glib::ObjectBase(std::move(src)), - i_(std::move(src.i_)) - { - ObjectBase::initialize_move(src.gobject_, &src); - } - - DerivedObjectBase& operator=(DerivedObjectBase&& src) noexcept - { - Glib::ObjectBase::operator=(std::move(src)); - i_ = std::move(src.i_); - - return *this; - } - - int i_; -}; - static void test_objectbase_move_constructor() { diff --git a/tests/glibmm_refptr/main.cc b/tests/glibmm_refptr/main.cc index 53a7449..050db35 100644 --- a/tests/glibmm_refptr/main.cc +++ b/tests/glibmm_refptr/main.cc @@ -101,16 +101,18 @@ test_refptr_copy_constructor() g_assert_cmpint(refSomething->max_ref_count(), ==, 1); { + //The reference count should not change, + //because we only take and release a single reference: Glib::RefPtr refSomething2(refSomething); - g_assert_cmpint(refSomething->ref_count(), ==, 2); - g_assert_cmpint(refSomething2->ref_count(), ==, 2); - g_assert_cmpint(refSomething->max_ref_count(), ==, 2); + g_assert_cmpint(refSomething->ref_count(), ==, 1); + g_assert_cmpint(refSomething2->ref_count(), ==, 1); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); } // Test the refcount after other references should have been released // when other RefPtrs went out of scope: g_assert_cmpint(refSomething->ref_count(), ==, 1); - g_assert_cmpint(refSomething->max_ref_count(), ==, 2); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); } static void @@ -121,16 +123,18 @@ test_refptr_assignment_operator() g_assert_cmpint(refSomething->max_ref_count(), ==, 1); { + //The reference count should not change, + //because we only take and release a single reference: Glib::RefPtr refSomething2 = refSomething; - g_assert_cmpint(refSomething->ref_count(), ==, 2); - g_assert_cmpint(refSomething2->ref_count(), ==, 2); - g_assert_cmpint(refSomething->max_ref_count(), ==, 2); + g_assert_cmpint(refSomething->ref_count(), ==, 1); + g_assert_cmpint(refSomething2->ref_count(), ==, 1); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); } // Test the refcount after other references should have been released // when other RefPtrs went out of scope: g_assert_cmpint(refSomething->ref_count(), ==, 1); - g_assert_cmpint(refSomething->max_ref_count(), ==, 2); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); } static Glib::RefPtr @@ -139,7 +143,7 @@ get_something() static Glib::RefPtr something_to_get; // Reinitialize it each time: - something_to_get = Glib::RefPtr(new Something()); + something_to_get = Glib::make_refptr_for_instance(new Something()); return something_to_get; } @@ -148,23 +152,25 @@ static void test_refptr_with_parent_copy_constructor() { // We use get_something() because test_refptr_with_parent_move_constructor() does. + //The reference count should not change, + //because we only take and release a single reference: Glib::RefPtr refSomething = get_something(); - g_assert_cmpint(refSomething->ref_count(), ==, 2); // 1 here and 1 inside get_something() - g_assert_cmpint(refSomething->max_ref_count(), ==, 2); + g_assert_cmpint(refSomething->ref_count(), ==, 1); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); { Parent parent(refSomething); g_assert(!parent.was_constructed_via_move_constructor()); g_assert(parent.was_constructed_via_copy_constructor()); g_assert_cmpint( - parent.something_ref_count(), ==, 3); // 1 here, 1 in parent, and 1 inside get_something() - g_assert_cmpint(parent.something_max_ref_count(), ==, 3); + parent.something_ref_count(), ==, 1); + g_assert_cmpint(parent.something_max_ref_count(), ==, 1); } // Test the refcount after other references should have been released // when other RefPtrs went out of scope: - g_assert_cmpint(refSomething->ref_count(), ==, 2); // 1 here and 1 inside get_something() - g_assert_cmpint(refSomething->max_ref_count(), ==, 3); + g_assert_cmpint(refSomething->ref_count(), ==, 1); + g_assert_cmpint(refSomething->max_ref_count(), ==, 1); } static void @@ -173,8 +179,8 @@ test_refptr_with_parent_move_constructor() Parent parent(get_something()); g_assert(parent.was_constructed_via_move_constructor()); g_assert(!parent.was_constructed_via_copy_constructor()); - g_assert_cmpint(parent.something_ref_count(), ==, 2); // 1 in parent and 1 inside get_something() - g_assert_cmpint(parent.something_max_ref_count(), ==, 2); + g_assert_cmpint(parent.something_ref_count(), ==, 1); + g_assert_cmpint(parent.something_max_ref_count(), ==, 1); } static void diff --git a/tests/glibmm_ustring_make_valid/main.cc b/tests/glibmm_ustring_make_valid/main.cc new file mode 100644 index 0000000..3f94122 --- /dev/null +++ b/tests/glibmm_ustring_make_valid/main.cc @@ -0,0 +1,58 @@ +#include +#include + +int +main() +{ + Glib::init(); + + // 0-1: bad character + const char not_utf8[] = { '\x80', + // 1-4: good three bytes (one character) + '\xef', '\x80', '\x80', + // 4-5: bad character + '\xef', + // 5-6: bad character + '\x80', + // 6-7: good character + 'a', + // 7-8: bad character + '\0', + // 8-9: good character + 'd', + // 9-10: bad character + '\x80', + // 10-13: good three bytes (one character) + '\xef', '\x80', '\x80', + // 13-15: two bad characters + '\xef', '\x80' + }; + + const char fixed_utf8[] = { '\xef', '\xbf', '\xbd', + '\xef', '\x80', '\x80', + '\xef', '\xbf', '\xbd', + '\xef', '\xbf', '\xbd', + 'a', + '\xef', '\xbf', '\xbd', + 'd', + '\xef', '\xbf', '\xbd', + '\xef', '\x80', '\x80', + '\xef', '\xbf', '\xbd', + '\xef', '\xbf', '\xbd' + }; + + // const char repl_character[] = {'\xef', '\xbf', '\xbd'}; + const Glib::ustring s(not_utf8, not_utf8 + sizeof not_utf8); + g_assert(s.validate() == false); + + const Glib::ustring good_one = s.make_valid(); + g_assert(s.validate() == false); // we make a copy + g_assert(good_one.validate()); // this one is good! + + const Glib::ustring correct_output(fixed_utf8, + fixed_utf8 + sizeof fixed_utf8); + g_assert(correct_output.validate()); + g_assert(correct_output == good_one); + + return EXIT_SUCCESS; +} diff --git a/tests/glibmm_value/glibmm_value.cc b/tests/glibmm_value/glibmm_value.cc deleted file mode 100644 index 1f598a3..0000000 --- a/tests/glibmm_value/glibmm_value.cc +++ /dev/null @@ -1,32 +0,0 @@ - -#include - -struct Foo -{ - int bar; -}; - -namespace Gtk -{ -class Widget; -} - -void -some_method() -{ - // custom copyable - Glib::Value value_foo; - - // custom pointer - Glib::Value value_foo_pointer; - Glib::Value value_foo_const_pointer; - - // Glib::Object pointer - Glib::Value value_widget_pointer; - Glib::Value value_widget_const_pointer; -} - -// Glib::Object RefPtr<> - -// template Glib::Value< Glib::RefPtr >; -// template Glib::Value< Glib::RefPtr >; diff --git a/tests/glibmm_value/main.cc b/tests/glibmm_value/main.cc index 7682ffd..a824f94 100644 --- a/tests/glibmm_value/main.cc +++ b/tests/glibmm_value/main.cc @@ -1,8 +1,156 @@ - +#include "../glibmm_object/test_derived_object.h" #include +#include + +struct Foo +{ + int bar = 1; +}; + +namespace Gtk +{ + +class Widget { +}; -int -main(int, char**) +} + +void +test() { + { + Foo foo; + + // custom copyable + Glib::Value value; + value.init(Glib::Value::value_type()); // TODO: Avoid this step? + value.set(foo); + + const auto v = value.get(); + assert(v.bar == 1); + } + + { + Foo foo; + + // custom pointer + Glib::Value value; + value.init(Glib::Value::value_type()); // TODO: Avoid this step? + value.set(&foo); + + const auto v = value.get(); + assert(v); + } + + { + Foo foo; + + Glib::Value value; + value.init(Glib::Value::value_type()); // TODO: Avoid this step? + value.set(&foo); + + const auto v = value.get(); + assert(v); + } + + { + Gtk::Widget widget; + + // Glib::Object pointer + Glib::Value value; + value.init(Glib::Value::value_type()); // TODO: Avoid this step? + value.set(&widget); + + const auto v = value.get(); + assert(v); + } + + { + Gtk::Widget widget; + + Glib::Value value; + value.init(Glib::Value::value_type()); // TODO: Avoid this step? + value.set(&widget); + + const auto v = value.get(); + assert(v); + } + + Glib::init(); + + // TODO: Put this test, of internal stuff, somewhere else. + static_assert(Glib::Traits::HasGetBaseType::value, + "DerivedObject has no get_base_type()."); + + // RefPtr to Glib::ObjectBase-derived type: + { + GObject* gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr)); + auto derived = Glib::make_refptr_for_instance(new DerivedObject(gobject, 5)); + + using ValueType = Glib::Value>; + ValueType value; + value.init(ValueType::value_type()); // TODO: Avoid this step? + + // Check that value_type() returns the type of the underlying GObjectBase, + // not a custom GType for the Glib::RefPtr: + assert(ValueType::value_type() == DerivedObject::get_base_type()); + + value.set(derived); + + const auto v = value.get(); + assert(v); + } + + { + GObject* gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr)); + auto derived = Glib::make_refptr_for_instance(new DerivedObject(gobject, 5)); + + using ValueType = Glib::Value>; + ValueType value; + value.init(ValueType::value_type()); // TODO: Avoid this step? + + // Check that value_type() returns the type of the underlying GObjectBase, + // not a custom GType for the Glib::RefPtr: + assert(ValueType::value_type() == DerivedObject::get_base_type()); + + value.set(derived); + + const auto v = value.get(); + assert(v); + } + + { + auto foo = std::make_shared(); + + // custom pointer + Glib::Value> value; + value.init(Glib::Value>::value_type()); // TODO: Avoid this step? + value.set(foo); + + const auto v = value.get(); + assert(v); + } + + { + auto foo = std::make_shared(); + + Glib::Value> value; + value.init(Glib::Value>::value_type()); // TODO: Avoid this step? + value.set(foo); + + const auto v = value.get(); + assert(v); + } +} + +// Glib::Object RefPtr<> + +// template Glib::Value< Glib::RefPtr >; +// template Glib::Value< Glib::RefPtr >; +// + +int main() { + test(); + return EXIT_SUCCESS; } diff --git a/tests/glibmm_valuearray/main.cc b/tests/glibmm_valuearray/main.cc deleted file mode 100644 index b9fc12a..0000000 --- a/tests/glibmm_valuearray/main.cc +++ /dev/null @@ -1,102 +0,0 @@ -// Glib::ValueArray is deprecated, but let's keep the test. -// The recommended replacement is std::vector<> which requires no test here. -#undef GLIBMM_DISABLE_DEPRECATED - -#include -#include - -#ifdef GLIBMM_DISABLE_DEPRECATED -int -main(int, char**) -{ - // If glibmm is configured with --disable-deprecated-api, GLIBMM_DISABLE_DEPRECATED - // is defined in glibmm.h (actually in glibmmconfig.h). The undef at the start of - // this file has no effect. - return 77; // Tell automake's test harness to skip this test. -} - -#else - -// Use this line if you want debug output: -// std::ostream& ostr = std::cout; - -// This seems nicer and more useful than putting an ifdef around the use of ostr: -std::stringstream debug; -std::ostream& ostr = debug; - -int -on_compare(const Glib::ValueBase& v1, const Glib::ValueBase& v2) -{ - const Glib::Value& intVal1 = static_cast&>(v1); - const Glib::Value& intVal2 = static_cast&>(v2); - - int int1 = intVal1.get(); - int int2 = intVal2.get(); - - if (int1 < int2) - return -1; - else if (int1 == int2) - return EXIT_SUCCESS; - else - return 1; -} - -int -main(int, char**) -{ - const int VALUES_COUNT = 10; - - Glib::init(); - - Glib::Value values[VALUES_COUNT]; - Glib::ValueArray array; - - for (int i = 0; i < VALUES_COUNT; i++) - { - values[i].init(Glib::Value::value_type()); - values[i].set(i + 1); // (i + 1) ==> Set to natural counting numbers. - array.prepend(values[i]); - } - - ostr << "Array members before sorting:" << std::endl; - - for (int i = 0; i < VALUES_COUNT; i++) - { - Glib::ValueBase value; - - if (!array.get_nth(i, value)) - { - std::cerr << "Error getting element " << i << " of value array." << std::endl; - return EXIT_FAILURE; - break; - } - - auto int_val = static_cast&>(value); - ostr << int_val.get() << " "; - } - ostr << std::endl; // End of line for list of array elements. - - // Sort array and remove last element: - array.sort(sigc::ptr_fun(&on_compare)).remove(VALUES_COUNT - 1); - - ostr << "Array members after sorting without last element:" << std::endl; - - for (int i = 0; i < VALUES_COUNT - 1; i++) - { - Glib::ValueBase value; - - if (!array.get_nth(i, value)) - { - std::cerr << "Error getting element " << i << " of value array." << std::endl; - return EXIT_FAILURE; - break; - } - - auto int_val = static_cast&>(value); - ostr << int_val.get() << " "; - } - ostr << std::endl; // End of line for list of array elements. - - return EXIT_SUCCESS; -} -#endif // GLIBMM_DISABLE_DEPRECATED diff --git a/tests/glibmm_variant/main.cc b/tests/glibmm_variant/main.cc index 7431a9a..0836ec2 100644 --- a/tests/glibmm_variant/main.cc +++ b/tests/glibmm_variant/main.cc @@ -514,7 +514,7 @@ get_log_flags() struct WarnCatcher { - WarnCatcher(const std::string& domain) + explicit WarnCatcher(const std::string& domain) : m_domain(domain), m_old_flags(g_log_set_fatal_mask(m_domain.c_str(), get_log_flags())) { } diff --git a/tests/glibmm_vector/main.cc b/tests/glibmm_vector/main.cc index 31138cf..e4e779c 100644 --- a/tests/glibmm_vector/main.cc +++ b/tests/glibmm_vector/main.cc @@ -11,7 +11,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // ugly code ahead. diff --git a/tests/glibmm_weakref/main.cc b/tests/glibmm_weakref/main.cc deleted file mode 100644 index 20a8031..0000000 --- a/tests/glibmm_weakref/main.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 2015 The glibmm Development Team - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include -#include //There is no class derived from Glib::Object in glibmm -#include -#include -#include // std::move - -int -main(int, char**) -{ - Glib::init(); - bool success = true; - - // A Glib::WeakRef cannot be created from a Glib::RefPtr, - // because Glib::Bytes is not derived from Glib::ObjectBase. - // const int bdata = 1234; - // Glib::RefPtr bytes = Glib::Bytes::create(&bdata, sizeof bdata); - // Glib::WeakRef weakbytes = bytes; // does not compile - - // Gio::MemoryInputStream - Glib::RefPtr memstream1 = Gio::MemoryInputStream::create(); - const char data[] = "Some arbitrary data"; - memstream1->add_data(data, sizeof data, Gio::MemoryInputStream::SlotDestroyData()); - - // Downcast copy, followed by upcast. - Glib::WeakRef weakmemstream1 = memstream1; - Glib::WeakRef weakstream1 = weakmemstream1; - Glib::WeakRef weakmemstream2 = - Glib::WeakRef::cast_dynamic(weakstream1); - Glib::RefPtr memstream2 = weakmemstream2.get(); - if (memstream2) - { - char buffer[200]; - gsize bytes_read = 0; - try - { - memstream2->read_all(buffer, sizeof buffer, bytes_read); - std::cout << buffer << std::endl; - success &= std::strcmp(buffer, data) == 0; - } - catch (const Glib::Error& ex) - { - std::cout << "Error reading from memory stream: " << ex.what() << std::endl; - success = false; - } - } - else - { - std::cout << "!memstream2" << std::endl; - success = false; - } - - // Move construction. - Glib::WeakRef weakmemstream3(std::move(weakmemstream1)); - if (weakmemstream1.get() || !weakmemstream3.get()) - { - success = false; - if (weakmemstream1.get()) - std::cout << "weakmemstream1 || !weakmemstream3: weakmemstream1" << std::endl; - if (!weakmemstream3.get()) - std::cout << "weakmemstream1 || !weakmemstream3: !weakmemstream3" << std::endl; - } - else - { - // Move assignment. - weakmemstream2 = std::move(weakmemstream3); - if (!weakmemstream2 || weakmemstream3) - { - success = false; - if (!weakmemstream2.get()) - std::cout << "!weakmemstream2 || weakmemstream3: !weakmemstream2" << std::endl; - if (weakmemstream3.get()) - std::cout << "!weakmemstream2 || weakmemstream3: weakmemstream3" << std::endl; - } - else - { - // Downcast move, followed by upcast. - weakstream1 = std::move(weakmemstream2); - weakmemstream1 = Glib::WeakRef::cast_dynamic(weakstream1); - if (weakmemstream2 || !weakmemstream1) - { - success = false; - if (weakmemstream2) - std::cout << "weakmemstream2 || !weakmemstream1: weakmemstream2" << std::endl; - if (!weakmemstream1) - std::cout << "weakmemstream2 || !weakmemstream1: !weakmemstream1" << std::endl; - } - } - } - - // Gio::SimpleAction - Glib::RefPtr action1 = Gio::SimpleAction::create("Action1"); - - Glib::ustring name = action1->get_name(); - std::cout << "The name is '" << name << "'." << std::endl; - success &= name == "Action1"; - - Glib::WeakRef weakaction1 = action1; - Glib::WeakRef weakaction2 = weakaction1; - - // A second RefPtr - Glib::RefPtr action2 = weakaction1.get(); - if (action2) - { - name = action2->get_name(); - std::cout << "The name is '" << name << "'." << std::endl; - success &= name == "Action1"; - } - else - { - std::cout << "!action2" << std::endl; - success = false; - } - - weakaction1.reset(); - if (weakaction1.get()) - { - std::cout << "weakaction1" << std::endl; - success = false; - } - - action2 = weakaction2.get(); - if (action2) - { - name = action2->get_name(); - std::cout << "The name is '" << name << "'." << std::endl; - success &= name == "Action1"; - } - else - { - std::cout << "!action2" << std::endl; - success = false; - } - - // Reset one of the RefPtrs. One remains. - action1.reset(); - action2 = weakaction2.get(); - if (action2) - { - name = action2->get_name(); - std::cout << "The name is '" << name << "'." << std::endl; - success &= name == "Action1"; - } - else - { - std::cout << "!action2" << std::endl; - success = false; - } - - // Reset the other RefPtr as well. - action2.reset(); - if (weakaction2.get()) - { - std::cout << "weakaction2" << std::endl; - success = false; - } - - return success ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/tools/Makefile.am b/tools/Makefile.am index af53de8..b583e1d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -34,16 +34,16 @@ dist_noinst_DATA = README TODO dist_noinst_SCRIPTS = enum.pl noinst_PROGRAMS = extra_defs_gen/generate_defs_glib extra_defs_gen/generate_defs_gio -lib_LTLIBRARIES = extra_defs_gen/libglibmm_generate_extra_defs-2.4.la +lib_LTLIBRARIES = extra_defs_gen/libglibmm_generate_extra_defs-2.56.la extradefs_includedir = $(includedir)/$(GLIBMM_MODULE_NAME)/glibmm_generate_extra_defs extradefs_include_HEADERS = extra_defs_gen/generate_extra_defs.h extradefs_ldflags = -no-undefined -version-info $(LIBGLIBMM_SO_VERSION) -extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_SOURCES = extra_defs_gen/generate_extra_defs.cc -extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_LDFLAGS = $(extradefs_ldflags) -extra_defs_gen_libglibmm_generate_extra_defs_2_4_la_LIBADD = $(GLIBMM_LIBS) +extra_defs_gen_libglibmm_generate_extra_defs_2_56_la_SOURCES = extra_defs_gen/generate_extra_defs.cc +extra_defs_gen_libglibmm_generate_extra_defs_2_56_la_LDFLAGS = $(extradefs_ldflags) +extra_defs_gen_libglibmm_generate_extra_defs_2_56_la_LIBADD = $(GLIBMM_LIBS) extra_defs_gen_generate_defs_glib_SOURCES = extra_defs_gen/generate_defs_glib.cc extra_defs_gen_generate_defs_glib_LDADD = $(GLIBMM_LIBS) $(lib_LTLIBRARIES) diff --git a/tools/defs_fixer.pl b/tools/defs_fixer.pl index bc0ace8..e59c13c 100644 --- a/tools/defs_fixer.pl +++ b/tools/defs_fixer.pl @@ -13,7 +13,8 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see . +# License along with this library; if not, write to the Free +# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # # diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc index 0759a52..30c3939 100644 --- a/tools/extra_defs_gen/generate_defs_gio.cc +++ b/tools/extra_defs_gen/generate_defs_gio.cc @@ -13,7 +13,8 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "generate_extra_defs.h" diff --git a/tools/extra_defs_gen/generate_defs_glib.cc b/tools/extra_defs_gen/generate_defs_glib.cc index f1e552f..235bc39 100644 --- a/tools/extra_defs_gen/generate_defs_glib.cc +++ b/tools/extra_defs_gen/generate_defs_glib.cc @@ -13,7 +13,8 @@ * General Public License for more details. * * You should have received a copy of the GNU General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "generate_extra_defs.h" diff --git a/tools/extra_defs_gen/generate_extra_defs.cc b/tools/extra_defs_gen/generate_extra_defs.cc index 23300c8..3b5028d 100644 --- a/tools/extra_defs_gen/generate_extra_defs.cc +++ b/tools/extra_defs_gen/generate_extra_defs.cc @@ -13,28 +13,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "generate_extra_defs.h" #include -#include -#include - -namespace -{ -void add_signal_flag_if(std::string& strFlags, const char* strFlag, - const GSignalQuery& signalQuery, GSignalFlags flag) -{ - if (signalQuery.signal_flags & flag) - { - if (!strFlags.empty()) - strFlags += ", "; - strFlags += strFlag; - } -} - -} // anonymous namespace std::string get_property_with_node_name( @@ -74,55 +58,6 @@ get_property_with_node_name( if (bDeprecated) strResult += " (deprecated #t)\n"; // Default: not deprecated - // Default value: - const GValue* defValue = g_param_spec_get_default_value(pParamSpec); - std::string defString; - bool defValueExists = false; - if (G_VALUE_HOLDS_STRING(defValue)) - { - defValueExists = true; - const char* defCString = g_value_get_string(defValue); - if (defCString) - { - // Replace newlines with \n. - // A string default value can contain newline characters. - // gmmproc removes all newlines when it reads .defs files. - defString = std::regex_replace(defCString, std::regex("\n"), "\\n"); - } - else - defString = ""; // A NULL string pointer becomes an empty string. - } - else if (G_VALUE_HOLDS_FLOAT(defValue) || G_VALUE_HOLDS_DOUBLE(defValue)) - { - // g_value_transform() can transform a floating point value to a terrible - // string, especially if the value is huge. - defValueExists = true; - const double defDouble = G_VALUE_HOLDS_FLOAT(defValue) ? - g_value_get_float(defValue) : g_value_get_double(defValue); - std::ostringstream defStringStream; - defStringStream << defDouble; - defString = defStringStream.str(); - } - else - { - GValue defStringValue = G_VALUE_INIT; - g_value_init(&defStringValue, G_TYPE_STRING); - - if (g_value_transform(defValue, &defStringValue)) - { - const char* defCString = g_value_get_string(&defStringValue); - if (defCString) - { - defValueExists = true; - defString = defCString; - } - } - g_value_unset(&defStringValue); - } - - if (defValueExists) - strResult += " (default-value \"" + defString + "\")\n"; - strResult += ")\n\n"; // close (strNodeName return strResult; @@ -275,21 +210,24 @@ get_signals(GType gtype, GTypeIsAPointerFunc is_a_pointer_func) // G_SIGNAL_TYPE_STATIC_SCOPE; strResult += " (return-type \"" + strReturnTypeName + "\")\n"; - // Flags: - std::string strFlags; - add_signal_flag_if(strFlags, "Run First", signalQuery, G_SIGNAL_RUN_FIRST); - add_signal_flag_if(strFlags, "Run Last", signalQuery, G_SIGNAL_RUN_LAST); - add_signal_flag_if(strFlags, "Run Cleanup", signalQuery, G_SIGNAL_RUN_CLEANUP); - add_signal_flag_if(strFlags, "No Recurse", signalQuery, G_SIGNAL_NO_RECURSE); - add_signal_flag_if(strFlags, "Action", signalQuery, G_SIGNAL_ACTION); - add_signal_flag_if(strFlags, "No Hooks", signalQuery, G_SIGNAL_NO_HOOKS); - add_signal_flag_if(strFlags, "Must Collect", signalQuery, G_SIGNAL_MUST_COLLECT); - strResult += " (flags \"" + strFlags + "\")\n"; - - if (signalQuery.signal_flags & G_SIGNAL_DETAILED) - strResult += " (detailed #t)\n"; // Default: not detailed - - if (signalQuery.signal_flags & G_SIGNAL_DEPRECATED) + // When: + { + bool bWhenFirst = (signalQuery.signal_flags & G_SIGNAL_RUN_FIRST) == G_SIGNAL_RUN_FIRST; + bool bWhenLast = (signalQuery.signal_flags & G_SIGNAL_RUN_LAST) == G_SIGNAL_RUN_LAST; + + std::string strWhen = "unknown"; + + if (bWhenFirst && bWhenLast) + strWhen = "both"; + else if (bWhenFirst) + strWhen = "first"; + else if (bWhenLast) + strWhen = "last"; + + strResult += " (when \"" + strWhen + "\")\n"; + } + bool bDeprecated = (signalQuery.signal_flags & G_SIGNAL_DEPRECATED) == G_SIGNAL_DEPRECATED; + if (bDeprecated) strResult += " (deprecated #t)\n"; // Default: not deprecated // Loop through the list of parameters: diff --git a/tools/extra_defs_gen/generate_extra_defs.h b/tools/extra_defs_gen/generate_extra_defs.h index 300df4c..9d960e3 100644 --- a/tools/extra_defs_gen/generate_extra_defs.h +++ b/tools/extra_defs_gen/generate_extra_defs.h @@ -1,3 +1,5 @@ +/* $Id$ */ + /* generate_extra_defs.h * * Copyright (C) 2001 The Free Software Foundation @@ -13,7 +15,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include diff --git a/tools/gmmproc.in b/tools/gmmproc.in index 56b44e6..e929503 100644 --- a/tools/gmmproc.in +++ b/tools/gmmproc.in @@ -21,7 +21,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # # 'classes': diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4 index 0e0e4f6..ff07505 100644 --- a/tools/m4/class_gobject.m4 +++ b/tools/m4/class_gobject.m4 @@ -105,7 +105,7 @@ define(`_CREATE_METHOD',` _PUSH(SECTION_CC) Glib::RefPtr<`'__CPPNAME__`'> __CPPNAME__`'::create(`'$2`') { - return Glib::RefPtr<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') ); + return Glib::make_refptr_for_instance<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') ); } _POP() @@ -169,7 +169,7 @@ namespace Glib Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy) { - return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4 index 3c0b93e..bce51ff 100644 --- a/tools/m4/class_interface.m4 +++ b/tools/m4/class_interface.m4 @@ -161,7 +161,7 @@ namespace Glib Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy) { - return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) ); + return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4 index e90a1c0..41fbc5a 100644 --- a/tools/m4/class_opaque_refcounted.m4 +++ b/tools/m4/class_opaque_refcounted.m4 @@ -66,7 +66,7 @@ Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy) __OPAQUE_FUNC_REF`'(object); // See the comment at the top of this file, if you want to know why the cast works. - return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object)); + return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object)); } } // namespace Glib @@ -84,7 +84,7 @@ ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl Glib::RefPtr<__CPPNAME__> __CPPNAME__::create() { // See the comment at the top of this file, if you want to know why the cast works. - return Glib::RefPtr<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'())); + return Glib::make_refptr_for_instance<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'())); } ')dnl endif __OPAQUE_FUNC_NEW diff --git a/tools/m4/convert_base.m4 b/tools/m4/convert_base.m4 index 8d372fa..da5137c 100644 --- a/tools/m4/convert_base.m4 +++ b/tools/m4/convert_base.m4 @@ -1,5 +1,3 @@ -dnl $Id$ - # # Define a hashing for names # @@ -52,11 +50,29 @@ define(`_EQUAL',`define(EV`'__HASH(`$1'),`$2')') define(`__ARG3__',`$`'3') + +# _CONV_ENUM(namespace, enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of namespace+enum_name. define(`_CONV_ENUM',`dnl -_CONVERSION(`$1$2', `$2', (($2)(__ARG3__))) -_CONVERSION(`$1$2', `$1::$2', (($1::$2)(__ARG3__))) -_CONVERSION(`$2', `$1$2', (($1$2)(__ARG3__))) -_CONVERSION(`$1::$2', `$1$2', (($1$2)(__ARG3__))) +pushdef(`C_ENUM_NAME', `m4_ifelse(`$3',,`$1$2',`$3')') +_CONVERSION(`C_ENUM_NAME', `$2', static_cast<$2>(__ARG3__)) +_CONVERSION(`C_ENUM_NAME', `$1::$2', static_cast<$1::$2>(__ARG3__)) +_CONVERSION(`$2', `C_ENUM_NAME', static_cast(__ARG3__)) +_CONVERSION(`$1::$2', `C_ENUM_NAME', static_cast(__ARG3__)) +popdef(`C_ENUM_NAME') +')dnl + +# _CONV_INCLASS_ENUM(namespace, class_name, enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of namespace+class_name+enum_name. +define(`_CONV_INCLASS_ENUM',`dnl +pushdef(`C_ENUM_NAME', `m4_ifelse(`$4',,`$1$2$3',`$4')') +_CONVERSION(`C_ENUM_NAME', `$3', static_cast<$3>(__ARG3__)) +_CONVERSION(`C_ENUM_NAME', `$2::$3', static_cast<$2::$3>(__ARG3__)) +_CONVERSION(`C_ENUM_NAME', `$1::$2::$3', static_cast<$1::$2::$3>(__ARG3__)) +_CONVERSION(`$3', `C_ENUM_NAME', static_cast(__ARG3__)) +_CONVERSION(`$2::$3', `C_ENUM_NAME', static_cast(__ARG3__)) +_CONVERSION(`$1::$2::$3', `C_ENUM_NAME', static_cast(__ARG3__)) +popdef(`C_ENUM_NAME') ')dnl # e.g. Glib::RefPtr to GdkSomething* diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4 index e6f7cb4..6a968b3 100644 --- a/tools/m4/convert_gio.m4 +++ b/tools/m4/convert_gio.m4 @@ -1,59 +1,86 @@ -_CONV_ENUM(G,AppInfoCreateFlags) -_CONV_ENUM(G,ApplicationFlags) -_CONV_ENUM(G,AskPasswordFlags) -_CONV_ENUM(G,BusType) -_CONV_ENUM(G,ConverterFlags) -_CONV_ENUM(G,ConverterResult) -_CONV_ENUM(G,CredentialsType) -_CONV_ENUM(G,DataStreamByteOrder) -_CONV_ENUM(G,DataStreamNewlineType) -_CONV_ENUM(GDBus,CallFlags) -_CONV_ENUM(GDBus,CapabilityFlags) -_CONV_ENUM(GDBus, InterfaceSkeletonFlags) -_CONV_ENUM(GDBus,MessageFlags) -_CONV_ENUM(GDBus,MessageHeaderField) -_CONV_ENUM(GDBus,MessageType) -_CONV_ENUM(GDBus,ProxyFlags) -_CONV_ENUM(GDBus,SendMessageFlags) -_CONV_ENUM(GDBus,ServerFlags) -_CONV_ENUM(G,DriveStartFlags) -_CONV_ENUM(G,DriveStartFlags) -_CONV_ENUM(G,DriveStartStopType) -_CONV_ENUM(G,EmblemOrigin) -_CONV_ENUM(G,FileAttributeInfoFlags) -_CONV_ENUM(G,FileAttributeStatus) -_CONV_ENUM(G,FileAttributeType) -_CONV_ENUM(G,FileCopyFlags) -_CONV_ENUM(G,FileCreateFlags) -_CONV_ENUM(G,FileMonitorEvent) -_CONV_ENUM(G,FileMonitorFlags) -_CONV_ENUM(G,FileQueryInfoFlags) -_CONV_ENUM(G,FileType) -_CONV_ENUM(G,MountMountFlags) -_CONV_ENUM(G,MountOperationResult) -_CONV_ENUM(G,MountUnmountFlags) -_CONV_ENUM(G,NetworkConnectivity) -_CONV_ENUM(G,NotificationPriority) -_CONV_ENUM(G,OutputStreamSpliceFlags) -_CONV_ENUM(G,PasswordSave) -_CONV_ENUM(G,ResolverRecordType) -_CONV_ENUM(G,ResourceFlags) -_CONV_ENUM(G,ResourceLookupFlags) -_CONV_ENUM(G,SettingsBindFlags) -_CONV_ENUM(G,SocketClientEvent) -_CONV_ENUM(G,SocketFamily) -_CONV_ENUM(G,SocketMsgFlags) -_CONV_ENUM(G,SocketProtocol) -_CONV_ENUM(G,SocketType) -_CONV_ENUM(G,TlsCertificateFlags) -_CONV_ENUM(G,TlsCertificateRequestFlags) -_CONV_ENUM(G,TlsDatabaseVerifyFlags) -_CONV_ENUM(G,TlsDatabaseLookupFlags) -_CONV_ENUM(G,TlsInteractionResult) -_CONV_ENUM(G,TlsPasswordFlags) -_CONV_ENUM(G,TlsRehandshakeMode) -_CONV_ENUM(G,UnixSocketAddressType) -_CONV_ENUM(G,ZlibCompressorFormat) +dnl +dnl Gio C names have prefix 'G' or 'GDBus' but C++ namespace Gio ot Gio::DBus +dnl +# _CONV_GIO_ENUM(enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of G+enum_name. +define(`_CONV_GIO_ENUM',`dnl +_CONV_ENUM(`Gio',`$1',`m4_ifelse(`$2',,`G$1',`$2')') +')dnl + +# _CONV_GIO_DBUS_ENUM(enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of GDBus+enum_name. +define(`_CONV_GIO_DBUS_ENUM',`dnl +_CONV_ENUM(`Gio::DBus',`$1',`m4_ifelse(`$2',,`GDBus$1',`$2')') +')dnl + +# _CONV_GIO_INCLASS_ENUM(class_name, enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of G+class_name+enum_name. +define(`_CONV_GIO_INCLASS_ENUM',`dnl +_CONV_INCLASS_ENUM(`Gio',`$1',`$2',`m4_ifelse(`$3',,`G$1$2',`$3')') +')dnl + +# _CONV_GIO_DBUS_INCLASS_ENUM(class_name, enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of GDBus+class_name+enum_name. +define(`_CONV_GIO_DBUS_INCLASS_ENUM',`dnl +_CONV_INCLASS_ENUM(`Gio::DBus',`$1',`$2',`m4_ifelse(`$3',,`GDBus$1$2',`$3')') +')dnl + +_CONV_GIO_INCLASS_ENUM(AppInfo,CreateFlags) +_CONV_GIO_INCLASS_ENUM(Application,Flags) +_CONV_GIO_ENUM(AskPasswordFlags) +_CONV_GIO_ENUM(BusType) +_CONV_GIO_INCLASS_ENUM(Converter,Flags) +_CONV_GIO_INCLASS_ENUM(Converter,Result) +_CONV_GIO_INCLASS_ENUM(Credentials,Type) +_CONV_GIO_ENUM(DataStreamByteOrder) +_CONV_GIO_ENUM(DataStreamNewlineType) +_CONV_GIO_DBUS_ENUM(CallFlags) +_CONV_GIO_DBUS_ENUM(CapabilityFlags) +_CONV_GIO_DBUS_INCLASS_ENUM(InterfaceSkeleton,Flags) +_CONV_GIO_DBUS_INCLASS_ENUM(Message,ByteOrder) +_CONV_GIO_DBUS_ENUM(MessageFlags) +_CONV_GIO_DBUS_ENUM(MessageHeaderField) +_CONV_GIO_DBUS_ENUM(MessageType) +_CONV_GIO_DBUS_ENUM(ProxyFlags) +_CONV_GIO_DBUS_ENUM(SendMessageFlags) +_CONV_GIO_DBUS_INCLASS_ENUM(Server,Flags) +_CONV_GIO_INCLASS_ENUM(Drive,StartFlags) +_CONV_GIO_INCLASS_ENUM(Drive,StartStopType) +_CONV_GIO_INCLASS_ENUM(Emblem,Origin) +_CONV_GIO_INCLASS_ENUM(FileAttributeInfo,Flags) +_CONV_GIO_ENUM(FileAttributeStatus) +_CONV_GIO_ENUM(FileAttributeType) +_CONV_GIO_INCLASS_ENUM(FileCopy,Flags) +_CONV_GIO_INCLASS_ENUM(FileCreate,Flags) +_CONV_GIO_INCLASS_ENUM(FileMonitor,Event) +_CONV_GIO_INCLASS_ENUM(FileMonitor,Flags) +_CONV_GIO_ENUM(FileQueryInfoFlags) +_CONV_GIO_ENUM(FileType) +_CONV_GIO_INCLASS_ENUM(Mount,MountFlags) +_CONV_GIO_ENUM(MountOperationResult) +_CONV_GIO_INCLASS_ENUM(Mount,UnmountFlags) +_CONV_GIO_ENUM(NetworkConnectivity) +_CONV_GIO_INCLASS_ENUM(Notification,Priority) +_CONV_GIO_INCLASS_ENUM(OutputStream,SpliceFlags) +_CONV_GIO_ENUM(PasswordSave) +_CONV_GIO_INCLASS_ENUM(Resolver,RecordType) +_CONV_GIO_INCLASS_ENUM(Resource,Flags) +_CONV_GIO_INCLASS_ENUM(Resource,LookupFlags) +_CONV_GIO_INCLASS_ENUM(Settings,BindFlags) +_CONV_GIO_ENUM(SocketClientEvent) +_CONV_GIO_ENUM(SocketFamily) +_CONV_GIO_INCLASS_ENUM(Socket,MsgFlags) +_CONV_GIO_INCLASS_ENUM(Socket,Protocol) +_CONV_GIO_INCLASS_ENUM(Socket,Type) +_CONV_GIO_ENUM(TlsCertificateFlags) +_CONV_GIO_ENUM(TlsCertificateRequestFlags) +_CONV_GIO_INCLASS_ENUM(TlsDatabase,VerifyFlags) +_CONV_GIO_INCLASS_ENUM(TlsDatabase,LookupFlags) +_CONV_GIO_ENUM(TlsInteractionResult) +_CONV_GIO_INCLASS_ENUM(TlsPassword,Flags) +_CONV_GIO_ENUM(TlsRehandshakeMode) +_CONV_GIO_INCLASS_ENUM(UnixSocketAddress,Type) +_CONV_GIO_ENUM(ZlibCompressorFormat) # Action _CONVERSION(`GAction*',`Glib::RefPtr',`Glib::wrap($3)') @@ -69,7 +96,7 @@ _CONVERSION(`GAppLaunchContext*',`const Glib::RefPtr&',Glib::w _CONVERSION(`const Glib::RefPtr&',`GAppInfo*',__CONVERT_REFPTR_TO_P) _CONVERSION(`Glib::RefPtr',`GAppInfo*',__CONVERT_REFPTR_TO_P) _CONVERSION(`GAppInfo*',`const Glib::RefPtr&',`Glib::wrap($3)') -_CONVERSION(`const Glib::ListHandle< Glib::RefPtr >&',`GList*',`$3.data()') +_CONVERSION(`const std::vector>&',`GList*',`Glib::ListHandler>::vector_to_list($3).data()') # Application _CONVERSION(`GApplication*',`Glib::RefPtr',`Glib::wrap($3)') @@ -229,7 +256,7 @@ _CONVERSION(`const Glib::RefPtr&',`GMenuModel*',__CONVERT_CONST_REFPT # MenuItem _CONVERSION(`GMenuItem*',`Glib::RefPtr',`Glib::wrap($3)') -_CONVERSION(`const Glib::RefPtr&',`GMenuItem*',__CONVERT_CONST_REFPTR_TO_P) +_CONVERSION(`const Glib::RefPtr&',`GMenuItem*',__CONVERT_CONST_REFPTR_TO_P) # Mount _CONVERSION(`GMount*',`Glib::RefPtr',`Glib::wrap($3)') @@ -265,7 +292,7 @@ _CONVERSION(`GResource*',`Glib::RefPtr',`Glib::wrap($3)') #Settings _CONVERSION(`GSettings*',`Glib::RefPtr',`Glib::wrap($3)') -_CONVERSION(`const Glib::StringArrayHandle&',`const gchar*-const*',`($3).data()') +_CONVERSION(`const std::vector&',`const gchar*-const*',`Glib::ArrayHandler::vector_to_array($3).data()') _CONVERSION(`const Glib::RefPtr&',`GSettingsBackend*',__CONVERT_REFPTR_TO_P) _CONVERSION(`GSettingsSchemaKey*',`Glib::RefPtr',`Glib::wrap($3)') diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4 index 0c70cdf..8d32659 100644 --- a/tools/m4/convert_glib.m4 +++ b/tools/m4/convert_glib.m4 @@ -1,11 +1,16 @@ dnl dnl Glib C names have prefix 'G' but C++ namespace Glib dnl +# _CONV_GLIB_ENUM(enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of G+enum_name. define(`_CONV_GLIB_ENUM',`dnl -_CONVERSION(`G$1', `$1', (($1)(__ARG3__))) -_CONVERSION(`G$1', `Glib::$1', ((Glib::$1)(__ARG3__))) -_CONVERSION(`$1', `G$1', ((G$1)(__ARG3__))) -_CONVERSION(`Glib::$1', `G$1', ((G$1)(__ARG3__))) +_CONV_ENUM(`Glib',`$1',`m4_ifelse(`$2',,`G$1',`$2')') +')dnl + +# _CONV_GLIB_INCLASS_ENUM(class_name, enum_name[, C_enum_name]) +# Specify C_enum_name, if it's not the concatenation of G+class_name+enum_name. +define(`_CONV_GLIB_INCLASS_ENUM',`dnl +_CONV_INCLASS_ENUM(`Glib',`$1',`$2',`m4_ifelse(`$3',,`G$1$2',`$3')') ')dnl _EQUAL(gchar,char) @@ -60,14 +65,14 @@ dnl dnl # These are for fixmegtkconst _CONVERSION(`const guchar*',`guchar*',`const_cast($3)',`$3') -_CONV_GLIB_ENUM(BindingFlags) +_CONV_GLIB_INCLASS_ENUM(Binding,Flags) _CONV_GLIB_ENUM(IOCondition) _CONV_GLIB_ENUM(IOFlags) _CONV_GLIB_ENUM(IOStatus) -_CONV_GLIB_ENUM(KeyFileFlags) +_CONV_GLIB_INCLASS_ENUM(KeyFile,Flags) _CONV_GLIB_ENUM(OptionArg) -_CONV_GLIB_ENUM(RegexCompileFlags) -_CONV_GLIB_ENUM(RegexMatchFlags) +_CONV_GLIB_INCLASS_ENUM(Regex,CompileFlags) +_CONV_GLIB_INCLASS_ENUM(Regex,MatchFlags) _CONV_GLIB_ENUM(SeekType) _CONV_GLIB_ENUM(TimeType) @@ -85,7 +90,6 @@ _CONVERSION(`const Glib::ustring&', `const guchar*', `(($2)$3.c_str())') _CONVERSION(`const std::string&',`const char*',`$3.c_str()') _CONVERSION(`std::string',`const char*',`$3.c_str()') _CONVERSION(`const Glib::ustring&',`gchar*',`const_cast($3.c_str())') -_CONVERSION(`gchar*',`Glib::ustring',__GCHARP_TO_USTRING) _CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING) _CONVERSION(`const-guchar*',`Glib::ustring',__GCHARP_TO_USTRING) _CONVERSION(`const gchar*',`Glib::ustring',__GCHARP_TO_USTRING) @@ -95,7 +99,6 @@ _CONVERSION(`const char*',`std::string',__GCHARP_TO_STDSTRING) _CONVERSION(`const char*',`const-gchar*',`$3') _CONVERSION(`const-gchar*',`const char*',`$3') _CONVERSION(`const char*',`const std::string&',__GCHARP_TO_STDSTRING) -_CONVERSION(`char*',`std::string',__GCHARP_TO_STDSTRING) _CONVERSION(`std::string', `char*', `g_strdup(($3).c_str())') _CONVERSION(`const std::string&', `char*', `g_strdup(($3).c_str())') _CONVERSION(`Glib::ustring', `char*', `g_strdup(($3).c_str())') diff --git a/tools/m4/enum.m4 b/tools/m4/enum.m4 index 9064e35..ab7e816 100644 --- a/tools/m4/enum.m4 +++ b/tools/m4/enum.m4 @@ -1,13 +1,18 @@ dnl -dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `no_gtype', `optional_refdoc_comment', 'deprecated') -dnl $1 $2 $3 $4 $5 $6 $7 +dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `no_gtype', `conv_to_int', +dnl $1 $2 $3 $4 $5 $6 +dnl in_class, `optional_refdoc_comment', 'deprecated') +dnl $7 $8 $9 dnl m4_define(`_ENUM',`dnl _PUSH() m4_define(`__ENUM_CPPNAME__',`$1') m4_define(`__ENUM_CNAME__',`$2') -m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CPPNAME__>') +m4_define(`__ENUM_CLASS_CPPNAME__',m4_ifelse($7,0,,`__CPPNAME__::')`__ENUM_CPPNAME__') +m4_define(`__ENUM_INDENT1__',m4_ifelse($7,0,,` ')) +m4_define(`__ENUM_INDENT2__',__ENUM_INDENT1__`'m4_ifelse($6,,,` ')) +m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CLASS_CPPNAME__>') _POP() dnl @@ -17,88 +22,128 @@ m4_ifdef(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__',,`dnl else m4_define(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__')dnl /** @addtogroup '__MODULE_CANONICAL__`Enums __MODULE_CANONICAL__ Enums and Flags */ -')dnl endif +__ENUM_INDENT1__')`'dnl endif dnl dnl -ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline -/** $6 - * - * @ingroup __MODULE_CANONICAL__`'Enums -m4_ifelse($3,Flags,`dnl - * @par Bitwise operators: - * %__ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__, __ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__, __ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__, __ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)
- * %__ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)
+ifelse(`$9',,,`_DEPRECATE_IFDEF_START'`'__ENUM_INDENT1__)`'dnl The expansion of _DEPRECATE_IFDEF_START ends with a newline +ifelse($6,,,`/** Wrapper for enum __ENUM_CPPNAME__. +__ENUM_INDENT1__ * __ENUM_CPPNAME__ enumerators are scoped and can be implicitly converted to int. +__ENUM_INDENT1__ * The scope is __NAMESPACE__::__ENUM_CLASS_CPPNAME__:: +__ENUM_INDENT1__ * +__ENUM_INDENT1__ * @ingroup __MODULE_CANONICAL__`'Enums +__ENUM_INDENT1__ */ +__ENUM_INDENT1__`'class __ENUM_CPPNAME__`'_Wrapper final +__ENUM_INDENT1__{ +__ENUM_INDENT1__`'public: +__ENUM_INDENT2__')`'dnl endif conv_to_int +/** $8 +__ENUM_INDENT2__ * +__ENUM_INDENT2__ * @ingroup __MODULE_CANONICAL__`'Enums +m4_ifelse($3,`Flags',`dnl +__ENUM_INDENT2__ * @par Bitwise operators: +__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__ operator|(__ENUM_CLASS_CPPNAME__, __ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__ operator&(__ENUM_CLASS_CPPNAME__, __ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__ operator^(__ENUM_CLASS_CPPNAME__, __ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__ operator~(__ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__& operator|=(__ENUM_CLASS_CPPNAME__&, __ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__& operator&=(__ENUM_CLASS_CPPNAME__&, __ENUM_CLASS_CPPNAME__)
+__ENUM_INDENT2__ * __ENUM_CLASS_CPPNAME__& operator^=(__ENUM_CLASS_CPPNAME__&, __ENUM_CLASS_CPPNAME__)
')dnl endif - */ -enum __ENUM_CPPNAME__ -{ +__ENUM_INDENT2__ */ +__ENUM_INDENT2__`'enum ifelse($6,,`class ',)`'__ENUM_CPPNAME__ +__ENUM_INDENT2__{ $4 -}; -m4_ifelse($3,Flags,`dnl +__ENUM_INDENT2__}; +ifelse($6,,,`__ENUM_INDENT2__`'#ifndef DOXYGEN_SHOULD_SKIP_THIS +__ENUM_INDENT2__`'__ENUM_CPPNAME__`'_Wrapper`'() = delete; +__ENUM_INDENT2__`'#endif +__ENUM_INDENT1__}; +__ENUM_INDENT1__/** __ENUM_CPPNAME__ enumerators are scoped by the wrapper class +__ENUM_INDENT1__ * and can be implicitly converted to int. +__ENUM_INDENT1__ * +__ENUM_INDENT1__ * @ingroup __MODULE_CANONICAL__`'Enums +__ENUM_INDENT1__ */ +__ENUM_INDENT1__`'using __ENUM_CPPNAME__ = __ENUM_CPPNAME__`'_Wrapper::__ENUM_CPPNAME__; +')`'dnl endif conv_to_int +m4_ifelse($3,`Flags',`dnl +m4_ifelse($7,0,,`dnl in_class +_PUSH(SECTION_HEADER3) +__NAMESPACE_BEGIN__ +ifelse(`$9',,,`_DEPRECATE_IFDEF_START')`'dnl +')dnl endif /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs) - { return static_cast<__ENUM_CPPNAME__>(static_cast(lhs) | static_cast(rhs)); } +inline __ENUM_CLASS_CPPNAME__ operator|(__ENUM_CLASS_CPPNAME__ lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) | static_cast(rhs)); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs) - { return static_cast<__ENUM_CPPNAME__>(static_cast(lhs) & static_cast(rhs)); } +inline __ENUM_CLASS_CPPNAME__ operator&(__ENUM_CLASS_CPPNAME__ lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) & static_cast(rhs)); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs) - { return static_cast<__ENUM_CPPNAME__>(static_cast(lhs) ^ static_cast(rhs)); } +inline __ENUM_CLASS_CPPNAME__ operator^(__ENUM_CLASS_CPPNAME__ lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) ^ static_cast(rhs)); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__ flags) - { return static_cast<__ENUM_CPPNAME__>(~static_cast(flags)); } +inline __ENUM_CLASS_CPPNAME__ operator~(__ENUM_CLASS_CPPNAME__ flags) + { return static_cast<__ENUM_CLASS_CPPNAME__>(~static_cast(flags)); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs) - { return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast(lhs) | static_cast(rhs))); } +inline __ENUM_CLASS_CPPNAME__& operator|=(__ENUM_CLASS_CPPNAME__& lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return (lhs = static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) | static_cast(rhs))); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs) - { return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast(lhs) & static_cast(rhs))); } +inline __ENUM_CLASS_CPPNAME__& operator&=(__ENUM_CLASS_CPPNAME__& lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return (lhs = static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) & static_cast(rhs))); } /** @ingroup __MODULE_CANONICAL__`'Enums */ -inline __ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs) - { return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast(lhs) ^ static_cast(rhs))); } +inline __ENUM_CLASS_CPPNAME__& operator^=(__ENUM_CLASS_CPPNAME__& lhs, __ENUM_CLASS_CPPNAME__ rhs) + { return (lhs = static_cast<__ENUM_CLASS_CPPNAME__>(static_cast(lhs) ^ static_cast(rhs))); } +m4_ifelse($7,0,,`dnl in_class +ifelse(`$9',,,`_DEPRECATE_IFDEF_END')`'dnl +__NAMESPACE_END__ +_POP() +')dnl endif ')dnl endif Flags -ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline + +ifelse(`$9',,,`_DEPRECATE_IFDEF_END')`'dnl The expansion of _DEPRECATE_IFDEF_END ends with a newline m4_ifelse($5,`NO_GTYPE',,`dnl else +m4_ifelse($7,0,`dnl not in_class __NAMESPACE_END__ +',`dnl else +_PUSH(SECTION_HEADER3) +')dnl endif #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Glib { -ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl +ifelse(`$9',,,`_DEPRECATE_IFDEF_START')`'dnl template <> -class Value<__NAMESPACE__::__ENUM_CPPNAME__> : public __ENUM_VALUE_BASE__ +class Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__> : public __ENUM_VALUE_BASE__ { public: static GType value_type() G_GNUC_CONST; }; -ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl +ifelse(`$9',,,`_DEPRECATE_IFDEF_END')`'dnl } // namespace Glib #endif /* DOXYGEN_SHOULD_SKIP_THIS */ +m4_ifelse($7,0,`dnl not in_class __NAMESPACE_BEGIN__ +',`dnl else +_POP() +')dnl endif _PUSH(SECTION_SRC_GENERATED) -ifelse(`$7',,,`_DEPRECATE_IFDEF_START')`'dnl +ifelse(`$9',,,`_DEPRECATE_IFDEF_START')`'dnl // static -GType Glib::Value<__NAMESPACE__::__ENUM_CPPNAME__>::value_type() +GType Glib::Value<__NAMESPACE__::__ENUM_CLASS_CPPNAME__>::value_type() { return _GET_TYPE_FUNC(__ENUM_CNAME__); } -ifelse(`$7',,,`_DEPRECATE_IFDEF_END')`'dnl +ifelse(`$9',,,`_DEPRECATE_IFDEF_END')`'dnl _POP() ')dnl endif !NO_GTYPE diff --git a/tools/m4/method.m4 b/tools/m4/method.m4 index 3ca4de6..279f0ee 100644 --- a/tools/m4/method.m4 +++ b/tools/m4/method.m4 @@ -45,7 +45,7 @@ ifelse(`$8',,,`$8 ')dnl ',dnl If the C function returns non-void: dnl Store the return if there are C output parameters. -`ifelse(`$6',,` return ',` `$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)'); +`ifelse(`$6',,` return ',` auto retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)'); dnl Insert the initializations for the C output parameters ifelse(`$8',,,`$8 ')dnl @@ -78,7 +78,7 @@ dnl Insert the declarations for C output parameters ifelse(`$6',,,`$6 ')`'dnl ifelse(`$16',,dnl If no C++ output parameter is specified: -` ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)'); +` ifelse(`$3',void,,`auto retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)'); 'dnl ,dnl A C++ output parameter is specified: ` _INITIALIZE($17,$4,`$16',`$2`'(ifelse(`$9',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$7',,,`, ')$7)',$21); @@ -144,7 +144,7 @@ dnl If no C++ output parameter is specified. ` ifelse(`$3',void,,dnl dnl Returns non-void: dnl Store the return if there are C output parameters -ifelse(`$6',,`return ',``$3' retval = '))_CONVERT($4,`$3',`$2`'($7)');'dnl +ifelse(`$6',,`return ',`auto retval = '))_CONVERT($4,`$3',`$2`'($7)');'dnl dnl A C++ output parameter is specified so initialize it from C return ,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$18);'dnl ) @@ -171,7 +171,7 @@ dnl Insert the declarations for the C output parameters ifelse(`$6',,,`$6 ')`'dnl ifelse(`$13',,dnl If no C++ output parameter is specified: - ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'($7)');dnl + ifelse(`$3',void,,`auto retvalue = ')_CONVERT($4,`$3',`$2`'($7)');dnl dnl A C++ output parameter is specified: ,` _INITIALIZE($14,$4,`$13',`$2`'($7)',$18);'dnl )dnl diff --git a/tools/m4/signal.m4 b/tools/m4/signal.m4 index 5b680f4..fa2cd99 100644 --- a/tools/m4/signal.m4 +++ b/tools/m4/signal.m4 @@ -24,17 +24,17 @@ ifelse(`$9',,,`_DEPRECATE_IFDEF_START ')dnl ifelse($13,,`dnl no detail_name $10 - Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'(); + Glib::SignalProxy<$5`'($6)> signal_$4`'(); ',dnl detail_name $14,0,`dnl $10 - Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13 = Glib::ustring()); + Glib::SignalProxyDetailed<$5`'($6)> signal_$4`'(const Glib::ustring& $13 = Glib::ustring()); ',`dnl detail_name and two_signal_methods $10 - Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > signal_$4`'(); + Glib::SignalProxy<$5`'($6)> signal_$4`'(); $10 - Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > signal_$4`'(const Glib::ustring& $13); + Glib::SignalProxyDetailed<$5`'($6)> signal_$4`'(const Glib::ustring& $13); ')dnl end detail_name ifelse(`$9',,,`_DEPRECATE_IFDEF_END ')dnl @@ -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__; - using SlotType = sigc::slot< $5`'_COMMA_PREFIX($6) >; + using SlotType = sigc::slot<$5`'($6)>; auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. @@ -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__; - using SlotType = sigc::slot< void`'_COMMA_PREFIX($6) >; + using SlotType = sigc::slot; auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. @@ -161,25 +161,25 @@ ifelse(`$11',,,`#ifdef $11' ifelse(`$9',,,`_DEPRECATE_IFDEF_START ')dnl ifelse($13,,`dnl no detail_name -Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'() +Glib::SignalProxy<$5`'($6)> __CPPNAME__::signal_$4`'() { - return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info); + return Glib::SignalProxy<$5`'($6) >(this, &__CPPNAME__`'_signal_$4_info); } ',dnl detail_name $14,0,`dnl -Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13) +Glib::SignalProxyDetailed<$5`'($6)> __CPPNAME__::signal_$4`'(const Glib::ustring& $13) { - return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13); + return Glib::SignalProxyDetailed<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info, $13); } ',`dnl detail_name and two_signal_methods -Glib::SignalProxy< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'() +Glib::SignalProxy<$5`'($6)> __CPPNAME__::signal_$4`'() { - return Glib::SignalProxy< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info); + return Glib::SignalProxy<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info); } -Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'(const Glib::ustring& $13) +Glib::SignalProxyDetailed<$5`'($6)> __CPPNAME__::signal_$4`'(const Glib::ustring& $13) { - return Glib::SignalProxyDetailedAnyType< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info, $13); + return Glib::SignalProxyDetailed<$5`'($6)>(this, &__CPPNAME__`'_signal_$4_info, $13); } ')dnl end detail_name ifelse(`$9',,,`_DEPRECATE_IFDEF_END diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm index 047aff4..93928be 100644 --- a/tools/pm/DocsParser.pm +++ b/tools/pm/DocsParser.pm @@ -13,7 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # Based on XML::Parser tutorial found at http://www.devshed.com/Server_Side/Perl/PerlXML/PerlXML1/page1.html @@ -300,7 +301,7 @@ sub lookup_enum_documentation($$$$$$$) # Replace @newin in the enum description, but don't in the element descriptions. my $description = "\@enum $cpp_enum_name\n"; $description .= $$objFunction{description}; - DocsParser::convert_docs_to_cpp($c_enum_name, \$description); + DocsParser::convert_docs_to_cpp($objFunction, \$description); DocsParser::replace_or_add_newin(\$description, $newin); # Add note about deprecation if we have specified that in our _WRAP_ENUM(), @@ -311,7 +312,7 @@ sub lookup_enum_documentation($$$$$$$) } # Append the enum description docs. - DocsParser::convert_docs_to_cpp($c_enum_name, \$docs); + DocsParser::convert_docs_to_cpp($objFunction, \$docs); $docs .= "\n\n$description"; DocsParser::add_m4_quotes(\$docs); @@ -350,7 +351,7 @@ sub lookup_documentation($$$;$) print "DocsParser.pm: Warning: No C docs for: \"$functionName\"\n"; } - DocsParser::convert_docs_to_cpp($functionName, \$text); + DocsParser::convert_docs_to_cpp($objFunction, \$text); DocsParser::replace_or_add_newin(\$text, $newin); # A blank line, marking the end of a paragraph, is needed after @newin. # Most @newins are at the end of a function description. @@ -390,20 +391,6 @@ sub lookup_documentation($$$;$) return $text; } -# void convert_value_to_cpp(\$text) -# Converts e.g. a property's default value. -sub convert_value_to_cpp($) -{ - my ($text) = @_; - - $$text =~ s"\bFALSE\b"false"g; - $$text =~ s"\bTRUE\b"true"g; - $$text =~ s"\bNULL\b"nullptr"g; - - # Enumerator names - $$text =~ s/\b([A-Z]+)_([A-Z\d_]+)\b/&DocsParser::substitute_enumerator_name($1, $2)/eg; -} - # void remove_example_code($obj_name, \$text) # Removes example code from the text of docs (passed by reference). sub remove_example_code($$) @@ -569,7 +556,7 @@ sub append_parameter_docs($$;$) $param_name_mappings{$param} = "slot"; } - DocsParser::convert_docs_to_cpp($$obj_function{name}, \$desc); + DocsParser::convert_docs_to_cpp($obj_function, \$desc); if(length($desc) > 0) { $desc .= '.' unless($desc =~ /(?:^|\.)$/); @@ -585,7 +572,7 @@ sub append_return_docs($$) my ($obj_function, $text) = @_; my $desc = $$obj_function{return_description}; - DocsParser::convert_docs_to_cpp($$obj_function{name}, \$desc); + DocsParser::convert_docs_to_cpp($obj_function, \$desc); $desc =~ s/\.$//; $$text .= "\n\@return \u${desc}." unless($desc eq ""); @@ -594,7 +581,7 @@ sub append_return_docs($$) sub convert_docs_to_cpp($$) { - my ($doc_func, $text) = @_; + my ($obj_function, $text) = @_; # Chop off leading and trailing whitespace. $$text =~ s/^\s+//; @@ -603,7 +590,7 @@ sub convert_docs_to_cpp($$) # Convert C documentation to C++. DocsParser::remove_c_memory_handling_info($text); DocsParser::convert_tags_to_doxygen($text); - DocsParser::substitute_identifiers($doc_func, $text); + DocsParser::substitute_identifiers($$obj_function{name}, $text); $$text =~ s/\bX\s+Window\b/X \%Window/g; $$text =~ s/\bWindow\s+manager/\%Window manager/g; @@ -876,7 +863,8 @@ sub substitute_enumerator_name($$) my $cxx_name = (($module eq "G") ? "" : (ucfirst(lc($module)) . "::")) . $name; - #print "DocsParser.pm: Assuming the enumerator $c_name shall become $cxx_name.\n"; + print "DocsParser.pm: Assuming the enumerator $c_name shall become $cxx_name.\n"; + return $cxx_name; } diff --git a/tools/pm/Enum.pm b/tools/pm/Enum.pm index ceb705c..c1bdc3c 100644 --- a/tools/pm/Enum.pm +++ b/tools/pm/Enum.pm @@ -26,6 +26,7 @@ our @EXPORT_OK; # string module; # string c_type; # +# string array elem_short_names; # string array elem_names; # string array elem_values; # string c_prefix; @@ -147,6 +148,7 @@ sub new $$self{flags} = 0; $$self{c_prefix} = ""; + $$self{elem_short_names} = []; $$self{elem_names} = []; $$self{elem_values} = []; @@ -173,6 +175,7 @@ sub new } # this should never happen + warn if(scalar(@{$$self{elem_short_names}}) != scalar(@{$$self{elem_values}})); warn if(scalar(@{$$self{elem_names}}) != scalar(@{$$self{elem_values}})); return $self; @@ -182,6 +185,7 @@ sub parse_values($$) { my ($self, $value) = @_; + my $elem_short_names = []; my $elem_names = []; my $elem_values = []; my $common_prefix = undef; @@ -189,9 +193,9 @@ sub parse_values($$) # and handles triples like '("dq-token", "MY_SCANNER_DQ_TOKEN", "'"'"). foreach (split_enum_tokens($value)) { - if (/^"\S+" "(\S+)" "(.+)"$/) + if (/^"(\S+)" "(\S+)" "(.+)"$/) { - my ($name, $value) = ($1, $2); + my ($nick_name, $name, $value) = ($1, $2, $3); # detect whether there is module prefix common to all names, e.g. GTK_ my $prefix = $1 if ($name =~ /^([^_]+_)/); @@ -205,6 +209,16 @@ sub parse_values($$) $common_prefix = ""; } + # enum.pl generates nick names from the C names of the enum constants. + # A nick name consists of the trailing part of the enum name. + # The leading part which is common for each constant of an enum type + # has been removed. The remaining part is then tranform to lowercase + # and hyphens. + # Transform the nick name with lowercase letters and hyphens + # back to a short name with uppercase letters and underscores. + # The short names are suitable for 'enum class' definitions. + $nick_name =~ tr/a-z-/A-Z_/; + push(@$elem_short_names, $nick_name); push(@$elem_names, $name); push(@$elem_values, $value); } @@ -223,17 +237,18 @@ sub parse_values($$) $$self{c_prefix} = $common_prefix; } + $$self{elem_short_names} = $elem_short_names; $$self{elem_names} = $elem_names; $$self{elem_values} = $elem_values; } -sub beautify_values($) +sub beautify_values($$) { - my ($self) = @_; + my ($self, $use_short_names) = @_; return if($$self{flags}); - my $elem_names = $$self{elem_names}; + my $elem_names = $use_short_names ? $$self{elem_short_names} : $$self{elem_names}; my $elem_values = $$self{elem_values}; my $num_elements = scalar(@$elem_values); @@ -277,9 +292,9 @@ sub beautify_values($) sub build_element_list($$$$) { - my ($self, $ref_subst_in, $ref_subst_out, $indent) = @_; + my ($self, $use_short_names, $ref_subst_in, $ref_subst_out, $indent) = @_; - my $elem_names = $$self{elem_names}; + my $elem_names = $use_short_names ? $$self{elem_short_names} : $$self{elem_names}; my $elem_values = $$self{elem_values}; my $num_elements = scalar(@$elem_names); @@ -307,6 +322,19 @@ sub build_element_list($$$$) return $elements; } +# The name prefix is defined by: $name_prefix . $short_name eq $name +# I.e. what shall be chopped off the name to get the short name. +sub get_name_prefix($) +{ + my ($self) = @_; + + my $name = ${$$self{elem_names}}[0]; + my $short_name = ${$$self{elem_short_names}}[0]; + my $prefix_length = length($name) - length($short_name); + + return substr($name, 0, $prefix_length); +} + sub dump($) { my ($self) = @_; diff --git a/tools/pm/Function.pm b/tools/pm/Function.pm index f962216..e0f404c 100644 --- a/tools/pm/Function.pm +++ b/tools/pm/Function.pm @@ -226,7 +226,7 @@ sub parse_param($$) # but possibly spaces between the multiple ">>". # Quoted strings are not detected. If a quoted string exists in a function # prototype, it's probably as part of a default value, inside ("x") or {"y"}. - # + # my @str = (); foreach (split(/(\bconst\b|[,=&*>]|<.*?>|{.*?}|\(.*?\)|\s+)/, $line)) { @@ -376,12 +376,12 @@ sub add_parameter($$$) return $self; } -# $string get_refdoc_comment($existing_signal_docs, $signal_flags) +# $string get_refdoc_comment($existing_signal_docs) # Generate a readable prototype for signals and merge the prototype into the # existing Doxygen comment block. -sub get_refdoc_comment($$$) +sub get_refdoc_comment($$) { - my ($self, $documentation, $signal_flags) = @_; + my ($self, $documentation) = @_; my $str = " /**\n"; @@ -402,11 +402,6 @@ sub get_refdoc_comment($$$) $str .= ")\n"; $str .= " *\n"; - if ($signal_flags) - { - $str .= " * Flags: $signal_flags\n *\n"; - } - if($documentation ne "") { # Remove the initial '/** ' from the existing docs and merge it. diff --git a/tools/pm/GtkDefs.pm b/tools/pm/GtkDefs.pm index c50af4a..03c1131 100644 --- a/tools/pm/GtkDefs.pm +++ b/tools/pm/GtkDefs.pm @@ -13,7 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # package GtkDefs; use strict; @@ -713,9 +714,8 @@ BEGIN { @GtkDefs::Signal::ISA=qw(GtkDefs::Function); } # # string rettype; # -# string flags. e.g. Run Last, No Hooks +# string when. e.g. first, last, or both. # string entity_type. e.g. vfunc or signal -# bool detailed; # optional # bool deprecated; # optional # } @@ -742,7 +742,7 @@ sub new $$self{rettype} = "none"; $$self{param_types} = []; $$self{param_names} = []; - $$self{flags} = ""; + $$self{when} = ""; $$self{class} = ""; # snarf down lisp fields @@ -761,26 +761,9 @@ sub new $$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code. } - if ($def =~ s/\(flags "(.*?)"\)//) + if($def =~ s/\(when "(\S+)"\)//) { - $$self{flags} = $1; - } - elsif ($def =~ s/\(when "(\S+)"\)//) - { - # "when" is a deprecated alternative to "flags". - # when eq "none", "first", "last", or "both". - if ($1 eq "first") - { - $$self{flags} = "Run First"; - } - elsif ($1 eq "last") - { - $$self{flags} = "Run Last"; - } - elsif ($1 eq "both") - { - $$self{flags} = "Run First, Run Last"; - } + $$self{when} = $1; } if($$self{rettype} eq "none") @@ -788,7 +771,6 @@ sub new $$self{rettype} = "void" } - $$self{detailed} = ($1 eq "#t") if ($def =~ s/\(detailed (\S+)\)//); $$self{deprecated} = ($1 eq "#t") if ($def =~ s/\(deprecated (\S+)\)//); # signals always have a parameter @@ -809,13 +791,6 @@ sub new return $self; } -# bool get_detailed() -sub get_detailed($) -{ - my ($self) = @_; - return $$self{detailed}; # undef, 0 or 1 -} - # bool get_deprecated() sub get_deprecated($) { diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm index f0a011a..f3c3bb3 100644 --- a/tools/pm/Output.pm +++ b/tools/pm/Output.pm @@ -13,7 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # package Output; use strict; @@ -99,11 +100,15 @@ sub check_deprecation($$$$$$) print STDERR "Warning, $main::source: The $entity_name $entity_type" . " is deprecated in the .defs file, but not in _WRAP_$wrapper.\n"; } - elsif (!$defs_deprecated && $wrap_deprecated) - { - print STDERR "Warning, $main::source: The $entity_name $entity_type" . - " is deprecated in _WRAP_$wrapper, but not in the .defs file.\n"; - } + # Uncomment the following lines some time in the future, when most + # signal.defs files have been updated with deprecation information. + # generate_extra_defs.cc was updated to generate this info soon after + # glibmm 2.47.6. + #elsif (!$defs_deprecated && $wrap_deprecated) + #{ + # print STDERR "Warning, $main::source: The $entity_name $entity_type" . + # " is deprecated in _WRAP_$wrapper, but not in the .defs file.\n"; + #} } sub ifdef($$) @@ -630,7 +635,7 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$) # Create a merged Doxygen comment block for the signal from the looked up # docs (the block will also contain a prototype of the slot as an example). - my $doxycomment = $objCppfunc->get_refdoc_comment($documentation, $$objCSignal{flags}); + my $doxycomment = $objCppfunc->get_refdoc_comment($documentation); # If there was already a previous doxygen comment, we want to merge this # one with the previous so it is one big comment. If @@ -684,13 +689,13 @@ sub output_wrap_sig_decl($$$$$$$$$$$$$$) } # void output_wrap_enum($filename, $line_num, $cpp_type, $c_type, -# $comment, $ref_subst_in, $ref_subst_out, $no_gtype, -# $deprecated, $deprecation_docs, $newin) -sub output_wrap_enum($$$$$$$$$$$$) +# $comment, $ref_subst_in, $ref_subst_out, $no_gtype, $conv_to_int, +# $in_class, $deprecated, $deprecation_docs, $newin) +sub output_wrap_enum($$$$$$$$$$$$$$) { my ($self, $filename, $line_num, $cpp_type, $c_type, - $comment, $ref_subst_in, $ref_subst_out, $no_gtype, - $deprecated, $deprecation_docs, $newin) = @_; + $comment, $ref_subst_in, $ref_subst_out, $no_gtype, $conv_to_int, + $in_class, $deprecated, $deprecation_docs, $newin) = @_; my $objEnum = GtkDefs::lookup_enum($c_type); if(!$objEnum) @@ -699,9 +704,12 @@ sub output_wrap_enum($$$$$$$$$$$$) return; } - $objEnum->beautify_values(); + $objEnum->beautify_values(1); - my $elements = $objEnum->build_element_list($ref_subst_in, $ref_subst_out, " "); + my $indent = " "; + $indent .= " " if ($in_class); + $indent .= " " if ($conv_to_int); + my $elements = $objEnum->build_element_list(1, $ref_subst_in, $ref_subst_out, $indent); add_m4_quotes(\$elements); if(!$elements) @@ -710,37 +718,57 @@ sub output_wrap_enum($$$$$$$$$$$$) return; } - my $value_suffix = "Enum"; - $value_suffix = "Flags" if($$objEnum{flags}); + # Chop off the name prefix in the documentation. + my $name_prefix = $objEnum->get_name_prefix(); + unshift(@$ref_subst_in, "^$name_prefix"); + unshift(@$ref_subst_out, ""); # Get the enum documentation from the parsed docs. + $indent = substr($indent, 1); # Remove one blank my $enum_docs = DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", - " ", $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin); + $indent, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin); # Merge the passed in comment to the existing enum documentation. - $comment .= "\n * " . $enum_docs if $enum_docs ne ""; + $comment .= "\n$indent* $enum_docs" if $enum_docs ne ""; - my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',\`%s\')dnl\n", + my $value_suffix = "Enum"; + $value_suffix = "Flags" if ($$objEnum{flags}); + + my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\',%d,\`%s\',\`%s\')dnl\n", $cpp_type, $c_type, $value_suffix, $elements, $no_gtype, + $conv_to_int, + $in_class, $comment, $deprecated ); - $self->append($str); } -sub output_wrap_enum_docs_only($$$$$$$$$$$) +sub output_wrap_enum_docs_only($$$$$$$$$$$$) { my ($self, $filename, $line_num, $module_canonical, $cpp_type, $c_type, - $comment, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin) = @_; + $comment, $ref_subst_in, $ref_subst_out, $in_class, $deprecation_docs, $newin) = @_; + + my $objEnum = GtkDefs::lookup_enum($c_type); + if(!$objEnum) + { + $self->output_wrap_failed($c_type, "enum defs lookup failed."); + return; + } + # Chop off the name prefix in the documentation. + my $name_prefix = $objEnum->get_name_prefix(); + unshift(@$ref_subst_in, "^$name_prefix"); + unshift(@$ref_subst_out, ""); - # Get the existing enum description from the parsed docs. + # Get the enum documentation from the parsed docs. + my $indent = " "; + $indent .= " " if ($in_class); my $enum_docs = DocsParser::lookup_enum_documentation("$c_type", "$cpp_type", - " ", $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin); + $indent, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin); if($enum_docs eq "") { @@ -749,10 +777,10 @@ sub output_wrap_enum_docs_only($$$$$$$$$$$) } # Include the enum docs in the module's enum docs group. - $enum_docs .= "\n *\n * \@ingroup ${module_canonical}Enums"; + $enum_docs .= "\n$indent*\n$indent* \@ingroup ${module_canonical}Enums"; # Merge the passed in comment to the existing enum documentation. - $comment = "/** " . $comment . "\n * " . $enum_docs . "\n */\n"; + $comment = "/** " . $comment . "\n$indent* " . $enum_docs . "\n$indent*/\n"; $self->append($comment); } @@ -778,7 +806,7 @@ sub output_wrap_gerror($$$$$$$$$$$$$) # Shouldn't happen, and if it does, I'd like to know that. warn if($$objEnum{flags}); - $objEnum->beautify_values(); + $objEnum->beautify_values(0); # cut off the module prefix, e.g. GDK_ my $prefix = $domain; @@ -788,7 +816,7 @@ sub output_wrap_gerror($$$$$$$$$$$$$) unshift(@$ref_subst_in, "^${prefix}_"); unshift(@$ref_subst_out, ""); - my $elements = $objEnum->build_element_list($ref_subst_in, $ref_subst_out, " "); + my $elements = $objEnum->build_element_list(0, $ref_subst_in, $ref_subst_out, " "); add_m4_quotes(\$elements); # Get the enum documentation from the parsed docs. @@ -849,22 +877,22 @@ sub output_wrap_any_property($$$$$$$$$$) my $proxy_suffix = ""; # Read/Write: - if ($objProperty->get_construct_only()) + if($objProperty->get_construct_only() eq 1) { # construct-only functions can be read, but not written. $proxy_suffix = "_ReadOnly"; - if (!$objProperty->get_readable()) + if($objProperty->get_readable() ne 1) { $self->output_wrap_failed($name, "attempt to wrap write-only and construct-only property."); return; } } - elsif (!$objProperty->get_readable()) + elsif($objProperty->get_readable() ne 1) { $proxy_suffix = "_WriteOnly"; } - elsif (!$objProperty->get_writable()) + elsif($objProperty->get_writable() ne 1) { $proxy_suffix = "_ReadOnly"; } @@ -898,6 +926,7 @@ sub output_wrap_any_property($$$$$$$$$$) my $objdoc = $objProperty->get_docs("", ""); if ($objdoc ne "") { + add_m4_quotes(\$objdoc); $documentation = "$objdoc\n *\n * $documentation"; } } @@ -905,26 +934,10 @@ sub output_wrap_any_property($$$$$$$$$$) { # Try to get the (usually short) documentation from the Property object. $documentation = $objProperty->get_docs($deprecation_docs, $newin); - } - - # Default value, if available: - my $default_value = $objProperty->get_default_value(); - if (defined($default_value)) - { - DocsParser::convert_value_to_cpp(\$default_value); - - # Add double quotes around a string value. - if ($objProperty->get_type() eq "GParamString") - { - $default_value = "\"" . $default_value . "\""; - } - $default_value = "Default value: $default_value"; - add_m4_quotes(\$default_value); if ($documentation ne "") { - $documentation .= "\n *\n * "; + add_m4_quotes(\$documentation); } - $documentation .= $default_value; } #Declaration: diff --git a/tools/pm/Property.pm b/tools/pm/Property.pm index 5efca50..265a3f7 100644 --- a/tools/pm/Property.pm +++ b/tools/pm/Property.pm @@ -2,7 +2,6 @@ package Property; use strict; use warnings; -use DocsParser; BEGIN { use Exporter (); @@ -28,7 +27,6 @@ our @EXPORT_OK; # bool writable; # bool construct_only; # bool deprecated; # optional -# string default_value; # optional # string docs; # } @@ -50,11 +48,10 @@ sub new $$self{writable} = ($1 eq "#t") if ($def =~ s/\(writable (\S+)\)//); $$self{construct_only} = ($1 eq "#t") if ($def =~ s/\(construct-only (\S+)\)//); $$self{deprecated} = ($1 eq "#t") if ($def =~ s/\(deprecated (\S+)\)//); - $$self{default_value} = $1 if ($def =~ s/\(default-value "(.*?)"\)//); $$self{entity_type} = 'property'; # Property documentation: - my $propertydocs = $1 if ($def =~ s/\(docs "([^"]*)"\)//); + my $propertydocs = $1 if ($def =~ s/\(docs "([^"]*)"\)//); # Add a full-stop if there is not one already: if(defined($propertydocs)) { @@ -121,19 +118,11 @@ sub get_deprecated($) return $$self{deprecated}; # undef, 0 or 1 } -sub get_default_value($) -{ - my ($self) = @_; - return $$self{default_value}; # undef or a string (possibly empty) -} - sub get_docs($$) { my ($self, $deprecation_docs, $newin) = @_; my $text = $$self{docs}; - DocsParser::convert_docs_to_cpp("$$self{class}:$$self{name}", \$text); - #Add note about deprecation if we have specified that in our _WRAP_PROPERTY() #or_WRAP_CHILD_PROPERTY() call: if($deprecation_docs ne "") @@ -146,11 +135,6 @@ sub get_docs($$) $text .= "\n *\n * \@newin{$newin}"; } - if ($text ne "") - { - DocsParser::add_m4_quotes(\$text); - } - return $text; } diff --git a/tools/pm/Util.pm b/tools/pm/Util.pm index 9b0dd66..bf033c6 100644 --- a/tools/pm/Util.pm +++ b/tools/pm/Util.pm @@ -13,7 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # # This file holds basic functions used throughout gtkmmproc modules. diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm index cb3337a..504e0c4 100644 --- a/tools/pm/WrapParser.pm +++ b/tools/pm/WrapParser.pm @@ -13,7 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # package WrapParser; use strict; @@ -669,45 +670,43 @@ sub extract_bracketed_text($) my $str = ""; # Move to the first "(": - while ( scalar(@tokens) ) - { - my $t = $self->extract_token(); - last if ($t eq "("); - } + while (scalar(@tokens)) + { + my $t = $self->extract_token(); + last if ($t eq "("); + } - # TODO: Don't count "(" and ")" within double quotes. - # There may be .hg files with unpaired quotes that generate correct - # .h and .cc files. Don't want to break such code yet. - # See also TODO in string_split_commas(). + my $filename = $$self{filename}; + my $line_num = $$self{line_num}; # Concatenate until the corresponding ")": - while ( scalar(@tokens) ) + while (scalar(@tokens) and $filename eq $$self{filename}) + { + my $t = $self->extract_token(); + $in_quotes = !$in_quotes if ($t eq '"'); + # Don't count "(" and ")" within double quotes. + if (!$in_quotes) { - my $t = $self->extract_token(); - $in_quotes = !$in_quotes if ($t eq '"'); $level++ if ($t eq "("); $level-- if ($t eq ")"); - - if (!$level) - { - $self->error("End of gmmproc directive within a quoted string.\n") if $in_quotes; - return $str; - } - $str .= $t; + return $str if (!$level); # Found matching ")" } + $str .= $t; + } - return ""; + # No matching ")" found. + my $quote_text = $in_quotes ? " in a quoted string" : ""; + die "$filename:$line_num: *** End of file$quote_text in a gmmproc macro. ***\n"; } ######################################## ### breaks up a string by commas (smart) -# @strings string_split_commas($string [, $ignore_quotes]) -sub string_split_commas($;$) +# @strings string_split_commas($string) +sub string_split_commas($) { - my ($in, $ignore_quotes) = @_; + my ($in) = @_; - $ignore_quotes = 2 unless defined $ignore_quotes; my @out; my $level = 0; my $in_quotes = 0; @@ -720,10 +719,7 @@ sub string_split_commas($;$) next if ($t eq ""); - # TODO: Delete the test for scalar(@out) >= $ignore_quotes when we can stop accepting - # .hg files with unpaired quotes, such as _WRAP_PROPERTY("text_column, int). - # See also TODO in extract_bracketed_text(). - $in_quotes = !$in_quotes if ($t eq '"' and scalar(@out) >= $ignore_quotes); + $in_quotes = !$in_quotes if ($t eq '"'); if (!$in_quotes) { $level++ if ($t eq "(" or $t eq "<" or $t eq "{"); @@ -1028,7 +1024,7 @@ sub on_wrap_method_docs_only($) my $line_num = $$self{line_num}; my $str = $self->extract_bracketed_text(); - my @args = string_split_commas($str, 1); + my @args = string_split_commas($str); my $entity_type = "method"; @@ -1431,6 +1427,7 @@ sub on_wrap_any_enum($$) my @subst_in = []; my @subst_out = []; my $no_gtype = ""; + my $conv_to_int = ""; my $argDeprecated = ""; my $deprecation_docs = ""; my $newin = ""; @@ -1442,12 +1439,11 @@ sub on_wrap_any_enum($$) if ($arg eq "NO_GTYPE") { - $no_gtype = "NO_GTYPE"; + $no_gtype = $arg; } - elsif ($arg =~ /^(get_type_func=)(\s*)$/) + elsif (!$is_gerror and $arg eq "CONV_TO_INT") { - my $part1 = $1; - my $part2 = $2; + $conv_to_int = $arg; } elsif ($arg =~ /^s#([^#]+)#([^#]*)#$/) { @@ -1469,9 +1465,28 @@ sub on_wrap_any_enum($$) } } return ($cpp_type, $c_type, $domain, \@subst_in, \@subst_out, $no_gtype, - $argDeprecated, $deprecation_docs, $newin); + $conv_to_int, $argDeprecated, $deprecation_docs, $newin); } +# void on_wrap_enum() +# _WRAP_ENUM(cpp_type, c_type [,NO_GTYPE] [,CONV_TO_INT] [,s#regexpr#subst#]*) +# Optional arguments: +# NO_GTYPE Don't generate code for a specialization of the template +# Glib::Value_Enum or Glib::Value_Flags. +# Necessary, if the C type enum is not registered as a GType. +# CONV_TO_INT "Convertible to int" Generate a plain enum (not an enum class) +# within a class. Such an enum is scoped like an enum class, +# and it can be implicitly converted to int like a plain enum. +# s#regexpr#subst# Zero or more substitutions in names of enum constants, e.g. s#^DATE_##. +# +# _WRAP_ENUM can be located either in a class or outside all classes. +# When located in a class, and Value specialization shall be generated or it's +# a Flags type (i.e. bitwise operators shall be generated), then the following +# requirements must be fulfilled: +# 1. _WRAP_ENUM must be located in the public part of the class. +# 2. The class must contain a class macro (_CLASS_GENERIC, _CLASS_GOBJECT, +# _CLASS_GTKOBJECT, etc.) before _WRAP_ENUM. +# sub on_wrap_enum($) { my ($self) = @_; @@ -1481,13 +1496,13 @@ sub on_wrap_enum($) my $comment = $self->extract_preceding_documentation(); # get the arguments - my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $no_gtype, + my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, $no_gtype, $conv_to_int, $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0); $$self{objOutputter}->output_wrap_enum( $$self{filename}, $$self{line_num}, $cpp_type, $c_type, - $comment, $ref_subst_in, $ref_subst_out, $no_gtype, - $argDeprecated, $deprecation_docs, $newin); + $comment, $ref_subst_in, $ref_subst_out, $no_gtype, $conv_to_int, + $$self{in_class}, $argDeprecated, $deprecation_docs, $newin); } sub on_wrap_enum_docs_only($) @@ -1499,7 +1514,7 @@ sub on_wrap_enum_docs_only($) my $comment = $self->extract_preceding_documentation(); # get the arguments - my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, undef, + my ($cpp_type, $c_type, undef, $ref_subst_in, $ref_subst_out, undef, undef, $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(0); # Get the module name so the enum docs can be included in the module's @@ -1508,7 +1523,7 @@ sub on_wrap_enum_docs_only($) $$self{objOutputter}->output_wrap_enum_docs_only( $$self{filename}, $$self{line_num}, $module_canonical, $cpp_type, $c_type, - $comment, $ref_subst_in, $ref_subst_out, $deprecation_docs, $newin); + $comment, $ref_subst_in, $ref_subst_out, $$self{in_class}, $deprecation_docs, $newin); } sub on_wrap_gerror($) @@ -1523,7 +1538,7 @@ sub on_wrap_gerror($) my $class_docs = $self->extract_preceding_documentation(); # get the arguments - my ($cpp_type, $c_type, $domain, $ref_subst_in, $ref_subst_out, $no_gtype, + my ($cpp_type, $c_type, $domain, $ref_subst_in, $ref_subst_out, $no_gtype, undef, $argDeprecated, $deprecation_docs, $newin) = $self->on_wrap_any_enum(1); $$self{objOutputter}->output_wrap_gerror( @@ -1662,7 +1677,7 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$) $objCSignal = GtkDefs::lookup_signal($$self{c_class}, $signal_name); # Check for failed lookup. - if (!$objCSignal) + if($objCSignal eq 0) { print STDERR "$signal_name\n"; $objOutputter->output_wrap_failed($signal_name, @@ -1671,19 +1686,6 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$) } } - # Check detailed. - my $defs_detailed = $objCSignal->get_detailed(); - if ($defs_detailed && !$detail_name) - { - print STDERR "Warning, $main::source: The $signal_name signal" . - " is marked 'detailed' in the .defs file, but not in _WRAP_SIGNAL.\n"; - } - elsif (!$defs_detailed && $detail_name) - { - print STDERR "Warning, $main::source: The $signal_name signal" . - " is marked 'detailed' in _WRAP_SIGNAL, but not in the .defs file.\n"; - } - Output::check_deprecation($$self{deprecated}, $objCSignal->get_deprecated(), $deprecated, $signal_name, "signal", "SIGNAL"); @@ -1692,7 +1694,7 @@ sub output_wrap_signal($$$$$$$$$$$$$$$$$) $deprecated, $deprecation_docs, $newin, $exceptionHandler, $detail_name, $bTwoSignalMethods); - if (!$bNoDefaultHandler) + if($bNoDefaultHandler eq 0) { $objOutputter->output_wrap_default_signal_handler_h($filename, $line_num, $objCppSignal, $objCSignal, $ifdef, $deprecated, $exceptionHandler); diff --git a/tools/test_scripts/testheaders.sh b/tools/test_scripts/testheaders.sh index 150ada4..3d8477d 100755 --- a/tools/test_scripts/testheaders.sh +++ b/tools/test_scripts/testheaders.sh @@ -5,9 +5,9 @@ # files that it depends on. # Example: In glibmm, go to directory glibmm, and run -# tools/test_scripts/testheaders.sh -I glib glibmm-2.4 gio # compile glibmm/gio/giomm/*.h -# tools/test_scripts/testheaders.sh glibmm-2.4 glib gio # compile glibmm/glib/glibmm/*.h and glibmm/gio/giomm/*.h -# tools/test_scripts/testheaders.sh -I glib -I gio glibmm-2.4 glib/glibmm/ustring.h # compile glibmm/glib/glibmm/ustring.h +# tools/test_scripts/testheaders.sh -I glib glibmm-2.54 gio # compile glibmm/gio/giomm/*.h +# tools/test_scripts/testheaders.sh glibmm-2.54 glib gio # compile glibmm/glib/glibmm/*.h and glibmm/gio/giomm/*.h +# tools/test_scripts/testheaders.sh -I glib -I gio glibmm-2.54 glib/glibmm/ustring.h # compile glibmm/glib/glibmm/ustring.h # Usage: testheaders.sh [-I]... [ | ]... # -I is added to the g++ command. @@ -18,6 +18,9 @@ function usage() { exit 1 } +#extra_gcc_args=-std=c++11 +extra_gcc_args= + # Search for directories to include in CFLAGS. idirs="" while [ $# -gt 0 ] @@ -75,11 +78,11 @@ do for headerfile in $i/${i}mm/*.h do echo "=== $headerfile" - g++ -c -x c++ -std=c++11 -o /dev/null $headerfile $CFLAGS + g++ -c -x c++ $extra_gcc_args -o /dev/null $headerfile $CFLAGS done else echo "=== $i" - g++ -c -x c++ -std=c++11 -o /dev/null $i $CFLAGS + g++ -c -x c++ $extra_gcc_args -o /dev/null $i $CFLAGS fi done -- 2.7.4