summaryrefslogtreecommitdiff
path: root/glib/glibmm
diff options
context:
space:
mode:
Diffstat (limited to 'glib/glibmm')
-rw-r--r--glib/glibmm/arrayhandle.h4
-rw-r--r--glib/glibmm/dispatcher.cc10
-rw-r--r--glib/glibmm/dispatcher.h8
-rw-r--r--glib/glibmm/error.cc40
-rw-r--r--glib/glibmm/error.h8
-rw-r--r--glib/glibmm/exception.cc2
-rw-r--r--glib/glibmm/exception.h2
-rw-r--r--glib/glibmm/exceptionhandler.cc4
-rw-r--r--glib/glibmm/exceptionhandler.h2
-rw-r--r--glib/glibmm/filelist.am2
-rw-r--r--glib/glibmm/helperlist.h17
-rw-r--r--glib/glibmm/init.cc10
-rw-r--r--glib/glibmm/interface.cc2
-rw-r--r--glib/glibmm/interface.h11
-rw-r--r--glib/glibmm/listhandle.h8
-rw-r--r--glib/glibmm/main.cc24
-rw-r--r--glib/glibmm/main.h29
-rw-r--r--glib/glibmm/miscutils.cc269
-rw-r--r--glib/glibmm/miscutils.h467
-rw-r--r--glib/glibmm/object.cc4
-rw-r--r--glib/glibmm/object.h8
-rw-r--r--glib/glibmm/objectbase.cc11
-rw-r--r--glib/glibmm/objectbase.h19
-rw-r--r--glib/glibmm/pattern.h8
-rw-r--r--glib/glibmm/property.cc8
-rw-r--r--glib/glibmm/property.h7
-rw-r--r--glib/glibmm/propertyproxy_base.cc2
-rw-r--r--glib/glibmm/random.h8
-rw-r--r--glib/glibmm/refptr.h122
-rw-r--r--glib/glibmm/sarray.cc61
-rw-r--r--glib/glibmm/sarray.h80
-rw-r--r--glib/glibmm/signalproxy.cc43
-rw-r--r--glib/glibmm/signalproxy_connectionnode.cc4
-rw-r--r--glib/glibmm/slisthandle.h8
-rw-r--r--glib/glibmm/streamiochannel.cc32
-rw-r--r--glib/glibmm/stringutils.cc2
-rw-r--r--glib/glibmm/threadpool.cc22
-rw-r--r--glib/glibmm/timer.h8
-rw-r--r--glib/glibmm/ustring.cc10
-rw-r--r--glib/glibmm/ustring.h54
-rw-r--r--glib/glibmm/utility.h11
-rw-r--r--glib/glibmm/wrap.cc8
-rw-r--r--glib/glibmm/wrap.h19
43 files changed, 378 insertions, 1100 deletions
diff --git a/glib/glibmm/arrayhandle.h b/glib/glibmm/arrayhandle.h
index 6938c641..87127ebd 100644
--- a/glib/glibmm/arrayhandle.h
+++ b/glib/glibmm/arrayhandle.h
@@ -210,6 +210,10 @@ private:
} // 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.
diff --git a/glib/glibmm/dispatcher.cc b/glib/glibmm/dispatcher.cc
index f6257f36..d6117312 100644
--- a/glib/glibmm/dispatcher.cc
+++ b/glib/glibmm/dispatcher.cc
@@ -127,6 +127,10 @@ class DispatchNotifier : public sigc::trackable
public:
~DispatchNotifier();
+ // noncopyable
+ DispatchNotifier(const DispatchNotifier&) = delete;
+ DispatchNotifier& operator=(const DispatchNotifier&) = delete;
+
static DispatchNotifier* reference_instance(
const Glib::RefPtr<MainContext>& context, const Dispatcher* dispatcher);
static void unreference_instance(
@@ -158,10 +162,6 @@ private:
void create_pipe();
bool pipe_io_handler(Glib::IOCondition condition);
bool pipe_is_empty();
-
- // noncopyable
- DispatchNotifier(const DispatchNotifier&);
- DispatchNotifier& operator=(const DispatchNotifier&);
};
/**** Glib::DispatchNotifier ***********************************************/
@@ -197,7 +197,7 @@ DispatchNotifier::DispatchNotifier(const Glib::RefPtr<MainContext>& context)
// sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN);
// except for source->set_can_recurse(true).
- const Glib::RefPtr<IOSource> source = IOSource::create(fd, Glib::IO_IN);
+ const auto source = IOSource::create(fd, Glib::IO_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
diff --git a/glib/glibmm/dispatcher.h b/glib/glibmm/dispatcher.h
index 96721651..5de499d1 100644
--- a/glib/glibmm/dispatcher.h
+++ b/glib/glibmm/dispatcher.h
@@ -78,6 +78,10 @@ public:
*/
Dispatcher();
+ // noncopyable
+ Dispatcher(const Dispatcher&) = delete;
+ Dispatcher& operator=(const Dispatcher&) = delete;
+
/** Create new Dispatcher instance using an arbitrary main context.
* @throw Glib::FileError
*/
@@ -93,10 +97,6 @@ private:
sigc::signal<void> signal_;
DispatchNotifier* notifier_;
- // noncopyable
- Dispatcher(const Dispatcher&);
- Dispatcher& operator=(const Dispatcher&);
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
friend class Glib::DispatchNotifier;
#endif
diff --git a/glib/glibmm/error.cc b/glib/glibmm/error.cc
index fe01cc6f..315ea71d 100644
--- a/glib/glibmm/error.cc
+++ b/glib/glibmm/error.cc
@@ -1,5 +1,3 @@
-// -*- c++ -*-
-
/* error.cc
*
* Copyright 2002 The gtkmm Development Team
@@ -21,6 +19,7 @@
#include <glibmmconfig.h>
#include <glibmm/error.h>
+#include <glibmm/wrap.h>
#include <glibmm/wrap_init.h>
#include <glib.h>
#include <map>
@@ -30,7 +29,7 @@ namespace
typedef std::map<GQuark,Glib::Error::ThrowFunc> ThrowFuncTable;
-static ThrowFuncTable* throw_func_table = 0;
+static ThrowFuncTable* throw_func_table = nullptr;
} // anonymous namespace
@@ -43,9 +42,9 @@ Error::Error()
gobject_ (0)
{}
-Error::Error(GQuark domain, int code, const Glib::ustring& message)
+Error::Error(GQuark error_domain, int error_code, const Glib::ustring& message)
:
- gobject_ (g_error_new_literal(domain, code, message.c_str()))
+ gobject_ (g_error_new_literal(error_domain, error_code, message.c_str()))
{}
Error::Error(GError* gobject, bool take_copy)
@@ -66,7 +65,7 @@ Error& Error::operator=(const Error& other)
if(gobject_)
{
g_error_free(gobject_);
- gobject_ = 0;
+ gobject_ = nullptr;
}
if(other.gobject_)
{
@@ -76,7 +75,7 @@ Error& Error::operator=(const Error& other)
return *this;
}
-Error::~Error() throw()
+Error::~Error() noexcept
{
if(gobject_)
g_error_free(gobject_);
@@ -84,29 +83,29 @@ Error::~Error() throw()
GQuark Error::domain() const
{
- g_return_val_if_fail(gobject_ != 0, 0);
+ g_return_val_if_fail(gobject_ != nullptr, 0);
return gobject_->domain;
}
int Error::code() const
{
- g_return_val_if_fail(gobject_ != 0, -1);
+ g_return_val_if_fail(gobject_ != nullptr, -1);
return gobject_->code;
}
Glib::ustring Error::what() const
{
- g_return_val_if_fail(gobject_ != 0, "");
- g_return_val_if_fail(gobject_->message != 0, "");
+ g_return_val_if_fail(gobject_ != nullptr, "");
+ g_return_val_if_fail(gobject_->message != nullptr, "");
return gobject_->message;
}
-bool Error::matches(GQuark domain, int code) const
+bool Error::matches(GQuark error_domain, int error_code) const
{
- return g_error_matches(gobject_, domain, code);
+ return g_error_matches(gobject_, error_domain, error_code);
}
GError* Error::gobj()
@@ -122,7 +121,7 @@ const GError* Error::gobj() const
void Error::propagate(GError** dest)
{
g_propagate_error(dest, gobject_);
- gobject_ = 0;
+ gobject_ = nullptr;
}
// static
@@ -131,6 +130,7 @@ void Error::register_init()
if(!throw_func_table)
{
throw_func_table = new ThrowFuncTable();
+ Glib::wrap_register_init();
Glib::wrap_init(); // make sure that at least the Glib exceptions are registered
}
}
@@ -141,22 +141,22 @@ void Error::register_cleanup()
if(throw_func_table)
{
delete throw_func_table;
- throw_func_table = 0;
+ throw_func_table = nullptr;
}
}
// static
-void Error::register_domain(GQuark domain, Error::ThrowFunc throw_func)
+void Error::register_domain(GQuark error_domain, Error::ThrowFunc throw_func)
{
- g_assert(throw_func_table != 0);
+ g_assert(throw_func_table != nullptr);
- (*throw_func_table)[domain] = throw_func;
+ (*throw_func_table)[error_domain] = throw_func;
}
// static, noreturn
void Error::throw_exception(GError* gobject)
{
- g_assert(gobject != 0);
+ g_assert(gobject != nullptr);
// Just in case Gtk::Main hasn't been instantiated yet.
if(!throw_func_table)
@@ -176,6 +176,4 @@ void Error::throw_exception(GError* gobject)
throw Glib::Error(gobject);
}
-
} // namespace Glib
-
diff --git a/glib/glibmm/error.h b/glib/glibmm/error.h
index b68df859..1886d9a7 100644
--- a/glib/glibmm/error.h
+++ b/glib/glibmm/error.h
@@ -32,19 +32,19 @@ class Error : public Glib::Exception
{
public:
Error();
- Error(GQuark domain, int code, const Glib::ustring& message);
+ Error(GQuark error_domain, int error_code, const Glib::ustring& message);
explicit Error(GError* gobject, bool take_copy = false);
Error(const Error& other);
Error& operator=(const Error& other);
- virtual ~Error() throw();
+ virtual ~Error() noexcept;
GQuark domain() const;
int code() const;
virtual Glib::ustring what() const;
- bool matches(GQuark domain, int code) const;
+ bool matches(GQuark error_domain, int error_code) const;
GError* gobj();
const GError* gobj() const;
@@ -57,7 +57,7 @@ public:
static void register_init();
static void register_cleanup();
- static void register_domain(GQuark domain, ThrowFunc throw_func);
+ static void register_domain(GQuark error_domain, ThrowFunc throw_func);
static void throw_exception(GError* gobject) G_GNUC_NORETURN;
diff --git a/glib/glibmm/exception.cc b/glib/glibmm/exception.cc
index cc3d8efd..bf81ee00 100644
--- a/glib/glibmm/exception.cc
+++ b/glib/glibmm/exception.cc
@@ -30,7 +30,7 @@
namespace Glib
{
-Exception::~Exception() throw()
+Exception::~Exception() noexcept
{}
Glib::ustring Exception::what() const
diff --git a/glib/glibmm/exception.h b/glib/glibmm/exception.h
index 56d58b6b..c0e12700 100644
--- a/glib/glibmm/exception.h
+++ b/glib/glibmm/exception.h
@@ -31,7 +31,7 @@ namespace Glib
class Exception
{
public:
- virtual ~Exception() throw() = 0;
+ virtual ~Exception() noexcept = 0;
virtual Glib::ustring what() const = 0;
};
diff --git a/glib/glibmm/exceptionhandler.cc b/glib/glibmm/exceptionhandler.cc
index 734da3ef..df0b53e1 100644
--- a/glib/glibmm/exceptionhandler.cc
+++ b/glib/glibmm/exceptionhandler.cc
@@ -40,7 +40,7 @@ static Glib::Threads::Private<HandlerList> thread_specific_handler_list;
static void glibmm_exception_warning(const GError* error)
{
- g_assert(error != 0);
+ g_assert(error != nullptr);
g_critical("\n"
"unhandled exception (type Glib::Error) in signal handler:\n"
@@ -99,7 +99,7 @@ sigc::connection add_exception_handler(const sigc::slot<void>& slot)
}
// internal
-void exception_handlers_invoke() throw()
+void exception_handlers_invoke() noexcept
{
// This function will be called from our GLib signal handler proxies
// if an exception has been caught. It's not possible to throw C++
diff --git a/glib/glibmm/exceptionhandler.h b/glib/glibmm/exceptionhandler.h
index 534ca064..350cd023 100644
--- a/glib/glibmm/exceptionhandler.h
+++ b/glib/glibmm/exceptionhandler.h
@@ -34,7 +34,7 @@ sigc::connection add_exception_handler(const sigc::slot<void>& slot);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// internal
-void exception_handlers_invoke() throw();
+void exception_handlers_invoke() noexcept;
#endif //DOXYGEN_SHOULD_SKIP_THIS
} // namespace Glib
diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am
index 97170ce0..909ef6d5 100644
--- a/glib/glibmm/filelist.am
+++ b/glib/glibmm/filelist.am
@@ -17,7 +17,6 @@ glibmm_files_extra_cc = \
init.cc \
interface.cc \
main.cc \
- miscutils.cc \
object.cc \
objectbase.cc \
pattern.cc \
@@ -59,7 +58,6 @@ glibmm_files_extra_h = \
interface.h \
listhandle.h \
main.h \
- miscutils.h \
object.h \
objectbase.h \
pattern.h \
diff --git a/glib/glibmm/helperlist.h b/glib/glibmm/helperlist.h
index dfdc0706..1c9b9ba5 100644
--- a/glib/glibmm/helperlist.h
+++ b/glib/glibmm/helperlist.h
@@ -22,12 +22,23 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+//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 <glibmm/containers.h>
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< typename T_Child, typename T_CppElement, typename T_Iterator >
class HelperList
{
@@ -74,7 +85,7 @@ public:
}
inline size_type max_size() { return size_type(-1); }
- inline bool empty() { return glist() == 0; }
+ inline bool empty() { return glist() == nullptr; }
inline iterator begin()
{return begin_();}
@@ -110,7 +121,7 @@ public:
{
size_type j = 0;
iterator i;
- for(i = begin(), j = 0; i != end(), j < l; ++i, ++j)
+ for(i = begin(), j = 0; i != end() && j < l; ++i, ++j)
;
return (*i);
}
@@ -162,5 +173,7 @@ protected:
} /* namespace Glib */
+//#endif //GLIBMM_DISABLE_DEPRECATED
+
#endif /* _GLIBMM_HELPERLIST_H */
diff --git a/glib/glibmm/init.cc b/glib/glibmm/init.cc
index 0710f3f4..92555607 100644
--- a/glib/glibmm/init.cc
+++ b/glib/glibmm/init.cc
@@ -1,6 +1,3 @@
-// -*- c++ -*-
-/* $Id$ */
-
/* Copyright (C) 2003 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +15,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/wrap.h>
+#include <glibmm/init.h>
#include <glibmm/error.h>
namespace Glib
@@ -26,9 +23,8 @@ namespace Glib
void init()
{
- Glib::wrap_register_init();
- Glib::Error::register_init(); //also calls Glib::wrap_init();
+ // Also calls Glib::wrap_register_init() and Glib::wrap_init().
+ Glib::Error::register_init();
}
} // namespace Glib
-
diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc
index c8495653..8ed14d39 100644
--- a/glib/glibmm/interface.cc
+++ b/glib/glibmm/interface.cc
@@ -98,7 +98,7 @@ Interface::Interface(const Interface_Class& interface_class)
g_free(iface_props);
}
}
- else // gobject_ == 0
+ else // gobject_ == nullptr
{
// The GObject is not instantiated yet. Add to the custom_interface_classes
// and add the interface in the Glib::Object constructor.
diff --git a/glib/glibmm/interface.h b/glib/glibmm/interface.h
index 06390441..0fc9ba62 100644
--- a/glib/glibmm/interface.h
+++ b/glib/glibmm/interface.h
@@ -32,7 +32,7 @@ class Interface_Class;
#endif
// There is no base GInterface struct in Glib, though there is G_TYPE_INTERFACE enum value.
-class Interface : virtual public Glib::ObjectBase
+class GLIBMM_API Interface : virtual public Glib::ObjectBase
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -62,6 +62,10 @@ public:
explicit Interface(GObject* castitem);
virtual ~Interface();
+ // noncopyable
+ Interface(const Interface&) = delete;
+ Interface& operator=(const Interface&) = delete;
+
//void add_interface(GType gtype_implementer);
// Hook for translating API
@@ -74,11 +78,6 @@ public:
inline GObject* gobj() { return gobject_; }
inline const GObject* gobj() const { return gobject_; }
-
-private:
- // noncopyable
- Interface(const Interface&);
- Interface& operator=(const Interface&);
};
RefPtr<ObjectBase> wrap_interface(GObject* object, bool take_copy = false);
diff --git a/glib/glibmm/listhandle.h b/glib/glibmm/listhandle.h
index e63bb0b0..76bb7a8f 100644
--- a/glib/glibmm/listhandle.h
+++ b/glib/glibmm/listhandle.h
@@ -37,7 +37,7 @@ namespace Container_Helpers
template <class Bi, class Tr>
GList* create_list(Bi pbegin, Bi pend, Tr)
{
- GList* head = 0;
+ GList* head = nullptr;
while(pend != pbegin)
{
@@ -56,7 +56,7 @@ GList* create_list(Bi pbegin, Bi pend, Tr)
template <class For, class Tr>
GList* create_list(For pbegin, Tr)
{
- GList* head = 0;
+ GList* head = nullptr;
while(*pbegin)
{
@@ -297,7 +297,7 @@ ListHandle<T,Tr>::~ListHandle()
if(ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
- for(GList* node = plist_; node != 0; node = node->next)
+ for(GList* node = plist_; node != nullptr; node = node->next)
Tr::release_c_type(static_cast<typename Tr::CTypeNonConst>(node->data));
}
g_list_free(plist_);
@@ -396,7 +396,7 @@ std::size_t ListHandle<T,Tr>::size() const
template <class T, class Tr> inline
bool ListHandle<T,Tr>::empty() const
{
- return (plist_ == 0);
+ return (plist_ == nullptr);
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index 1d9d9152..9dfe09f7 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -102,7 +102,7 @@ void* SourceConnectionNode::notify(void* data)
if (self->source_)
{
GSource* s = self->source_;
- self->source_ = 0;
+ self->source_ = nullptr;
g_source_destroy(s);
// Destroying the object triggers execution of destroy_notify_handler(),
@@ -120,7 +120,7 @@ void SourceConnectionNode::destroy_notify_callback(void* data)
if (self)
{
// The GLib side is disconnected now, thus the GSource* is no longer valid.
- self->source_ = 0;
+ self->source_ = nullptr;
delete self;
}
@@ -200,10 +200,10 @@ void SourceCallbackData::destroy_notify_callback(void* data)
*/
static SourceCallbackData* glibmm_source_get_callback_data(GSource* source)
{
- g_return_val_if_fail(source->callback_funcs != 0, 0);
+ g_return_val_if_fail(source->callback_funcs != nullptr, 0);
GSourceFunc func;
- void* user_data = 0;
+ void* user_data = nullptr;
// Retrieve the callback function and data.
(*source->callback_funcs->get)(source->callback_data, source, &func, &user_data);
@@ -268,7 +268,7 @@ static gboolean glibmm_source_callback_once(void* data)
static gboolean glibmm_iosource_callback(GIOChannel*, GIOCondition condition, void* data)
{
SourceCallbackData *const callback_data = static_cast<SourceCallbackData*>(data);
- g_return_val_if_fail(callback_data->node != 0, 0);
+ g_return_val_if_fail(callback_data->node != nullptr, 0);
try
{
@@ -497,7 +497,7 @@ SignalIO::SignalIO(GMainContext* context)
sigc::connection SignalIO::connect(const sigc::slot<bool,IOCondition>& slot,
int fd, IOCondition condition, int priority)
{
- const Glib::RefPtr<IOSource> source = IOSource::create(fd, condition);
+ const auto source = IOSource::create(fd, condition);
if(priority != G_PRIORITY_DEFAULT)
source->set_priority(priority);
@@ -513,7 +513,7 @@ sigc::connection SignalIO::connect(const sigc::slot<bool,IOCondition>& slot,
const Glib::RefPtr<IOChannel>& channel,
IOCondition condition, int priority)
{
- const Glib::RefPtr<IOSource> source = IOSource::create(channel, condition);
+ const auto source = IOSource::create(channel, condition);
if(priority != G_PRIORITY_DEFAULT)
source->set_priority(priority);
@@ -943,10 +943,10 @@ Source::~Source()
if(gobject_)
{
SourceCallbackData *const data = glibmm_source_get_callback_data(gobject_);
- data->wrapper = 0;
+ data->wrapper = nullptr;
GSource *const tmp_gobject = gobject_;
- gobject_ = 0;
+ gobject_ = nullptr;
g_source_unref(tmp_gobject);
@@ -1035,7 +1035,7 @@ gboolean Source::dispatch_vfunc(GSource*, GSourceFunc callback, void* user_data)
SourceCallbackData *const callback_data = static_cast<SourceCallbackData*>(user_data);
g_return_val_if_fail(callback == &glibmm_dummy_source_callback, 0);
- g_return_val_if_fail(callback_data != 0 && callback_data->node != 0, 0);
+ g_return_val_if_fail(callback_data != nullptr && callback_data->node != nullptr, 0);
try
{
@@ -1057,7 +1057,7 @@ void Source::destroy_notify_callback(void* data)
Source *const self = static_cast<Source*>(data);
// gobject_ is already invalid at this point.
- self->gobject_ = 0;
+ self->gobject_ = nullptr;
// No exception checking: if the dtor throws, you're out of luck anyway.
delete self;
@@ -1094,7 +1094,7 @@ sigc::slot_base* Source::get_slot_from_connection_node(void* data)
sigc::slot_base* Source::get_slot_from_callback_data(void* data)
{
SourceCallbackData* const callback_data = static_cast<SourceCallbackData*>(data);
- g_return_val_if_fail(callback_data->node != 0, 0);
+ g_return_val_if_fail(callback_data->node != nullptr, 0);
return callback_data->node->get_slot();
}
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index 94d495c1..53a23705 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -107,7 +107,7 @@ public:
* is equivalent to:
* @code
* bool timeout_handler() { ... }
- * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(1000);
+ * const auto timeout_source = Glib::TimeoutSource::create(1000);
* timeout_source->connect(sigc::ptr_fun(&timeout_handler));
* timeout_source->attach(Glib::MainContext::get_default());
* @endcode
@@ -165,7 +165,7 @@ public:
* is equivalent to:
* @code
* bool timeout_handler() { ... }
- * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(5000);
+ * const auto timeout_source = Glib::TimeoutSource::create(5000);
* timeout_source->connect(sigc::ptr_fun(&timeout_handler));
* timeout_source->attach(Glib::MainContext::get_default());
* @endcode
@@ -232,7 +232,7 @@ public:
* is equivalent to:
* @code
* bool idle_handler() { ... }
- * const Glib::RefPtr<Glib::IdleSource> idle_source = Glib::IdleSource::create();
+ * const auto idle_source = Glib::IdleSource::create();
* idle_source->connect(sigc::ptr_fun(&idle_handler));
* idle_source->attach(Glib::MainContext::get_default());
* @endcode
@@ -291,7 +291,7 @@ public:
* is equivalent to:
* @code
* bool io_handler(Glib::IOCondition io_condition) { ... }
- * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP);
+ * const auto io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP);
* io_source->connect(sigc::ptr_fun(&io_handler));
* io_source->attach(Glib::MainContext::get_default());
* @endcode
@@ -319,7 +319,7 @@ public:
* is equivalent to:
* @code
* bool io_handler(Glib::IOCondition io_condition) { ... }
- * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP);
+ * const auto io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP);
* io_source->connect(sigc::ptr_fun(&io_handler));
* io_source->attach(Glib::MainContext::get_default());
* @endcode
@@ -405,6 +405,10 @@ public:
typedef Glib::MainContext CppObjectType;
typedef GMainContext BaseObjectType;
+ // noncopyable
+ MainContext(const MainContext& other) = delete;
+ MainContext& operator=(const MainContext& other) = delete;
+
/** Creates a new MainContext.
* @return The new MainContext.
*/
@@ -587,11 +591,6 @@ private:
// Glib::MainContext can neither be constructed nor deleted.
MainContext();
void operator delete(void*, std::size_t);
-
- // noncopyable
- MainContext(const MainContext& other);
- MainContext& operator=(const MainContext& other);
-
};
/** @relates Glib::MainContext */
@@ -662,6 +661,10 @@ public:
typedef Glib::Source CppObjectType;
typedef GSource BaseObjectType;
+ // noncopyable
+ Source(const Source&) = delete;
+ Source& operator=(const Source&) = delete;
+
static Glib::RefPtr<Source> create() /* = 0 */;
/** Adds a Source to a context so that it will be executed within that context.
@@ -802,13 +805,7 @@ public:
static sigc::slot_base* get_slot_from_connection_node(void* data);
// Used by derived Source classes in other files.
static sigc::slot_base* get_slot_from_callback_data(void* data);
-
-private:
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
-
- // noncopyable
- Source(const Source&);
- Source& operator=(const Source&);
};
diff --git a/glib/glibmm/miscutils.cc b/glib/glibmm/miscutils.cc
deleted file mode 100644
index 95226b8f..00000000
--- a/glib/glibmm/miscutils.cc
+++ /dev/null
@@ -1,269 +0,0 @@
-// -*- c++ -*-
-/* $Id$ */
-
-/* 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, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <cstddef>
-#include <cstring>
-
-#include <glibmm/miscutils.h>
-#include <glibmm/utility.h>
-#include <glib.h>
-
-
-namespace Glib
-{
-
-Glib::ustring get_application_name()
-{
- return convert_const_gchar_ptr_to_ustring (g_get_application_name());
-}
-
-void set_application_name(const Glib::ustring& application_name)
-{
- g_set_application_name(application_name.c_str());
-}
-
-std::string get_prgname()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_prgname());
-}
-
-void set_prgname(const std::string& prgname)
-{
- g_set_prgname(prgname.c_str());
-}
-
-std::string getenv(const std::string& variable, bool& found)
-{
- const char *const value = g_getenv(variable.c_str());
- found = (value != 0);
- return convert_const_gchar_ptr_to_stdstring(value);
-}
-
-std::string getenv(const std::string& variable)
-{
- return convert_const_gchar_ptr_to_stdstring(g_getenv(variable.c_str()));
-}
-
-bool setenv(const std::string& variable, const std::string& value, bool overwrite)
-{
- return g_setenv(variable.c_str(), value.c_str(), overwrite);
-}
-
-void unsetenv(const std::string& variable)
-{
- g_unsetenv(variable.c_str());
-}
-
-Glib::ArrayHandle<std::string> listenv()
-{
- char **value = g_listenv();
- char **end = value;
- while(*end){
- ++end;
- }
- return Glib::ArrayHandle<std::string>(value, end-value, Glib::OWNERSHIP_DEEP);
-}
-
-std::string get_user_name()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_name());
-}
-
-std::string get_real_name()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_real_name());
-}
-
-std::string get_home_dir()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_home_dir());
-}
-
-std::string get_tmp_dir()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_tmp_dir());
-}
-
-std::string get_current_dir()
-{
- return convert_return_gchar_ptr_to_stdstring(g_get_current_dir());
-}
-
-std::string get_user_special_dir(GUserDirectory directory)
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_special_dir(directory));
-}
-
-std::string get_user_data_dir()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_data_dir());
-}
-
-std::string get_user_config_dir()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_config_dir());
-}
-
-std::vector<std::string> get_system_data_dirs()
-{
- //TODO: Use a utility function:
- std::vector<std::string> result;
- const char* const * cresult = g_get_system_data_dirs();
- if(!cresult)
- return result;
-
- for(const gchar* const * iter = cresult; *iter != 0; ++iter)
- {
- result.push_back(
- convert_const_gchar_ptr_to_stdstring(*iter));
- }
-
- return result;
-}
-
-std::vector<std::string> get_system_config_dirs()
-{
- //TODO: Use a utility function:
- std::vector<std::string> result;
- const char* const * cresult = g_get_system_config_dirs();
- if(!cresult)
- return result;
-
- for(const gchar* const * iter = cresult; *iter != 0; ++iter)
- {
- result.push_back(
- convert_const_gchar_ptr_to_stdstring(*iter));
- }
-
- return result;
-}
-
-std::string get_user_cache_dir()
-{
- return convert_const_gchar_ptr_to_stdstring(g_get_user_cache_dir());
-}
-
-bool path_is_absolute(const std::string& filename)
-{
- return (g_path_is_absolute(filename.c_str()) != 0);
-}
-
-std::string path_skip_root(const std::string& filename)
-{
- // g_path_skip_root() returns a pointer _into_ the argument string,
- // or NULL if there was no root component.
- return convert_const_gchar_ptr_to_stdstring(g_path_skip_root(filename.c_str()));
-}
-
-std::string path_get_basename(const std::string& filename)
-{
- return convert_return_gchar_ptr_to_stdstring(g_path_get_basename(filename.c_str()));
-}
-
-std::string path_get_dirname(const std::string& filename)
-{
- return convert_return_gchar_ptr_to_stdstring(g_path_get_dirname(filename.c_str()));
-}
-
-std::string build_filename(const Glib::ArrayHandle<std::string>& elements)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filenamev(const_cast<char**>(elements.data())));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(),
- static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- elem7.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7, const std::string& elem8)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- elem7.c_str(), elem8.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7, const std::string& elem8,
- const std::string& elem9)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_filename(elem1.c_str(),
- elem2.c_str(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- elem7.c_str(), elem8.c_str(), elem9.c_str(), static_cast<char*>(0)));
-}
-
-std::string build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
-{
- return convert_return_gchar_ptr_to_stdstring(g_build_pathv(separator.c_str(), const_cast<char**>(elements.data())));
-}
-
-std::string find_program_in_path(const std::string& program)
-{
- return convert_return_gchar_ptr_to_stdstring(g_find_program_in_path(program.c_str()));
-}
-
-} // namespace Glib
diff --git a/glib/glibmm/miscutils.h b/glib/glibmm/miscutils.h
deleted file mode 100644
index 12c9677b..00000000
--- a/glib/glibmm/miscutils.h
+++ /dev/null
@@ -1,467 +0,0 @@
-// -*- c++ -*-
-#ifndef _GLIBMM_MISCUTILS_H
-#define _GLIBMM_MISCUTILS_H
-
-/* $Id$ */
-
-/* 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, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <glibmm/arrayhandle.h>
-#include <glibmm/ustring.h>
-
-
-namespace Glib
-{
-
-/** @defgroup MiscUtils Miscellaneous Utility Functions
- * Miscellaneous Utility Functions -- a selection of portable utility functions.
- * @{
- */
-
-/** Gets a human-readable name for the application,
- * as set by Glib::set_application_name().
- * This name should be localized if possible, and is intended for display to
- * the user. Contrast with Glib::get_prgname(), which gets a non-localized
- * name. If Glib::set_application_name() has not been called, returns the
- * result of Glib::get_prgname() (which may be empty if Glib::set_prgname()
- * has also not been called).
- *
- * @return Human-readable application name. May return <tt>""</tt>.
- */
-Glib::ustring get_application_name();
-
-/** Sets a human-readable name for the application.
- * This name should be localized if possible, and is intended for display to
- * the user. Contrast with Glib::set_prgname(), which sets a non-localized
- * name. Glib::set_prgname() will be called automatically by
- * <tt>gtk_init()</tt>, but Glib::set_application_name() will not.
- *
- * Note that for thread safety reasons, this function can only be called once.
- *
- * The application name will be used in contexts such as error messages,
- * or when displaying an application's name in the task list.
- *
- * @param application_name Localized name of the application.
- */
-void set_application_name(const Glib::ustring& application_name);
-
-/** Gets the name of the program.
- * If you are using GDK or GTK+ the program name is set in <tt>gdk_init()</tt>,
- * which is called by <tt>gtk_init()</tt>. The program name is found by taking
- * the last component of <tt>argv[0]</tt>.
- * @return The name of the program.
- */
-std::string get_prgname();
-
-/** Sets the name of the program.
- * @param prgname The name of the program.
- */
-void set_prgname(const std::string& prgname);
-
-/** Returns the value of an environment variable. The name and value
- * are in the GLib file name encoding. On Unix, this means the actual
- * bytes which might or might not be in some consistent character set
- * and encoding. On Windows, it is in UTF-8. On Windows, in case the
- * environment variable's value contains references to other
- * environment variables, they are expanded.
- *
- * @param variable The environment variable to get.
- * @retval found <tt>true</tt> Whether the environment variable has been found.
- * @return The value of the environment variable, or <tt>""</tt> if not found.
- */
-std::string getenv(const std::string& variable, bool& found);
-
-/** Returns the value of an environment variable. The name and value
- * are in the GLib file name encoding. On Unix, this means the actual
- * bytes which might or might not be in some consistent character set
- * and encoding. On Windows, it is in UTF-8. On Windows, in case the
- * environment variable's value contains references to other
- * environment variables, they are expanded.
- *
- * @param variable The environment variable to get.
- * @return The value of the environment variable, or <tt>""</tt> if not found.
- */
-std::string getenv(const std::string& variable);
-
-
-/** Sets an environment variable. Both the variable's name and value
- * should be in the GLib file name encoding. On Unix, this means that
- * they can be any sequence of bytes. On Windows, they should be in
- * UTF-8.
- *
- * Note that on some systems, when variables are overwritten, the memory
- * used for the previous variables and its value isn't reclaimed.
- *
- * @param variable The environment variable to set. It must not contain '='.
- * @param value The value to which the variable should be set.
- * @param overwrite Whether to change the variable if it already exists.
- * @result false if the environment variable couldn't be set.
- */
-bool setenv(const std::string& variable, const std::string& value, bool overwrite = true);
-
-/** Removes an environment variable from the environment.
- *
- * Note that on some systems, when variables are overwritten, the memory
- * used for the previous variables and its value isn't reclaimed.
- * Furthermore, this function can't be guaranteed to operate in a
- * threadsafe way.
- *
- * @param variable: the environment variable to remove. It must not contain '='.
- **/
-void unsetenv(const std::string& variable);
-
-/** Gets the names of all variables set in the environment.
- *
- * Programs that want to be portable to Windows should typically use this
- * function and getenv() instead of using the environ array from the C library
- * directly. On Windows, the strings in the environ array are in system
- * codepage encoding, while in most of the typical use cases for environment
- * variables in GLib-using programs you want the UTF-8 encoding that this
- * function and getenv() provide.
- *
- * @return Array of environment names (The generic ArrayHandle will be
- * implicitly converted to any STL compatible container type).
- */
-Glib::ArrayHandle<std::string> listenv();
-
-/** Gets the user name of the current user.
- * @return The name of the current user.
- */
-std::string get_user_name();
-
-/** Gets the real name of the user.
- * This usually comes from the user's entry in the <tt>passwd</tt> file.
- * @return The user's real name.
- */
-std::string get_real_name();
-
-/** Gets the current user's home directory.
- * @return The current user's home directory or an empty string if not defined.
- */
-std::string get_home_dir();
-
-/** Gets the directory to use for temporary files.
- * This is found from inspecting the environment variables <tt>TMPDIR</tt>,
- * <tt>TMP</tt>, and <tt>TEMP</tt> in that order. If none of those are defined
- * <tt>"/tmp"</tt> is returned on UNIX and <tt>"C:\\"</tt> on Windows.
- * @return The directory to use for temporary files.
- */
-std::string get_tmp_dir();
-
-/** Gets the current directory.
- * @return The current directory.
- */
-std::string get_current_dir();
-
-//TODO: We could create a C++ enum to wrap the C GUserDirectory enum,
-//but we would have to either be very careful, or define the enum
-//values in terms of the C enums anyway.
-/** Returns the full path of a special directory using its logical id.
- *
- * On Unix this is done using the XDG special user directories.
- *
- * 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.
- *
- * Return value: the path to the specified special directory.
- * @param directory Te logical id of special directory
- *
- * @newin{2,14}
- */
-std::string get_user_special_dir(GUserDirectory directory);
-
-/** Returns a base directory in which to access application data such as icons
- * that is customized for a particular user.
- *
- * On UNIX platforms this is determined using the mechanisms described in the
- * XDG Base Directory Specification
- *
- * @newin{2,14}
- */
-std::string get_user_data_dir();
-
-/** Returns a base directory in which to store user-specific application
- * configuration information such as user preferences and settings.
- *
- * On UNIX platforms this is determined using the mechanisms described in the
- * XDG Base Directory Specification
- *
- * @newin{2,14}
- */
-std::string get_user_config_dir();
-
-/** Returns an ordered list of base directories in which to access system-wide application data.
- * On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.
- *
- * @newin{2,18}
- */
-std::vector<std::string> get_system_data_dirs();
-
-/** Returns an ordered list of base directories in which to access system-wide configuration information.
- * On Unix platforms this is determined using the mechanisms described in the XDG Base Directory Specification.
- *
- * @newin{2,18}
- */
-std::vector<std::string> get_system_config_dirs();
-
-/** Returns a base directory in which to store non-essential, cached data
- * specific to particular user.
- *
- * On UNIX platforms this is determined using the mechanisms described in the
- * XDG Base Directory Specification
- *
- * @newin{2,14}
- */
-std::string get_user_cache_dir();
-
-/** Returns @c true if the given @a filename is an absolute file name, i.e.\ it
- * contains a full path from the root directory such as <tt>"/usr/local"</tt>
- * on UNIX or <tt>"C:\\windows"</tt> on Windows systems.
- * @param filename A file name.
- * @return Whether @a filename is an absolute path.
- */
-bool path_is_absolute(const std::string& filename);
-
-/** Returns the remaining part of @a filename after the root component,
- * i.e.\ after the <tt>"/"</tt> on UNIX or <tt>"C:\\"</tt> on Windows.
- * If @a filename is not an absolute path, <tt>""</tt> will be returned.
- * @param filename A file name.
- * @return The file name without the root component, or <tt>""</tt>.
- */
-std::string path_skip_root(const std::string& filename);
-
-/** Gets the name of the file without any leading directory components.
- * @param filename The name of the file.
- * @return The name of the file without any leading directory components.
- */
-std::string path_get_basename(const std::string& filename);
-
-/** Gets the directory components of a file name.
- * If the file name has no directory components <tt>"."</tt> is returned.
- * @param filename The name of the file.
- * @return The directory components of the file.
- */
-std::string path_get_dirname(const std::string& filename);
-
-/** Creates a filename from a series of elements using the correct
- * separator for filenames.
- * This function behaves identically to Glib::build_path(G_DIR_SEPARATOR_S,
- * elements). No attempt is made to force the resulting filename to be an
- * absolute path. If the first element is a relative path, the result will
- * be a relative path.
- * @param elements A container holding the elements of the path to build.
- * Any STL compatible container type is accepted.
- * @return The resulting path.
- */
-std::string build_filename(const Glib::ArrayHandle<std::string>& 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.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @return The resulting path.
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2);
-
-/** Creates a filename from three elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3);
-
-
-/** Creates a filename from four elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4);
-
-/** Creates a filename from five elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @param elem5 Fifth path element.
- * @return The resulting path.
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5);
-
-/** Creates a filename from six elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @param elem5 Fifth path element.
- * @param elem6 Sixth path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6);
-
-/** Creates a filename from seven elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @param elem5 Fifth path element.
- * @param elem6 Sixth path element.
- * @param elem7 Seventh path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7);
-
-/** Creates a filename from eight elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @param elem5 Fifth path element.
- * @param elem6 Sixth path element.
- * @param elem7 Seventh path element.
- * @param elem8 Eighth path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7, const std::string& elem8);
-
-/** Creates a filename from nine elements using the correct separator for filenames.
- * No attempt is made to force the resulting filename to be an absolute path.
- * If the first element is a relative path, the result will be a relative path.
- * @param elem1 First path element.
- * @param elem2 Second path element.
- * @param elem3 Third path element.
- * @param elem4 Fourth path element.
- * @param elem5 Fifth path element.
- * @param elem6 Sixth path element.
- * @param elem7 Seventh path element.
- * @param elem8 Eighth path element.
- * @param elem9 Ninth path element.
- * @return The resulting path.
- *
- * @newin{2,28}
- */
-std::string build_filename(const std::string& elem1, const std::string& elem2,
- const std::string& elem3, const std::string& elem4,
- const std::string& elem5, const std::string& elem6,
- const std::string& elem7, const std::string& elem8,
- const std::string& elem9);
-
-/** Creates a path from a series of elements using @a separator as the
- * separator between elements.
- *
- * At the boundary between two elements, any trailing occurrences of
- * @a separator in the first element, or leading occurrences of @a separator
- * in the second element are removed and exactly one copy of the separator is
- * inserted.
- *
- * Empty elements are ignored.
- *
- * The number of leading copies of the separator on the result is
- * the same as the number of leading copies of the separator on
- * the first non-empty element.
- *
- * The number of trailing copies of the separator on the result is the same
- * as the number of trailing copies of the separator on the last non-empty
- * element. (Determination of the number of trailing copies is done without
- * stripping leading copies, so if the separator is <tt>"ABA"</tt>,
- * <tt>"ABABA"</tt> has 1 trailing copy.)
- *
- * However, if there is only a single non-empty element, and there
- * are no characters in that element not part of the leading or
- * trailing separators, then the result is exactly the original value
- * of that element.
- *
- * Other than for determination of the number of leading and trailing
- * copies of the separator, elements consisting only of copies
- * of the separator are ignored.
- *
- * @param separator A string used to separate the elements of the path.
- * @param elements A container holding the elements of the path to build.
- * Any STL compatible container type is accepted.
- * @return The resulting path.
- */
-std::string build_path(const std::string& separator,
- const Glib::ArrayHandle<std::string>& elements);
-
-/** Locates the first executable named @a program in the user's path, in the
- * same way that <tt>execvp()</tt> would locate it.
- * Returns a string with the absolute path name, or <tt>""</tt> if the program
- * is not found in the path. If @a program is already an absolute path,
- * returns a copy of @a program if @a program exists and is executable, and
- * <tt>""</tt> otherwise.
- *
- * On Windows, if @a program does not have a file type suffix, tries to append
- * the suffixes in the <tt>PATHEXT</tt> environment variable (if that doesn't
- * exist, the suffixes .com, .exe, and .bat) in turn, and then look for the
- * resulting file name in the same way as CreateProcess() would. This means
- * first in the directory where the program was loaded from, then in the
- * current directory, then in the Windows 32-bit system directory, then in the
- * Windows directory, and finally in the directories in the <tt>PATH</tt>
- * environment variable. If the program is found, the return value contains
- * the full name including the type suffix.
- *
- * @param program A program name.
- * @return An absolute path, or <tt>""</tt>.
- */
-std::string find_program_in_path(const std::string& program);
-
-/** @} group MiscUtils */
-
-} // namespace Glib
-
-
-#endif /* _GLIBMM_FILEUTILS_H */
diff --git a/glib/glibmm/object.cc b/glib/glibmm/object.cc
index 1658d81c..ddaa47b1 100644
--- a/glib/glibmm/object.cc
+++ b/glib/glibmm/object.cc
@@ -84,10 +84,10 @@ ConstructParams::ConstructParams(const Glib::Class& glibmm_class_,
static_cast<GObjectClass*>(g_type_class_ref(glibmm_class.get_type()));
unsigned int n_alloced_params = 0;
- char* collect_error = 0; // output argument of G_VALUE_COLLECT()
+ char* collect_error = nullptr; // output argument of G_VALUE_COLLECT()
for(const char* name = first_property_name;
- name != 0;
+ name != nullptr;
name = va_arg(var_args, char*))
{
GParamSpec *const pspec = g_object_class_find_property(g_class, name);
diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h
index 4ac56a11..202b28e5 100644
--- a/glib/glibmm/object.h
+++ b/glib/glibmm/object.h
@@ -103,6 +103,10 @@ public:
typedef GObjectClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+ // noncopyable
+ Object(const Object&) = delete;
+ Object& operator=(const Object&) = delete;
+
protected:
Object(); //For use by C++-only sub-types.
explicit Object(const Glib::ConstructParams& construct_params);
@@ -145,10 +149,6 @@ private:
friend class Glib::Object_Class;
static CppClassType object_class_;
- // noncopyable
- Object(const Object&);
- Object& operator=(const Object&);
-
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
// Glib::Object can not be dynamic because it lacks a float state.
diff --git a/glib/glibmm/objectbase.cc b/glib/glibmm/objectbase.cc
index 140816a4..c1efb135 100644
--- a/glib/glibmm/objectbase.cc
+++ b/glib/glibmm/objectbase.cc
@@ -1,6 +1,3 @@
-// -*- c++ -*-
-/* $Id$ */
-
/* Copyright 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -46,7 +43,7 @@ namespace Glib
// static data members
ObjectBase::extra_object_base_data_type ObjectBase::extra_object_base_data;
-std::auto_ptr<Threads::Mutex> ObjectBase::extra_object_base_data_mutex(new Threads::Mutex());
+Threads::Mutex* ObjectBase::extra_object_base_data_mutex = new Threads::Mutex();
ObjectBase::ObjectBase()
:
@@ -122,7 +119,7 @@ ObjectBase::~ObjectBase()
g_warning("(Glib::ObjectBase::~ObjectBase): gobject_ = %p", (void*) gobject_);
#endif
- gobject_ = 0;
+ gobject_ = nullptr;
#ifdef GLIBMM_DEBUG_REFCOUNTING
g_warning("(Glib::ObjectBase::~ObjectBase): before g_object_steal_qdata()");
@@ -225,7 +222,7 @@ void ObjectBase::destroy_notify_()
g_warning("Glib::ObjectBase::destroy_notify_: gobject_ = %p", (void*) gobject_);
#endif
- gobject_ = 0; // Make sure we don't unref it again in the dtor.
+ gobject_ = nullptr; // Make sure we don't unref it again in the dtor.
delete this;
}
@@ -239,7 +236,7 @@ bool ObjectBase::is_anonymous_custom_() const
bool ObjectBase::is_derived_() const
{
// gtkmmproc-generated classes initialize this to 0 by default.
- return (custom_type_name_ != 0);
+ return (custom_type_name_ != nullptr);
}
void ObjectBase::set_manage()
diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h
index a3afd834..44fb7adb 100644
--- a/glib/glibmm/objectbase.h
+++ b/glib/glibmm/objectbase.h
@@ -29,7 +29,7 @@
#include <sigc++/trackable.h>
#include <typeinfo>
#include <map> // Needed until the next ABI break.
-#include <memory> // auto_ptr, needed until the next ABI break.
+#include <memory> // Not used by ObjectBase any more, but user code may rely on it being here.
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GObject GObject; }
@@ -57,6 +57,12 @@ class Mutex;
*/
class GLIBMM_API ObjectBase : virtual public sigc::trackable
{
+public:
+
+ // noncopyable
+ ObjectBase(const ObjectBase&) = delete;
+ ObjectBase& operator=(const ObjectBase&) = delete;
+
protected:
/** This default constructor is called implicitly from the constructor of user-derived
* classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor.
@@ -70,7 +76,7 @@ protected:
* The C++ language itself ensures that the constructor
* is only invoked once.
*
- * All classes generated by gtkmmproc use this constructor, with custom_type_name = 0,
+ * All classes generated by gtkmmproc use this constructor, with custom_type_name = nullptr,
* which essentially means it's not a custom type. This is used to optimize
* vfunc and signal handler callbacks -- since the C++ virtual methods are
* not overridden, invocation can be skipped.
@@ -209,10 +215,10 @@ typedef std::map<const ObjectBase*, ExtraObjectBaseData> extra_object_base_data_
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.
-// auto_ptr, because we don't want to include glibmm/threads.h in objectbase.h.
+// Threads::Mutex*, because we don't want to include glibmm/threads.h in objectbase.h.
// threads.h must be the first included file that includes glib.h. That could cause
// problems in files that directly or indirectly include objectbase.h.
-static std::auto_ptr<Threads::Mutex> extra_object_base_data_mutex;
+static Threads::Mutex* extra_object_base_data_mutex;
public: // is_derived_() must be public, so that overridden vfuncs and signal handlers can call it via ObjectBase.
@@ -224,7 +230,7 @@ public: // is_derived_() must be public, so that overridden vfuncs and signal h
/// This is for use by gtkmm wrappers only, and not by applications.
//inline bool is_derived_inline_() const
//{
- // return (custom_type_name_ != 0);
+ // return (custom_type_name_ != nullptr);
//}
protected:
@@ -235,9 +241,6 @@ protected:
#endif //DOXYGEN_SHOULD_SKIP_THIS
private:
- // noncopyable
- ObjectBase(const ObjectBase&);
- ObjectBase& operator=(const ObjectBase&);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
virtual void set_manage(); // calls g_error()
diff --git a/glib/glibmm/pattern.h b/glib/glibmm/pattern.h
index 6f527ccc..dff0a97c 100644
--- a/glib/glibmm/pattern.h
+++ b/glib/glibmm/pattern.h
@@ -43,6 +43,10 @@ public:
explicit PatternSpec(GPatternSpec* gobject);
~PatternSpec();
+ // noncopyable
+ PatternSpec(const PatternSpec&) = delete;
+ PatternSpec& operator=(const PatternSpec&) = delete;
+
bool match(const Glib::ustring& str) const;
bool match(const Glib::ustring& str, const Glib::ustring& str_reversed) const;
@@ -54,10 +58,6 @@ public:
private:
GPatternSpec* gobject_;
-
- // noncopyable
- PatternSpec(const PatternSpec&);
- PatternSpec& operator=(const PatternSpec&);
};
/** @} group PatternMatching */
diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc
index 4cf054f9..346c3e1f 100644
--- a/glib/glibmm/property.cc
+++ b/glib/glibmm/property.cc
@@ -239,7 +239,7 @@ PropertyBase::~PropertyBase()
bool PropertyBase::lookup_property(const Glib::ustring& name)
{
- g_assert(param_spec_ == 0);
+ g_assert(param_spec_ == nullptr);
param_spec_ = g_object_class_find_property(G_OBJECT_GET_CLASS(object_->gobj()), name.c_str());
@@ -249,12 +249,12 @@ bool PropertyBase::lookup_property(const Glib::ustring& name)
g_param_spec_ref(param_spec_);
}
- return (param_spec_ != 0);
+ return (param_spec_ != nullptr);
}
void PropertyBase::install_property(GParamSpec* param_spec)
{
- g_return_if_fail(param_spec != 0);
+ g_return_if_fail(param_spec != nullptr);
// Ensure that there would not be id clashes with possible existing
// properties overridden from implemented interfaces if dealing with a custom
@@ -280,7 +280,7 @@ void PropertyBase::install_property(GParamSpec* param_spec)
const char* PropertyBase::get_name_internal() const
{
const char *const name = g_param_spec_get_name(param_spec_);
- g_return_val_if_fail(name != 0, "");
+ g_return_val_if_fail(name != nullptr, "");
return name;
}
diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h
index 716d8599..dadc0f29 100644
--- a/glib/glibmm/property.h
+++ b/glib/glibmm/property.h
@@ -57,6 +57,10 @@ class PropertyBase
{
public:
+ // noncopyable
+ PropertyBase(const PropertyBase&) = delete;
+ PropertyBase& operator=(const PropertyBase&) = delete;
+
/** Returns the name of the property.
*/
Glib::ustring get_name() const;
@@ -98,9 +102,6 @@ protected:
const char* get_name_internal() const;
private:
- // noncopyable
- PropertyBase(const PropertyBase&);
- PropertyBase& operator=(const PropertyBase&);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/glib/glibmm/propertyproxy_base.cc b/glib/glibmm/propertyproxy_base.cc
index 0f1fac8e..4d449390 100644
--- a/glib/glibmm/propertyproxy_base.cc
+++ b/glib/glibmm/propertyproxy_base.cc
@@ -112,7 +112,7 @@ void PropertyProxy_Base::reset_property_()
const GParamSpec *const pParamSpec =
g_object_class_find_property(G_OBJECT_GET_CLASS(obj_->gobj()), property_name_);
- g_return_if_fail(pParamSpec != 0);
+ g_return_if_fail(pParamSpec != nullptr);
Glib::ValueBase value;
value.init(G_PARAM_SPEC_VALUE_TYPE(pParamSpec));
diff --git a/glib/glibmm/random.h b/glib/glibmm/random.h
index 864a4a32..aeda3a6a 100644
--- a/glib/glibmm/random.h
+++ b/glib/glibmm/random.h
@@ -43,6 +43,10 @@ public:
explicit Rand(guint32 seed);
~Rand();
+ // noncopyable
+ Rand(const Rand&) = delete;
+ Rand& operator=(const Rand&) = delete;
+
void set_seed(guint32 seed);
bool get_bool();
@@ -58,10 +62,6 @@ public:
private:
GRand* gobject_;
-
- // noncopyable
- Rand(const Rand&);
- Rand& operator=(const Rand&);
};
/** @} group Random */
diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h
index 7b11a756..30dbf185 100644
--- a/glib/glibmm/refptr.h
+++ b/glib/glibmm/refptr.h
@@ -20,6 +20,8 @@
*/
#include <glibmmconfig.h>
+#include <glib.h>
+#include <utility>
namespace Glib
{
@@ -66,7 +68,16 @@ public:
*
* This increments the shared reference count.
*/
- inline RefPtr(const RefPtr<T_CppObject>& src);
+ inline RefPtr(const RefPtr& src);
+
+ /** Move constructor
+ */
+ inline RefPtr(RefPtr&& src);
+
+ /** Move constructor (from different, but castable type).
+ */
+ template <class T_CastFrom>
+ inline RefPtr(RefPtr<T_CastFrom>&& src);
/** Copy constructor (from different, but castable type).
*
@@ -80,23 +91,30 @@ public:
* done safely without involving a reference/unreference cycle and is
* therefore highly efficient.
*/
- inline void swap(RefPtr<T_CppObject>& other);
+ inline void swap(RefPtr& other);
/// Copy from another RefPtr:
- inline RefPtr<T_CppObject>& operator=(const RefPtr<T_CppObject>& src);
+ inline RefPtr& operator=(const RefPtr& src);
+
+ /// Move assignment operator:
+ inline RefPtr& operator=(RefPtr&& src);
+
+ /// Move assignment operator (from different, but castable type):
+ template <class T_CastFrom>
+ inline RefPtr& operator=(RefPtr<T_CastFrom>&& src);
/** Copy from different, but castable type).
*
* Increments the reference count.
*/
template <class T_CastFrom>
- inline RefPtr<T_CppObject>& operator=(const RefPtr<T_CastFrom>& src);
+ inline RefPtr& operator=(const RefPtr<T_CastFrom>& src);
/// Tests whether the RefPtr<> point to the same underlying instance.
- inline bool operator==(const RefPtr<T_CppObject>& src) const;
+ inline bool operator==(const RefPtr& src) const;
/// See operator==().
- inline bool operator!=(const RefPtr<T_CppObject>& src) const;
+ inline bool operator!=(const RefPtr& src) const;
/** Dereferencing.
*
@@ -125,6 +143,17 @@ public:
*/
inline void reset();
+ /** 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() 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
@@ -133,7 +162,7 @@ public:
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr<T_CppObject> cast_dynamic(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_dynamic(const RefPtr<T_CastFrom>& src);
/** Static cast to derived class.
*
@@ -143,7 +172,7 @@ public:
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr<T_CppObject> cast_static(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_static(const RefPtr<T_CastFrom>& src);
/** Cast to non-const.
*
@@ -153,7 +182,7 @@ public:
* @endcode
*/
template <class T_CastFrom>
- static inline RefPtr<T_CppObject> cast_const(const RefPtr<T_CastFrom>& src);
+ static inline RefPtr cast_const(const RefPtr<T_CastFrom>& src);
//TODO: Maybe remove these if we replace operator bool() with operator const void* after
//an API/ABI break, as suggested by Daniel Elstner? murrayc.
@@ -168,16 +197,16 @@ public:
* 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<T_CppObject>& src) const;
+ inline bool operator<(const RefPtr& src) const;
/// See operator<().
- inline bool operator<=(const RefPtr<T_CppObject>& src) const;
+ inline bool operator<=(const RefPtr& src) const;
/// See operator<().
- inline bool operator>(const RefPtr<T_CppObject>& src) const;
+ inline bool operator>(const RefPtr& src) const;
/// See operator<().
- inline bool operator>=(const RefPtr<T_CppObject>& src) const;
+ inline bool operator>=(const RefPtr& src) const;
private:
T_CppObject* pCppObject_;
@@ -215,7 +244,7 @@ RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject)
{}
template <class T_CppObject> inline
-RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CppObject>& src)
+RefPtr<T_CppObject>::RefPtr(const RefPtr& src)
:
pCppObject_ (src.pCppObject_)
{
@@ -223,6 +252,23 @@ RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CppObject>& src)
pCppObject_->reference();
}
+template <class T_CppObject> inline
+RefPtr<T_CppObject>::RefPtr(RefPtr&& src)
+:
+ pCppObject_ (src.pCppObject_)
+{
+ src.pCppObject_ = nullptr;
+}
+
+template <class T_CppObject>
+ template <class T_CastFrom>
+inline
+RefPtr<T_CppObject>::RefPtr(RefPtr<T_CastFrom>&& src)
+:
+ pCppObject_ (src.release())
+{
+}
+
// The templated ctor allows copy construction from any object that's
// castable. Thus, it does downcasts:
// base_ref = derived_ref
@@ -241,7 +287,7 @@ RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
}
template <class T_CppObject> inline
-void RefPtr<T_CppObject>::swap(RefPtr<T_CppObject>& other)
+void RefPtr<T_CppObject>::swap(RefPtr& other)
{
T_CppObject *const temp = pCppObject_;
pCppObject_ = other.pCppObject_;
@@ -249,7 +295,7 @@ void RefPtr<T_CppObject>::swap(RefPtr<T_CppObject>& other)
}
template <class T_CppObject> inline
-RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CppObject>& src)
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr& src)
{
// In case you haven't seen the swap() technique to implement copy
// assignment before, here's what it does:
@@ -280,6 +326,28 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CppObject>& s
return *this;
}
+template <class T_CppObject> inline
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr&& src)
+{
+ RefPtr<T_CppObject> temp (std::move(src));
+ this->swap(temp);
+ src.pCppObject_ = nullptr;
+
+ return *this;
+}
+
+template <class T_CppObject>
+ template <class T_CastFrom>
+inline
+RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(RefPtr<T_CastFrom>&& src)
+{
+ if (pCppObject_)
+ pCppObject_->unreference();
+ pCppObject_ = src.release();
+
+ return *this;
+}
+
template <class T_CppObject>
template <class T_CastFrom>
inline
@@ -291,13 +359,13 @@ RefPtr<T_CppObject>& RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& sr
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator==(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator==(const RefPtr& src) const
{
return (pCppObject_ == src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator!=(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator!=(const RefPtr& src) const
{
return (pCppObject_ != src.pCppObject_);
}
@@ -305,7 +373,7 @@ bool RefPtr<T_CppObject>::operator!=(const RefPtr<T_CppObject>& src) const
template <class T_CppObject> inline
RefPtr<T_CppObject>::operator bool() const
{
- return (pCppObject_ != 0);
+ return (pCppObject_ != nullptr);
}
#ifndef GLIBMM_DISABLE_DEPRECATED
@@ -323,6 +391,14 @@ void RefPtr<T_CppObject>::reset()
this->swap(temp);
}
+template <class T_CppObject> inline
+T_CppObject* RefPtr<T_CppObject>::release()
+{
+ T_CppObject *tmp = pCppObject_;
+ pCppObject_ = nullptr;
+ return tmp;
+}
+
template <class T_CppObject>
template <class T_CastFrom>
inline
@@ -363,25 +439,25 @@ RefPtr<T_CppObject> RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& sr
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator<(const RefPtr& src) const
{
return (pCppObject_ < src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator<=(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator<=(const RefPtr& src) const
{
return (pCppObject_ <= src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator>(const RefPtr& src) const
{
return (pCppObject_ > src.pCppObject_);
}
template <class T_CppObject> inline
-bool RefPtr<T_CppObject>::operator>=(const RefPtr<T_CppObject>& src) const
+bool RefPtr<T_CppObject>::operator>=(const RefPtr& src) const
{
return (pCppObject_ >= src.pCppObject_);
}
diff --git a/glib/glibmm/sarray.cc b/glib/glibmm/sarray.cc
index 2d7c6828..a7d6e315 100644
--- a/glib/glibmm/sarray.cc
+++ b/glib/glibmm/sarray.cc
@@ -21,65 +21,4 @@
*/
#include <glibmm/sarray.h>
-/*
-namespace Glib
-{
-SArray::SArray(const SArray& src)
-: type_base(src)
-{
-}
-
-SArray::SArray(const T_c* pValues, size_type size)
-: type_base(pValues, size)
-{
-}
-
-SArray::operator std::vector<nstring>() const
-{
- return std::vector<nstring>(begin(), end());
-}
-
-SArray::operator std::vector<ustring>() const
-{
- return std::vector<ustring>(begin(), end());
-}
-
-SArray::operator std::vector<std::string>() const
-{
- return std::vector<std::string>(begin(), end());
-}
-
-
-SArray::operator std::deque<nstring>() const
-{
- return std::deque<nstring>(begin(), end());
-}
-
-SArray::operator std::deque<ustring>() const
-{
- return std::deque<ustring>(begin(), end());
-}
-
-SArray::operator std::deque<std::string>() const
-{
- return std::deque<std::string>(begin(), end());
-}
-
-SArray::operator std::list<nstring>() const
-{
- return std::list<nstring>(begin(), end());
-}
-
-SArray::operator std::list<ustring>() const
-{
- return std::list<ustring>(begin(), end());
-}
-
-SArray::operator std::list<std::string>() const
-{
- return std::list<std::string>(begin(), end());
-}
-
-}; // namespace Glib
-*/
diff --git a/glib/glibmm/sarray.h b/glib/glibmm/sarray.h
index 4f7e4740..6226f50e 100644
--- a/glib/glibmm/sarray.h
+++ b/glib/glibmm/sarray.h
@@ -23,86 +23,20 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+#ifndef GLIBMM_DISABLE_DEPRECATED
#include <glibmm/arrayhandle.h>
#include <glibmm/ustring.h>
-namespace Glib { typedef Glib::ArrayHandle<Glib::ustring> SArray; }
-
-#if 0
-
-namespace Glib
-{
-
-template <>
-inline void cpp_type_to_c_type(const ustring& cpp_value, type_constpch& ref_c_value)
-{
- ref_c_value = cpp_value.c_str();
-}
-
-template <>
-inline void cpp_type_to_c_type(const std::string& cpp_value, type_constpch& ref_c_value)
-{
- ref_c_value = cpp_value.c_str();
-}
-
-typedef Array<Glib::ustring, const char*> SArray;
-
-/*
-class SArray: public Array<nstring, const char*>
-{
-public:
- typedef const char* T_c;
- typedef Array<nstring, const char*> type_base;
-
- SArray(const SArray& src);
-
- // copy other containers
- template <typename T_container>
- SArray(const T_container& t)
- {
- owned_ = Array_Helpers::Traits<T_container, pointer>::get_owned();
- size_ = Array_Helpers::Traits<T_container, pointer>::get_size(t);
- pData_ = Array_Helpers::Traits<T_container, pointer>::get_data(t);
- }
-
- SArray(const T_c* pValues, size_type size);
-
- // copy a sequence
- template <typename Iterator>
- SArray(Iterator b, Iterator e);
-
- operator std::vector<nstring>() const;
- operator std::vector<ustring>() const;
- operator std::vector<std::string>() const;
-
- operator std::deque<nstring>() const;
- operator std::deque<ustring>() const;
- operator std::deque<std::string>() const;
-
- operator std::list<nstring>() const;
- operator std::list<ustring>() const;
- operator std::list<std::string>() const;
-};
-
-
-//template <typename T_container>
-//SArray::SArray(const T_container& t)
-//: type_base(t)
-//{
-//}
+namespace Glib {
+/**
+ * @deprecated Use a std::vector instead.
+ */
+typedef Glib::ArrayHandle<Glib::ustring> SArray;
-template <typename Iterator>
-SArray::SArray(Iterator b, Iterator e)
-: type_base(b, e)
-{
}
-*/
-
-} // namespace Glib
-#endif /* #if 0 */
+#endif //GLIBMM_DISABLE_DEPRECATED
#endif // _GLIBMM_SARRAY_H
diff --git a/glib/glibmm/signalproxy.cc b/glib/glibmm/signalproxy.cc
index e218ba9a..41ee5f70 100644
--- a/glib/glibmm/signalproxy.cc
+++ b/glib/glibmm/signalproxy.cc
@@ -1,7 +1,3 @@
-// -*- c++ -*-
-
-/* $Id$ */
-
/* signalproxy.cc
*
* Copyright (C) 2002 The gtkmm Development Team
@@ -101,5 +97,42 @@ void SignalProxyNormal::slot0_void_callback(GObject* self, void* data)
}
}
-} // namespace Glib
+// SignalProxyDetailed implementation:
+
+SignalProxyDetailed::SignalProxyDetailed(Glib::ObjectBase* obj,
+ const SignalProxyInfo* info, const Glib::ustring& detail_name)
+:
+ SignalProxyBase (obj),
+ info_ (info),
+ detailed_name_ (Glib::ustring(info->signal_name) +
+ (detail_name.empty() ? Glib::ustring() : ("::" + detail_name)))
+{}
+
+SignalProxyDetailed::~SignalProxyDetailed()
+{}
+
+sigc::slot_base&
+SignalProxyDetailed::connect_impl_(bool notify, const sigc::slot_base& slot, bool after)
+{
+ // create a proxy to hold our connection info
+ SignalProxyConnectionNode *const pConnectionNode =
+ new SignalProxyConnectionNode(slot, obj_->gobj());
+
+ // connect it to glib
+ // pConnectionNode will be passed in the data argument to the callback.
+ pConnectionNode->connection_id_ = g_signal_connect_data(
+ obj_->gobj(), detailed_name_.c_str(),
+ notify ? info_->notify_callback : info_->callback,
+ pConnectionNode, &SignalProxyConnectionNode::destroy_notify_handler,
+ static_cast<GConnectFlags>(after ? G_CONNECT_AFTER : 0));
+
+ return pConnectionNode->slot_;
+}
+
+void SignalProxyDetailed::emission_stop()
+{
+ g_signal_stop_emission_by_name(obj_->gobj(), detailed_name_.c_str());
+}
+
+} // namespace Glib
diff --git a/glib/glibmm/signalproxy_connectionnode.cc b/glib/glibmm/signalproxy_connectionnode.cc
index cc6f7079..6784d6eb 100644
--- a/glib/glibmm/signalproxy_connectionnode.cc
+++ b/glib/glibmm/signalproxy_connectionnode.cc
@@ -51,7 +51,7 @@ void* SignalProxyConnectionNode::notify(void* data)
if(conn && conn->object_)
{
GObject* o = conn->object_;
- conn->object_ = 0;
+ conn->object_ = nullptr;
if(g_signal_handler_is_connected(o, conn->connection_id_)) //We check first, because during destruction, GTK+ sometimes seems to disconnect them for us, before we expect it to. See bug #87912
{
@@ -84,7 +84,7 @@ void SignalProxyConnectionNode::destroy_notify_handler(gpointer data, GClosure*)
if(conn)
{
// the object has already lost track of this object.
- conn->object_ = 0;
+ conn->object_ = nullptr;
delete conn; // if there are connection objects referring to slot_ they are notified during destruction of slot_
}
diff --git a/glib/glibmm/slisthandle.h b/glib/glibmm/slisthandle.h
index a83cc85e..231d675c 100644
--- a/glib/glibmm/slisthandle.h
+++ b/glib/glibmm/slisthandle.h
@@ -37,7 +37,7 @@ namespace Container_Helpers
template <class Bi, class Tr>
GSList* create_slist(Bi pbegin, Bi pend, Tr)
{
- GSList* head = 0;
+ GSList* head = nullptr;
while(pend != pbegin)
{
@@ -56,7 +56,7 @@ GSList* create_slist(Bi pbegin, Bi pend, Tr)
template <class For, class Tr>
GSList* create_slist(For pbegin, Tr)
{
- GSList* head = 0;
+ GSList* head = nullptr;
while(*pbegin)
{
@@ -296,7 +296,7 @@ SListHandle<T,Tr>::~SListHandle()
if(ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
- for(GSList* node = pslist_; node != 0; node = node->next)
+ for(GSList* node = pslist_; node != nullptr; node = node->next)
Tr::release_c_type(static_cast<typename Tr::CTypeNonConst>(node->data));
}
g_slist_free(pslist_);
@@ -395,7 +395,7 @@ std::size_t SListHandle<T,Tr>::size() const
template <class T, class Tr> inline
bool SListHandle<T,Tr>::empty() const
{
- return (pslist_ == 0);
+ return (pslist_ == nullptr);
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/glib/glibmm/streamiochannel.cc b/glib/glibmm/streamiochannel.cc
index e5201db7..674960dc 100644
--- a/glib/glibmm/streamiochannel.cc
+++ b/glib/glibmm/streamiochannel.cc
@@ -59,7 +59,7 @@ StreamIOChannel::~StreamIOChannel()
IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read)
{
- g_return_val_if_fail(stream_in_ != 0, IO_STATUS_ERROR);
+ g_return_val_if_fail(stream_in_ != nullptr, IO_STATUS_ERROR);
stream_in_->clear();
stream_in_->read(buf, count);
@@ -78,7 +78,7 @@ IOStatus StreamIOChannel::read_vfunc(char* buf, gsize count, gsize& bytes_read)
IOStatus StreamIOChannel::write_vfunc(const char* buf, gsize count, gsize& bytes_written)
{
- g_return_val_if_fail(stream_out_ != 0, IO_STATUS_ERROR);
+ g_return_val_if_fail(stream_out_ != nullptr, IO_STATUS_ERROR);
bytes_written = 0;
@@ -133,23 +133,23 @@ IOStatus StreamIOChannel::close_vfunc()
{
bool failed = false;
- if(std::fstream *const stream = dynamic_cast<std::fstream*>(stream_in_))
+ if(std::fstream *const fstream = dynamic_cast<std::fstream*>(stream_in_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ fstream->clear();
+ fstream->close();
+ failed = fstream->fail();
}
- else if(std::ifstream *const stream = dynamic_cast<std::ifstream*>(stream_in_))
+ else if(std::ifstream *const ifstream = dynamic_cast<std::ifstream*>(stream_in_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ ifstream->clear();
+ ifstream->close();
+ failed = ifstream->fail();
}
- else if(std::ofstream *const stream = dynamic_cast<std::ofstream*>(stream_out_))
+ else if(std::ofstream *const ofstream = dynamic_cast<std::ofstream*>(stream_out_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ ofstream->clear();
+ ofstream->close();
+ failed = ofstream->fail();
}
else
{
@@ -173,8 +173,8 @@ IOStatus StreamIOChannel::set_flags_vfunc(IOFlags)
IOFlags StreamIOChannel::get_flags_vfunc()
{
gobj()->is_seekable = 1;
- gobj()->is_readable = (stream_in_ != 0);
- gobj()->is_writeable = (stream_out_ != 0);
+ gobj()->is_readable = (stream_in_ != nullptr);
+ gobj()->is_writeable = (stream_out_ != nullptr);
IOFlags flags = IO_FLAG_IS_SEEKABLE;
diff --git a/glib/glibmm/stringutils.cc b/glib/glibmm/stringutils.cc
index 5b61dd1c..e72f029d 100644
--- a/glib/glibmm/stringutils.cc
+++ b/glib/glibmm/stringutils.cc
@@ -51,7 +51,7 @@ double Glib::Ascii::strtod(const std::string& str,
}
const char *const bufptr = str.c_str();
- char* endptr = 0;
+ char* endptr = nullptr;
const double result = g_ascii_strtod(bufptr + start_index, &endptr);
const int err_no = errno;
diff --git a/glib/glibmm/threadpool.cc b/glib/glibmm/threadpool.cc
index 9a9af184..a007a435 100644
--- a/glib/glibmm/threadpool.cc
+++ b/glib/glibmm/threadpool.cc
@@ -34,6 +34,10 @@ public:
SlotList();
~SlotList();
+ // noncopyable
+ SlotList(const ThreadPool::SlotList&) = delete;
+ ThreadPool::SlotList& operator=(const ThreadPool::SlotList&) = delete;
+
sigc::slot<void>* push(const sigc::slot<void>& slot);
sigc::slot<void> pop(sigc::slot<void>* slot_ptr);
@@ -42,10 +46,6 @@ public:
private:
Glib::Threads::Mutex mutex_;
std::list< sigc::slot<void> > list_;
-
- // noncopyable
- SlotList(const ThreadPool::SlotList&);
- ThreadPool::SlotList& operator=(const ThreadPool::SlotList&);
};
ThreadPool::SlotList::SlotList()
@@ -128,7 +128,7 @@ ThreadPool::ThreadPool(int max_threads, bool exclusive)
gobject_ (0),
slot_list_ (new SlotList())
{
- GError* error = 0;
+ GError* error = nullptr;
gobject_ = g_thread_pool_new(
&call_thread_entry_slot, slot_list_, max_threads, exclusive, &error);
@@ -136,7 +136,7 @@ ThreadPool::ThreadPool(int max_threads, bool exclusive)
if(error)
{
delete slot_list_;
- slot_list_ = 0;
+ slot_list_ = nullptr;
Glib::Error::throw_exception(error);
}
}
@@ -157,7 +157,7 @@ void ThreadPool::push(const sigc::slot<void>& slot)
{
sigc::slot<void> *const slot_ptr = slot_list_->push(slot);
- GError* error = 0;
+ GError* error = nullptr;
g_thread_pool_push(gobject_, slot_ptr, &error);
if(error)
@@ -169,7 +169,7 @@ void ThreadPool::push(const sigc::slot<void>& slot)
void ThreadPool::set_max_threads(int max_threads)
{
- GError* error = 0;
+ GError* error = nullptr;
g_thread_pool_set_max_threads(gobject_, max_threads, &error);
if(error)
@@ -193,7 +193,7 @@ unsigned int ThreadPool::unprocessed() const
bool ThreadPool::get_exclusive() const
{
- g_return_val_if_fail(gobject_ != 0, false);
+ g_return_val_if_fail(gobject_ != nullptr, false);
return gobject_->exclusive;
}
@@ -203,14 +203,14 @@ void ThreadPool::shutdown(bool immediately)
if(gobject_)
{
g_thread_pool_free(gobject_, immediately, 1);
- gobject_ = 0;
+ gobject_ = nullptr;
}
if(slot_list_)
{
slot_list_->lock_and_unlock();
delete slot_list_;
- slot_list_ = 0;
+ slot_list_ = nullptr;
}
}
diff --git a/glib/glibmm/timer.h b/glib/glibmm/timer.h
index 4864e68b..2c68d3a7 100644
--- a/glib/glibmm/timer.h
+++ b/glib/glibmm/timer.h
@@ -41,6 +41,10 @@ public:
Timer();
~Timer();
+ // not copyable
+ Timer(const Timer&) = delete;
+ Timer& operator=(const Timer&) = delete;
+
void start();
void stop();
void reset();
@@ -63,10 +67,6 @@ public:
private:
GTimer* gobject_;
-
- // not copyable
- Timer(const Timer&);
- Timer& operator=(const Timer&);
};
diff --git a/glib/glibmm/ustring.cc b/glib/glibmm/ustring.cc
index 6cb4b1f3..1d5e841d 100644
--- a/glib/glibmm/ustring.cc
+++ b/glib/glibmm/ustring.cc
@@ -1260,7 +1260,7 @@ ustring::FormatStream::~FormatStream()
ustring ustring::FormatStream::to_string() const
{
- GError* error = 0;
+ GError* error = nullptr;
#ifdef GLIBMM_HAVE_WIDE_STREAM
const std::wstring str = stream_.str();
@@ -1304,7 +1304,7 @@ std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string)
std::string str;
is >> str;
- GError* error = 0;
+ GError* error = nullptr;
gsize n_bytes = 0;
const ScopedPtr<char> buf (g_locale_to_utf8(str.data(), str.size(), 0, &n_bytes, &error));
@@ -1320,7 +1320,7 @@ std::istream& operator>>(std::istream& is, Glib::ustring& utf8_string)
std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string)
{
- GError* error = 0;
+ GError* error = nullptr;
const ScopedPtr<char> buf (g_locale_from_utf8(utf8_string.raw().data(),
utf8_string.raw().size(), 0, 0, &error));
if (error)
@@ -1344,7 +1344,7 @@ std::ostream& operator<<(std::ostream& os, const Glib::ustring& utf8_string)
std::wistream& operator>>(std::wistream& is, ustring& utf8_string)
{
- GError* error = 0;
+ GError* error = nullptr;
std::wstring wstr;
is >> wstr;
@@ -1378,7 +1378,7 @@ std::wistream& operator>>(std::wistream& is, ustring& utf8_string)
std::wostream& operator<<(std::wostream& os, const ustring& utf8_string)
{
- GError* error = 0;
+ GError* error = nullptr;
#if defined(__STDC_ISO_10646__) && SIZEOF_WCHAR_T == 4
// Avoid going through iconv if wchar_t always contains UCS-4.
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index c93a7d7e..3f74be7d 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -875,6 +875,12 @@ struct ustring::SequenceToString<Glib::ustring::const_iterator, gunichar> : publ
class ustring::FormatStream
{
+public:
+
+ // noncopyable
+ FormatStream(const ustring::FormatStream&) = delete;
+ FormatStream& operator=(const ustring::FormatStream&) = delete;
+
private:
#ifdef GLIBMM_HAVE_WIDE_STREAM
typedef std::wostringstream StreamType;
@@ -883,10 +889,6 @@ private:
#endif
StreamType stream_;
- // noncopyable
- FormatStream(const ustring::FormatStream&);
- FormatStream& operator=(const ustring::FormatStream&);
-
public:
FormatStream();
~FormatStream();
@@ -1261,16 +1263,16 @@ class ustring::Stringify
private:
ustring string_;
- // noncopyable
- Stringify(const ustring::Stringify<T>&);
- Stringify<T>& operator=(const ustring::Stringify<T>&);
-
public:
explicit inline Stringify(const T& arg) : string_ (ustring::format(arg)) {}
//TODO: Why is this here? See the template specialization:
explicit inline Stringify(const char* arg) : string_(arg) {}
+ // noncopyable
+ Stringify(const ustring::Stringify<T>&) = delete;
+ Stringify<T>& operator=(const ustring::Stringify<T>&) = delete;
+
inline const ustring* ptr() const { return &string_; }
};
@@ -1281,12 +1283,13 @@ class ustring::Stringify<ustring>
private:
const ustring& string_;
- // noncopyable
- Stringify(const ustring::Stringify<ustring>&);
- Stringify<ustring>& operator=(const ustring::Stringify<ustring>&);
-
public:
explicit inline Stringify(const ustring& arg) : string_(arg) {}
+
+ // noncopyable
+ Stringify(const ustring::Stringify<ustring>&) = delete;
+ Stringify<ustring>& operator=(const ustring::Stringify<ustring>&) = delete;
+
inline const ustring* ptr() const { return &string_; }
};
@@ -1299,12 +1302,13 @@ class ustring::Stringify<const char*>
private:
const ustring string_;
- // noncopyable
- Stringify(const ustring::Stringify<const char*>&);
- Stringify<ustring>& operator=(const ustring::Stringify<const char*>&);
-
public:
explicit inline Stringify(const char* arg) : string_(arg) {}
+
+ // noncopyable
+ Stringify(const ustring::Stringify<const char*>&) = delete;
+ Stringify<ustring>& operator=(const ustring::Stringify<const char*>&) = delete;
+
inline const ustring* ptr() const { return &string_; }
};
@@ -1317,12 +1321,13 @@ class ustring::Stringify<char[N]>
private:
const ustring string_;
- // noncopyable
- Stringify(const ustring::Stringify<char[N]>&);
- Stringify<ustring>& operator=(const ustring::Stringify<char[N]>&);
-
public:
explicit inline Stringify(const char arg[N]) : string_(arg) {}
+
+ // noncopyable
+ Stringify(const ustring::Stringify<char[N]>&) = delete;
+ Stringify<ustring>& operator=(const ustring::Stringify<char[N]>&) = delete;
+
inline const ustring* ptr() const { return &string_; }
};
@@ -1336,12 +1341,13 @@ class ustring::Stringify<const char[N]>
private:
const ustring string_;
- // noncopyable
- Stringify(const ustring::Stringify<const char[N]>&);
- Stringify<ustring>& operator=(const ustring::Stringify<const char[N]>&);
-
public:
explicit inline Stringify(const char arg[N]) : string_(arg) {}
+
+ // noncopyable
+ Stringify(const ustring::Stringify<const char[N]>&) = delete;
+ Stringify<ustring>& operator=(const ustring::Stringify<const char[N]>&) = delete;
+
inline const ustring* ptr() const { return &string_; }
};
diff --git a/glib/glibmm/utility.h b/glib/glibmm/utility.h
index 6e5319b8..79fecb6b 100644
--- a/glib/glibmm/utility.h
+++ b/glib/glibmm/utility.h
@@ -1,4 +1,3 @@
-// -*- c++ -*-
#ifndef _GLIBMM_UTILITY_H
#define _GLIBMM_UTILITY_H
@@ -113,6 +112,16 @@ std::string convert_return_gchar_ptr_to_stdstring(char* str)
// Append type_name to dest, while replacing special characters with '+'.
void append_canonical_typename(std::string& dest, const char* type_name);
+// Delete data referred to by a void*.
+// Instantiations can be used as destroy callbacks in glib functions
+// that take a GDestroyNotify parameter, such as g_object_set_qdata_full()
+// and g_option_group_set_translate_func().
+template <typename T>
+void destroy_notify_delete(void* data)
+{
+ delete static_cast<T*>(data);
+}
+
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/glib/glibmm/wrap.cc b/glib/glibmm/wrap.cc
index 4d9c71cf..4b801a46 100644
--- a/glib/glibmm/wrap.cc
+++ b/glib/glibmm/wrap.cc
@@ -38,7 +38,7 @@ namespace
typedef std::vector<Glib::WrapNewFunction> WrapFuncTable;
-static WrapFuncTable* wrap_func_table = 0;
+static WrapFuncTable* wrap_func_table = nullptr;
} // anonymous namespace
@@ -70,7 +70,7 @@ void wrap_register_cleanup()
if(wrap_func_table)
{
delete wrap_func_table;
- wrap_func_table = 0;
+ wrap_func_table = nullptr;
}
}
@@ -95,7 +95,7 @@ void wrap_register(GType type, WrapNewFunction func)
static Glib::ObjectBase* wrap_create_new_wrapper(GObject* object)
{
- g_return_val_if_fail(wrap_func_table != 0, 0);
+ g_return_val_if_fail(wrap_func_table != nullptr, 0);
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
if(gtkmm_wrapper_already_deleted)
@@ -140,7 +140,7 @@ static gboolean gtype_wraps_interface(GType implementer_type, GType interface_ty
Glib::ObjectBase* wrap_create_new_wrapper_for_interface(GObject* object, GType interface_gtype)
{
- g_return_val_if_fail(wrap_func_table != 0, 0);
+ g_return_val_if_fail(wrap_func_table != nullptr, 0);
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
if(gtkmm_wrapper_already_deleted)
diff --git a/glib/glibmm/wrap.h b/glib/glibmm/wrap.h
index 5b07395b..f898785a 100644
--- a/glib/glibmm/wrap.h
+++ b/glib/glibmm/wrap.h
@@ -1,9 +1,6 @@
-// -*- c++ -*-
#ifndef _GLIBMM_WRAP_H
#define _GLIBMM_WRAP_H
-/* $Id$ */
-
/* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -76,7 +73,7 @@ TInterface* wrap_auto_interface(GObject* object, bool take_copy = false)
//If no exact wrapper was created,
//create an instance of the interface,
//so we at least get the expected type:
- TInterface* result = 0;
+ TInterface* result = nullptr;
if(pCppObject)
{
result = dynamic_cast<TInterface*>(pCppObject);
@@ -143,6 +140,20 @@ const typename T::BaseObjectType* unwrap(const Glib::RefPtr<const T>& ptr)
return (ptr) ? ptr->gobj() : 0;
}
+// This unwrap_copy() overload is intended primarily for classes wrapped as
+// _CLASS_BOXEDTYPE, _CLASS_OPAQUE_COPYABLE or _CLASS_OPAQUE_REFCOUNTED,
+// where the C++ objects are not stored in Glib::RefPtr<>s. They have a const
+// gobj_copy() member that returns a non-const pointer to the underlying C instance.
+/** Get the underlying C instance from the C++ instance and acquire a
+ * reference or copy. This is just like calling gobj_copy(), but it does its own
+ * check for a NULL pointer to the underlying C instance.
+ */
+template <class T> inline
+typename T::BaseObjectType* unwrap_copy(const T& obj)
+{
+ return obj.gobj() ? obj.gobj_copy() : 0;
+}
+
/** Get the underlying C instance from the C++ instance and acquire a
* reference. This is just like calling gobj_copy(), but it does its own
* check for a NULL pointer.