/glibmm-*.tar.*
/tags
-# scripts/
+# build/
+/build/compile
/build/config.*
/build/depcomp
/build/install-sh
/docs/tagfile-to-devhelp2.xsl
/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/html/
+2.45.70 (unstable):
+
+Glib:
+* C++11: Add move operations to ObjectBase and Object.
+ (Murray Cumming)
+* C++11: RefPtr: Make methods noexcept.
+ (Murray Cumming)
+
+gmmproc:
+* C++11: Generate move operations.
+ (Murray Cumming)
+* C++11: IOChannel: move operations: Call the base sigc::trackable.
+ (Murray Cumming)
+* C++11: Markup: Add move operations
+ (Murray Cumming)
+* C++11: More use of = delete instead of private copy operations.
+ (Murray Cumming)
+* C++11: Use std::stoul instead of strtoul.
+ (Murray Cumming)
+
+Documentation:
+* Update configuration for Doxygen 1.8.9.1.
+ (Daniel Elstner)
+* Exclude bogus documentation symbols.
+ (Daniel Elstner)
+* Generate documentation for API all platforms.
+ (Daniel Elstner)
+
+
+2.45.52 (unstable):
+
+Glib::
+* C++11: Glib::ObjectBase, Object, Interface: Add move operators.
+ (Murray Cumming)
+* C++11: Mark all _CLASS_OPAQUE_REFCOUNTED classes as final.
+ (Murray Cumming)
+
+Gio:
+* FileIcon: Remove unncessary IMPLEMENTS_INTERFACE.
+ (Murray Cumming)
+
+gmmproc:
+* _CLASS_GOBJECT(): Generate move operations.
+* _CLASS_INTERFACE(): Generate move operations.
+* _CLASS_BOXEDTYPE_STATIC(): Add move operations.
+* _CLASS_BOXEDTYPE_STATIC: Add explicit copy operations.
+* _CLASS_OPAQUE_COPYABLE(): Add move operations.
+* _CLASS_OPAQUE_COPYABLE: Generate static swap().
+* _CLASS_OPAQUE_REFCOUNTED: Use = delete for the default constructor.
+(Murray Cumming)
+
+
2.45.50 (unstable):
Glib:
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.45.50],
+AC_INIT([glibmm], [2.45.70],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library])
])
-glibreq='2.0 >= 2.45.5'
+glibreq='2.0 >= 2.45.7'
-GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq"
+GLIBMM_MODULES="sigc++-2.0 >= 2.5.4 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"
include $(top_srcdir)/gio/src/filelist.am
include $(top_srcdir)/gio/giomm/filelist.am
-glibmm_files_h = $(filter-out wrap_init.h,$(glibmm_files_built_h) $(glibmm_files_extra_h))
-giomm_files_h = $(filter-out wrap_init.h,$(giomm_files_built_h) $(giomm_files_extra_h))
+glibmm_files_h = $(filter-out wrap_init.h,$(glibmm_files_all_h))
+giomm_files_h = $(filter-out wrap_init.h,$(giomm_files_all_h))
book_name = $(GLIBMM_MODULE_NAME)
doc_input = $(addprefix $(top_srcdir)/glib/glibmm/,$(glibmm_files_h)) \
$(addprefix $(top_srcdir)/gio/giomm/,$(giomm_files_h)) \
- $(top_srcdir)/glib/glibmm.h
+ $(top_srcdir)/glib/glibmm.h $(top_srcdir)/gio/giomm.h
docimagesdir = $(libdocdir)/images
dist_docimages_DATA = images/gtkmm_logo.gif images/top.gif
-# Doxyfile 1.8.3
-# @configure_input@
-
-# When Doxyfile.in is updated with 'doxygen -s -u Doxyfile.in' some lines
-# will be distorted or removed, and must be manually restored.
-# - These comment lines, including the configure_input line.
-# - The lines with HOST_WINDOWS_NATIVE_[FALSE|TRUE].
-# (True of Doxygen 1.8.3. Don't know how future releases will behave.)
+## @configure_input@
+# Doxyfile 1.8.9.1
#---------------------------------------------------------------------------
# Project related configuration options
PROJECT_LOGO =
OUTPUT_DIRECTORY = reference
CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
-SYMBOL_CACHE_SIZE = 0
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
+HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
+# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = reference/doxygen.log
#---------------------------------------------------------------------------
-# configuration options related to the input files
+# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT =
INPUT_ENCODING = UTF-8
basic_streambuf \
binary_function \
char_traits \
+ hash_load_check_resize_trigger_size_base \
internal \
+ lu_counter_policy_base \
nil \
pair \
unary_function
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
-# configuration options related to source browsing
+# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS =
#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
+# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
-# configuration options related to the HTML output
+# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
SEARCHENGINE = NO
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
+# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
-# configuration options related to the RTF output
+# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
-# configuration options related to the man page output
+# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
+MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
-# configuration options related to the XML output
+# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
XML_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
+# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
"G_GNUC_NORETURN=" \
"G_GNUC_NULL_TERMINATED=" \
"G_GNUC_PURE=" \
+ G_OS_UNIX \
+ G_OS_WIN32 \
"GLIBMM_API=" \
"GIOMM_API=" \
GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED \
GLIBMM_HAVE_WIDE_STREAM \
GLIBMM_PROPERTIES_ENABLED \
GLIBMM_VFUNCS_ENABLED
-@HOST_WINDOWS_NATIVE_FALSE@PREDEFINED += G_OS_UNIX
-@HOST_WINDOWS_NATIVE_TRUE@PREDEFINED += G_OS_WIN32
EXPAND_AS_DEFINED = GLIBMM_MAJOR_VERSION \
GLIBMM_MINOR_VERSION \
GLIBMM_MICRO_VERSION \
GIOMM_MICRO_VERSION
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
-# Configuration::additions related to external references
+# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES = @DOXYGEN_TAGFILES@
GENERATE_TAGFILE = "reference/@GLIBMM_MODULE_NAME@.tag"
ALLEXTERNALS = NO
EXTERNAL_GROUPS = NO
+EXTERNAL_PAGES = YES
PERL_PATH = @PERL@
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
+DIA_PATH =
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
DOT_NUM_THREADS = 0
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
{
host = arg.substr (0, pos);
port_str = arg.substr(pos);
- port = strtoul (port_str.c_str (), nullptr, 10);
+ port = std::stoul (port_str);
}
else
port = 0;
giomm_files_extra_cc = contenttype.cc init.cc slot_async.cc socketsource.cc
giomm_files_extra_h = contenttype.h init.h socketsource.h wrap_init.h
giomm_files_extra_ph =
+
+giomm_files_all_h = $(giomm_files_hg:.hg=.h) $(giomm_files_extra_h)
(GSourceFunc)&giomm_socketsource_callback)
{}
-SocketSource::~SocketSource()
+SocketSource::~SocketSource() noexcept
{}
} // namespace Gio
protected:
SocketSource(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
const Glib::RefPtr<Cancellable>& cancellable);
- virtual ~SocketSource();
+ virtual ~SocketSource() noexcept;
};
} // namespace Gio
gobject_.set_property = &DBusInterfaceVTable_SetProperty_giomm_callback;
}
+InterfaceVTable::InterfaceVTable(InterfaceVTable&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+ slot_method_call_(std::move(other.slot_method_call_)),
+ slot_get_property_(std::move(other.slot_get_property_)),
+ slot_set_property_(std::move(other.slot_set_property_))
+{
+ other.slot_method_call_ = nullptr;
+ other.slot_get_property_ = nullptr;
+ other.slot_set_property_ = nullptr;
+}
+
+InterfaceVTable& InterfaceVTable::operator=(InterfaceVTable&& other) noexcept
+{
+ delete slot_method_call_;
+ delete slot_get_property_;
+ delete slot_set_property_;
+
+ gobject_ = std::move(other.gobject_);
+ slot_method_call_ = std::move(other.slot_method_call_);
+ slot_get_property_ = std::move(other.slot_get_property_);
+ slot_set_property_ = std::move(other.slot_set_property_);
+
+ other.slot_method_call_ = nullptr;
+ other.slot_get_property_ = nullptr;
+ other.slot_set_property_ = nullptr;
+
+ return *this;
+}
+
InterfaceVTable::~InterfaceVTable()
{
delete slot_method_call_;
const SlotInterfaceSetProperty& slot_set_property = SlotInterfaceSetProperty()
);
+ InterfaceVTable(const InterfaceVTable& other) = delete;
+ InterfaceVTable& operator=(const InterfaceVTable& other) = delete;
+
+ InterfaceVTable(InterfaceVTable&& other) noexcept;
+ InterfaceVTable& operator=(InterfaceVTable&& other) noexcept;
+
/// Destructor.
virtual ~InterfaceVTable();
const GDBusInterfaceVTable* gobj() const
{ return reinterpret_cast<const GDBusInterfaceVTable*>(&gobject_); }
-
-private:
- // Non-copyable.
- InterfaceVTable(const InterfaceVTable& other);
- InterfaceVTable& operator=(const InterfaceVTable& other);
-
-public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These are so the C callbacks and the
// Gio::DBus::Connection::register_object() method can have access to the
* @newin{2,28}
* @ingroup DBus
*/
-class AnnotationInfo
+class AnnotationInfo final
{
_CLASS_OPAQUE_REFCOUNTED(AnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
_IGNORE(g_dbus_annotation_info_ref, g_dbus_annotation_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class ArgInfo
+class ArgInfo final
{
_CLASS_OPAQUE_REFCOUNTED(ArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref)
_IGNORE(g_dbus_arg_info_ref, g_dbus_arg_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class MethodInfo
+class MethodInfo final
{
_CLASS_OPAQUE_REFCOUNTED(MethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref)
_IGNORE(g_dbus_method_info_ref, g_dbus_method_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class SignalInfo
+class SignalInfo final
{
_CLASS_OPAQUE_REFCOUNTED(SignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref)
_IGNORE(g_dbus_signal_info_ref, g_dbus_signal_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class PropertyInfo
+class PropertyInfo final
{
_CLASS_OPAQUE_REFCOUNTED(PropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref)
_IGNORE(g_dbus_property_info_ref, g_dbus_property_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class InterfaceInfo
+class InterfaceInfo final
{
_CLASS_OPAQUE_REFCOUNTED(InterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref)
_IGNORE(g_dbus_interface_info_ref, g_dbus_interface_info_unref)
* @newin{2,28}
* @ingroup DBus
*/
-class NodeInfo
+class NodeInfo final
{
_CLASS_OPAQUE_REFCOUNTED(NodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref)
_IGNORE(g_dbus_node_info_ref, g_dbus_node_info_unref)
gobject_.dispatch = &DBusSubtreeVTable_Dispatch_giomm_callback;
}
+SubtreeVTable::SubtreeVTable(SubtreeVTable&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+ slot_enumerate_(std::move(other.slot_enumerate_)),
+ slot_introspect_(std::move(other.slot_introspect_)),
+ slot_dispatch_(std::move(other.slot_dispatch_))
+{
+ other.slot_enumerate_ = nullptr;
+ other.slot_introspect_ = nullptr;
+ other.slot_dispatch_ = nullptr;
+}
+
+SubtreeVTable& SubtreeVTable::operator=(SubtreeVTable&& other) noexcept
+{
+ delete slot_enumerate_;
+ delete slot_introspect_;
+ delete slot_dispatch_;
+
+ gobject_ = std::move(other.gobject_);
+ slot_enumerate_ = std::move(other.slot_enumerate_);
+ slot_introspect_ = std::move(other.slot_introspect_);
+ slot_dispatch_ = std::move(other.slot_dispatch_);
+
+ other.slot_enumerate_ = nullptr;
+ other.slot_introspect_ = nullptr;
+ other.slot_dispatch_ = nullptr;
+
+ return *this;
+}
+
SubtreeVTable::~SubtreeVTable()
{
delete slot_enumerate_;
const SlotSubtreeDispatch& slot_dispatch = SlotSubtreeDispatch()
);
+ SubtreeVTable(const SubtreeVTable& other) = delete;
+ SubtreeVTable& operator=(const SubtreeVTable& other) = delete;
+
+ SubtreeVTable(SubtreeVTable&& other) noexcept;
+ SubtreeVTable& operator=(SubtreeVTable&& other) noexcept;
+
/// Destructor.
virtual ~SubtreeVTable();
const GDBusSubtreeVTable* gobj() const
{ return reinterpret_cast<const GDBusSubtreeVTable*>(&gobject_); }
-
-private:
- // Non-copyable.
- SubtreeVTable(const SubtreeVTable& other);
- SubtreeVTable& operator=(const SubtreeVTable& other);
-
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// These are so the C callbacks and the
return *this;
}
+FileAttributeInfo::FileAttributeInfo(FileAttributeInfo&& other) noexcept
+: m_name(std::move(other.m_name)),
+ m_type(std::move(other.m_type)),
+ m_flags(std::move(other.m_flags))
+{
+}
+
+FileAttributeInfo& FileAttributeInfo::operator=(FileAttributeInfo&& other) noexcept
+{
+ m_name = std::move(other.m_name);
+ m_type = std::move(other.m_type);
+ m_flags = std::move(other.m_flags);
+
+ return *this;
+}
+
FileAttributeInfo::~FileAttributeInfo()
{
}
FileAttributeInfo(const FileAttributeInfo& other);
FileAttributeInfo& operator=(const FileAttributeInfo& other);
+ FileAttributeInfo(FileAttributeInfo&& other) noexcept;
+ FileAttributeInfo& operator=(FileAttributeInfo&& other) noexcept;
+
~FileAttributeInfo();
std::string get_name() const;
*
* @newin{2,16}
*/
-class FileAttributeInfoList
+class FileAttributeInfoList final
{
_CLASS_OPAQUE_REFCOUNTED(FileAttributeInfoList, GFileAttributeInfoList,
g_file_attribute_info_list_new,
public LoadableIcon
{
_CLASS_GOBJECT(FileIcon, GFileIcon, G_FILE_ICON, Glib::Object, GObject)
- _IMPLEMENTS_INTERFACE(Icon)
_IMPLEMENTS_INTERFACE(LoadableIcon)
protected:
*
* @newin{2,16}
*/
-class FileAttributeMatcher
+class FileAttributeMatcher final
{
_CLASS_OPAQUE_REFCOUNTED(FileAttributeMatcher, GFileAttributeMatcher,
NONE, g_file_attribute_matcher_ref, g_file_attribute_matcher_unref)
*
* @newin{2,44}
*/
-class Resource
+class Resource final
{
_CLASS_OPAQUE_REFCOUNTED(Resource, GResource, NONE, g_resource_ref, g_resource_unref)
_IGNORE(g_resource_ref, g_resource_unref)
*
* @newin{2,32}
*/
-class SettingsSchema
+class SettingsSchema final
{
_CLASS_OPAQUE_REFCOUNTED(SettingsSchema, GSettingsSchema, NONE, g_settings_schema_ref, g_settings_schema_unref)
*
* @newin{2,32}
*/
-class SettingsSchemaKey
+class SettingsSchemaKey final
{
_CLASS_OPAQUE_REFCOUNTED(SettingsSchemaKey, GSettingsSchemaKey, NONE, g_settings_schema_key_ref, g_settings_schema_key_unref)
*
* @newin{2,32}
*/
-class SettingsSchemaSource
+class SettingsSchemaSource final
{
_CLASS_OPAQUE_REFCOUNTED(SettingsSchemaSource, GSettingsSchemaSource, NONE, g_settings_schema_source_ref, g_settings_schema_source_unref)
namespace Glib
{
-ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::~ArrayHandle()
+ArrayHandle<bool,Container_Helpers::TypeTraits<bool> >::~ArrayHandle() noexcept
{
if(parray_ && ownership_ != Glib::OWNERSHIP_NONE)
{
// Copying clears the ownership flag of the source handle.
inline ArrayHandle(const ArrayHandle<T,Tr>& other);
- ~ArrayHandle();
+ ~ArrayHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
// Copying clears the ownership flag of the source handle.
inline ArrayHandle(const Me& other);
- ~ArrayHandle();
+ ~ArrayHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
}
template <class T, class Tr>
-ArrayHandle<T,Tr>::~ArrayHandle()
+ArrayHandle<T,Tr>::~ArrayHandle() noexcept
{
if(parray_ && ownership_ != Glib::OWNERSHIP_NONE)
{
* is zero-initialized at program start.
*/
//Class();
- //~Class();
+ //~Class() noexcept;
//static void class_init_function(BaseClassType *p);
//static void object_init_function(BaseObjectType *o);
class DispatchNotifier : public sigc::trackable
{
public:
- ~DispatchNotifier();
+ ~DispatchNotifier() noexcept;
// noncopyable
DispatchNotifier(const DispatchNotifier&) = delete;
}
}
-DispatchNotifier::~DispatchNotifier()
+DispatchNotifier::~DispatchNotifier() noexcept
{
#ifndef G_OS_WIN32
fd_close_and_invalidate(fd_sender_);
notifier_ (DispatchNotifier::reference_instance(context, this))
{}
-Dispatcher::~Dispatcher()
+Dispatcher::~Dispatcher() noexcept
{
DispatchNotifier::unreference_instance(notifier_, this);
}
* @throw Glib::FileError
*/
explicit Dispatcher(const Glib::RefPtr<MainContext>& context);
- ~Dispatcher();
+ ~Dispatcher() noexcept;
void emit();
void operator()();
glibmm_files_built_cc = $(glibmm_files_used_hg:.hg=.cc) $(glibmm_files_cc_m4:.m4=) wrap_init.cc
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_hg))
+glibmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(glibmm_files_used_hg))
glibmm_files_extra_cc = \
arrayhandle.cc \
glibmm_files_extra_ph = \
private/interface_p.h \
private/object_p.h
+
+glibmm_files_all_h = $(glibmm_files_hg:.hg=.h) $(glibmm_files_h_m4:.m4=) $(glibmm_files_extra_h)
: gparent_(gp)
{}
- virtual ~HelperList()
+ virtual ~HelperList() noexcept
{}
typedef T_Child value_type;
Interface::Interface()
{}
-Interface::~Interface()
+Interface::Interface(Interface&& src) noexcept
+: ObjectBase(std::move(src))
+{
+ //We don't call initialize_move() because we
+ //want the derived move constructor to only cause it
+ //to be called once, so we just let it be called
+ //by the implementing class, such as Entry (implementing Editable).
+ //ObjectBase::initialize_move(src.gobject_, &src);
+}
+
+Interface& Interface::operator=(Interface&& src) noexcept
+{
+ ObjectBase::operator=(std::move(src));
+ return *this;
+}
+
+Interface::~Interface() noexcept
{}
GType Interface::get_type()
*/
Interface();
+ Interface(Interface&& src) noexcept;
+ Interface& operator=(Interface&& src) noexcept;
+
/** Called by constructors of derived classes. Provide the result of
* the Class object's init() function to ensure that it is properly
* initialized.
* if necessary.
*/
explicit Interface(GObject* castitem);
- virtual ~Interface();
+ virtual ~Interface() noexcept;
// noncopyable
Interface(const Interface&) = delete;
// Copying clears the ownership flag of the source handle.
inline ListHandle(const ListHandle<T,Tr>& other);
- ~ListHandle();
+ ~ListHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
}
template <class T, class Tr>
-ListHandle<T,Tr>::~ListHandle()
+ListHandle<T,Tr>::~ListHandle() noexcept
{
if(ownership_ != Glib::OWNERSHIP_NONE)
{
&SourceCallbackData::destroy_notify_callback);
}
-Source::~Source()
+Source::~Source() noexcept
{
// The dtor should be invoked by destroy_notify_callback() only, which clears
// gobject_ before deleting. However, we might also get to this point if
expiration_.add_milliseconds(std::min<unsigned long>(G_MAXLONG, interval_));
}
-TimeoutSource::~TimeoutSource()
+TimeoutSource::~TimeoutSource() noexcept
{}
bool TimeoutSource::prepare(int& timeout)
set_priority(PRIORITY_DEFAULT_IDLE);
}
-IdleSource::~IdleSource()
+IdleSource::~IdleSource() noexcept
{}
bool IdleSource::prepare(int& timeout)
Source(cast_item, callback_func)
{}
-IOSource::~IOSource()
+IOSource::~IOSource() noexcept
{}
bool IOSource::prepare(int& timeout)
*/
Source(GSource* cast_item, GSourceFunc callback_func);
- virtual ~Source();
+ virtual ~Source() noexcept;
sigc::connection connect_generic(const sigc::slot_base& slot);
protected:
explicit TimeoutSource(unsigned int interval);
- virtual ~TimeoutSource();
+ virtual ~TimeoutSource() noexcept;
virtual bool prepare(int& timeout);
virtual bool check();
protected:
IdleSource();
- virtual ~IdleSource();
+ virtual ~IdleSource() noexcept;
virtual bool prepare(int& timeout);
virtual bool check();
*/
IOSource(GSource* cast_item, GSourceFunc callback_func);
- virtual ~IOSource();
+ virtual ~IOSource() noexcept;
virtual bool prepare(int& timeout);
virtual bool check();
va_end(var_args);
}
-ConstructParams::~ConstructParams()
+ConstructParams::~ConstructParams() noexcept
{
while(n_parameters > 0)
g_value_unset(¶meters[--n_parameters].value);
ObjectBase::initialize(castitem);
}
-Object::~Object()
+Object::Object(Object&& src) noexcept
+: ObjectBase(std::move(src)) //not actually called because it's a virtual base
+{
+ ObjectBase::initialize_move(src.gobject_, &src);
+}
+
+Object& Object::operator=(Object&& src) noexcept
+{
+ ObjectBase::operator=(std::move(src));
+ return *this;
+}
+
+Object::~Object() noexcept
{
cpp_destruction_in_progress_ = true;
}
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();
+ ~ConstructParams() noexcept;
// The copy constructor is semantically required by the C++ compiler
// (since g++ 3.4) to be able to create temporary instances, depending
Object(const Object&) = delete;
Object& operator=(const Object&) = delete;
+ Object(Object&& src) noexcept;
+ Object& operator=(Object&& src) noexcept;
+
protected:
Object(); //For use by C++-only sub-types.
explicit Object(const Glib::ConstructParams& construct_params);
explicit Object(GObject* castitem);
- virtual ~Object(); //It should only be deleted by the callback.
+ virtual ~Object() noexcept; //It should only be deleted by the callback.
public:
//static RefPtr<Object> create(); //You must reimplement this in each derived class.
_set_current_wrapper(castitem);
}
-ObjectBase::~ObjectBase()
+void ObjectBase::initialize_move(GObject* castitem, Glib::ObjectBase* previous_wrapper)
+{
+ if(gobject_)
+ {
+ g_assert(gobject_ == castitem);
+
+ // TODO: Think about it. Will this really be called twice?
+ g_printerr("ObjectBase::initialize_move() called twice for the same GObject\n");
+
+ return; // Don't initialize the wrapper twice.
+ }
+
+ gobject_ = castitem;
+ _move_current_wrapper(castitem, previous_wrapper);
+ custom_type_name_ = previous_wrapper->custom_type_name_;
+ cpp_destruction_in_progress_ = previous_wrapper->cpp_destruction_in_progress_;
+
+ //Clear the previous wrapper:
+ previous_wrapper->custom_type_name_ = nullptr;
+ previous_wrapper->cpp_destruction_in_progress_ = false;
+}
+
+ObjectBase::ObjectBase(ObjectBase&& src) noexcept
+: sigc::trackable(std::move(src)),
+ gobject_(std::move(src.gobject_)),
+ custom_type_name_(std::move(src.custom_type_name_)),
+ cpp_destruction_in_progress_(std::move(src.custom_type_name_))
+{}
+
+ObjectBase& ObjectBase::operator=(ObjectBase&& src) noexcept
+{
+ sigc::trackable::operator=(std::move(src));
+
+ if(gobject_)
+ unreference();
+
+ gobject_ = std::move(src.gobject_);
+ custom_type_name_ = std::move(src.custom_type_name_);
+ cpp_destruction_in_progress_ = std::move(src.custom_type_name_);
+
+ return *this;
+}
+
+ObjectBase::~ObjectBase() noexcept
{
// Normally, gobject_ should always be 0 at this point, because:
//
}
}
+void ObjectBase::_move_current_wrapper(GObject* object, Glib::ObjectBase* previous_wrapper) noexcept
+{
+ //See _set_current_wrapper().
+ ObjectBase* current_wrapper = _get_current_wrapper(object);
+ if(current_wrapper != previous_wrapper)
+ {
+ g_warning("%s: Unexpected previous wrapper, for object of type %s.\n"
+ "previous_wrapper=%p, current_wrapper=%p",
+ G_STRFUNC, G_OBJECT_TYPE_NAME(object),
+ previous_wrapper, current_wrapper);
+ }
+
+ //Remove the previous wrapper, without invoking destroy_notify_callback_():
+ g_object_steal_qdata(object, Glib::quark_);
+
+ //Set the new wrapper:
+ g_object_set_qdata_full(object, Glib::quark_, this, &destroy_notify_callback_);
+
+ //Clear the previous wrapper:
+ previous_wrapper->gobject_ = nullptr;
+}
+
// static
ObjectBase* ObjectBase::_get_current_wrapper(GObject* object)
{
*/
explicit ObjectBase(const std::type_info& custom_type_info);
- virtual ~ObjectBase() = 0;
+ ObjectBase(ObjectBase&& src) noexcept;
+ ObjectBase& operator=(ObjectBase&& src) noexcept;
+
+ virtual ~ObjectBase() noexcept = 0;
// Called by Glib::Object and Glib::Interface constructors. See comments there.
void initialize(GObject* castitem);
+ // Called by Glib::Object and Glib::Interface C++ move operations.
+ void initialize_move(GObject* castitem, Glib::ObjectBase* previous_wrapper);
+
public:
/// You probably want to use a specific property_*() accessor method instead.
virtual void destroy_notify_();
void _set_current_wrapper(GObject* object);
+
+ /// For (indirect) use by C++ move operations.
+ void _move_current_wrapper(GObject* object, Glib::ObjectBase* previous_wrapper) noexcept;
#endif //DOXYGEN_SHOULD_SKIP_THIS
private:
gobject_ (gobject)
{}
-PatternSpec::~PatternSpec()
+PatternSpec::~PatternSpec() noexcept
{
g_pattern_spec_free(gobject_);
}
public:
explicit PatternSpec(const Glib::ustring& pattern);
explicit PatternSpec(GPatternSpec* gobject);
- ~PatternSpec();
+ ~PatternSpec() noexcept;
// noncopyable
PatternSpec(const PatternSpec&) = delete;
value_.init(value_type);
}
-PropertyBase::~PropertyBase()
+PropertyBase::~PropertyBase() noexcept
{
if(param_spec_)
g_param_spec_unref(param_spec_);
* first instance of an object.
*/
PropertyBase(Glib::Object& object, GType value_type);
- ~PropertyBase();
+ ~PropertyBase() noexcept;
/**
* Checks if the property has already been installed.
{
}
-SignalProxyProperty::~SignalProxyProperty()
+SignalProxyProperty::~SignalProxyProperty() noexcept
{
}
friend class PropertyProxy_Base;
SignalProxyProperty(Glib::ObjectBase* obj, const gchar* property_name);
- ~SignalProxyProperty();
+ ~SignalProxyProperty() noexcept;
typedef sigc::slot<void> SlotType;
sigc::connection connect(const SlotType& sl);
: QueryQuark(g_quark_from_string(s))
{}
-Quark::~Quark()
+Quark::~Quark() noexcept
{}
QueryQuark(const GQuark& q);
QueryQuark(const ustring& s);
QueryQuark(const char*s);
- ~QueryQuark() {}
+ ~QueryQuark() noexcept {}
QueryQuark& operator=(const QueryQuark& q);
operator ustring() const;
public:
Quark(const ustring& s);
Quark(const char* s);
- ~Quark();
+ ~Quark() noexcept;
};
/** @relates Glib::QueryQuark */
gobject_ (g_rand_new_with_seed(seed))
{}
-Rand::~Rand()
+Rand::~Rand() noexcept
{
g_rand_free(gobject_);
}
public:
Rand();
explicit Rand(guint32 seed);
- ~Rand();
+ ~Rand() noexcept;
// noncopyable
Rand(const Rand&) = delete;
* 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.
+ * 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.
*
*
* Afterwards it will be null and use of -> will cause a segmentation fault.
*/
- inline RefPtr();
+ inline RefPtr() noexcept;
/// Destructor - decrements reference count.
- inline ~RefPtr();
+ inline ~RefPtr() noexcept;
/// For use only by the \::create() methods.
- explicit inline RefPtr(T_CppObject* pCppObject);
+ explicit inline RefPtr(T_CppObject* pCppObject) noexcept;
/** Copy constructor
*
* This increments the shared reference count.
*/
- inline RefPtr(const RefPtr& src);
+ inline RefPtr(const RefPtr& src) noexcept;
/** Move constructor
*/
- inline RefPtr(RefPtr&& src);
+ inline RefPtr(RefPtr&& src) noexcept;
/** Move constructor (from different, but castable type).
*/
template <class T_CastFrom>
- inline RefPtr(RefPtr<T_CastFrom>&& src);
+ inline RefPtr(RefPtr<T_CastFrom>&& src) noexcept;
/** Copy constructor (from different, but castable type).
*
* Increments the reference count.
*/
template <class T_CastFrom>
- inline RefPtr(const RefPtr<T_CastFrom>& src);
+ inline RefPtr(const RefPtr<T_CastFrom>& 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);
+ inline void swap(RefPtr& other) noexcept;
/// Copy from another RefPtr:
- inline RefPtr& operator=(const RefPtr& src);
+ inline RefPtr& operator=(const RefPtr& src) noexcept;
/// Move assignment operator:
- inline RefPtr& operator=(RefPtr&& src);
+ inline RefPtr& operator=(RefPtr&& src) noexcept;
/// Move assignment operator (from different, but castable type):
template <class T_CastFrom>
- inline RefPtr& operator=(RefPtr<T_CastFrom>&& src);
+ inline RefPtr& operator=(RefPtr<T_CastFrom>&& src) noexcept;
/** Copy from different, but castable type).
*
* Increments the reference count.
*/
template <class T_CastFrom>
- inline RefPtr& operator=(const RefPtr<T_CastFrom>& src);
+ inline RefPtr& operator=(const RefPtr<T_CastFrom>& src) noexcept;
/// Tests whether the RefPtr<> point to the same underlying instance.
- inline bool operator==(const RefPtr& src) const;
+ inline bool operator==(const RefPtr& src) const noexcept;
/// See operator==().
- inline bool operator!=(const RefPtr& src) const;
+ inline bool operator!=(const RefPtr& src) const noexcept;
/** Dereferencing.
*
* Use the methods of the underlying instance like so:
* <code>refptr->memberfun()</code>.
*/
- inline T_CppObject* operator->() const;
+ inline T_CppObject* operator->() const noexcept;
/** Test whether the RefPtr<> points to any underlying instance.
*
* do_something();
* @endcode
*/
- inline operator bool() const;
+ inline 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();
+ inline void clear() noexcept;
#endif //GLIBMM_DISABLE_DEPRECATED
/** Set underlying instance to 0, decrementing reference count of existing instance appropriately.
* @newin{2,16}
*/
- inline void reset();
+ inline void reset() noexcept;
/** Release the ownership of underlying instance.
*
* of the managed object. A legitimate use is if you immediately give RefPtr's
* reference to another object.
*/
- inline T_CppObject* release() G_GNUC_WARN_UNUSED_RESULT;
+ inline T_CppObject* release() noexcept G_GNUC_WARN_UNUSED_RESULT;
/** Dynamic cast to derived class.
*
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr cast_dynamic(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_dynamic(const RefPtr<T_CastFrom>& src) noexcept;
/** Static cast to derived class.
*
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr cast_static(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_static(const RefPtr<T_CastFrom>& src) noexcept;
/** Cast to non-const.
*
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr cast_const(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_const(const RefPtr<T_CastFrom>& src) noexcept;
//TODO: Maybe remove these if we replace operator bool() with operator const void* after
//an API/ABI break, as suggested by Daniel Elstner? murrayc.
* 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;
+ inline bool operator<(const RefPtr& src) const noexcept;
/// See operator<().
- inline bool operator<=(const RefPtr& src) const;
+ inline bool operator<=(const RefPtr& src) const noexcept;
/// See operator<().
- inline bool operator>(const RefPtr& src) const;
+ inline bool operator>(const RefPtr& src) const noexcept;
/// See operator<().
- inline bool operator>=(const RefPtr& src) const;
+ inline bool operator>=(const RefPtr& src) const noexcept;
private:
T_CppObject* pCppObject_;
// If it would come after them it wouldn't be inlined.
template <class T_CppObject> inline
-T_CppObject* RefPtr<T_CppObject>::operator->() const
+T_CppObject* RefPtr<T_CppObject>::operator->() const noexcept
{
return pCppObject_;
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr()
+RefPtr<T_CppObject>::RefPtr() noexcept
:
pCppObject_ (0)
{}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::~RefPtr()
+RefPtr<T_CppObject>::~RefPtr() noexcept
{
if(pCppObject_)
pCppObject_->unreference(); // This could cause pCppObject to be deleted.
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject)
+RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject) noexcept
:
pCppObject_ (pCppObject)
{}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(const RefPtr& src)
+RefPtr<T_CppObject>::RefPtr(const RefPtr& src) noexcept
:
pCppObject_ (src.pCppObject_)
{
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(RefPtr&& src)
+RefPtr<T_CppObject>::RefPtr(RefPtr&& src) noexcept
:
pCppObject_ (src.pCppObject_)
{
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src)
+RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src) noexcept
:
pCppObject_ (src.release())
{
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& 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
}
template <class T_CppObject> inline
-void RefPtr<T_CppObject>::swap(RefPtr& other)
+void RefPtr<T_CppObject>::swap(RefPtr& other) noexcept
{
T_CppObject *const temp = pCppObject_;
pCppObject_ = other.pCppObject_;
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src) noexcept
{
// In case you haven't seen the swap() technique to implement copy
// assignment before, here's what it does:
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src) noexcept
{
RefPtr<T_CppObject> temp (std::move(src));
this->swap(temp);
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src) noexcept
{
if (pCppObject_)
pCppObject_->unreference();
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src) noexcept
{
RefPtr<T_CppObject> temp (src);
this->swap(temp);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator==(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator==(const RefPtr& src) const noexcept
{
return (pCppObject_ == src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator!=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator!=(const RefPtr& src) const noexcept
{
return (pCppObject_ != src.pCppObject_);
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::operator bool() const
+RefPtr<T_CppObject>::operator bool() const noexcept
{
return (pCppObject_ != nullptr);
}
#ifndef GLIBMM_DISABLE_DEPRECATED
template <class T_CppObject> inline
-void RefPtr<T_CppObject>::clear()
+void RefPtr<T_CppObject>::clear() noexcept
{
reset();
}
#endif //GLIBMM_DISABLE_DEPRECATED
template <class T_CppObject> inline
-void RefPtr<T_CppObject>::reset()
+void RefPtr<T_CppObject>::reset() noexcept
{
RefPtr<T_CppObject> temp; // swap with an empty RefPtr<> to clear *this
this->swap(temp);
}
template <class T_CppObject> inline
-T_CppObject* RefPtr<T_CppObject>::release()
+T_CppObject* RefPtr<T_CppObject>::release() noexcept
{
T_CppObject *tmp = pCppObject_;
pCppObject_ = nullptr;
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src) noexcept
{
T_CppObject *const pCppObject = dynamic_cast<T_CppObject*>(src.operator->());
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src) noexcept
{
T_CppObject *const pCppObject = static_cast<T_CppObject*>(src.operator->());
template <class T_CppObject>
template <class T_CastFrom>
inline
-RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src)
+RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src) noexcept
{
T_CppObject *const pCppObject = const_cast<T_CppObject*>(src.operator->());
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator<(const RefPtr& src) const noexcept
{
return (pCppObject_ < src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator<=(const RefPtr& src) const noexcept
{
return (pCppObject_ <= src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator>(const RefPtr& src) const noexcept
{
return (pCppObject_ > src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const
+bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const noexcept
{
return (pCppObject_ >= src.pCppObject_);
}
/** @relates Glib::RefPtr */
template <class T_CppObject> inline
-void swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs)
+void swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs) noexcept
{
lhs.swap(rhs);
}
info_ (info)
{}
-SignalProxyNormal::~SignalProxyNormal()
+SignalProxyNormal::~SignalProxyNormal() noexcept
{}
sigc::slot_base&
(detail_name.empty() ? Glib::ustring() : ("::" + detail_name)))
{}
-SignalProxyDetailed::~SignalProxyDetailed()
+SignalProxyDetailed::~SignalProxyDetailed() noexcept
{}
sigc::slot_base&
// Copying clears the ownership flag of the source handle.
inline SListHandle(const SListHandle<T,Tr>& other);
- ~SListHandle();
+ ~SListHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
}
template <class T, class Tr>
-SListHandle<T,Tr>::~SListHandle()
+SListHandle<T,Tr>::~SListHandle() noexcept
{
if(ownership_ != Glib::OWNERSHIP_NONE)
{
get_flags_vfunc(); // initialize GIOChannel flag bits
}
-StreamIOChannel::~StreamIOChannel()
+StreamIOChannel::~StreamIOChannel() noexcept
{}
IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read)
class StreamIOChannel : public Glib::IOChannel
{
public:
- virtual ~StreamIOChannel();
+ virtual ~StreamIOChannel() noexcept;
static Glib::RefPtr<StreamIOChannel> create(std::istream& stream);
static Glib::RefPtr<StreamIOChannel> create(std::ostream& stream);
{
public:
SlotList();
- ~SlotList();
+ ~SlotList() noexcept;
// noncopyable
SlotList(const ThreadPool::SlotList&) = delete;
ThreadPool::SlotList::SlotList()
{}
-ThreadPool::SlotList::~SlotList()
+ThreadPool::SlotList::~SlotList() noexcept
{}
sigc::slot<void>* ThreadPool::SlotList::push(const sigc::slot<void>& slot)
}
}
-ThreadPool::~ThreadPool()
+ThreadPool::~ThreadPool() noexcept
{
if(gobject_)
g_thread_pool_free(gobject_, 1, 1);
* set to <tt>true</tt> and not all @a max_threads threads could be created.
*/
explicit ThreadPool(int max_threads = -1, bool exclusive = false);
- virtual ~ThreadPool();
+ virtual ~ThreadPool() noexcept;
//See http://bugzilla.gnome.org/show_bug.cgi?id=512348 about the sigc::trackable issue.
// TODO: At the next ABI break, consider changing const sigc::slot<void>& slot
gobject_ (g_timer_new())
{}
-Timer::~Timer()
+Timer::~Timer() noexcept
{
g_timer_destroy(gobject_);
}
* Also starts timing by calling start() implicitly.
*/
Timer();
- ~Timer();
+ ~Timer() noexcept;
// not copyable
Timer(const Timer&) = delete;
string_ (src)
{}
-ustring::~ustring()
+ustring::~ustring() noexcept
{}
void ustring::swap(ustring& other)
stream_ ()
{}
-ustring::FormatStream::~FormatStream()
+ustring::FormatStream::~FormatStream() noexcept
{}
ustring ustring::FormatStream::to_string() const
*/
ustring();
- ~ustring();
+ ~ustring() noexcept;
/*! Construct a ustring as a copy of another ustring.
* @param other A source string.
public:
FormatStream();
- ~FormatStream();
+ ~FormatStream() noexcept;
template <class T> inline void stream(const T& value);
public:
ScopedPtr() : ptr_ (0) {}
explicit ScopedPtr(T* ptr) : ptr_ (ptr) {}
- ~ScopedPtr() { g_free(ptr_); }
+ ~ScopedPtr() noexcept { g_free(ptr_); }
T* get() const { return ptr_; }
T** addr() { return &ptr_; }
};
return *this;
}
-ValueBase::~ValueBase()
+ValueBase::~ValueBase() noexcept
{
g_value_unset(&gobject_);
}
ValueBase(const ValueBase& other);
ValueBase& operator=(const ValueBase& other);
- ~ValueBase();
+ ~ValueBase() noexcept;
/** Setup the GValue for storing the specified @a type.
* The contents will be initialized to the default value for this type.
*/
explicit inline ArrayKeeper(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayKeeper(const ArrayKeeper& keeper);
- ~ArrayKeeper();
+ ~ArrayKeeper() noexcept;
/** Gets data the keeper holds.
*
*/
explicit inline GListKeeper(const GList* glist, Glib::OwnershipType ownership);
inline GListKeeper(const GListKeeper& keeper);
- ~GListKeeper();
+ ~GListKeeper() noexcept;
/** Gets data the keeper holds.
*
*/
explicit inline GSListKeeper(const GSList* gslist, Glib::OwnershipType ownership);
inline GSListKeeper(const GSListKeeper& keeper);
- ~GSListKeeper();
+ ~GSListKeeper() noexcept;
/** Gets data the keeper holds.
*
}
template <typename Tr>
-ArrayKeeper<Tr>::~ArrayKeeper()
+ArrayKeeper<Tr>::~ArrayKeeper() noexcept
{
if(array_ && ownership_ != Glib::OWNERSHIP_NONE)
{
}
template <typename Tr>
-GListKeeper<Tr>::~GListKeeper()
+GListKeeper<Tr>::~GListKeeper() noexcept
{
typedef typename Tr::CTypeNonConst CTypeNonConst;
}
template <typename Tr>
-GSListKeeper<Tr>::~GSListKeeper()
+GSListKeeper<Tr>::~GSListKeeper() noexcept
{
typedef typename Tr::CTypeNonConst CTypeNonConst;
if(gslist_ && ownership_ != Glib::OWNERSHIP_NONE)
gobject_ = g_tree_new_full(on_compare_tree, &key_compare_slot, on_destroy_key, on_destroy_value);
}
+ //TODO: Add move operations, being careful of universal references and overload resolution.
+
public:
static Glib::RefPtr< BalancedTree<K, V> > create()
{
*
* @newin{2,36}
*/
-class ByteArray
+class ByteArray final
{
_CLASS_OPAQUE_REFCOUNTED(ByteArray, GByteArray, NONE, g_byte_array_ref, g_byte_array_unref)
_IGNORE(g_byte_array_ref, g_byte_array_unref)
*
* @newin{2,34}
*/
-class Bytes
+class Bytes final
{
_CLASS_OPAQUE_REFCOUNTED(Bytes, GBytes, NONE, g_bytes_ref, g_bytes_unref)
_IGNORE(g_bytes_ref, g_bytes_unref)
IConv(const std::string& to_codeset, const std::string& from_codeset);
_IGNORE(g_iconv_open)
+ IConv(const IConv&) = delete;
+ IConv& operator=(const IConv&) = delete;
+
explicit IConv(GIConv gobject);
/** Close conversion descriptor.
private:
GIConv gobject_;
-
- // noncopyable
- IConv(const IConv&);
- IConv& operator=(const IConv&);
};
explicit Dir(GDir* gobject);
#endif
+ Dir(const Dir&) = delete;
+ Dir& operator=(const Dir&) = delete;
+
/** Closes the directory and deallocates all related resources.
*/
~Dir();
private:
GDir* gobject_;
-
- // noncopyable
- Dir(const Dir&);
- Dir& operator=(const Dir&);
};
reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = this;
}
+IOChannel::IOChannel(IOChannel&& other) noexcept
+: sigc::trackable(std::move(other)),
+ gobject_(std::move(other.gobject_))
+{
+ other.gobject_ = nullptr;
+}
+
+IOChannel& IOChannel::operator=(IOChannel&& other) noexcept
+{
+ sigc::trackable::operator=(std::move(other));
+
+ release_gobject();
+
+ gobject_ = std::move(other.gobject_);
+ other.gobject_ = nullptr;
+
+ return *this;
+}
+
/* Construct an IOChannel wrapper for an already created GIOChannel.
* See the comment at the top of this file for an explanation of the
* problems with this approach.
g_io_channel_ref(gobject_);
}
-IOChannel::~IOChannel()
+void IOChannel::release_gobject()
{
if(gobject_)
{
}
}
+IOChannel::~IOChannel()
+{
+ release_gobject();
+}
+
Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode)
{
GError* gerror = nullptr;
{
_CLASS_GENERIC(IOChannel, GIOChannel)
+ IOChannel(IOChannel&& other) noexcept;
+ IOChannel& operator=(IOChannel&& other) noexcept;
+
dnl // We can't support get_fd() properly because it is impossible
dnl // to detect the specific GIOChannel type at runtime.
_IGNORE(g_io_channel_unix_get_fd, g_io_channel_win32_get_fd)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
friend class Glib::GlibmmIOChannel;
#endif
+
+private:
+ void release_gobject();
};
Glib::RefPtr<IOChannel> wrap(GIOChannel* gobject, bool take_copy = false);
owns_gobject_ = takes_ownership;
}
+KeyFile::KeyFile(KeyFile&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+ owns_gobject_(std::move(other.owns_gobject_))
+{
+ other.gobject_ = nullptr;
+ other.owns_gobject_ = false;
+}
+
+KeyFile& KeyFile::operator=(KeyFile&& other) noexcept
+{
+ if (owns_gobject_)
+ g_key_file_free(gobject_);
+
+ gobject_ = std::move(other.gobject_);
+ owns_gobject_ = std::move(other.owns_gobject_);
+
+ other.gobject_ = nullptr;
+ other.owns_gobject_ = false;
+
+ return *this;
+}
+
KeyFile::~KeyFile()
{
if (owns_gobject_)
*/
KeyFile();
+ KeyFile(const KeyFile&) = delete;
+ KeyFile& operator=(const KeyFile&) = delete;
+
+ KeyFile(KeyFile&& other) noexcept;
+ KeyFile& operator=(KeyFile&& other) noexcept;
+
/** Destructor
*/
~KeyFile();
protected:
GKeyFile* gobject_;
bool owns_gobject_;
-
-private:
- // noncopyable
- KeyFile(const KeyFile&);
- KeyFile& operator=(const KeyFile&);
};
} // namespace Glib
Parser::Parser()
{}
+Parser::Parser(Parser&& other) noexcept
+: sigc::trackable(std::move(other))
+{
+}
+
+Parser& Parser::operator=(Parser&& other) noexcept
+{
+ sigc::trackable::operator=(std::move(other));
+ return *this;
+}
+
Parser::~Parser()
{}
this, &ParseContext::destroy_notify_callback))
{}
+ParseContext::ParseContext(ParseContext&& other) noexcept
+: sigc::trackable(std::move(other)),
+ parser_(std::move(other.parser_)),
+ gobject_(std::move(other.gobject_))
+{
+}
+
+ParseContext& ParseContext::operator=(ParseContext&& other) noexcept
+{
+ sigc::trackable::operator=(std::move(other));
+
+ parser_ = std::move(other.parser_);
+ gobject_ = std::move(other.gobject_);
+
+ other.parser_ = nullptr;
+ other.gobject_ = nullptr;
+
+ return *this;
+}
+
ParseContext::~ParseContext()
{
parser_ = nullptr;
*/
Parser();
+ Parser(const Parser&) = delete;
+ Parser& operator=(const Parser&) = delete;
+
+ Parser(Parser&& other) noexcept;
+ Parser& operator=(Parser&& other) noexcept;
+
/** Called for open tags <tt>\<foo bar="baz"\></tt>.
* This virtual method is invoked when the opening tag of an element is seen.
* @param context The Markup::ParseContext object the parsed data belongs to.
virtual void on_error(ParseContext& context, const MarkupError& error);
private:
- // noncopyable
- Parser(const Parser&);
- Parser& operator=(const Parser&);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
friend class Glib::Markup::ParserCallbacks;
* @param flags Bitwise combination of Markup::ParseFlags.
*/
explicit ParseContext(Parser& parser, ParseFlags flags = ParseFlags(0));
+
+ ParseContext(const ParseContext&) = delete;
+ ParseContext& operator=(const ParseContext&) = delete;
+
+ ParseContext(ParseContext&& other) noexcept;
+ ParseContext& operator=(ParseContext&& other) noexcept;
+
virtual ~ParseContext();
/** Feed some data to the ParseContext.
Markup::Parser* parser_;
GMarkupParseContext* gobject_;
- // noncopyable
- ParseContext(const ParseContext&);
- ParseContext& operator=(const ParseContext&);
-
static void destroy_notify_callback(void* data);
};
gobject_ (g_module_open(file_name.c_str(), (GModuleFlags) flags))
{}
+Module::Module(Module&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+ other.gobject_ = nullptr;
+}
+
+Module& Module::operator=(Module&& other) noexcept
+{
+ if(gobject_)
+ g_module_close(gobject_);
+
+ gobject_ = std::move(other.gobject_);
+ other.gobject_ = nullptr;
+
+ return *this;
+}
+
Module::~Module()
{
if(gobject_)
*/
explicit Module(const std::string& file_name, ModuleFlags flags = ModuleFlags(0));
+ Module(const Module&) = delete;
+ Module& operator=(const Module&) = delete;
+
+ Module(Module&& other) noexcept;
+ Module& operator=(Module&& other) noexcept;
+
/** Close a module. The module will be removed from memory, unless
* <tt>make_resident</tt> has been called.
*/
protected:
GModule* gobject_;
-
-private:
- // noncopyable
- Module(const Module&);
- Module& operator=(const Module&);
};
} // namespace Glib
clone(&node);
}
+ //TODO: Add move operations, being careful of universal references and overload resolution.
+
/** Removes the instance and its children from the tree,
* freeing any memory allocated.
*/
{
}
+OptionContext::OptionContext(OptionContext&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+ has_ownership_(std::move(other.has_ownership_))
+{
+ other.gobject_ = nullptr;
+ other.has_ownership_ = false;
+}
+
+OptionContext& OptionContext::operator=(OptionContext&& other) noexcept
+{
+ if(has_ownership_)
+ g_option_context_free(gobj());
+
+ gobject_ = std::move(other.gobject_);
+ has_ownership_ = std::move(other.has_ownership_);
+
+ other.gobject_ = nullptr;
+ other.has_ownership_ = false;
+
+ return *this;
+}
+
OptionContext::~OptionContext()
{
if(has_ownership_)
//Note that, unlike Glib::Wrap(), this would create a second C++ instance for the same C instance,u
//so it should be used carefully. For instance you could not access data in a derived class via this second instance.
explicit OptionContext(GOptionContext* castitem, bool take_ownership = false);
+
+ //TODO?:
+ //OptionContext(const OptionContext& other) = delete;
+ //OptionContext& operator=(const OptionContext& other) = delete;
+
+ OptionContext(OptionContext&& other) noexcept;
+ OptionContext& operator=(OptionContext&& other) noexcept;
+
virtual ~OptionContext();
_WRAP_METHOD(void set_help_enabled(bool help_enabled = true), g_option_context_set_help_enabled)
OptionEntry::~OptionEntry()
{
+ release_gobject();
+}
+
+void OptionEntry::release_gobject() noexcept
+{
+ if(!gobject_)
+ return;
+
g_free(const_cast<char*>(gobject_->long_name));
g_free(const_cast<char*>(gobject_->description));
g_free(const_cast<char*>(gobject_->arg_description));
return *this;
}
+OptionEntry::OptionEntry(OptionEntry&& other) noexcept
+: gobject_(std::move(other.gobject_))
+{
+ other.gobject_ = nullptr;
+}
+
+OptionEntry& OptionEntry::operator=(OptionEntry&& other) noexcept
+{
+ release_gobject();
+
+ gobject_ = std::move(other.gobject_);
+ other.gobject_ = nullptr;
+
+ return *this;
+}
+
void OptionEntry::set_long_name(const Glib::ustring& value)
{
if(gobject_->long_name)
OptionEntry();
OptionEntry(const OptionEntry& src);
+
+ OptionEntry(OptionEntry&& other) noexcept;
+ OptionEntry& operator=(OptionEntry&& other) noexcept;
+
virtual ~OptionEntry();
OptionEntry& operator=(const OptionEntry& src);
GOptionEntry* gobj() { return gobject_; }
const GOptionEntry* gobj() const { return gobject_; }
+private:
+ void release_gobject() noexcept;
+
protected:
GOptionEntry* gobject_;
//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()
+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
{
//Free any C types that were allocated during add_entry():
for(auto& the_pair : map_entries_)
cpp_entry.release_c_arg();
}
- if(has_ownership_)
+ if(has_ownership_ && gobject_)
{
g_option_group_unref(gobj());
gobject_ = nullptr;
}
}
+OptionGroup::~OptionGroup()
+{
+ release_gobject();
+}
+
void OptionGroup::add_entry(const OptionEntry& entry)
{
//It does not copy the entry, so it needs to live as long as the group.
explicit OptionGroup(GOptionGroup* castitem);
_IGNORE(g_option_group_new, g_option_group_ref)
+ OptionGroup(OptionGroup&& other) noexcept;
+ OptionGroup& operator=(OptionGroup&& other) noexcept;
+
virtual ~OptionGroup();
_IGNORE(g_option_group_free, g_option_group_unref)
GOptionGroup* gobject_;
bool has_ownership_; //Whether the gobject_ belongs to this C++ instance.
#endif //DOXYGEN_SHOULD_SKIP_THIS
+
+private:
+ void release_gobject() noexcept;
};
} // namespace Glib
{
}
+
+MatchInfo::MatchInfo(MatchInfo&& other) noexcept
+: gobject_(std::move(other.gobject_)),
+ take_ownership(std::move(other.take_ownership))
+{
+ other.gobject_ = nullptr;
+ other.take_ownership = false;
+}
+
+MatchInfo& MatchInfo::operator=(MatchInfo&& other) noexcept
+{
+ if(take_ownership && gobject_)
+ g_match_info_free(gobject_);
+
+ gobject_ = std::move(other.gobject_);
+ take_ownership = std::move(other.take_ownership);
+
+ other.gobject_ = nullptr;
+ other.take_ownership = false;
+
+ return *this;
+}
+
void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_the_ownership)
{
if(gobject_ && this->take_ownership)
*
* @newin{2,14}
*/
-class Regex
+class Regex final
{
_CLASS_OPAQUE_REFCOUNTED(Regex, GRegex, NONE, g_regex_ref, g_regex_unref)
_IGNORE(g_regex_ref, g_regex_unref)
*/
explicit MatchInfo(GMatchInfo* castitem, bool take_the_ownership = true); //TODO: Rename to take_ownership when we can rename the member variable.
+ MatchInfo(const MatchInfo& other) = delete;
+ MatchInfo& operator=(const MatchInfo& other) = delete;
+
+ MatchInfo(MatchInfo&& other) noexcept;
+ MatchInfo& operator=(MatchInfo&& other) noexcept;
+
/// Destructor.
virtual ~MatchInfo();
{ return reinterpret_cast<GMatchInfo*>(gobject_); }
private:
-// noncopyable
- MatchInfo(const MatchInfo& other);
- MatchInfo& operator=(const MatchInfo& other);
friend class Regex;
class SignalProxyNormal : public SignalProxyBase
{
public:
- ~SignalProxyNormal();
+ ~SignalProxyNormal() noexcept;
/// Stops the current signal emission (not in libsigc++)
void emission_stop();
class SignalProxyDetailed : public SignalProxyBase
{
public:
- ~SignalProxyDetailed();
+ ~SignalProxyDetailed() noexcept;
/// Stops the current signal emission (not in libsigc++)
void emission_stop();
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.
// Glib::Thread can neither be constructed nor deleted.
Thread();
void operator delete(void*, std::size_t);
-
- // noncopyable
- Thread(const Thread&);
- Thread& operator=(const Thread&);
};
/** %Exception class used to exit from a thread.
class Lock;
Mutex();
+
+ Mutex(const Mutex&) = delete;
+ Mutex& operator=(const Mutex&) = delete;
+
~Mutex();
/** Locks the mutex.
private:
GMutex* gobject_;
-
- // noncopyable
- Mutex(const Mutex&);
- Mutex& operator=(const Mutex&);
};
/** Utility class for exception-safe mutex locking.
Mutex& mutex_;
bool locked_;
- // noncopyable
- Lock(const Mutex::Lock&);
- Mutex::Lock& operator=(const Mutex::Lock&);
+
};
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();
private:
RecMutex& mutex_;
bool locked_;
-
- // noncopyable
- Lock(const RecMutex::Lock&);
- RecMutex::Lock& operator=(const RecMutex::Lock&);
};
class WriterLock;
RWLock();
- ~RWLock();
-private:
- // noncopyable
- RWLock(const RWLock&);
- RWLock& operator=(const RWLock&);
+ RWLock(const RWLock&) = delete;
+ RWLock& operator=(const RWLock&) = delete;
+
+ ~RWLock();
};
/** Utility class for exception-safe locking of read/write locks.
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();
private:
RWLock& rwlock_;
bool locked_;
-
- // noncopyable
- ReaderLock(const RWLock::ReaderLock&);
- RWLock::ReaderLock& operator=(const RWLock::ReaderLock&);
};
/** Utility class for exception-safe locking of read/write locks.
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();
private:
RWLock& rwlock_;
bool locked_;
-
- // noncopyable
- WriterLock(const RWLock::WriterLock&);
- RWLock::WriterLock& operator=(const RWLock::WriterLock&);
};
/** An opaque data structure to represent a condition.
{
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.
private:
GCond* gobject_;
-
- // noncopyable
- Cond(const Cond&);
- Cond& operator=(const Cond&);
};
class Private
{
public:
+
+ Private(const Private<T>&) = delete;
+ Private<T>& operator=(const Private<T>&) = delete;
+
typedef void (*DestructorFunc) (void*);
static void delete_ptr(void* data);
private:
GPrivate* gobject_;
-
- // noncopyable
- Private(const Private<T>&);
- Private<T>& operator=(const Private<T>&);
};
/** @} group Threads */
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.
// Glib::Thread can neither be constructed nor deleted.
Thread();
void operator delete(void*, std::size_t);
-
- // noncopyable
- Thread(const Thread&);
- Thread& operator=(const Thread&);
};
/** %Exception class used to exit from a thread.
class Lock;
Mutex();
+
+ Mutex(const Mutex&) = delete;
+ Mutex& operator=(const Mutex&) = delete;
+
~Mutex();
/** Locks the mutex.
private:
GMutex gobject_;
-
- // noncopyable
- Mutex(const Mutex&);
- Mutex& operator=(const Mutex&);
};
/** Utility class for exception-safe mutex locking.
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();
private:
Mutex& mutex_;
bool locked_;
-
- // noncopyable
- Lock(const Mutex::Lock&);
- Mutex::Lock& operator=(const Mutex::Lock&);
};
/** A C++ wrapper for the C object.
class Lock;
RecMutex();
+
+ RecMutex(const RecMutex&) = delete;
+ RecMutex& operator=(const RecMutex&) = delete;
+
~RecMutex();
void lock();
GRecMutex* gobj() { return &gobject_; }
private:
- // noncopyable
- RecMutex(const RecMutex&);
- RecMutex& operator=(const RecMutex&);
-
GRecMutex gobject_;
};
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();
private:
RecMutex& mutex_;
bool locked_;
-
- // noncopyable
- Lock(const RecMutex::Lock&);
- RecMutex::Lock& operator=(const RecMutex::Lock&);
};
/** A C++ wrapper for the C object.
class WriterLock;
RWLock();
+
+ RWLock(const RWLock&) = delete;
+ RWLock& operator=(const RWLock&) = delete;
+
~RWLock();
void reader_lock();
GRWLock* gobj() { return &gobject_; }
private:
- // noncopyable
- RWLock(const RWLock&);
- RWLock& operator=(const RWLock&);
-
GRWLock gobject_;
};
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();
private:
RWLock& rwlock_;
bool locked_;
-
- // noncopyable
- ReaderLock(const RWLock::ReaderLock&);
- RWLock::ReaderLock& operator=(const RWLock::ReaderLock&);
};
/** Utility class for exception-safe locking of read/write locks.
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();
private:
RWLock& rwlock_;
bool locked_;
-
- // noncopyable
- WriterLock(const RWLock::WriterLock&);
- RWLock::WriterLock& operator=(const RWLock::WriterLock&);
};
/** An opaque data structure to represent a condition.
{
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.
private:
GCond gobject_;
-
- // noncopyable
- Cond(const Cond&);
- Cond& operator=(const Cond&);
};
/** Thread-local data pointer.
class Private
{
public:
+ Private(const Private<T>&) = delete;
+ Private<T>& operator=(const Private<T>&) = delete;
+
typedef void (*DestructorFunc) (void*);
/** Deletes static_cast<T*>(data)
private:
GPrivate gobject_;
-
- // noncopyable
- Private(const Private<T>&);
- Private<T>& operator=(const Private<T>&);
};
/** @} group Threads */
*
* newin{2,40}
*/
-class VariantDict
+class VariantDict final
{
//GVariantDict is registered as a boxed type, but it has ref/unref functions instead of copy/free,
//so we use it via RefPtr.
glibmm_date/test \
glibmm_buildfilename/test \
glibmm_interface_implementation/test \
+ glibmm_interface_move/test \
glibmm_mainloop/test \
glibmm_nodetree/test \
+ glibmm_object_move/test \
+ glibmm_objectbase_move/test \
glibmm_ustring_compose/test \
glibmm_ustring_format/test \
glibmm_value/test \
glibmm_interface_implementation_test_SOURCES = glibmm_interface_implementation/main.cc
glibmm_interface_implementation_test_LDADD = $(giomm_ldadd)
+glibmm_interface_move_test_SOURCES = glibmm_interface_move/main.cc
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_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
--- /dev/null
+#include <glibmm.h>
+#include <glibmm/private/interface_p.h>
+#include <glibmm/private/object_p.h>
+#include <iostream>
+#include <stdlib.h>
+
+//A basic derived GInterface, just to test Glib::Interface
+
+G_DECLARE_INTERFACE (TestIface, test_Iface, TEST, IFACE, GObject)
+
+struct _TestIface
+{
+ GTypeInterface g_iface;
+};
+
+static void
+test_Iface_init (gpointer)
+{}
+
+GType
+test_Iface_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (TestIface), /* class_size */
+ test_Iface_init, /* base_init */
+ 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE, "TestIface",
+ &info, GTypeFlags(0));
+ }
+
+ return type;
+}
+
+#define TEST_TYPE_IFACE (test_Iface_get_type ())
+
+
+//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_EXTENDED(TestDerived, test_derived, G_TYPE_OBJECT,
+ 0, G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE,
+ test_Iface_init))
+
+class TestInterface;
+
+class TestInterface_Class : public Glib::Interface_Class
+{
+public:
+ typedef TestInterface BaseClassType;
+
+ friend class TestInterface;
+
+ const Glib::Interface_Class& init()
+ {
+ if(!gtype_) // create the GType if necessary
+ {
+ // Glib::Interface_Class has to know the interface init function
+ // in order to add interfaces to implementing types.
+ class_init_func_ = &TestInterface_Class::iface_init_function;
+
+ // We can not derive from another interface, and it is not necessary anyway.
+ gtype_ = test_Iface_get_type();
+ }
+
+ return *this;
+ }
+
+ static void iface_init_function(void* /* g_iface */, void* /* iface_data */)
+ {
+ }
+
+ //static Glib::ObjectBase* wrap_new(GObject*);
+};
+
+class TestInterface : public Glib::Interface
+{
+protected:
+ typedef TestInterface_Class CppClassType;
+
+ TestInterface()
+ : Glib::Interface(derived_interface_class_.init())
+ {}
+
+public:
+ //A real application would never make the constructor public.
+ //It would instead have a protectd constructor and a public create() method.
+ TestInterface(GObject* gobject, int i)
+ : Glib::Interface(gobject),
+ i_(i)
+ {
+ }
+
+ static void add_interface(GType gtype_implementer)
+ {
+ derived_interface_class_.init().add_interface(gtype_implementer);
+ }
+
+ TestInterface(const TestInterface& src) = delete;
+ TestInterface& operator=(const TestInterface& src) = delete;
+
+ TestInterface(TestInterface&& src) noexcept
+ : Glib::Interface(std::move(src)),
+ i_(std::move(src.i_))
+ {}
+
+ TestInterface& operator=(TestInterface&& src) noexcept
+ {
+ Glib::Interface::operator=(std::move(src));
+ i_ = std::move(src.i_);
+
+ return *this;
+ }
+
+ int i_;
+
+private:
+ friend class TestInterface_Class;
+ static CppClassType derived_interface_class_;
+};
+
+class DerivedObject_Class : public Glib::Class
+{
+public:
+ typedef GObjectClass BaseClassType;
+ typedef Glib::Object_Class CppClassParent;
+
+ static void class_init_function(void* g_class, void* class_data)
+ {
+ const auto klass = static_cast<BaseClassType*>(g_class);
+ CppClassParent::class_init_function(klass, class_data);
+ }
+
+ const Glib::Class& init()
+ {
+ if(!gtype_) // create the GType if necessary
+ {
+ // Glib::Class has to know the class init function to clone custom types.
+ class_init_func_ = &DerivedObject_Class::class_init_function;
+
+ // This is actually just optimized away, apparently with no harm.
+ // Make sure that the parent type has been created.
+ //CppClassParent::CppObjectType::get_type();
+
+ // Create the wrapper type, with the same class/instance size as the base type.
+ register_derived_type(test_derived_get_type());
+
+ // Add derived versions of interfaces, if the C type implements any interfaces:
+ TestInterface::add_interface(get_type());
+ }
+
+ return *this;
+ }
+};
+
+TestInterface::CppClassType TestInterface::derived_interface_class_; // initialize static member
+
+class DerivedObject
+: public Glib::Object,
+ public TestInterface
+{
+public:
+ typedef DerivedObject_Class CppClassType;
+
+ //A real application would never make the constructor public.
+ //It would instead have a protected constructor and a public create() method.
+ DerivedObject(int i)
+ : Glib::ObjectBase(0),
+ Glib::Object(Glib::ConstructParams(derived_object_class_.init())),
+ i_(i)
+ {
+ }
+
+ DerivedObject(const DerivedObject& src) = delete;
+ DerivedObject& operator=(const DerivedObject& src) = delete;
+
+ DerivedObject(DerivedObject&& src) noexcept
+ : Glib::Object(std::move(src)),
+ TestInterface(std::move(src)),
+ i_(std::move(src.i_))
+ {}
+
+ DerivedObject& operator=(DerivedObject&& src) noexcept
+ {
+ Glib::Object::operator=(std::move(src));
+ TestInterface::operator=(std::move(src));
+ i_ = std::move(src.i_);
+
+ return *this;
+ }
+
+ int i_;
+
+private:
+ friend class DerivedObject_Class;
+ static CppClassType derived_object_class_;
+};
+
+DerivedObject::CppClassType DerivedObject::derived_object_class_; // initialize static member
+
+/* TODO: Shouldn't this work too?
+static
+void test_interface_move_constructor()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ TestInterface derived(gobject, 5);
+ std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ TestInterface derived2(std::move(derived));
+ g_assert_cmpint(derived2.i_, ==, 5);
+ std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_interface_move_assignment_operator()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ TestInterface derived(gobject, 5);
+ //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ TestInterface derived2 = std::move(derived);
+ g_assert_cmpint(derived2.i_, ==, 5);
+ //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+*/
+
+
+static
+void test_object_with_interface_move_constructor()
+{
+ DerivedObject derived(5);
+ g_assert_cmpint(derived.i_, ==, 5);
+ GObject *gobject = derived.gobj();
+ g_assert(derived.gobj() == gobject);
+ DerivedObject derived2(std::move(derived));
+ g_assert_cmpint(derived2.i_, ==, 5);
+ g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_object_with_interface_move_assignment_operator()
+{
+ DerivedObject derived(5);
+ g_assert_cmpint(derived.i_, ==, 5);
+ GObject *gobject = derived.gobj();
+ g_assert(derived.gobj() == gobject);
+ DerivedObject derived2 = std::move(derived);
+ g_assert_cmpint(derived2.i_, ==, 5);
+ g_assert(derived2.gobj() == gobject);
+}
+
+
+int main(int, char**)
+{
+ Glib::init();
+
+ //test_interface_move_constructor();
+ //test_interface_move_assignment_operator();
+
+ test_object_with_interface_move_constructor();
+ test_object_with_interface_move_assignment_operator();
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+#include <glibmm.h>
+#include <iostream>
+#include <stdlib.h>
+
+//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 DerivedObject : public Glib::Object
+{
+public:
+ //A real application would never make the constructor public.
+ //It would instead have a protectd 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()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ DerivedObject derived(gobject, 5);
+ std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ DerivedObject derived2(std::move(derived));
+ g_assert_cmpint(derived2.i_, ==, 5);
+ std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+
+
+static
+void test_object_move_assignment_operator()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ DerivedObject derived(gobject, 5);
+ //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ DerivedObject derived2 = std::move(derived);
+ g_assert_cmpint(derived2.i_, ==, 5);
+ //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+
+
+int main(int, char**)
+{
+ Glib::init();
+
+ test_object_move_constructor();
+ test_object_move_assignment_operator();
+
+ return EXIT_SUCCESS;
+}
--- /dev/null
+#include <glibmm.h>
+#include <iostream>
+#include <stdlib.h>
+
+//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 protectd 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_))
+ {}
+
+ 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()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ DerivedObjectBase derived(gobject, 5);
+ //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ DerivedObjectBase derived2(std::move(derived));
+ g_assert_cmpint(derived2.i_, ==, 5);
+ //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+
+static
+void test_objectbase_move_assignment_operator()
+{
+ GObject *gobject = G_OBJECT(g_object_new(TEST_TYPE_DERIVED, nullptr));
+ g_object_ref(gobject);
+
+ DerivedObjectBase derived(gobject, 5);
+ //std::cout << "debug: gobj(): " << derived.gobj() << std::endl;
+ g_assert(derived.gobj() == gobject);
+ DerivedObjectBase derived2 = std::move(derived);
+ g_assert_cmpint(derived2.i_, ==, 5);
+ //std::cout << "debug: gobj(): " << derived2.gobj() << std::endl;
+ g_assert(derived2.gobj() == gobject);
+}
+
+int main(int, char**)
+{
+ Glib::init();
+
+ test_objectbase_move_constructor();
+ test_objectbase_move_assignment_operator();
+
+ return EXIT_SUCCESS;
+}
_NEW_SECTION(SECTION_CC) dnl section for methods (in current namespace)
_NEW_SECTION(SECTION_CC_IMPLEMENTS_INTERFACES) dnl Calls SomeBaseInterface::add_interface(get_type()).
+_NEW_SECTION(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES) dnl Calls the base constructors
+_NEW_SECTION(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES) dnl Calls the base move assignment operator
dnl Virtual Functions and Default Signal Handlers (Very similar)
_NEW_SECTION(SECTION_H_VFUNCS) dnl Declaration of vfunc hooks.
* @param lhs The left-hand side
* @param rhs The right-hand side
*/
-inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs)
+inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
{ lhs.swap(rhs); }
__NAMESPACE_END__
return *this;
}
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::~__CPPNAME__`'() noexcept
{
dnl This could be a free or an unref, we do not need to know.
if(gobject_)
__CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
_IMPORT(SECTION_DTOR_DOCUMENTATION)
- ~__CPPNAME__`'();
+ ~__CPPNAME__`'() noexcept;
void swap(__CPPNAME__& other) noexcept;
dnl The implementation:
dnl
+__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other) noexcept
+:
+ gobject_(other.gobject_)
+{
+}
+
+__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other) noexcept
+{
+ gobject_ = other.gobject_;
+ return *this;
+}
+
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
+:
+ gobject_(std::move(other.gobject_))
+{
+ //We could wipe other.gobject_ via memset,
+ //but that is not really necessary:
+ //other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
+{
+ gobject_ = std::move(other.gobject_);
+ return *this;
+}
+
dnl // static
dnl const __CNAME__ __CPPNAME__::gobject_initializer_ = { 0, };
dnl
typedef __CNAME__ BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+ __CPPNAME__`'(const __CPPNAME__& other) noexcept;
+ __CPPNAME__& operator=(const __CPPNAME__& other) noexcept;
+
+ __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
+
/** Get the GType for this class, for use with the underlying GObject type system.
*/
static GType get_type() G_GNUC_CONST;
')dnl
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
+: __CPPPARENT__`'(std::move(src))
+_IMPORT(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
+{}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
+{
+ __CPPPARENT__::operator=`'(std::move(src));
+_IMPORT(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
+ return *this;
+}
+
ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
',`dnl
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::~__CPPNAME__`'() noexcept
{}
')dnl
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
+
+ __CPPNAME__`'(__CPPNAME__&& src) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
- virtual ~__CPPNAME__`'();
+ virtual ~__CPPNAME__`'() noexcept;
/** Get the GType for this class, for use with the underlying GObject type system.
*/
{
}
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept
+: __CPPPARENT__`'(std::move(src))
+{}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__&& src) noexcept
+{
+ __CPPPARENT__::operator=`'(std::move(src));
+ return *this;
+}
+
+__CPPNAME__::~__CPPNAME__`'() noexcept
{}
// static
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
+
+ __CPPNAME__`'(__CPPNAME__&& src) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& src) noexcept;
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
- virtual ~__CPPNAME__`'();
+ virtual ~__CPPNAME__`'() noexcept;
static void add_interface(GType gtype_implementer);
_SECTION(SECTION_HEADER3)
+__NAMESPACE_BEGIN__
+
+/** @relates __NAMESPACE__::__CPPNAME__
+ * @param lhs The left-hand side
+ * @param rhs The right-hand side
+ */
+inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs) noexcept
+ { lhs.swap(rhs); }
+
+__NAMESPACE_END__
+
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
}
')dnl
-__CPPNAME__::~__CPPNAME__`'()
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
+:
+ gobject_(other.gobject_)
+{
+ other.gobject_ = nullptr;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other) noexcept
+{
+ __CPPNAME__ temp (other);
+ swap(temp);
+ return *this;
+}
+
+__CPPNAME__::~__CPPNAME__`'() noexcept
{
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
}
+void __CPPNAME__::swap(__CPPNAME__& other) noexcept
+{
+ __CNAME__ *const temp = gobject_;
+ gobject_ = other.gobject_;
+ other.gobject_ = temp;
+}
+
__CNAME__* __CPPNAME__::gobj_copy() const
{
return __OPAQUE_FUNC_COPY`'(gobject_);
__CPPNAME__`'(const __CPPNAME__& src);
__CPPNAME__& operator=(const __CPPNAME__& src);
+ __CPPNAME__`'(__CPPNAME__&& other) noexcept;
+ __CPPNAME__& operator=(__CPPNAME__&& other) noexcept;
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
- ~__CPPNAME__`'();
+ ~__CPPNAME__`'() noexcept;
+
+ void swap(__CPPNAME__& other) noexcept;
__CNAME__* gobj() { return gobject_; }
const __CNAME__* gobj() const { return gobject_; }
* wrap it dynamically either.
*
* The cast works because __CPPNAME__ does not have any member data, and
- * it is impossible to derive from it. This is ensured by not implementing
- * the (protected) default constructor. The ctor is protected rather than
- * private just to avoid a compile warning.
+ * it is impossible to derive from it. This is ensured by using final on the
+ * class and by using = delete on the default constructor.
*/
namespace Glib
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
__CNAME__* gobj_copy() const;
-protected:
- // Do not derive this. __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
- __CPPNAME__`'();
- void operator delete(void*, std::size_t);
+ __CPPNAME__`'() = delete;
// noncopyable
__CPPNAME__`'(const __CPPNAME__&) = delete;
__CPPNAME__& operator=(const __CPPNAME__&) = delete;
+protected:
+ // Do not derive this. __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
+
+ void operator delete(void*, std::size_t);
+
private:
_IMPORT(SECTION_CLASS2)
')
#endif // $2
')dnl
_POP()
+_PUSH(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES)
+ifelse(`$2',,,`#ifdef $2'
+)dnl
+ , $1`'(std::move(src))
+ifelse(`$2',,,`
+#endif // $2
+')dnl
+_POP()
+_PUSH(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES)
+ifelse(`$2',,,`#ifdef $2'
+)dnl
+ $1`'::operator=(std::move(src));
+ifelse(`$2',,,`
+#endif // $2
+')dnl
+_POP()
')
dnl GVolumeMonitor can be broken/impeded by defining a sub-type.