</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
- <AdditionalIncludeDirectories>.\glibmm;..;..\glib;$(GlibEtcInstallRoot)\include\sigc++-2.0;$(GlibEtcInstallRoot)\lib\sigc++-2.0\include;$(GlibEtcInstallRoot)\include\gio-win32-2.0;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>.\glibmm;..;..\glib;$(GlibEtcInstallRoot)\include\sigc++-2.0;$(GlibEtcInstallRoot)\lib\sigc++-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalOptions>/d2Zi+ %(AdditionalOptions)</AdditionalOptions>
-2.46.4:
-
-Glib:
-* Fix definition of VARIANT_TYPE_DICT_ENTRY to match header declaration
- (Aurelien Jacobs) Bug #761046
-
-Build:
-* MSVC builds: Look for includes in include/gio-win32-2.0.
- (Chun-wei Fan) Bug #761046
-* glibmmconfig.h.in: Fix Visual Studio 2013 builds.
- (Chun-wei Fan) Bug #760612
-* Glib::ustring: fix -Wmisleading-indentation gcc 6 warning in public header.
- (Aurelien Jacobs) Bug #760641.
-
-
-2.46.3:
-
-Gio:
-* ActionMap: Fix the ref count in lookup_action_vfunc()
- (Kjell Ahlstedt) Bug #758813 (Aurimas ÄŒernius)
-* Application: Destructor: Use noexcept in the implementation too.
- (Murray Cumming) Bug #758798 (Émeric Maschino)
-
+2.47.3:
+* Deprecate all of Glib::Threads, including Mutex, Lock, Thread, etc.
+* Deprecated Glib::ThreadPool
2.46.2:
* ObjectBase, Object, Interface: Correct move constructors and move assignment
## 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.46.4],
+AC_INIT([glibmm], [2.47.3],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
# include <config.h>
#endif
#include <giomm.h>
+#include <thread>
#include <iostream>
+#include <mutex>
#include <cerrno>
#include <csignal>
exit (1);
}
-G_LOCK_DEFINE_STATIC (response);
+static std::mutex response_mutex;
static bool
idle_quit ()
print_resolved_name (const Glib::ustring& phys,
const Glib::ustring& name)
{
- G_LOCK (response);
+ std::lock_guard<std::mutex> lock_guard (response_mutex);
std::cout
<< Glib::ustring::compose ("Address: %1\n", phys)
<< Glib::ustring::compose ("Name: %1\n", name)
<< std::endl;
done_lookup ();
- G_UNLOCK (response);
}
static void
print_resolved_addresses (const Glib::ustring& name,
const std::list<Glib::RefPtr<Gio::InetAddress>>& addresses)
{
- G_LOCK (response);
+ std::lock_guard<std::mutex> lock_guard (response_mutex);
std::cout << Glib::ustring::compose ("Name: %1\n", name);
for (const auto& i : addresses)
{
std::cout << std::endl;
done_lookup ();
- G_UNLOCK (response);
}
static void
print_resolved_service (const Glib::ustring& service,
const std::list<Gio::SrvTarget>& targets)
{
- G_LOCK (response);
+ std::lock_guard<std::mutex> lock_guard (response_mutex);
std::cout << Glib::ustring::compose ("Service: %1\n", service);
for (const auto& i : targets)
{
std::cout << std::endl;
done_lookup ();
- G_UNLOCK (response);
}
static std::vector<Glib::ustring>
lookup_one_sync (arg);
}
-static void
+static std::vector<std::thread*>
start_threaded_lookups (char **argv, int argc)
{
+ std::vector<std::thread*> result;
for (auto i = 0; i < argc; i++)
{
- Glib::Threads::Thread::create (sigc::bind (sigc::ptr_fun (lookup_thread),
- argv[i]));
- }
+ const Glib::ustring arg = argv[i];
+ const auto thread = new std::thread(&lookup_thread, arg);
+ result.push_back(thread);
+ }
+
+ return result;
}
static void
nlookups = argc - 1;
loop = Glib::MainLoop::create (true);
+ std::vector<std::thread*> threads;
if (use_connectable)
do_connectable (argv[1], synchronous);
else
{
if (synchronous)
- start_threaded_lookups (argv + 1, argc - 1);
+ threads = start_threaded_lookups (argv + 1, argc - 1);
else
start_async_lookups (argv + 1, argc - 1);
}
loop->run ();
+ //Join and delete each thread:
+ std::for_each(threads.begin(), threads.end(),
+ [] (std::thread* thread)
+ {
+ thread->join();
+ delete thread;
+ });
+
#ifdef G_OS_UNIX
watch_conn.disconnect ();
#endif
#include <cstring>
#include <giomm.h>
#include <glibmm.h>
+#include <thread>
#include <iostream>
namespace
return 1;
}
+ std::thread* thread = nullptr;
if (cancel_timeout)
{
cancellable = Gio::Cancellable::create ();
- Glib::Threads::Thread::create (sigc::bind (sigc::ptr_fun (cancel_thread), cancellable));
+ thread = new std::thread(&cancel_thread, cancellable);
}
loop = Glib::MainLoop::create ();
return 1;
}
+ //TODO: This won't happen if we returned earlier.
+ if(thread)
+ {
+ thread->join();
+ delete thread;
+ }
+
return 0;
}
+#include <thread>
#include <iostream>
#include <giomm.h>
#include <glibmm.h>
return 1;
}
+ std::thread* thread = nullptr;
if (cancel_timeout)
{
cancellable = Gio::Cancellable::create ();
- Glib::Threads::Thread::create (sigc::bind (sigc::ptr_fun (cancel_thread), cancellable));
+ thread = new std::thread(&cancel_thread, cancellable);
}
loop = Glib::MainLoop::create ();
return 1;
}
+
+ //TODO: This won't happen if we returned earlier.
+ if(thread)
+ {
+ thread->join();
+ delete thread;
+ }
+
return 0;
}
#include <algorithm>
#include <functional>
+#include <thread>
#include <iostream>
#include <vector>
// Note that the thread does not write to the member data at all. It only
// reads signal_increment_, which is only written to before the thread is
// launched. Therefore, no locking is required.
- Glib::Threads::Thread* thread_;
+ std::thread* thread_;
int id_;
unsigned int progress_;
Glib::Dispatcher signal_increment_;
void ThreadProgress::launch()
{
// Create a joinable thread.
- thread_ = Glib::Threads::Thread::create(sigc::mem_fun(*this, &ThreadProgress::thread_function));
+ thread_ = new std::thread(
+ [this] ()
+ {
+ thread_function();
+ });
}
void ThreadProgress::join()
{
thread_->join();
- thread_ = 0;
+ delete thread_;
+ thread_ = nullptr;
}
bool ThreadProgress::unfinished() const
#include <glibmm.h>
#include <sstream>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
#include <iostream>
Glib::Dispatcher signal_increment_;
Glib::Dispatcher* signal_finished_ptr_;
- Glib::Threads::Mutex startup_mutex_;
- Glib::Threads::Cond startup_cond_;
- Glib::Threads::Thread* thread_;
+ std::mutex startup_mutex_;
+ std::condition_variable startup_cond_;
+ std::thread* thread_;
static type_signal_end signal_end_;
// Create a new Glib::Dispatcher that is attached to the default main context,
signal_increment_ (),
// This pointer will be initialized later by the 2nd thread.
- signal_finished_ptr_ (nullptr)
+ signal_finished_ptr_ (nullptr),
+ thread_ (nullptr)
{
// Connect the cross-thread signal.
signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment));
// order to access the Glib::Dispatcher object instantiated by the 2nd thread.
// So, let's do some kind of hand-shake using a mutex and a condition
// variable.
- Glib::Threads::Mutex::Lock lock (startup_mutex_);
+ std::unique_lock<std::mutex> lock (startup_mutex_);
- // Create a joinable thread -- it needs to be joined, otherwise it's a memory leak.
- thread_ = Glib::Threads::Thread::create(
- sigc::mem_fun(*this, &ThreadTimer::thread_function));
+ // Create a joinable thread -- it needs to be joined, otherwise its destructor will block.
+ thread_ = new std::thread(
+ [this] ()
+ {
+ thread_function();
+ });
// Wait for the 2nd thread's startup notification.
- while(!signal_finished_ptr_)
- startup_cond_.wait(startup_mutex_);
+ startup_cond_.wait(lock,
+ [this] () -> bool
+ {
+ return signal_finished_ptr_;
+ });
}
void ThreadTimer::signal_finished_emit()
// wait for the thread to join
if(thread_)
+ {
thread_->join();
+ delete thread_;
+ thread_ = nullptr;
+ }
signal_finished_ptr_ = nullptr;
}
// We need to lock while creating the Glib::Dispatcher instance,
// in order to ensure memory visibility.
- Glib::Threads::Mutex::Lock lock (startup_mutex_);
+ std::unique_lock<std::mutex> lock (startup_mutex_);
// create a new dispatcher, that is connected to the newly
// created MainContext
signal_finished_ptr_ = &signal_finished;
// Tell the launcher thread that everything is in place now.
- startup_cond_.signal();
- lock.release();
+ //We unlock before notifying, because that is what the documentation suggests:
+ //http://en.cppreference.com/w/cpp/thread/condition_variable
+ lock.unlock();
+ startup_cond_.notify_one();
// start the mainloop
mainloop->run();
#include <iostream>
+#include <thread>
+#include <mutex>
+#include <condition_variable>
#include <queue>
-#include <glibmm/threads.h>
#include <glibmm/random.h>
#include <glibmm/timer.h>
#include <glibmm/init.h>
void consumer();
private:
- Glib::Threads::Mutex mutex_;
- Glib::Threads::Cond cond_push_;
- Glib::Threads::Cond cond_pop_;
+ std::mutex mutex_;
+ std::condition_variable cond_push_;
+ std::condition_variable cond_pop_;
std::queue<int> queue_;
};
for(auto i = 0; i < 200; ++i)
{
{
- Glib::Threads::Mutex::Lock lock (mutex_);
+ std::unique_lock<std::mutex> lock (mutex_);
- while(queue_.size() >= 64)
- cond_pop_.wait(mutex_);
+ cond_pop_.wait(lock,
+ [this] () -> bool
+ {
+ return queue_.size() < 64;
+ });
queue_.push(i);
std::cout << '*';
std::cout.flush();
- cond_push_.signal();
+ //We unlock before notifying, because that is what the documentation suggests:
+ //http://en.cppreference.com/w/cpp/thread/condition_variable
+ lock.unlock();
+ cond_push_.notify_one();
}
if(rand.get_bool())
for(;;)
{
{
- Glib::Threads::Mutex::Lock lock (mutex_);
+ std::unique_lock<std::mutex> lock (mutex_);
- while(queue_.empty())
- cond_push_.wait(mutex_);
+ cond_push_.wait(lock,
+ [this] () -> bool
+ {
+ return !queue_.empty();
+ });
const int i = queue_.front();
queue_.pop();
std::cout << "\x08 \x08";
std::cout.flush();
- cond_pop_.signal();
+ //We unlock before notifying, because that is what the documentation suggests:
+ //http://en.cppreference.com/w/cpp/thread/condition_variable
+ lock.unlock();
+ cond_pop_.notify_one();
if(i >= 199)
break;
MessageQueue queue;
- Glib::Threads::Thread *const producer = Glib::Threads::Thread::create(
- sigc::mem_fun(queue, &MessageQueue::producer));
+ //TODO: Use std::make_unique() when we use C++14:
+ const auto producer = std::unique_ptr<std::thread>(
+ new std::thread(&MessageQueue::producer, &queue));
- Glib::Threads::Thread *const consumer = Glib::Threads::Thread::create(
- sigc::mem_fun(queue, &MessageQueue::consumer));
+ const auto consumer = std::unique_ptr<std::thread>(
+ new std::thread(&MessageQueue::consumer, &queue));
producer->join();
consumer->join();
#include <iostream>
-#include <glibmm/threads.h>
+#include <thread>
+#include <mutex>
+
+//TODO: Remove this example sometime. Glib::ThreadPool is deprecated.
+//TODO: Maybe use std::async() instead?
+#undef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmm/random.h>
#include <glibmm/threadpool.h>
#include <glibmm/timer.h>
+
namespace
{
-Glib::Threads::Mutex mutex;
+std::mutex mutex;
void print_char(char c)
{
for(auto i = 0; i < 100; ++i)
{
{
- Glib::Threads::Mutex::Lock lock (mutex);
+ std::lock_guard<std::mutex> lock (mutex);
std::cout << c;
std::cout.flush();
}
const std::basic_string<guchar>& data, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
gchar* cresult = g_content_type_guess(c_filename, data.c_str(),
data.size(), &c_result_uncertain);
result_uncertain = c_result_uncertain;
const guchar* data, gsize data_size, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
gchar* cresult = g_content_type_guess(c_filename, data,
data_size, &c_result_uncertain);
result_uncertain = c_result_uncertain;
const std::string& data, bool& result_uncertain)
{
gboolean c_result_uncertain = FALSE;
- const gchar *c_filename = filename.empty () ? NULL : filename.c_str ();
+ const gchar *c_filename = filename.empty () ? nullptr : filename.c_str ();
gchar* cresult = g_content_type_guess(c_filename, (const guchar*)data.c_str(),
data.size(), &c_result_uncertain);
result_uncertain = c_result_uncertain;
gboolean giomm_generic_socket_callback(sigc::slot_base* slot, GIOCondition condition)
{
- g_return_val_if_fail(slot != 0, 0);
+ g_return_val_if_fail(slot != nullptr, FALSE);
try
{
void Action::activate()
{
- g_action_activate(gobj(), 0);
+ g_action_activate(gobj(), nullptr);
}
} // namespace Gio
_WRAP_METHOD(Glib::VariantContainerBase get_action_state_hint(const Glib::ustring& action_name) const, g_action_group_get_action_state_hint, deprecated "Use the get_action_state() method that takes an output parameter instead.")
- //TODO: How do we check for a NULL Variant?
+ //TODO: How do we check for a nullptr Variant?
/**
* Requests a hint about the valid range of values for the state of the
* named action within the action group
_WRAP_METHOD(Glib::VariantBase get_action_state(const Glib::ustring& action_name) const, g_action_group_get_action_state, deprecated "Use the get_action_state() method that takes an output parameter instead.")
- //TODO: How do we check for a NULL Variant?
+ //TODO: How do we check for a nullptr Variant?
/** Queries the current state of the named action within the action group.
*
* If the action is not stateful then a null Variant will be returned. If the
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
/* Copyright (C) 2012 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
_WRAP_METHOD(void remove_action(const Glib::ustring& action_name), g_action_map_remove_action)
#m4 _CONVERSION(`Glib::RefPtr<Action>', `GAction*', `Glib::unwrap($3)')
- _WRAP_VFUNC(Glib::RefPtr<Action> lookup_action(const Glib::ustring& name) const, "lookup_action", refreturn)
+ _WRAP_VFUNC(Glib::RefPtr<Action> lookup_action(const Glib::ustring& name) const, "lookup_action")
//TODO: Change this to use const & when we can break ABI.
// ( Changing it causes a symbol lookup error when trying to run already-built applications. )
vec.push_back(file);
GError* gerror = nullptr;
- bool retvalue = g_app_info_launch(gobj(), Glib::ListHandler<Glib::RefPtr<Gio::File> >::vector_to_list(vec).data (), Glib::unwrap(launch_context), &(gerror));
+ const bool retvalue = g_app_info_launch(gobj(),
+ Glib::ListHandler<Glib::RefPtr<Gio::File> >::vector_to_list(vec).data(),
+ Glib::unwrap(launch_context), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
vec.push_back(file);
GError* gerror = nullptr;
- bool retvalue = g_app_info_launch(gobj(), Glib::ListHandler<Glib::RefPtr<Gio::File> >::vector_to_list(vec).data (), 0, &(gerror));
+ const bool retvalue = g_app_info_launch(gobj(),
+ Glib::ListHandler<Glib::RefPtr<Gio::File> >::vector_to_list(vec).data (),
+ nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
vec.push_back(uri);
GError* gerror = nullptr;
- bool retvalue = g_app_info_launch_uris(gobj(), Glib::ListHandler<std::string>::vector_to_list(vec).data (), Glib::unwrap(launch_context), &(gerror));
+ const bool retvalue = g_app_info_launch_uris(gobj(),
+ Glib::ListHandler<std::string>::vector_to_list(vec).data (),
+ Glib::unwrap(launch_context), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
vec.push_back(uri);
GError* gerror = nullptr;
- bool retvalue = g_app_info_launch_uris(gobj(), Glib::ListHandler<std::string>::vector_to_list(vec).data (), 0, &(gerror));
+ const bool retvalue = g_app_info_launch_uris(gobj(),
+ Glib::ListHandler<std::string>::vector_to_list(vec).data (), nullptr,
+ &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
#include <giomm/actiongroup.h>
#include <giomm/init.h>
#include <cstring> // std::memset()
-#include <glibmm/threads.h>
#include <map>
#include <vector>
// similarly to the corresponding Glib::OptionGroup::add_entry*() methods.
// There is an important difference: In add_main_option_entry*() we can't pass
// an Application pointer to the used GOptionGroup.
-// g_application_add_main_option_entries() creates a GOptionGroup with user_data == NULL.
-// Therefore Application_option_arg_callback() is called with data == NULL.
+// g_application_add_main_option_entries() creates a GOptionGroup with user_data == nullptr.
+// Therefore Application_option_arg_callback() is called with data == nullptr.
// Application_option_arg_callback() does not know which Application instance
// the command-line option belongs to. All Application instances (usually only one)
// share a map, mapping the long command option name to an OptionArgCallbackData.
public:
explicit OptionArgCallbackData(const Gio::Application* application, gchar short_name,
const Glib::OptionGroup::SlotOptionArgString& slot)
- : application_(application), short_name_(short_name),
- slot_string_(new Glib::OptionGroup::SlotOptionArgString(slot)), slot_filename_(0)
+ : application_(application),
+ short_name_(short_name),
+ slot_string_(new Glib::OptionGroup::SlotOptionArgString(slot)),
+ slot_filename_(nullptr)
{ }
explicit OptionArgCallbackData(const Gio::Application* application, gchar short_name,
const Glib::OptionGroup::SlotOptionArgFilename& slot)
- : application_(application), short_name_(short_name),
- slot_string_(0), slot_filename_(new Glib::OptionGroup::SlotOptionArgFilename(slot))
+ : application_(application),
+ short_name_(short_name),
+ slot_string_(nullptr),
+ slot_filename_(new Glib::OptionGroup::SlotOptionArgFilename(slot))
{ }
const Gio::Application* get_application() const { return application_; }
private:
const Gio::Application* application_;
gchar short_name_;
- // One of these slot pointers is 0 and the other one points to a slot.
+ // One of these slot pointers is nullptr and the other one points to a slot.
Glib::OptionGroup::SlotOptionArgString* slot_string_;
Glib::OptionGroup::SlotOptionArgFilename* slot_filename_;
// Gio::Application instances may be used in different threads.
// Accesses to option_arg_callback_data must be thread-safe.
-Glib::Threads::Mutex option_arg_callback_data_mutex;
+std::mutex option_arg_callback_data_mutex;
gboolean Application_option_arg_callback(const gchar* option_name, const gchar* value,
gpointer /* data */, GError** error)
// option_name is either a single dash followed by a single letter (for a
// short name) or two dashes followed by a long option name.
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::unique_lock<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::const_iterator iterFind = option_arg_callback_data.end();
if (option_name[1] == '-')
{
if (option_arg->is_filename_option())
{
const auto the_slot = option_arg->get_slot_filename();
- lock.release();
+ lock.unlock();
const std::string cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
}
else
{
const auto the_slot = option_arg->get_slot_string();
- lock.release();
+ lock.unlock();
const Glib::ustring cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
}
Application::Application(const Glib::ustring& application_id, ApplicationFlags flags)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
- Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id", (application_id.empty() ? 0 : application_id.c_str()), "flags", ((GApplicationFlags)(flags)), static_cast<char*>(0)))
+ Glib::ObjectBase(nullptr),
+ Glib::Object(Glib::ConstructParams(custom_class_init(), "application_id",
+ (application_id.empty() ? nullptr : application_id.c_str()),
+ "flags", ((GApplicationFlags)(flags)), nullptr))
{
}
-Application::~Application() noexcept
+Application::~Application()
{
// Delete all OptionArgCallbackData instances that belong to this application.
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
+ std::lock_guard<std::mutex> lock(option_arg_callback_data_mutex);
OptionArgCallbackDataMap::iterator iter = option_arg_callback_data.begin();
while (iter != option_arg_callback_data.end())
{
//static
void Application::unset_default()
{
- g_application_set_default(0);
+ g_application_set_default(nullptr);
}
void Application_Class::open_callback(GApplication* self, GFile** files,
if(obj_base && obj_base->is_derived_())
{
const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
- if(obj) // This can be NULL during destruction.
+ if(obj) // This can be nullptr during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
gchar short_name, const Glib::ustring& description,
const Glib::ustring& arg_description, int flags)
{
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
- OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
- if (iterFind != option_arg_callback_data.end())
- return; // Ignore duplicates
+ {
+ std::lock_guard<std::mutex> lock(option_arg_callback_data_mutex);
+ OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
+ if (iterFind != option_arg_callback_data.end())
+ return; // Ignore duplicates
- auto callback_data = new OptionArgCallbackData(this, short_name, slot);
- option_arg_callback_data[long_name] = callback_data;
- lock.release();
+ auto callback_data = new OptionArgCallbackData(this, short_name, slot);
+ option_arg_callback_data[long_name] = callback_data;
+ } // option_arg_callback_data_mutex.unlock()
add_main_option_entry_private(G_OPTION_ARG_CALLBACK, long_name, short_name,
description, arg_description, flags & ~Glib::OptionEntry::FLAG_FILENAME);
gchar short_name, const Glib::ustring& description,
const Glib::ustring& arg_description, int flags)
{
- Glib::Threads::Mutex::Lock lock(option_arg_callback_data_mutex);
- OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
- if (iterFind != option_arg_callback_data.end())
- return; // Ignore duplicates
+ {
+ std::lock_guard<std::mutex> lock(option_arg_callback_data_mutex);
+ OptionArgCallbackDataMap::iterator iterFind = option_arg_callback_data.find(long_name);
+ if (iterFind != option_arg_callback_data.end())
+ return; // Ignore duplicates
- auto callback_data = new OptionArgCallbackData(this, short_name, slot);
- option_arg_callback_data[long_name] = callback_data;
- lock.release();
+ auto callback_data = new OptionArgCallbackData(this, short_name, slot);
+ option_arg_callback_data[long_name] = callback_data;
+ } // option_arg_callback_data_mutex.unlock()
add_main_option_entry_private(G_OPTION_ARG_CALLBACK, long_name, short_name,
description, arg_description, flags | Glib::OptionEntry::FLAG_FILENAME);
// GOptionEntry.long_name must be set, even if it's an empty string.
gchar* lname = g_strdup(long_name.c_str());
- gchar* desc = description.empty() ? 0 : g_strdup(description.c_str());
- gchar* arg_desc = arg_description.empty() ? 0 : g_strdup(arg_description.c_str());
+ gchar* desc = description.empty() ? nullptr : g_strdup(description.c_str());
+ gchar* arg_desc = arg_description.empty() ? nullptr : g_strdup(arg_description.c_str());
ExtraApplicationData* extra_application_data =
static_cast<ExtraApplicationData*>(g_object_get_qdata(gobject_, quark_extra_application_data));
void Application::unset_resource_base_path()
{
- g_application_set_resource_base_path(gobj(), 0 /* see the C docs. */);
+ g_application_set_resource_base_path(gobj(), nullptr /* see the C docs. */);
}
} // namespace Gio
// and deleted in the callback.
auto slot_copy = new SlotAsyncReady(slot);
- g_async_initable_init_async(gobj(), io_priority, 0,
+ g_async_initable_init_async(gobj(), io_priority, nullptr,
&SignalProxy_async_callback, slot_copy);
}
if(obj_base && obj_base->is_derived_())
{
const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
- if(obj) // This can be NULL during destruction.
+ if(obj) // This can be nullptr during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
if(obj_base && obj_base->is_derived_())
{
const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
- if(obj) // This can be NULL during destruction.
+ if(obj) // This can be nullptr during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
* method directly; instead it will be used automatically in various ways. For
* C applications you generally just call g_async_initable_new_async()
* directly, or indirectly via a foo_thing_new_async() wrapper. This will call
- * g_async_initable_init_async() under the cover, calling back with NULL and a
+ * g_async_initable_init_async() under the cover, calling back with nullptr and a
* set GError on failure.
*/
class AsyncInitable : public Glib::Interface
static GObject* unwrap_objectbase_custom(const Glib::RefPtr<Glib::ObjectBase>& cpp_instance)
{
- return (cpp_instance ? cpp_instance->gobj() : 0);
+ return (cpp_instance ? cpp_instance->gobj() : nullptr);
}
Glib::RefPtr<Glib::ObjectBase> AsyncResult::get_source_object_base()
g_buffered_input_stream_fill_async(gobj(),
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
GError* gerror = nullptr;
char* c_line = g_data_input_stream_read_line(gobj(),
- 0, // pass NULL since we can easily determine the length from the returned std::string
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
Glib::unwrap(cancellable),
&gerror);
if(gerror)
{
GError* gerror = nullptr;
char* c_line = g_data_input_stream_read_line(gobj(),
- 0, // pass NULL since we can easily determine the length from the returned std::string
- 0,
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char* c_str = g_data_input_stream_read_until(gobj(),
stop_chars.c_str(),
- 0, // pass NULL since we can easily determine the length from the returned std::string
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
Glib::unwrap(cancellable),
&gerror);
if(gerror)
GError* gerror = nullptr;
char* c_str = g_data_input_stream_read_until(gobj(),
stop_chars.c_str(),
- 0, // pass NULL since we can easily determine the length from the returned std::string
- 0,
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char* c_str = g_data_input_stream_read_upto(gobj(),
stop_chars.c_str(), -1, /* null-terminated */
- 0, // pass NULL since we can easily determine the length from the returned std::string
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
Glib::unwrap(cancellable),
&gerror);
if(gerror)
GError* gerror = nullptr;
char* c_str = g_data_input_stream_read_upto(gobj(),
stop_chars.c_str(), -1, /* null-terminated */
- 0, // pass NULL since we can easily determine the length from the returned std::string
- 0,
+ nullptr, // pass nullptr since we can easily determine the length from the returned std::string
+ nullptr,
&gerror);
if(gerror)
_WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable{?}), g_data_input_stream_read_uint64, errthrow)
- //Note that we return a bool because we can't use std::string to distinguish between an empty string and a NULL.
+ //Note that we return a bool because we can't use std::string to distinguish between an empty string and a nullptr.
/** Reads a line from the data input stream.
*
void get_stream(const std::string& address, const SlotAsyncReady slot)
{
auto slot_copy = new SlotAsyncReady(slot);
- g_dbus_address_get_stream(address.c_str(), 0, &SignalProxy_async_callback,
+ g_dbus_address_get_stream(address.c_str(), nullptr, &SignalProxy_async_callback,
slot_copy);
}
GError* gerror = nullptr;
auto result =
- Glib::wrap(g_dbus_address_get_stream_finish(Glib::unwrap(res), 0,
+ Glib::wrap(g_dbus_address_get_stream_finish(Glib::unwrap(res), nullptr,
&gerror));
if(gerror)
auto result =
Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(),
- &g_out_guid, 0, &gerror));
+ &g_out_guid, nullptr, &gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
auto result =
- Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), 0,
+ Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), nullptr,
Glib::unwrap(cancellable), &gerror));
if(gerror)
GError* gerror = nullptr;
auto result =
- Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), 0, 0, &gerror));
+ Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), nullptr, nullptr, &gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
std::string result(g_dbus_address_get_for_bus_sync(
- static_cast<GBusType>(bus_type), 0, &gerror));
+ static_cast<GBusType>(bus_type), nullptr, &gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
auto result = (*the_slot)(
Glib::wrap(connection, true), Glib::wrap(message, true),
static_cast<bool>(incoming));
- return (result) ? result->gobj_copy() : 0;
+ return (result) ? result->gobj_copy() : nullptr;
}
catch(...)
{
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init_async(slot, cancellable);
}
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init_async(slot);
}
const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init_async(slot, cancellable);
}
const SlotAsyncReady& slot,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
const SlotAsyncReady& slot,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init_async(slot);
}
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init(cancellable);
}
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
ConnectionFlags flags)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
- "guid", (guid.empty() ? 0 : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init();
}
const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init(cancellable);
}
const Glib::RefPtr<AuthObserver>& observer,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
"authentication-observer", Glib::unwrap(observer))
{
Connection::Connection(const std::string& address,
ConnectionFlags flags)
:
- _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ _CONSTRUCT("address", (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusConnectionFlags>(flags),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init();
}
{
auto slot_copy = new SlotAsyncReady(slot);
- g_bus_get(static_cast<GBusType>(bus_type), 0, &SignalProxy_async_callback,
+ g_bus_get(static_cast<GBusType>(bus_type), nullptr, &SignalProxy_async_callback,
slot_copy);
}
void Connection::close()
{
- g_dbus_connection_close(gobj(), 0, 0, 0);
+ g_dbus_connection_close(gobj(), nullptr, nullptr, nullptr);
}
void Connection::close(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_close(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
void Connection::flush()
{
- g_dbus_connection_flush(gobj(), 0, 0, 0);
+ g_dbus_connection_flush(gobj(), nullptr, nullptr, nullptr);
}
void Connection::flush(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_flush(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
GError* gerror = nullptr;
const bool result = g_dbus_connection_send_message(gobj(),
- Glib::unwrap(message), static_cast<GDBusSendMessageFlags>(flags), 0,
+ Glib::unwrap(message), static_cast<GDBusSendMessageFlags>(flags), nullptr,
&gerror);
if(gerror)
g_dbus_connection_send_message_with_reply(gobj(), Glib::unwrap(message),
static_cast<GDBusSendMessageFlags>(message->get_flags()),
timeout_msec, &out_serial,
- 0, &SignalProxy_async_callback,
+ nullptr, &SignalProxy_async_callback,
slot_copy);
message->set_serial(out_serial);
}
g_dbus_connection_send_message_with_reply_sync(gobj(),
Glib::unwrap(message),
static_cast<GDBusSendMessageFlags>(message->get_flags()), timeout_msec,
- &out_serial, 0, &gerror);
+ &out_serial, nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
g_dbus_connection_call(gobj(), bus_name.c_str(), object_path.c_str(),
interface_name.c_str(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()), reply_type.gobj(),
- static_cast<GDBusCallFlags>(flags), timeout_msec, 0,
+ static_cast<GDBusCallFlags>(flags), timeout_msec, nullptr,
&SignalProxy_async_callback, slot_copy);
}
g_dbus_connection_call_sync(gobj(), bus_name.c_str(), object_path.c_str(),
interface_name.c_str(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()), reply_type.gobj(),
- static_cast<GDBusCallFlags>(flags), timeout_msec, 0, &gerror);
+ static_cast<GDBusCallFlags>(flags), timeout_msec, nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
object_path.c_str(), interface_name.c_str(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()), reply_type.gobj(),
static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(fd_list),
- 0, &SignalProxy_async_callback, slot_copy);
+ nullptr, &SignalProxy_async_callback, slot_copy);
}
#endif // G_OS_UNIX
{
GError* gerror = nullptr;
- // Strings are checked to see if they are empty so that NULL can be passed
+ // Strings are checked to see if they are empty so that nullptr can be passed
// for those strings to the C API. This is done because some strings such as
- // the bus name can be NULL in the C API meaning that the signal should be
+ // the bus name can be nullptr in the C API meaning that the signal should be
// emitted to all the listeners.
g_dbus_connection_emit_signal(gobj(),
- (destination_bus_name.empty() ? 0 : destination_bus_name.c_str()),
- (object_path.empty()? 0 : object_path.c_str()),
- (interface_name.empty() ? 0 : interface_name.c_str()),
- (signal_name.empty() ? 0 : signal_name.c_str()),
+ (destination_bus_name.empty() ? nullptr : destination_bus_name.c_str()),
+ (object_path.empty()? nullptr : object_path.c_str()),
+ (interface_name.empty() ? nullptr : interface_name.c_str()),
+ (signal_name.empty() ? nullptr : signal_name.c_str()),
const_cast<GVariant*>(parameters.gobj()), &gerror);
if(gerror)
const guint result = g_dbus_connection_register_object(gobj(),
object_path.c_str(), Glib::unwrap(interface_info),
- vtable.gobj(), const_cast<InterfaceVTable*>(&vtable), 0, &gerror);
+ vtable.gobj(), const_cast<InterfaceVTable*>(&vtable), nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
const guint result = g_dbus_connection_register_object(gobj(),
object_path.c_str(), Glib::unwrap(interface_info),
- 0, 0, 0, &gerror);
+ nullptr, nullptr, nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
const guint result = g_dbus_connection_register_subtree(gobj(),
object_path.c_str(),
vtable.gobj(), static_cast<GDBusSubtreeFlags>(flags),
- const_cast<SubtreeVTable*>(&vtable), 0, &gerror);
+ const_cast<SubtreeVTable*>(&vtable), nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
static gboolean DBusInterfaceVTable_SetProperty_giomm_callback(
{
//We hand-code this because g_dbus_node_info_lookup_interface() doesn't
-//do this when it takes a NULL.
+//do this when it takes a nullptr.
//See bug https://bugzilla.gnome.org/show_bug.cgi?id=646417
Glib::RefPtr<InterfaceInfo> NodeInfo::lookup_interface()
{
#ifdef G_OS_UNIX
void Message::unset_unix_fd_list()
{
- g_dbus_message_set_unix_fd_list(gobj(), 0);
+ g_dbus_message_set_unix_fd_list(gobj(), nullptr);
}
#endif //G_OS_UNIX
* name_lost_slot slots will be invoked after calling this function - there
* are three possible cases:
*
- * - @a name_lost_slot with a NULL connection (if a connection to the bus
+ * - @a name_lost_slot with a nullptr connection (if a connection to the bus
* can't be made).
* - @a bus_acquired_slot then @a name_lost_slot (if the name can't be
* obtained)
_CONSTRUCT("g-connection", Glib::unwrap(connection),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init_async(slot, cancellable);
}
_CONSTRUCT("g-connection", Glib::unwrap(connection),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init_async(slot);
}
_CONSTRUCT("g-connection", Glib::unwrap(connection),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init(cancellable);
}
_CONSTRUCT("g-connection", Glib::unwrap(connection),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init();
}
_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init_async(slot, cancellable);
}
_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init_async(slot);
}
_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init(cancellable);
}
_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
"g-flags", static_cast<GDBusProxyFlags>(flags),
"g-interface-info", Glib::unwrap(info),
- "g-name", (name.empty() ? 0 : name.c_str()),
- "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
- "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+ "g-name", (name.empty() ? nullptr : name.c_str()),
+ "g-object-path", (object_path.empty() ? nullptr : object_path.c_str()),
+ "g-interface-name", (interface_name.empty() ? nullptr : interface_name.c_str()))
{
init();
}
g_dbus_proxy_call(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
static_cast<GDBusCallFlags>(flags), timeout_msec,
- 0, &SignalProxy_async_callback, slot_copy);
+ nullptr, &SignalProxy_async_callback, slot_copy);
}
Glib::VariantContainerBase Proxy::call_sync(
GVariant* const gvariant =
g_dbus_proxy_call_sync(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
- static_cast<GDBusCallFlags>(flags), timeout_msec, 0, &g_error);
+ static_cast<GDBusCallFlags>(flags), timeout_msec, nullptr, &g_error);
if(g_error)
::Glib::Error::throw_exception(g_error);
g_dbus_proxy_call_with_unix_fd_list(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(fd_list),
- 0, &SignalProxy_async_callback, slot_copy);
+ nullptr, &SignalProxy_async_callback, slot_copy);
}
#endif // G_OS_UNIX
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags)
: _CONSTRUCT("address",
- (address.empty() ? static_cast<char*>(0) : address.c_str()),
+ (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusServerFlags>(flags),
- "guid", (guid.empty() ? static_cast<char*>(0) : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"authentication-observer", Glib::unwrap(observer))
{
init(cancellable);
const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags)
: _CONSTRUCT("address",
- (address.empty() ? static_cast<char*>(0) : address.c_str()),
+ (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusServerFlags>(flags),
- "guid", (guid.empty() ? static_cast<char*>(0) : guid.c_str()),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init(cancellable);
}
const Glib::RefPtr<AuthObserver>& observer,
ServerFlags flags)
: _CONSTRUCT("address",
- (address.empty() ? static_cast<char*>(0) : address.c_str()),
+ (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusServerFlags>(flags),
- "guid", (guid.empty() ? static_cast<char*>(0) : guid.c_str()),
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
"authentication-observer", Glib::unwrap(observer))
{
init();
const std::string& guid,
ServerFlags flags)
: _CONSTRUCT("address",
- (address.empty() ? static_cast<char*>(0) : address.c_str()),
+ (address.empty() ? nullptr : address.c_str()),
"flags", static_cast<GDBusServerFlags>(flags),
- "guid", (guid.empty() ? static_cast<char*>(0) : guid.c_str()),
- "authentication-observer", static_cast<GDBusAuthObserver*>(0))
+ "guid", (guid.empty() ? nullptr : guid.c_str()),
+ "authentication-observer", static_cast<GDBusAuthObserver*>(nullptr))
{
init();
}
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
static GDBusInterfaceInfo** DBusSubtreeVTable_Introspect_giomm_callback(
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
static const GDBusInterfaceVTable* DBusSubtreeVTable_Dispatch_giomm_callback(
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
} // extern "C"
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
+ nullptr, // mount_operation
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
- 0, // cancellable
+ nullptr, // mount_operation
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
- 0, // callback
- 0); // user_data
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // user_data
}
void Drive::eject(MountUnmountFlags flags)
{
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
- 0, // cancellable
- 0, // callback
- 0); // user_data
+ nullptr, // mount_operation
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // user_data
}
void Drive::poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
auto slot_copy = new SlotAsyncReady(slot);
g_drive_poll_for_media(gobj(),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
void Drive::poll_for_media()
{
g_drive_poll_for_media(gobj(),
- 0, // cancellable
- 0,
- 0);
+ nullptr, // cancellable
+ nullptr,
+ nullptr);
}
void
g_drive_stop(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_drive_start(gobj(),
static_cast<GDriveStartFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
static void release_c_type (CType item)
{
- GLIBMM_DEBUG_UNREFERENCE(0, item);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, item);
g_object_unref(item);
}
};
_IMPLEMENTS_INTERFACE(Icon)
protected:
- //We have this constructor because g_emblemed_icon_new() may take a NULL emblem parameter.
+ //We have this constructor because g_emblemed_icon_new() may take a nullptr emblem parameter.
/** Creates a new emblemed icon for @a icon with no emblem.
* @param icon An Icon.
*
g_file_read_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_append_to_async(gobj(),
static_cast<GFileCreateFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_file_create_async(gobj(),
static_cast<GFileCreateFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_file_create_readwrite_async(gobj(),
static_cast<GFileCreateFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_replace_async(gobj(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
io_priority,
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_replace_async(gobj(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_file_open_readwrite_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_replace_readwrite_async(gobj(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
io_priority,
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_replace_readwrite_async(gobj(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
FileType File::query_file_type(FileQueryInfoFlags flags) const
{
- return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, 0);
+ return (FileType)g_file_query_file_type(const_cast<GFile*>(gobj()), (GFileQueryInfoFlags)flags, nullptr);
}
Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const
Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags) const
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
attributes.c_str(),
static_cast<GFileQueryInfoFlags>(flags),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_query_filesystem_info_async(const_cast<GFile*>(gobj()),
attributes.c_str(),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
attributes.c_str(),
static_cast<GFileQueryInfoFlags>(flags),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_set_display_name_async(gobj(),
display_name.c_str(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
res = g_file_copy(gobj(),
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
- 0,
+ nullptr,
&SignalProxy_file_progress_callback,
slot_copy,
&gerror);
bool res = g_file_copy(gobj(),
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
- 0,
- 0,
- 0,
+ nullptr,
+ nullptr,
+ nullptr,
&gerror);
if (gerror)
static_cast<GFileCopyFlags>(flags),
io_priority,
Glib::unwrap(cancellable),
- 0,
- 0,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_ready_copy);
}
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
io_priority,
- 0,
+ nullptr,
&SignalProxy_file_progress_callback,
slot_progress_copy,
&SignalProxy_file_copy_async_callback,
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
io_priority,
- 0,
- 0,
- 0,
+ nullptr,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_ready_copy);
}
res = g_file_move(gobj(),
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
- 0,
+ nullptr,
&SignalProxy_file_progress_callback,
slot_copy,
&gerror);
res = g_file_move(gobj(),
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
- 0,
- 0,
- 0,
+ nullptr,
+ nullptr,
+ nullptr,
&gerror);
if (gerror)
Glib::unwrap(info),
static_cast<GFileQueryInfoFlags>(flags),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_mount_mountable(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_mount_mountable(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
g_file_mount_mountable(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr);
}
void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
g_file_unmount_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
+ nullptr,
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_file_unmount_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
- 0,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
g_file_unmount_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr);
}
void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<MountOperation>& mount_operation, MountUnmountFlags flags)
g_file_unmount_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_unmount_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr);
}
g_file_mount_enclosing_volume(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_mount_enclosing_volume(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
g_file_mount_enclosing_volume(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr);
}
void
g_file_eject_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_eject_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr);
}
void
g_file_eject_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
+ nullptr,
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_file_eject_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
- 0,
+ nullptr,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
g_file_eject_mountable_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr);
}
void
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_load_contents_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
slots->second = slot_async_copy;
g_file_load_partial_contents_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_load_partial_contents_read_more_callback,
&SignalProxy_load_partial_contents_ready_callback,
slots);
{
GError* gerror = nullptr;
gchar* c_etag_new = nullptr;
- g_file_replace_contents(gobj(), contents, length, etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
+ g_file_replace_contents(gobj(), contents, length, etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
gchar* c_etag_new = nullptr;
- g_file_replace_contents(gobj(), contents, length, etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 0, &(gerror));
+ g_file_replace_contents(gobj(), contents, length, etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
gchar* c_etag_new = nullptr;
- g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
+ g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
gchar* c_etag_new = nullptr;
- g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, 0, &(gerror));
+ g_file_replace_contents(gobj(), contents.c_str(), contents.size(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), &c_etag_new, nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_replace_contents_async(gobj(),
contents,
length,
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
Glib::unwrap(cancellable),
g_file_replace_contents_async(gobj(),
contents,
length,
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_replace_contents_async(gobj(),
contents.c_str(),
contents.size(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
Glib::unwrap(cancellable),
g_file_replace_contents_async(gobj(),
contents.c_str(),
contents.size(),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
void File::replace_contents_finish(const Glib::RefPtr<AsyncResult>& result)
{
GError* gerror = nullptr;
- g_file_replace_contents_finish(gobj(), Glib::unwrap(result), 0, &(gerror));
+ g_file_replace_contents_finish(gobj(), Glib::unwrap(result), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
}
g_file_replace_contents_bytes_async(gobj(),
const_cast<GBytes*>(Glib::unwrap(contents)),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
Glib::unwrap(cancellable),
g_file_replace_contents_bytes_async(gobj(),
const_cast<GBytes*>(Glib::unwrap(contents)),
- etag.empty() ? 0 : etag.c_str(),
+ etag.empty() ? nullptr : etag.c_str(),
make_backup,
static_cast<GFileCreateFlags>(flags),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::replace(const std::string& etag, bool make_backup, FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_replace(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileIOStream> File::replace_readwrite(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileIOStream> File::replace_readwrite(const std::string& etag, bool make_backup, FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_replace_readwrite(gobj(), etag.empty() ? nullptr : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_start_mountable(gobj(),
((GDriveStartFlags)(flags)),
Glib::unwrap(start_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_stop_mountable(gobj(),
((GMountUnmountFlags)(flags)),
Glib::unwrap(start_operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_poll_mountable(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_file_find_enclosing_mount_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
bool File::set_attributes_from_info(const Glib::RefPtr<FileInfo>& info, FileQueryInfoFlags flags)
{
GError* gerror = nullptr;
- bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(flags)), 0, &(gerror));
+ bool retvalue = g_file_set_attributes_from_info(gobj(), Glib::unwrap(info), ((GFileQueryInfoFlags)(flags)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
res = g_file_copy_attributes(gobj(),
Glib::unwrap(destination),
static_cast<GFileCopyFlags>(flags),
- 0,
+ nullptr,
&gerror);
if (gerror)
Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileIOStream> File::create_file_readwrite(FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool File::load_contents(const Glib::RefPtr<Cancellable>& cancellable, char*& contents, gsize& length)
{
GError* gerror = nullptr;
- bool retvalue = g_file_load_contents(gobj(), Glib::unwrap(cancellable), &contents, &(length), 0, &(gerror));
+ bool retvalue = g_file_load_contents(gobj(), Glib::unwrap(cancellable), &contents, &(length), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
gchar* cetag_out = nullptr;
- bool retvalue = g_file_load_contents(gobj(), 0, &contents, &(length), &cetag_out, &(gerror));
+ bool retvalue = g_file_load_contents(gobj(), nullptr, &contents, &(length), &cetag_out, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool File::load_contents(char*& contents, gsize& length)
{
GError* gerror = nullptr;
- bool retvalue = g_file_load_contents(gobj(), 0, &contents, &(length), 0, &(gerror));
+ bool retvalue = g_file_load_contents(gobj(), nullptr, &contents, &(length), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool File::load_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length)
{
GError* gerror = nullptr;
- bool retvalue = g_file_load_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), 0, &(gerror));
+ bool retvalue = g_file_load_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool File::load_partial_contents_finish(const Glib::RefPtr<AsyncResult>& result, char*& contents, gsize& length)
{
GError* gerror = nullptr;
- bool retvalue = g_file_load_partial_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), 0, &(gerror));
+ bool retvalue = g_file_load_partial_contents_finish(gobj(), Glib::unwrap(result), &contents, &(length), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool File::has_parent() const
{
- return g_file_has_parent(const_cast<GFile*>(gobj()), 0);
+ return g_file_has_parent(const_cast<GFile*>(gobj()), nullptr);
}
g_file_delete_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_ready_copy);
}
g_file_trash_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_ready_copy);
}
g_file_make_directory_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_ready_copy);
}
*
* @param slot A callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
- * @param start_operation A MountOperation, or <tt>0</tt> to avoid user interaction.
+ * @param start_operation A MountOperation, or <tt>nullptr</tt> to avoid user interaction.
* @param flags Flags affecting the operation
*
* @newin{2,24}
* was cancelled, a Gio::Error with CANCELLED will be thrown.
*
* @param slot A callback to call when the request is satisfied.
- * @param start_operation A MountOperation, or <tt>0</tt> to avoid user interaction.
+ * @param start_operation A MountOperation, or <tt>nullptr</tt> to avoid user interaction.
* @param flags Flags affecting the operation
*
* @newin{2,24}
*
* @param slot A callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
- * @param start_operation A MountOperation, or <tt>0</tt> to avoid user interaction.
+ * @param start_operation A MountOperation, or <tt>nullptr</tt> to avoid user interaction.
* @param flags Flags affecting the operation
*
* @newin{2,24}
* was cancelled, a Gio::Error with CANCELLED will be thrown.
*
* @param slot A callback to call when the request is satisfied.
- * @param start_operation A MountOperation, or <tt>0</tt> to avoid user interaction.
+ * @param start_operation A MountOperation, or <tt>nullptr</tt> to avoid user interaction.
* @param flags Flags affecting the operation
*
* @newin{2,24}
*/
typedef sigc::slot<bool, const char*, goffset> SlotReadMore;
- //Note that slot_read_more can be NULL but that would not be a useful method overload, because the documentation says that it would
+ //Note that slot_read_more can be nullptr but that would not be a useful method overload, because the documentation says that it would
//then be equivalent to load_contents_async.
/** Reads the partial contents of a file.
static void release_c_type (CType item)
{
- GLIBMM_DEBUG_UNREFERENCE(0, item);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, item);
g_object_unref(item);
}
};
g_file_enumerator_next_files_async(gobj(),
num_files,
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_file_enumerator_close_async(gobj(),
io_priority,
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_input_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileInfo> FileIOStream::query_info(const std::string& attributes)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_io_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes)
{
GError* gerror = nullptr;
- auto retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), nullptr, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_file_output_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
</parameter_description>
</parameter>
<parameter name="G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START">
-<parameter_description> If not set and the proxy if for a well-known name,
-then request the bus to launch an owner for the name if no-one owns the name. This flag can
-only be used in proxies for well-known names.
+<parameter_description> If the proxy is for a well-known name,
+do not ask the bus to launch an owner during proxy initialization or a method call.
+This flag is only meaningful in proxies for well-known names.
</parameter_description>
</parameter>
<parameter name="G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES">
<parameter_description> If the proxy is for a well-known name,
do not ask the bus to launch an owner during proxy initialization, but allow it to be
autostarted by a method call. This flag is only meaningful in proxies for well-known names,
-and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTOSTART is not also specified.
+and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified.
</parameter_description>
</parameter>
</parameters>
<parameter_description> Transport endpoint is not connected. Since 2.44
</parameter_description>
</parameter>
+<parameter name="G_IO_ERROR_MESSAGE_TOO_LARGE">
+<parameter_description> Message too large. Since 2.48.
+</parameter_description>
+</parameter>
</parameters>
</enum>
<property name="GTlsConnection:database">
<description>
The certificate database to use when verifying this TLS connection.
-If no cerificate database is set, then the default database will be
+If no certificate database is set, then the default database will be
used. See g_tls_backend_get_default_database().
Since: 2.30
</parameter_description>
</parameter>
<parameter name="outbuf">
-<parameter_description> a buffer to write converted data in.
+<parameter_description> a buffer to write
+converted data in.
</parameter_description>
</parameter>
<parameter name="outbuf_size">
<return></return>
</function>
+<function name="g_datagram_based_condition_check">
+<description>
+Checks on the readiness of @datagram_based to perform operations. The
+operations specified in @condition are checked for and masked against the
+currently-satisfied conditions on @datagram_based. The result is returned.
+
+%G_IO_IN will be set in the return value if data is available to read with
+g_datagram_based_receive_messages(), or if the connection is closed remotely
+(EOS); and if the datagram_based has not been closed locally using some
+implementation-specific method (such as g_socket_close() or
+g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket).
+
+If the connection is shut down or closed (by calling g_socket_close() or
+g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket, for
+example), all calls to this function will return %G_IO_ERROR_CLOSED.
+
+%G_IO_OUT will be set if it is expected that at least one byte can be sent
+using g_datagram_based_send_messages() without blocking. It will not be set
+if the datagram_based has been closed locally.
+
+%G_IO_HUP will be set if the connection has been closed locally.
+
+%G_IO_ERR will be set if there was an asynchronous error in transmitting data
+previously enqueued using g_datagram_based_send_messages().
+
+Note that on Windows, it is possible for an operation to return
+%G_IO_ERROR_WOULD_BLOCK even immediately after
+g_datagram_based_condition_check() has claimed that the #GDatagramBased is
+ready for writing. Rather than calling g_datagram_based_condition_check() and
+then writing to the #GDatagramBased if it succeeds, it is generally better to
+simply try writing right away, and try again later if the initial attempt
+returns %G_IO_ERROR_WOULD_BLOCK.
+
+It is meaningless to specify %G_IO_ERR or %G_IO_HUP in @condition; these
+conditions will always be set in the output if they are true. Apart from
+these flags, the output is guaranteed to be masked by @condition.
+
+This call never blocks.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="datagram_based">
+<parameter_description> a #GDatagramBased
+</parameter_description>
+</parameter>
+<parameter name="condition">
+<parameter_description> a #GIOCondition mask to check
+</parameter_description>
+</parameter>
+</parameters>
+<return> the #GIOCondition mask of the current state
+
+</return>
+</function>
+
+<function name="g_datagram_based_condition_wait">
+<description>
+Waits for up to @timeout microseconds for condition to become true on
+@datagram_based. If the condition is met, %TRUE is returned.
+
+If @cancellable is cancelled before the condition is met, or if @timeout is
+reached before the condition is met, then %FALSE is returned and @error is
+set appropriately (%G_IO_ERROR_CANCELLED or %G_IO_ERROR_TIMED_OUT).
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="datagram_based">
+<parameter_description> a #GDatagramBased
+</parameter_description>
+</parameter>
+<parameter name="condition">
+<parameter_description> a #GIOCondition mask to wait for
+</parameter_description>
+</parameter>
+<parameter name="timeout">
+<parameter_description> the maximum time (in microseconds) to wait, 0 to not block, or -1
+to block indefinitely
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> a #GCancellable
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> return location for a #GError
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the condition was met, %FALSE otherwise
+
+</return>
+</function>
+
+<function name="g_datagram_based_create_source">
+<description>
+Creates a #GSource that can be attached to a #GMainContext to monitor for
+the availability of the specified @condition on the #GDatagramBased. The
+#GSource keeps a reference to the @datagram_based.
+
+The callback on the source is of the #GDatagramBasedSourceFunc type.
+
+It is meaningless to specify %G_IO_ERR or %G_IO_HUP in @condition; these
+conditions will always be reported in the callback if they are true.
+
+If non-%NULL, @cancellable can be used to cancel the source, which will
+cause the source to trigger, reporting the current condition (which is
+likely 0 unless cancellation happened at the same time as a condition
+change). You can check for this in the callback using
+g_cancellable_is_cancelled().
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="datagram_based">
+<parameter_description> a #GDatagramBased
+</parameter_description>
+</parameter>
+<parameter name="condition">
+<parameter_description> a #GIOCondition mask to monitor
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> a #GCancellable
+</parameter_description>
+</parameter>
+</parameters>
+<return> a newly allocated #GSource
+
+</return>
+</function>
+
+<function name="g_datagram_based_receive_messages">
+<description>
+Receive one or more data messages from @datagram_based in one go.
+
+@messages must point to an array of #GInputMessage structs and
+@num_messages must be the length of this array. Each #GInputMessage
+contains a pointer to an array of #GInputVector structs describing the
+buffers that the data received in each message will be written to.
+
+@flags modify how all messages are received. The commonly available
+arguments for this are available in the #GSocketMsgFlags enum, but the
+values there are the same as the system values, and the flags
+are passed in as-is, so you can pass in system-specific flags too. These
+flags affect the overall receive operation. Flags affecting individual
+messages are returned in #GInputMessage.flags.
+
+The other members of #GInputMessage are treated as described in its
+documentation.
+
+If @timeout is negative the call will block until @num_messages have been
+received, the connection is closed remotely (EOS), @cancellable is cancelled,
+or an error occurs.
+
+If @timeout is 0 the call will return up to @num_messages without blocking,
+or %G_IO_ERROR_WOULD_BLOCK if no messages are queued in the operating system
+to be received.
+
+If @timeout is positive the call will block on the same conditions as if
+@timeout were negative. If the timeout is reached
+before any messages are received, %G_IO_ERROR_TIMED_OUT is returned,
+otherwise it will return the number of messages received before timing out.
+(Note: This is effectively the behaviour of `MSG_WAITFORONE` with
+recvmmsg().)
+
+To be notified when messages are available, wait for the %G_IO_IN condition.
+Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
+g_datagram_based_receive_messages() even if you were previously notified of a
+%G_IO_IN condition.
+
+If the remote peer closes the connection, any messages queued in the
+underlying receive buffer will be returned, and subsequent calls to
+g_datagram_based_receive_messages() will return 0 (with no error set).
+
+If the connection is shut down or closed (by calling g_socket_close() or
+g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket, for
+example), all calls to this function will return %G_IO_ERROR_CLOSED.
+
+On error -1 is returned and @error is set accordingly. An error will only
+be returned if zero messages could be received; otherwise the number of
+messages successfully received before the error will be returned. If
+@cancellable is cancelled, %G_IO_ERROR_CANCELLED is returned as with any
+other error.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="datagram_based">
+<parameter_description> a #GDatagramBased
+</parameter_description>
+</parameter>
+<parameter name="messages">
+<parameter_description> an array of #GInputMessage structs
+</parameter_description>
+</parameter>
+<parameter name="num_messages">
+<parameter_description> the number of elements in @messages
+</parameter_description>
+</parameter>
+<parameter name="flags">
+<parameter_description> an int containing #GSocketMsgFlags flags for the overall operation
+</parameter_description>
+</parameter>
+<parameter name="timeout">
+<parameter_description> the maximum time (in microseconds) to wait, 0 to not block, or -1
+to block indefinitely
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> a %GCancellable
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> return location for a #GError
+</parameter_description>
+</parameter>
+</parameters>
+<return> number of messages received, or -1 on error. Note that the number
+of messages received may be smaller than @num_messages if @timeout is
+zero or positive, if the peer closed the connection, or if @num_messages
+was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try
+to receive the remaining messages.
+
+</return>
+</function>
+
+<function name="g_datagram_based_send_messages">
+<description>
+Send one or more data messages from @datagram_based in one go.
+
+@messages must point to an array of #GOutputMessage structs and
+@num_messages must be the length of this array. Each #GOutputMessage
+contains an address to send the data to, and a pointer to an array of
+#GOutputVector structs to describe the buffers that the data to be sent
+for each message will be gathered from.
+
+@flags modify how the message is sent. The commonly available arguments
+for this are available in the #GSocketMsgFlags enum, but the
+values there are the same as the system values, and the flags
+are passed in as-is, so you can pass in system-specific flags too.
+
+The other members of #GOutputMessage are treated as described in its
+documentation.
+
+If @timeout is negative the call will block until @num_messages have been
+sent, @cancellable is cancelled, or an error occurs.
+
+If @timeout is 0 the call will send up to @num_messages without blocking,
+or will return %G_IO_ERROR_WOULD_BLOCK if there is no space to send messages.
+
+If @timeout is positive the call will block on the same conditions as if
+@timeout were negative. If the timeout is reached before any messages are
+sent, %G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the number
+of messages sent before timing out.
+
+To be notified when messages can be sent, wait for the %G_IO_OUT condition.
+Note though that you may still receive %G_IO_ERROR_WOULD_BLOCK from
+g_datagram_based_send_messages() even if you were previously notified of a
+%G_IO_OUT condition. (On Windows in particular, this is very common due to
+the way the underlying APIs work.)
+
+If the connection is shut down or closed (by calling g_socket_close() or
+g_socket_shutdown() with @shutdown_write set, if it’s a #GSocket, for
+example), all calls to this function will return %G_IO_ERROR_CLOSED.
+
+On error -1 is returned and @error is set accordingly. An error will only
+be returned if zero messages could be sent; otherwise the number of messages
+successfully sent before the error will be returned. If @cancellable is
+cancelled, %G_IO_ERROR_CANCELLED is returned as with any other error.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="datagram_based">
+<parameter_description> a #GDatagramBased
+</parameter_description>
+</parameter>
+<parameter name="messages">
+<parameter_description> an array of #GOutputMessage structs
+</parameter_description>
+</parameter>
+<parameter name="num_messages">
+<parameter_description> the number of elements in @messages
+</parameter_description>
+</parameter>
+<parameter name="flags">
+<parameter_description> an int containing #GSocketMsgFlags flags
+</parameter_description>
+</parameter>
+<parameter name="timeout">
+<parameter_description> the maximum time (in microseconds) to wait, 0 to not block, or -1
+to block indefinitely
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> a %GCancellable
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> return location for a #GError
+</parameter_description>
+</parameter>
+</parameters>
+<return> number of messages sent, or -1 on error. Note that the number of
+messages sent may be smaller than @num_messages if @timeout is zero
+or positive, or if @num_messages was larger than `UIO_MAXIOV` (1024), in
+which case the caller may re-try to send the remaining messages.
+
+</return>
+</function>
+
<function name="g_dbus_action_group_get">
<description>
Obtains a #GDBusActionGroup for the action group which is exported at
message. Similary, if a filter consumes an outgoing message, the
message will not be sent to the other peer.
+If @user_data_free_func is non-%NULL, it will be called (in the
+thread-default main context of the thread you are calling this
+method from) at some point after @user_data is no longer
+needed. (It is not guaranteed to be called synchronously when the
+filter is removed, and may be called after @connection has been
+destroyed.)
+
Since: 2.26
</description>
</parameter_description>
</parameter>
</parameters>
-<return> a #GCredentials or %NULL if not available.
-Do not free this object, it is owned by @connection.
+<return> a #GCredentials or %NULL if not
+available. Do not free this object, it is owned by @connection.
</return>
</function>
<description>
Removes a filter.
+Note that since filters run in a different thread, there is a race
+condition where it is possible that the filter will be running even
+after calling g_dbus_connection_remove_filter(), so you cannot just
+free data that the filter might be using. Instead, you should pass
+a #GDestroyNotify to g_dbus_connection_add_filter(), which will be
+called when it is guaranteed that the data is no longer needed.
+
Since: 2.26
</description>
interpreted as part of a namespace or path. The first argument
of a signal is matched against that part as specified by D-Bus.
+If @user_data_free_func is non-%NULL, it will be called (in the
+thread-default main context of the thread you are calling this
+method from) at some point after @user_data is no longer
+needed. (It is not guaranteed to be called synchronously when the
+signal is unsubscribed from, and may be called after @connection
+has been destroyed.)
+
Since: 2.26
</description>
<function name="g_file_get_path">
<description>
-Gets the local pathname for #GFile, if one exists.
+Gets the local pathname for #GFile, if one exists. If non-%NULL, this is
+guaranteed to be an absolute, canonical path. It might contain symlinks.
This call does no blocking I/O.
If @parent is %NULL then this function returns %TRUE if @file has any
parent at all. If @parent is non-%NULL then %TRUE is only returned
-if @file is a child of @parent.
+if @file is an immediate child of @parent.
Since: 2.24
</parameter_description>
</parameter>
</parameters>
-<return> %TRUE if @file is a child of @parent (or any parent in the
-case that @parent is %NULL).
+<return> %TRUE if @file is an immediate child of @parent (or any parent in
+the case that @parent is %NULL).
</return>
</function>
</parameter_description>
</parameter>
<parameter name="value_pp">
-<parameter_description> return location for the attribute value, or %NULL
+<parameter_description> return location for the
+attribute value, or %NULL; the attribute value will not be %NULL
</parameter_description>
</parameter>
<parameter name="status">
</return>
</function>
+<function name="g_file_monitor_emit_event">
+<description>
+Emits the #GFileMonitor::changed signal if a change
+has taken place. Should be called from file monitor
+implementations only.
+
+Implementations are responsible to call this method from the
+[thread-default main context][g-main-context-push-thread-default] of the
+thread that the monitor was created in.
+
+</description>
+<parameters>
+<parameter name="monitor">
+<parameter_description> a #GFileMonitor.
+</parameter_description>
+</parameter>
+<parameter name="child">
+<parameter_description> a #GFile.
+</parameter_description>
+</parameter>
+<parameter name="other_file">
+<parameter_description> a #GFile.
+</parameter_description>
+</parameter>
+<parameter name="event_type">
+<parameter_description> a set of #GFileMonitorEvent flags.
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_file_monitor_file">
<description>
Obtains a file monitor for the given file. If no file notification
<function name="g_io_stream_close">
<description>
Closes the stream, releasing resources related to it. This will also
-closes the individual input and output streams, if they are not already
+close the individual input and output streams, if they are not already
closed.
Once the stream is closed, all other operations will return
<return></return>
</function>
+<function name="g_list_store_sort">
+<description>
+Sort the items in @store according to @compare_func.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="store">
+<parameter_description> a #GListStore
+</parameter_description>
+</parameter>
+<parameter name="compare_func">
+<parameter_description> pairwise comparison function for sorting
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> user data for @compare_func
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_list_store_splice">
<description>
Changes @store by removing @n_removals items and adding @n_additions
</parameter_description>
</parameter>
</parameters>
-<return> pointer to the stream's data
+<return> pointer to the stream's data, or %NULL if the data
+has been stolen
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> the stream's data
+<return> the stream's data, or %NULL if it has previously
+been stolen
</return>
</function>
<function name="g_native_socket_address_new">
<description>
-Creates a new #GNativeSocketAddress for @address and @port.
+Creates a new #GNativeSocketAddress for @native and @len.
Since: 2.46
</description>
<parameters>
-<parameter name="address">
-<parameter_description> a #GNativeAddress
+<parameter name="native">
+<parameter_description> a native address object
</parameter_description>
</parameter>
-<parameter name="port">
-<parameter_description> a port number
+<parameter name="len">
+<parameter_description> the length of @native, in bytes
</parameter_description>
</parameter>
</parameters>
</return>
</function>
-<function name="g_poll_file_monitor_new">
-<description>
-Polls @file for changes.
-
-
-</description>
-<parameters>
-<parameter name="file">
-<parameter_description> a #GFile.
-</parameter_description>
-</parameter>
-</parameters>
-<return> a new #GFileMonitor for the given #GFile.
-</return>
-</function>
-
<function name="g_pollable_input_stream_can_poll">
<description>
Checks if @stream is actually pollable. Some classes may implement
</return>
</function>
+<function name="g_socket_connectable_to_string">
+<description>
+Format a #GSocketConnectable as a string. This is a human-readable format for
+use in debugging output, and is not a stable serialization format. It is not
+suitable for use in user interfaces as it exposes too much information for a
+user.
+
+If the #GSocketConnectable implementation does not support string formatting,
+the implementation’s type name will be returned as a fallback.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="connectable">
+<parameter_description> a #GSocketConnectable
+</parameter_description>
+</parameter>
+</parameters>
+<return> the formatted string
+
+</return>
+</function>
+
<function name="g_socket_connection_connect">
<description>
Connect @connection to the specified remote address.
<function name="g_socket_get_available_bytes">
<description>
-Get the amount of data pending in the OS input buffer.
+Get the amount of data pending in the OS input buffer, without blocking.
If @socket is a UDP or SCTP socket, this will return the size of
just the next packet, even if additional packets are buffered after
Check whether the socket is connected. This is only useful for
connection-oriented sockets.
+If using g_socket_shutdown(), this function will return %TRUE until the
+socket has been shut down for reading and writing. If you do a non-blocking
+connect, this function will not return %TRUE until after you call
+g_socket_check_connect_result().
+
Since: 2.22
</description>
<function name="g_socket_receive_message">
<description>
-Receive data from a socket. This is the most complicated and
-fully-featured version of this call. For easier use, see
+Receive data from a socket. For receiving multiple messages, see
+g_socket_receive_messages(); for easier use, see
g_socket_receive() and g_socket_receive_from().
If @address is non-%NULL then @address will be set equal to the
values there are the same as the system values, and the flags
are passed in as-is, so you can pass in system-specific flags too
(and g_socket_receive_message() may pass system-specific flags out).
+Flags passed in to the parameter affect the receive operation; flags returned
+out of it are relevant to the specific returned message.
As with g_socket_receive(), data may be discarded if @socket is
%G_SOCKET_TYPE_DATAGRAM or %G_SOCKET_TYPE_SEQPACKET and you do not
</return>
</function>
+<function name="g_socket_receive_messages">
+<description>
+Receive multiple data messages from @socket in one go. This is the most
+complicated and fully-featured version of this call. For easier use, see
+g_socket_receive(), g_socket_receive_from(), and g_socket_receive_message().
+
+@messages must point to an array of #GInputMessage structs and
+@num_messages must be the length of this array. Each #GInputMessage
+contains a pointer to an array of #GInputVector structs describing the
+buffers that the data received in each message will be written to. Using
+multiple #GInputVectors is more memory-efficient than manually copying data
+out of a single buffer to multiple sources, and more system-call-efficient
+than making multiple calls to g_socket_receive(), such as in scenarios where
+a lot of data packets need to be received (e.g. high-bandwidth video
+streaming over RTP/UDP).
+
+@flags modify how all messages are received. The commonly available
+arguments for this are available in the #GSocketMsgFlags enum, but the
+values there are the same as the system values, and the flags
+are passed in as-is, so you can pass in system-specific flags too. These
+flags affect the overall receive operation. Flags affecting individual
+messages are returned in #GInputMessage.flags.
+
+The other members of #GInputMessage are treated as described in its
+documentation.
+
+If #GSocket:blocking is %TRUE the call will block until @num_messages have
+been received, or the end of the stream is reached.
+
+If #GSocket:blocking is %FALSE the call will return up to @num_messages
+without blocking, or %G_IO_ERROR_WOULD_BLOCK if no messages are queued in the
+operating system to be received.
+
+In blocking mode, if #GSocket:timeout is positive and is reached before any
+messages are received, %G_IO_ERROR_TIMED_OUT is returned, otherwise up to
+@num_messages are returned. (Note: This is effectively the
+behaviour of `MSG_WAITFORONE` with recvmmsg().)
+
+To be notified when messages are available, wait for the
+%G_IO_IN condition. Note though that you may still receive
+%G_IO_ERROR_WOULD_BLOCK from g_socket_receive_messages() even if you were
+previously notified of a %G_IO_IN condition.
+
+If the remote peer closes the connection, any messages queued in the
+operating system will be returned, and subsequent calls to
+g_socket_receive_messages() will return 0 (with no error set).
+
+On error -1 is returned and @error is set accordingly. An error will only
+be returned if zero messages could be received; otherwise the number of
+messages successfully received before the error will be returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="socket">
+<parameter_description> a #GSocket
+</parameter_description>
+</parameter>
+<parameter name="messages">
+<parameter_description> an array of #GInputMessage structs
+</parameter_description>
+</parameter>
+<parameter name="num_messages">
+<parameter_description> the number of elements in @messages
+</parameter_description>
+</parameter>
+<parameter name="flags">
+<parameter_description> an int containing #GSocketMsgFlags flags for the overall operation
+</parameter_description>
+</parameter>
+<parameter name="cancellable">
+<parameter_description> a %GCancellable or %NULL
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> #GError for error reporting, or %NULL to ignore
+</parameter_description>
+</parameter>
+</parameters>
+<return> number of messages received, or -1 on error. Note that the number
+of messages received may be smaller than @num_messages if in non-blocking
+mode, if the peer closed the connection, or if @num_messages
+was larger than `UIO_MAXIOV` (1024), in which case the caller may re-try
+to receive the remaining messages.
+
+</return>
+</function>
+
<function name="g_socket_receive_with_blocking">
<description>
This behaves exactly the same as g_socket_receive(), except that
<function name="g_socket_send_message">
<description>
-Send data to @address on @socket. This is the most complicated and
-fully-featured version of this call. For easier use, see
+Send data to @address on @socket. For sending multiple messages see
+g_socket_send_messages(); for easier use, see
g_socket_send() and g_socket_send_to().
If @address is %NULL then the message is sent to the default receiver
notified of a %G_IO_OUT condition. (On Windows in particular, this is
very common due to the way the underlying APIs work.)
-On error -1 is returned and @error is set accordingly.
+On error -1 is returned and @error is set accordingly. An error will only
+be returned if zero messages could be sent; otherwise the number of messages
+successfully sent before the error will be returned.
Since: 2.44
<function name="g_socket_set_blocking">
<description>
Sets the blocking mode of the socket. In blocking mode
-all operations block until they succeed or there is an error. In
+all operations (which don’t take an explicit blocking parameter) block until
+they succeed or there is an error. In
non-blocking mode all functions return results immediately or
with a %G_IO_ERROR_WOULD_BLOCK error.
<function name="g_socket_shutdown">
<description>
-Shut down part of a full-duplex connection.
+Shut down part or all of a full-duplex connection.
If @shutdown_read is %TRUE then the receiving side of the connection
is shut down, and further reading is disallowed.
It is allowed for both @shutdown_read and @shutdown_write to be %TRUE.
-One example where this is used is graceful disconnect for TCP connections
-where you close the sending side, then wait for the other side to close
-the connection, thus ensuring that the other side saw all sent data.
+One example where it is useful to shut down only one side of a connection is
+graceful disconnect for TCP connections where you close the sending side,
+then wait for the other side to close the connection, thus ensuring that the
+other side saw all sent data.
Since: 2.22
If @type is %G_UNIX_SOCKET_ADDRESS_PATH, this is equivalent to
calling g_unix_socket_address_new().
+If @type is %G_UNIX_SOCKET_ADDRESS_ANONYMOUS, @path and @path_len will be
+ignored.
+
If @path_type is %G_UNIX_SOCKET_ADDRESS_ABSTRACT, then @path_len
bytes of @path will be copied to the socket's path, and only those
bytes will be considered part of the name. (If @path_len is -1,
to watch the key only.
</parameter_description>
</parameter>
-<parameter name="change_flags">
+<parameter name="watch_flags">
<parameter_description> specifies the types of changes to watch for.
</parameter_description>
</parameter>
<parameter_description> a #GWin32RegistryValueIter
</parameter_description>
</parameter>
+<parameter name="auto_expand">
+<parameter_description> %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to
+G_WIN32_REGISTRY_VALUE_STR
+</parameter_description>
+</parameter>
<parameter name="value_data">
<parameter_description> Pointer to a
-location to store the data of the value (in UTF-8, if it's a string).
+location to store the data of the value (in UTF-8, if it's a string)
</parameter_description>
</parameter>
<parameter name="value_data_size">
<parameter_description> Pointer to a location to store the length
-of @value_data, in bytes (including any NUL-terminators, if it's a
-string).
-%NULL if length is not needed.
+of @value_data, in bytes (including any NUL-terminators, if it's a string).
+%NULL if length is not needed
</parameter_description>
</parameter>
<parameter name="error">
</parameter>
<parameter name="auto_expand">
<parameter_description> %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to
-G_WIN32_REGISTRY_VALUE_STR.
+G_WIN32_REGISTRY_VALUE_STR
</parameter_description>
</parameter>
<parameter name="value_data">
<parameter_description> Pointer to a
-location to store the data of the value (in UTF-16, if it's a string).
+location to store the data of the value (in UTF-16, if it's a string)
</parameter_description>
</parameter>
-<parameter name="value_data_len">
+<parameter name="value_data_size">
<parameter_description> Pointer to a location to store the size
-of @value_data, in bytes (including any NUL-terminators, if it's a
-string).
+of @value_data, in bytes (including any NUL-terminators, if it's a string).
%NULL if length is not needed.
</parameter_description>
</parameter>
;; G_IO_ERROR_PROXY_NOT_ALLOWED,
;; G_IO_ERROR_BROKEN_PIPE,
;; G_IO_ERROR_CONNECTION_CLOSED = G_IO_ERROR_BROKEN_PIPE,
-;; G_IO_ERROR_NOT_CONNECTED
+;; G_IO_ERROR_NOT_CONNECTED,
+;; G_IO_ERROR_MESSAGE_TOO_LARGE,
;; } GIOErrorEnum;
(define-enum-extended IOErrorEnum
'("broken-pipe" "G_IO_ERROR_BROKEN_PIPE" "44")
'("connection-closed" "G_IO_ERROR_CONNECTION_CLOSED" "44")
'("not-connected" "G_IO_ERROR_NOT_CONNECTED" "45")
+ '("message-too-large" "G_IO_ERROR_MESSAGE_TOO_LARGE" "46")
)
)
'("broken-pipe" "G_IO_ERROR_BROKEN_PIPE")
'("connection-closed" "G_IO_ERROR_CONNECTION_CLOSED")
'("not-connected" "G_IO_ERROR_NOT_CONNECTED")
+ '("message-too-large" "G_IO_ERROR_MESSAGE_TOO_LARGE")
)
)
+;; From gdatagrambased.h
+
+(define-function g_datagram_based_get_type
+ (c-name "g_datagram_based_get_type")
+ (return-type "GType")
+)
+
+(define-method receive_messages
+ (of-object "GDatagramBased")
+ (c-name "g_datagram_based_receive_messages")
+ (return-type "gint")
+ (parameters
+ '("GInputMessage*" "messages")
+ '("guint" "num_messages")
+ '("gint" "flags")
+ '("gint64" "timeout")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+(define-method send_messages
+ (of-object "GDatagramBased")
+ (c-name "g_datagram_based_send_messages")
+ (return-type "gint")
+ (parameters
+ '("GOutputMessage*" "messages")
+ '("guint" "num_messages")
+ '("gint" "flags")
+ '("gint64" "timeout")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+(define-method create_source
+ (of-object "GDatagramBased")
+ (c-name "g_datagram_based_create_source")
+ (return-type "GSource*")
+ (parameters
+ '("GIOCondition" "condition")
+ '("GCancellable*" "cancellable")
+ )
+)
+
+(define-method condition_check
+ (of-object "GDatagramBased")
+ (c-name "g_datagram_based_condition_check")
+ (return-type "GIOCondition")
+ (parameters
+ '("GIOCondition" "condition")
+ )
+)
+
+(define-method condition_wait
+ (of-object "GDatagramBased")
+ (c-name "g_datagram_based_condition_wait")
+ (return-type "gboolean")
+ (parameters
+ '("GIOCondition" "condition")
+ '("gint64" "timeout")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+
+
;; From gdatainputstream.h
(define-function g_data_input_stream_get_type
)
)
+(define-method sort
+ (of-object "GListStore")
+ (c-name "g_list_store_sort")
+ (return-type "none")
+ (parameters
+ '("GCompareDataFunc" "compare_func")
+ '("gpointer" "user_data")
+ )
+)
+
(define-method append
(of-object "GListStore")
(c-name "g_list_store_append")
(return-type "GSocketAddressEnumerator*")
)
+(define-method to_string
+ (of-object "GSocketConnectable")
+ (c-name "g_socket_connectable_to_string")
+ (return-type "gchar*")
+)
+
;; From gsocketconnection.h
)
)
+(define-method receive_messages
+ (of-object "GSocket")
+ (c-name "g_socket_receive_messages")
+ (return-type "gint")
+ (parameters
+ '("GInputMessage*" "messages")
+ '("guint" "num_messages")
+ '("gint" "flags")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
(define-method send_messages
(of-object "GSocket")
(c-name "g_socket_send_messages")
* method directly, instead it will be used automatically in various ways. For C
* applications you generally just call g_initable_new() directly, or indirectly
* via a foo_thing_new() wrapper. This will call g_initable_init() under the
- * cover, returning NULL and setting a GError on failure.
+ * cover, returning nullptr and setting a GError on failure.
*
* For bindings in languages where the native constructor supports exceptions
* the binding could check for objects implemention GInitable during normal
buffer,
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
buffer,
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_input_stream_read_bytes_async(gobj(),
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_input_stream_skip_async(gobj(),
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_input_stream_close_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_io_stream_close_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
auto slot_copy = new SlotAsyncReady(slot);
g_io_stream_splice_async(gobj(), Glib::unwrap(stream2),
- static_cast<GIOStreamSpliceFlags>(flags), io_priority, 0,
+ static_cast<GIOStreamSpliceFlags>(flags), io_priority, nullptr,
&SignalProxy_async_callback, slot_copy);
}
Glib::wrap(g_loadable_icon_load(gobj(),
size,
&c_type,
- 0,
+ nullptr,
&gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_loadable_icon_load_async(gobj(),
size,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
/** Non-cancellable version of load()
*/
Glib::RefPtr<InputStream> load(int size, Glib::ustring& type);
- //TODO: 'type' can be NULL as well, but I don't really want to add 2 more
+ //TODO: 'type' can be nullptr as well, but I don't really want to add 2 more
//overloads -- one cancellable, and one not...
/**
void destroy_data_callback(void* user_data)
{
auto slot_with_data = static_cast<SlotWithData*>(user_data);
- g_return_if_fail(slot_with_data != 0);
+ g_return_if_fail(slot_with_data != nullptr);
try
{
void MenuItem::set_action_and_target(const Glib::ustring& action)
{
- g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0);
+ g_menu_item_set_action_and_target_value(gobj(), action.c_str(), nullptr);
}
void MenuItem::set_action(const Glib::ustring& action)
{
- g_menu_item_set_action_and_target_value(gobj(), action.c_str(), 0);
+ g_menu_item_set_action_and_target_value(gobj(), action.c_str(), nullptr);
}
void MenuItem::unset_target()
const gchar *action_name = nullptr;
g_menu_item_get_attribute (gobj(), G_MENU_ATTRIBUTE_ACTION, "&s", &action_name);
- g_menu_item_set_action_and_target_value(gobj(), action_name, 0);
+ g_menu_item_set_action_and_target_value(gobj(), action_name, nullptr);
}
void MenuItem::unset_action_and_target()
{
- g_menu_item_set_action_and_target_value(gobj(), 0, 0);
+ g_menu_item_set_action_and_target_value(gobj(), nullptr, nullptr);
}
void MenuItem::unset_icon()
{
- g_menu_item_set_icon(gobj(), 0);
+ g_menu_item_set_icon(gobj(), nullptr);
}
} // namespace Gio
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
+ nullptr, // mount_operation
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
- 0, // cancellable
+ nullptr, // mount_operation
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
{
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // mount_operation
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
void Mount::unmount(const Glib::RefPtr<MountOperation>& mount_operation,
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(operation),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(operation),
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr);
}
void Mount::remount(MountMountFlags flags)
{
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr);
}
void Mount::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
+ nullptr, // mount_operation
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
- 0, // cancellable
+ nullptr, // mount_operation
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
{
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
- 0, // mount_operation
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // mount_operation
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
void Mount::eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
g_mount_guess_content_type(gobj(),
force_rescan,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
g_mount_guess_content_type(gobj(),
force_rescan,
- 0,
- 0,
- 0);
+ nullptr,
+ nullptr,
+ nullptr);
}
void Mount::guess_content_type_sync(const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan)
void Mount::guess_content_type_sync(bool force_rescan)
{
GError* gerror = nullptr;
- g_mount_guess_content_type_sync(gobj(), force_rescan, 0, &gerror);
+ g_mount_guess_content_type_sync(gobj(), force_rescan, nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
}
static void release_c_type (CType item)
{
- GLIBMM_DEBUG_UNREFERENCE(0, item);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, item);
g_object_unref(item);
}
};
buffer,
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
buffer,
count,
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
Glib::unwrap(source),
static_cast<GOutputStreamSpliceFlags>(flags),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_output_stream_flush_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_output_stream_close_async(gobj(),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
gssize OutputStream::write(const std::string& buffer)
{
GError* gerror = nullptr;
- gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), 0, &(gerror));
+ gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written)
{
GError* gerror = nullptr;
- bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), 0, &(gerror));
+ bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_output_stream_write_bytes_async(gobj(),
const_cast<GBytes*>(Glib::unwrap(bytes)),
io_priority,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags)
{
GError* gerror = nullptr;
- gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), 0, &(gerror));
+ gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_proxy_connect_async(gobj(),
Glib::unwrap(connection),
const_cast<GProxyAddress*>(Glib::unwrap(proxy_address)),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
GError* gerror = nullptr;
auto retvalue =
- Glib::ArrayHandler<Glib::ustring>::array_to_vector(g_proxy_resolver_lookup(gobj(), uri.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
+ Glib::ArrayHandler<Glib::ustring>::array_to_vector(g_proxy_resolver_lookup(gobj(), uri.c_str(), nullptr, &(gerror)), Glib::OWNERSHIP_DEEP);
if(gerror)
::Glib::Error::throw_exception(gerror);
g_proxy_resolver_lookup_async(gobj(),
uri.c_str(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_resolver_lookup_by_name_async (gobj(),
hostname.c_str(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_resolver_lookup_by_address_async (gobj(),
Glib::unwrap(address),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
service.c_str(),
protocol.c_str(),
domain.c_str(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_records_async(gobj(),
- (rrname.empty() ? 0 : rrname.c_str()),
+ (rrname.empty() ? nullptr : rrname.c_str()),
static_cast<GResolverRecordType>(record_type),
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_records_async(gobj(),
- (rrname.empty() ? 0 : rrname.c_str()),
+ (rrname.empty() ? nullptr : rrname.c_str()),
static_cast<GResolverRecordType>(record_type),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
{
GError* gerror = nullptr;
g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
- (GResourceLookupFlags)lookup_flags, 0, 0, &gerror);
+ (GResourceLookupFlags)lookup_flags, nullptr, nullptr, &gerror);
if (gerror)
::Glib::Error::throw_exception(gerror);
}
bool Resource::get_file_exists_nothrow(const std::string& path, ResourceLookupFlags lookup_flags) const
{
return g_resource_get_info(const_cast<GResource*>(gobj()), path.c_str(),
- (GResourceLookupFlags)lookup_flags, 0, 0, 0);
+ (GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr);
}
// Hand-coded because we want ResourceFlags& instead of guint32&.
//static
void Resource::get_file_exists_global(const std::string& path, ResourceLookupFlags lookup_flags)
{
- GError* gerror = 0;
+ GError* gerror = nullptr;
g_resources_get_info(path.c_str(),
- (GResourceLookupFlags)lookup_flags, 0, 0, &gerror);
+ (GResourceLookupFlags)lookup_flags, nullptr, nullptr, &gerror);
if (gerror)
::Glib::Error::throw_exception(gerror);
}
//static
bool Resource::get_file_exists_global_nothrow(const std::string& path, ResourceLookupFlags lookup_flags)
{
- return g_resources_get_info(path.c_str(), (GResourceLookupFlags)lookup_flags, 0, 0, 0);
+ return g_resources_get_info(path.c_str(), (GResourceLookupFlags)lookup_flags, nullptr, nullptr, nullptr);
}
} // namespace Gio
void get_value(const Glib::ustring& key, Glib::VariantBase& value) const;
_IGNORE(g_settings_get_value)
- //TODO: We've added a bool return to handle the NULL return value case,
- //but maybe other get_value() methods can return NULLs too.
+ //TODO: We've added a bool return to handle the nullptr return value case,
+ //but maybe other get_value() methods can return nullptrs too.
/** Checks the "user value" of a @a key, if there is one.
*
{
GError* gerror = nullptr;
GSocketAddress* caddr = nullptr;
- auto retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, 0, &(gerror));
+ auto retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
g_socket_client_connect_async (gobj(),
connectable->gobj (),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_socket_client_connect_to_host_async (gobj(),
host_and_port.c_str (),
default_port,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_socket_client_connect_to_service_async (gobj(),
domain.c_str (),
service.c_str (),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_socket_client_connect_to_uri_async (gobj(),
uri.c_str(), default_port,
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
g_socket_connection_connect_async(gobj(),
Glib::unwrap(address),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
GError* gerror = nullptr;
const bool retval = g_socket_listener_add_socket(gobj(),
Glib::unwrap(socket),
- 0,
+ nullptr,
&gerror);
if(gerror)
Glib::unwrap(address),
static_cast<GSocketType>(type),
static_cast<GSocketProtocol>(protocol),
- 0,
+ nullptr,
&retaddr,
&gerror);
if(gerror)
bool SocketListener::add_inet_port(guint16 port)
{
GError* gerror = nullptr;
- const bool retvalue = g_socket_listener_add_inet_port(gobj(), port, 0, &gerror);
+ const bool retvalue = g_socket_listener_add_inet_port(gobj(), port, nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
guint16 SocketListener::add_any_inet_port()
{
GError* gerror = nullptr;
- const auto retvalue = g_socket_listener_add_any_inet_port(gobj(), 0, &gerror);
+ const auto retvalue = g_socket_listener_add_any_inet_port(gobj(), nullptr, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
GObject *retobj = nullptr;
auto retvalue = g_socket_listener_accept_socket(gobj(),
&retobj,
- 0,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept_socket(gobj(),
- 0,
+ nullptr,
Glib::unwrap(cancellable),
&gerror);
if(gerror)
{
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept_socket(gobj(),
- 0,
- 0,
+ nullptr,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_socket_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept_socket_finish(gobj(),
Glib::unwrap(result),
- 0,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
GObject *retobj = nullptr;
auto retvalue = g_socket_listener_accept(gobj(),
&retobj,
- 0,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept(gobj(),
- 0,
+ nullptr,
Glib::unwrap(cancellable),
&gerror);
if(gerror)
{
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept(gobj(),
- 0,
- 0,
+ nullptr,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
GError* gerror = nullptr;
auto retvalue = g_socket_listener_accept_finish(gobj(),
Glib::unwrap(result),
- 0,
+ nullptr,
&gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_receive_credentials_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_send_credentials_async(gobj(),
- 0,
+ nullptr,
&SignalProxy_async_callback,
slot_copy);
}
UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
+ Glib::ObjectBase(nullptr),
// g_unix_fd_list_new_from_array() must be called.
// Its parameters don't correspond to properties.
// _CONSTRUCT() + g_unit_fd_list_append() is not an alternative.
UnixFDList::UnixFDList(const Glib::ArrayHandle<int>& fds, int n_fds)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
+ Glib::ObjectBase(nullptr),
// g_unix_fd_list_new_from_array() must be called.
// Its parameters don't correspond to properties.
// _CONSTRUCT() + g_unit_fd_list_append() is not an alternative.
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
- 0,
- 0);
+ nullptr, // cancellable
+ nullptr,
+ nullptr);
}
void
{
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
- 0,
- 0, // cancellable
- 0,
- 0);
+ nullptr,
+ nullptr, // cancellable
+ nullptr,
+ nullptr);
}
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
+ nullptr, // mount_operation
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
- 0, // cancellable
+ nullptr, // mount_operation
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
{
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
- 0, // mount_operation
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // mount_operation
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
void Volume::eject(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
+ nullptr, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
Glib::unwrap(mount_operation),
- 0, // cancellable
- 0, // callback
- 0); // data
+ nullptr, // cancellable
+ nullptr, // callback
+ nullptr); // data
}
} // namespace Gio
-// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
static void release_c_type (CType item)
{
- GLIBMM_DEBUG_UNREFERENCE(0, item);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, item);
g_object_unref(item);
}
};
-// -*- c++ -*-
-/* $Id$ */
-
/* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
void Class::register_derived_type(GType base_type)
{
- return register_derived_type(base_type, 0);
+ return register_derived_type(base_type, nullptr);
}
void Class::register_derived_type(GType base_type, GTypeModule* module)
if(base_type == 0)
return; // already initialized
- GTypeQuery base_query = { 0, 0, 0, 0, };
+ GTypeQuery base_query = { 0, nullptr, 0, 0, };
g_type_query(base_type, &base_query);
//GTypeQuery::class_size is guint but GTypeInfo::class_size is guint16.
const GTypeInfo derived_info =
{
class_size,
- 0, // base_init
- 0, // base_finalize
+ nullptr, // base_init
+ nullptr, // base_finalize
class_init_func_, //Set by the caller ( *_Class::init() ).
- 0, // class_finalize
- 0, // class_data
+ nullptr, // class_finalize
+ nullptr, // class_data
instance_size,
0, // n_preallocs
- 0, // instance_init
- 0, // value_table
+ nullptr, // instance_init
+ nullptr, // value_table
};
if(!(base_query.type_name))
return;
}
- gchar* derived_name = g_strconcat("gtkmm__", base_query.type_name, (void*)0);
+ gchar* derived_name = g_strconcat("gtkmm__", base_query.type_name, nullptr);
if(module)
gtype_ = g_type_module_register_type(module, base_type, derived_name, &derived_info, GTypeFlags(0));
// so that g_type_class_peek_parent() works correctly.
const GType base_type = g_type_parent(gtype_);
- GTypeQuery base_query = { 0, 0, 0, 0, };
+ GTypeQuery base_query = { 0, nullptr, 0, 0, };
g_type_query(base_type, &base_query);
//GTypeQuery::class_size is guint but GTypeInfo::class_size is guint16.
const GTypeInfo derived_info =
{
class_size,
- 0, // base_init
+ nullptr, // base_init
&Class::custom_class_base_finalize_function, // base_finalize
&Class::custom_class_init_function,
- 0, // class_finalize
+ nullptr, // class_finalize
this, // class_data
instance_size,
0, // n_preallocs
- 0, // instance_init
- 0, // value_table
+ nullptr, // instance_init
+ nullptr, // value_table
};
custom_type = g_type_register_static(
// The class_data pointer is set to 'this' by clone_custom_type().
const Class *const self = static_cast<Class*>(class_data);
- g_return_if_fail(self->class_init_func_ != 0);
+ g_return_if_fail(self->class_init_func_ != nullptr);
// Call the wrapper's class_init_function() to redirect
// the vfunc and default signal handler callbacks.
- (*self->class_init_func_)(g_class, 0);
+ (*self->class_init_func_)(g_class, nullptr);
GObjectClass *const gobject_class = static_cast<GObjectClass*>(g_class);
gobject_class->get_property = &Glib::custom_get_property_callback;
-// -*- c++ -*-
#ifndef _GLIBMM_CONTAINERHANDLE_SHARED_H
#define _GLIBMM_CONTAINERHANDLE_SHARED_H
static void release_c_type (CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(ptr);
}
};
static void release_c_type (CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(const_cast<CTypeNonConst>(ptr));
}
};
static void release_c_type (CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(ptr);
}
};
static void release_c_type (CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(const_cast<CTypeNonConst>(ptr));
}
};
namespace Glib
{
-gpointer glibmm_null_pointer=0;
+gpointer glibmm_null_pointer = nullptr;
} //namespace Glib
{}
List_Iterator()
- : head_(0), node_(0)
+ : head_(nullptr), node_(nullptr)
{}
List_Iterator(const Self& src)
{}
SList_Iterator()
- : node_(0)
+ : node_(nullptr)
{}
SList_Iterator(const Self& src)
{}
List_Cpp_Iterator()
- : head_(0), node_(0)
+ : head_(nullptr), node_(nullptr)
{}
List_Cpp_Iterator(const Self& src)
return *static_cast<pointer>(Glib::wrap_auto(cobj, false));
#endif
}
- return *static_cast<pointer>(0); // boom!
+ return *static_cast<pointer>(nullptr); // boom!
}
pointer operator->() const { return &**this; }
Glib::DispatchNotifier* notifier;
DispatchNotifyData()
- : dispatcher (0), notifier (0) {}
+ : dispatcher (nullptr), notifier (nullptr) {}
DispatchNotifyData(Glib::Dispatcher* d, Glib::DispatchNotifier* n)
: dispatcher (d), notifier (n) {}
long ref_count_;
Glib::RefPtr<MainContext> context_;
#ifdef G_OS_WIN32
- Glib::Threads::Mutex mutex_;
+ std::mutex mutex_;
std::list<DispatchNotifyData> notify_queue_;
HANDLE fd_receiver_;
#else
else
{
// Prevent massive mess-up.
- g_return_val_if_fail(instance->context_ == context, 0);
+ g_return_val_if_fail(instance->context_ == context, nullptr);
// In the possible but unlikely case that a new dispatcher gets the same
// address as a newly deleted one, if the pipe still contains messages to
g_return_if_fail(instance->ref_count_ == 0); // could be < 0 if messed up
// This causes deletion of the notifier object.
- thread_specific_instance_.replace(0);
+ thread_specific_instance_.replace(nullptr);
}
}
{
#ifdef G_OS_WIN32
{
- const Threads::Mutex::Lock lock (mutex_);
+ const std::lock_guard<std::mutex> lock (mutex_);
const bool was_empty = notify_queue_.empty();
notify_queue_.push_back(DispatchNotifyData(dispatcher, this));
#ifdef G_OS_WIN32
{
- const Threads::Mutex::Lock lock (mutex_);
+ const std::lock_guard<std::mutex> lock (mutex_);
// Should never be empty at this point, but let's allow for bogus
// notifications with no data available anyway; just to be safe.
Error::Error()
:
- gobject_ (0)
+ gobject_ (nullptr)
{}
Error::Error(GQuark error_domain, int error_code, const Glib::ustring& message)
Error::Error(const Error& other)
:
Exception(other),
- gobject_ ((other.gobject_) ? g_error_copy(other.gobject_) : 0)
+ gobject_ ((other.gobject_) ? g_error_copy(other.gobject_) : nullptr)
{}
Error& Error::operator=(const Error& other)
-// -*- c++ -*-
#ifndef _GLIBMM_HELPERLIST_H
#define _GLIBMM_HELPERLIST_H
-/* $Id$ */
/* helperlist.h
*
{
public:
HelperList()
- : gparent_(0)
+ : gparent_(nullptr)
{}
HelperList(GObject* gp) //We use gp instead of gparent because that can cause warnings about a shadowed member.
iterator end_() const
{
- return iterator(glist(), (GList*)0);
+ return iterator(glist(), (GList*)nullptr);
}
GObject* gparent_;
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/threads.h> // Needed until the next ABI break.
#include <glibmm/interface.h>
#include <glibmm/private/interface_p.h>
const GInterfaceInfo interface_info =
{
class_init_func_,
- 0, // interface_finalize
- 0, // interface_data
+ nullptr, // interface_finalize
+ nullptr, // interface_data
};
g_type_add_interface_static(instance_type, gtype_, &interface_info);
{
// The GObject is not instantiated yet. Add to the custom_interface_classes
// and add the interface in the Glib::Object constructor.
- Threads::Mutex::Lock lock(*extra_object_base_data_mutex);
+ std::lock_guard<std::mutex> lock(extra_object_base_data_mutex);
extra_object_base_data[this].custom_interface_classes.push_back(&interface_class);
}
}
-// -*- c++ -*-
#ifndef _GLIBMM_LISTHANDLE_H
#define _GLIBMM_LISTHANDLE_H
struct ListSourceTraits<Tr,Cont*>
{
static GList* get_data(const Cont* array)
- { return (array) ? Glib::Container_Helpers::create_list(array, Tr()) : 0; }
+ { return (array) ? Glib::Container_Helpers::create_list(array, Tr()) : nullptr; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
template <class T, class Tr> inline
typename ListHandle<T,Tr>::const_iterator ListHandle<T,Tr>::end() const
{
- return Glib::Container_Helpers::ListHandleIterator<Tr>(0);
+ return Glib::Container_Helpers::ListHandleIterator<Tr>(nullptr);
}
template <class T, class Tr>
-// -*- c++ -*-
-/* $Id$ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
std::map<const Glib::Source*, ExtraSourceData> extra_source_data;
// Source instances may be used in different threads.
// Accesses to extra_source_data must be thread-safe.
-Glib::Threads::Mutex extra_source_data_mutex;
+std::mutex extra_source_data_mutex;
class SourceConnectionNode
{
SourceConnectionNode::SourceConnectionNode(const sigc::slot_base& slot)
:
slot_ (slot),
- source_ (0)
+ source_ (nullptr)
{
slot_.set_parent(this, &SourceConnectionNode::notify);
}
SourceConnectionNode *const self = static_cast<SourceConnectionNode*>(data);
// if there is no object, this call was triggered from destroy_notify_handler(),
- // because we set self->source_ to 0 there:
+ // because we set self->source_ to nullptr there:
if (self->source_)
{
GSource* s = self->source_;
// either immediately or later, so we leave that to do the deletion.
}
- return 0;
+ return nullptr;
}
// static
SourceCallbackData::SourceCallbackData(Glib::Source* wrapper_)
:
wrapper (wrapper_),
- node (0)
+ node (nullptr)
{}
void SourceCallbackData::set_node(SourceConnectionNode* node_)
if(self->wrapper)
{
- Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+ std::unique_lock<std::mutex> lock(extra_source_data_mutex);
if (--extra_source_data[self->wrapper].keep_wrapper == 0)
{
// No other reference exists to the wrapper. Delete it!
extra_source_data.erase(self->wrapper);
- lock.release();
+ lock.unlock();
Glib::Source::destroy_notify_callback(self->wrapper);
}
}
*/
static SourceCallbackData* glibmm_source_get_callback_data(GSource* source)
{
- g_return_val_if_fail(source->callback_funcs != nullptr, 0);
+ g_return_val_if_fail(source->callback_funcs != nullptr, nullptr);
GSourceFunc func;
void* user_data = nullptr;
SignalTimeout signal_timeout()
{
- return SignalTimeout(0); // 0 means default context
+ return SignalTimeout(nullptr); // nullptr means default context
}
SignalIdle signal_idle()
{
- return SignalIdle(0); // 0 means default context
+ return SignalIdle(nullptr); // nullptr means default context
}
SignalIO signal_io()
{
- return SignalIO(0); // 0 means default context
+ return SignalIO(nullptr); // nullptr means default context
}
/**** Glib::SignalChildWatch **************************************************/
SignalChildWatch signal_child_watch()
{
- return SignalChildWatch(0); // 0 means default context
+ return SignalChildWatch(nullptr); // nullptr means default context
}
/**** Glib::MainContext ****************************************************/
{
return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
}
-#endif //GLIBMM_DISABLE_DEPRECATED
bool MainContext::wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex)
{
return g_main_context_wait(gobj(), cond.gobj(), mutex.gobj());
}
+#endif //GLIBMM_DISABLE_DEPRECATED
void MainContext::release()
{
bool MainContext::prepare()
{
- return g_main_context_prepare(gobj(), 0);
+ return g_main_context_prepare(gobj(), nullptr);
}
void MainContext::query(int max_priority, int& timeout, std::vector<PollFD>& fds)
Glib::RefPtr<MainLoop> MainLoop::create(bool is_running)
{
return Glib::RefPtr<MainLoop>(
- reinterpret_cast<MainLoop*>(g_main_loop_new(0, is_running)));
+ reinterpret_cast<MainLoop*>(g_main_loop_new(nullptr, is_running)));
}
Glib::RefPtr<MainLoop> MainLoop::create(const Glib::RefPtr<MainContext>& context, bool is_running)
&Source::prepare_vfunc,
&Source::check_vfunc,
&Source::dispatch_vfunc,
- 0, // finalize_vfunc // We can't use finalize_vfunc because there is no way
+ nullptr, // finalize_vfunc // We can't use finalize_vfunc because there is no way
// to store a pointer to our wrapper anywhere in GSource so
// that it persists until finalize_vfunc would be called from here.
- 0, // closure_callback
- 0, // closure_marshal
+ nullptr, // closure_callback
+ nullptr, // closure_marshal
};
unsigned int Source::attach(const Glib::RefPtr<MainContext>& context)
unsigned int Source::attach()
{
- return g_source_attach(gobject_, 0);
+ return g_source_attach(gobject_, nullptr);
}
void Source::destroy()
void Source::reference() const
{
- Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+ std::lock_guard<std::mutex> lock(extra_source_data_mutex);
++extra_source_data[this].ref_count;
}
void Source::unreference() const
{
- Glib::Threads::Mutex::Lock lock(extra_source_data_mutex);
+ std::unique_lock<std::mutex> lock(extra_source_data_mutex);
if (--extra_source_data[this].ref_count == 0)
{
GSource* const tmp_gobject = gobject_;
// extra_source_data[this].keep_wrapper was > 1.
// Delete the wrapper!
extra_source_data.erase(this);
- lock.release();
+ lock.unlock();
destroy_notify_callback(const_cast<Source*>(this));
}
else
- lock.release();
+ lock.unlock();
// Drop the one and only GSource reference held by the C++ wrapper.
// If the GSource instance is attached to a main context, the GMainContext
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 != nullptr, 0);
+ g_return_val_if_fail(callback_data->node != nullptr, nullptr);
return callback_data->node->get_slot();
}
* @deprecated Use wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex) instead.
*/
bool wait(Glib::Cond& cond, Glib::Mutex& mutex);
-#endif //GLIBMM_DISABLE_DEPRECATED
+ //Deprecated mostly because it uses deprecated Glib::Threads:: for parameters.
/** Tries to become the owner of the specified context, as with acquire(). But if another thread is the owner,
* atomically drop mutex and wait on cond until that owner releases ownership or until cond is signaled, then try
* again (once) to become the owner.
* @param cond A condition variable.
* @param mutex A mutex, currently held.
* @return true if the operation succeeded, and this thread is now the owner of context.
+ *
+ * @deprecated Please use the underlying g_main_context_wait() function if you really need this functionality.
*/
bool wait(Glib::Threads::Cond& cond, Glib::Threads::Mutex& mutex);
+#endif //GLIBMM_DISABLE_DEPRECATED
/** Releases ownership of a context previously acquired by this thread with acquire(). If the context was acquired
* multiple times, the only release ownership when release() is called as many times as it was acquired.
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/threads.h> // Needed until the next ABI break.
#include <glibmm/object.h>
#include <glibmm/private/object_p.h>
#include <glibmm/property.h>
:
glibmm_class (glibmm_class_),
n_parameters (0),
- parameters (0)
+ parameters (nullptr)
{}
/*
:
glibmm_class (glibmm_class_),
n_parameters (0),
- parameters (0)
+ parameters (nullptr)
{
va_list var_args;
va_start(var_args, first_property_name);
{
Class::interface_class_vector_type custom_interface_classes;
- Threads::Mutex::Lock lock(*extra_object_base_data_mutex);
- const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this);
- if (iter != extra_object_base_data.end())
{
- custom_interface_classes = iter->second.custom_interface_classes;
- extra_object_base_data.erase(iter);
+ std::lock_guard<std::mutex> lock(extra_object_base_data_mutex);
+ const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this);
+ if (iter != extra_object_base_data.end())
+ {
+ custom_interface_classes = iter->second.custom_interface_classes;
+ extra_object_base_data.erase(iter);
+ }
}
- lock.release();
object_class_.init();
// This creates a type that is derived (indirectly) from GObject.
custom_type_name_, custom_interface_classes);
}
- void *const new_object = g_object_newv(object_type, 0, 0);
+ void *const new_object = g_object_newv(object_type, 0, nullptr);
// Connect the GObject and Glib::Object instances.
ObjectBase::initialize(static_cast<GObject*>(new_object));
{
Class::interface_class_vector_type custom_interface_classes;
- Threads::Mutex::Lock lock(*extra_object_base_data_mutex);
- const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this);
- if (iter != extra_object_base_data.end())
{
- custom_interface_classes = iter->second.custom_interface_classes;
- extra_object_base_data.erase(iter);
+ std::lock_guard<std::mutex> lock(extra_object_base_data_mutex);
+ const extra_object_base_data_type::iterator iter = extra_object_base_data.find(this);
+ if (iter != extra_object_base_data.end())
+ {
+ custom_interface_classes = iter->second.custom_interface_classes;
+ extra_object_base_data.erase(iter);
+ }
}
- lock.release();
object_type = construct_params.glibmm_class.clone_custom_type(
custom_type_name_, custom_interface_classes);
-// -*- c++ -*-
#ifndef _GLIBMM_OBJECT_H
#define _GLIBMM_OBJECT_H
static void release_c_type(CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(ptr);
}
};
static void release_c_type (CType ptr)
{
- GLIBMM_DEBUG_UNREFERENCE(0, ptr);
+ GLIBMM_DEBUG_UNREFERENCE(nullptr, ptr);
g_object_unref(const_cast<CTypeNonConst>(ptr));
}
};
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <glibmm/threads.h> // Needed until the next ABI break.
#include <glib-object.h>
#include <glibmm/quark.h>
// static data members
ObjectBase::extra_object_base_data_type ObjectBase::extra_object_base_data;
-Threads::Mutex* ObjectBase::extra_object_base_data_mutex = new Threads::Mutex();
+std::mutex ObjectBase::extra_object_base_data_mutex;
ObjectBase::ObjectBase()
:
- gobject_ (0),
+ gobject_ (nullptr),
custom_type_name_ (anonymous_custom_type_name),
cpp_destruction_in_progress_ (false)
{}
ObjectBase::ObjectBase(const char* custom_type_name)
:
- gobject_ (0),
+ gobject_ (nullptr),
custom_type_name_ (custom_type_name),
cpp_destruction_in_progress_ (false)
{}
ObjectBase::ObjectBase(const std::type_info& custom_type_info)
:
- gobject_ (0),
+ gobject_ (nullptr),
custom_type_name_ (custom_type_info.name()),
cpp_destruction_in_progress_ (false)
{}
// Just a precaution. Unless a derived class's ctor has thrown an exception,
// 'this' should have been erased from extra_object_base_data by
// Glib::Object's constructor.
- Threads::Mutex::Lock lock(*extra_object_base_data_mutex);
- extra_object_base_data.erase(this);
- lock.release();
+ {
+ std::lock_guard<std::mutex> lock(extra_object_base_data_mutex);
+ extra_object_base_data.erase(this);
+ }
if(GObject *const gobject = gobject_)
{
if(object)
return static_cast<ObjectBase*>(g_object_get_qdata(object, Glib::quark_));
else
- return 0;
+ return nullptr;
}
// static
#include <typeinfo>
#include <map> // Needed until the next ABI break.
#include <memory> // Not used by ObjectBase any more, but user code may rely on it being here.
+#include <mutex>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GObject GObject; }
#ifndef DOXYGEN_SHOULD_SKIP_THIS
class GSigConnectionNode;
class Interface_Class;
-namespace Threads
-{
-class Mutex;
-}
#endif
//This inherits virtually from sigc::trackable so that people can multiply inherit glibmm classes from other sigc::trackable-derived classes.
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.
-// 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 Threads::Mutex* extra_object_base_data_mutex;
+static std::mutex extra_object_base_data_mutex;
public: // is_derived_() must be public, so that overridden vfuncs and signal handlers can call it via ObjectBase.
bool PatternSpec::match(const Glib::ustring& str) const
{
- return g_pattern_match(gobject_, str.bytes(), str.c_str(), 0);
+ return g_pattern_match(gobject_, str.bytes(), str.c_str(), nullptr);
}
bool PatternSpec::match(const Glib::ustring& str, const Glib::ustring& str_reversed) const
:
object_ (&object),
value_ (),
- param_spec_ (0)
+ param_spec_ (nullptr)
{
value_.init(value_type);
}
-// -*- c++ -*-
#ifndef _GLIBMM_REFPTR_H
#define _GLIBMM_REFPTR_H
inline void clear() noexcept;
#endif //GLIBMM_DISABLE_DEPRECATED
- /** Set underlying instance to 0, decrementing reference count of existing instance appropriately.
+ /** Set underlying instance to nullptr, decrementing reference count of existing instance appropriately.
* @newin{2,16}
*/
inline void reset() noexcept;
template <class T_CppObject> inline
RefPtr<T_CppObject>::RefPtr() noexcept
:
- pCppObject_ (0)
+ pCppObject_ (nullptr)
{}
template <class T_CppObject> inline
}
}
- return 0; // apparently unused in libsigc++
+ return nullptr; // apparently unused in libsigc++
}
//static
-// -*- c++ -*-
#ifndef _GLIBMM_SLISTHANDLE_H
#define _GLIBMM_SLISTHANDLE_H
struct SListSourceTraits<Tr,Cont*>
{
static GSList* get_data(const Cont* array)
- { return (array) ? Glib::Container_Helpers::create_slist(array, Tr()) : 0; }
+ { return (array) ? Glib::Container_Helpers::create_slist(array, Tr()) : nullptr; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
template <class T, class Tr> inline
typename SListHandle<T,Tr>::const_iterator SListHandle<T,Tr>::end() const
{
- return Glib::Container_Helpers::SListHandleIterator<Tr>(0);
+ return Glib::Container_Helpers::SListHandleIterator<Tr>(nullptr);
}
template <class T, class Tr>
// static
Glib::RefPtr<StreamIOChannel> StreamIOChannel::create(std::istream& stream)
{
- return Glib::RefPtr<StreamIOChannel>(new StreamIOChannel(&stream, 0));
+ return Glib::RefPtr<StreamIOChannel>(new StreamIOChannel(&stream, nullptr));
}
// static
Glib::RefPtr<StreamIOChannel> StreamIOChannel::create(std::ostream& stream)
{
- return Glib::RefPtr<StreamIOChannel>(new StreamIOChannel(0, &stream));
+ return Glib::RefPtr<StreamIOChannel>(new StreamIOChannel(nullptr, &stream));
}
// static
std::string Glib::strescape(const std::string& source)
{
- const Glib::ScopedPtr<char> buf (g_strescape(source.c_str(), 0));
+ const Glib::ScopedPtr<char> buf (g_strescape(source.c_str(), nullptr));
return buf.get();
}
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GLIBMM_DISABLE_DEPRECATED
+
#include <glibmmconfig.h>
#include <glibmm/threadpool.h>
#include <glibmm/exceptionhandler.h>
ThreadPool::ThreadPool(int max_threads, bool exclusive)
:
- gobject_ (0),
+ gobject_ (nullptr),
slot_list_ (new SlotList())
{
GError* error = nullptr;
} // namespace Glib
+#endif // GLIBMM_DISABLE_DEPRECATED
+
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifndef GLIBMM_DISABLE_DEPRECATED
+
#include <sigc++/sigc++.h>
extern "C" { typedef struct _GThreadPool GThreadPool; }
/** @defgroup ThreadPools Thread Pools
* Pools of threads to execute work concurrently.
+ *
+ * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
+ *
* @{
*/
+//TODO: Is std::async() an appropriate replacement to mention for this deprecated API?
+
/** A pool of threads to execute work concurrently.
+ *
+ * @deprecated This is deprecated in favor of the standard C++ concurrency API in C++11 and C++14.
*/
class ThreadPool
{
} // namespace Glib
+#endif // GLIBMM_DISABLE_DEPRECATED
#endif /* _GLIBMM_THREADPOOL_H */
double Timer::elapsed() const
{
- return g_timer_elapsed(gobject_, 0);
+ return g_timer_elapsed(gobject_, nullptr);
}
double Timer::elapsed(unsigned long& microseconds) const
bool ustring::validate() const
{
- return (g_utf8_validate(string_.data(), string_.size(), 0) != 0);
+ return (g_utf8_validate(string_.data(), string_.size(), nullptr) != 0);
}
bool ustring::validate(ustring::iterator& first_invalid)
// Avoid going through iconv if wchar_t always contains UCS-4.
glong n_bytes = 0;
const ScopedPtr<char> buf (g_ucs4_to_utf8(reinterpret_cast<const gunichar*>(str.data()),
- str.size(), 0, &n_bytes, &error));
+ str.size(), nullptr, &n_bytes, &error));
# elif defined(G_OS_WIN32) && SIZEOF_WCHAR_T == 2
// Avoid going through iconv if wchar_t always contains UTF-16.
glong n_bytes = 0;
const ScopedPtr<char> buf (g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(str.data()),
- str.size(), 0, &n_bytes, &error));
+ str.size(), nullptr, &n_bytes, &error));
# else
gsize n_bytes = 0;
const ScopedPtr<char> buf (g_convert(reinterpret_cast<const char*>(str.data()),
str.size() * sizeof(std::wstring::value_type),
- "UTF-8", "WCHAR_T", 0, &n_bytes, &error));
+ "UTF-8", "WCHAR_T", nullptr, &n_bytes, &error));
# endif /* !(__STDC_ISO_10646__ || G_OS_WIN32) */
#else /* !GLIBMM_HAVE_WIDE_STREAM */
GError* error = nullptr;
gsize n_bytes = 0;
- const ScopedPtr<char> buf (g_locale_to_utf8(str.data(), str.size(), 0, &n_bytes, &error));
+ const ScopedPtr<char> buf (g_locale_to_utf8(str.data(), str.size(), nullptr, &n_bytes, &error));
if (error)
{
{
GError* error = nullptr;
const ScopedPtr<char> buf (g_locale_from_utf8(utf8_string.raw().data(),
- utf8_string.raw().size(), 0, 0, &error));
+ utf8_string.raw().size(), nullptr, nullptr, &error));
if (error)
{
Glib::Error::throw_exception(error);
// Avoid going through iconv if wchar_t always contains UCS-4.
glong n_bytes = 0;
const ScopedPtr<char> buf (g_ucs4_to_utf8(reinterpret_cast<const gunichar*>(wstr.data()),
- wstr.size(), 0, &n_bytes, &error));
+ wstr.size(), nullptr, &n_bytes, &error));
#elif defined(G_OS_WIN32) && SIZEOF_WCHAR_T == 2
// Avoid going through iconv if wchar_t always contains UTF-16.
glong n_bytes = 0;
const ScopedPtr<char> buf (g_utf16_to_utf8(reinterpret_cast<const gunichar2*>(wstr.data()),
- wstr.size(), 0, &n_bytes, &error));
+ wstr.size(), nullptr, &n_bytes, &error));
#else
gsize n_bytes = 0;
const ScopedPtr<char> buf (g_convert(reinterpret_cast<const char*>(wstr.data()),
wstr.size() * sizeof(std::wstring::value_type),
- "UTF-8", "WCHAR_T", 0, &n_bytes, &error));
+ "UTF-8", "WCHAR_T", nullptr, &n_bytes, &error));
#endif // !(__STDC_ISO_10646__ || G_OS_WIN32)
if (error)
#if defined(__STDC_ISO_10646__) && SIZEOF_WCHAR_T == 4
// Avoid going through iconv if wchar_t always contains UCS-4.
const ScopedPtr<gunichar> buf (g_utf8_to_ucs4(utf8_string.raw().data(),
- utf8_string.raw().size(), 0, 0, &error));
+ utf8_string.raw().size(), nullptr, nullptr, &error));
#elif defined(G_OS_WIN32) && SIZEOF_WCHAR_T == 2
// Avoid going through iconv if wchar_t always contains UTF-16.
const ScopedPtr<gunichar2> buf (g_utf8_to_utf16(utf8_string.raw().data(),
- utf8_string.raw().size(), 0, 0, &error));
+ utf8_string.raw().size(), nullptr, nullptr, &error));
#else
const ScopedPtr<char> buf (g_convert(utf8_string.raw().data(), utf8_string.raw().size(),
- "WCHAR_T", "UTF-8", 0, 0, &error));
+ "WCHAR_T", "UTF-8", nullptr, nullptr, &error));
#endif // !(__STDC_ISO_10646__ || G_OS_WIN32)
if (error)
-// -*- c++ -*-
#ifndef _GLIBMM_USTRING_H
#define _GLIBMM_USTRING_H
-/* $Id$ */
-
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
template <class T> inline
ustring_Iterator<T>& ustring_Iterator<T>::operator--()
{
- while ((static_cast<unsigned char>(*--pos_) & 0xC0u) == 0x80)
- ;
+ do --pos_; while((static_cast<unsigned char>(*pos_) & 0xC0u) == 0x80);
return *this;
}
inline // static
ustring ustring::compose(const ustring& fmt)
{
- return ustring::compose_argv(fmt, 0, 0);
+ return ustring::compose_argv(fmt, 0, nullptr);
}
template <class T1>
ScopedPtr<T>& operator=(const ScopedPtr<T>&);
public:
- ScopedPtr() : ptr_ (0) {}
+ ScopedPtr() : ptr_ (nullptr) {}
explicit ScopedPtr(T* ptr) : ptr_ (ptr) {}
~ScopedPtr() noexcept { g_free(ptr_); }
T* get() const { return ptr_; }
GParamSpec* ValueBase_Boxed::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_boxed(
- name.c_str(), 0, 0, G_VALUE_TYPE(&gobject_),
+ name.c_str(), nullptr, nullptr, G_VALUE_TYPE(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
void ValueBase_Object::set_object(Glib::ObjectBase* data)
{
- g_value_set_object(&gobject_, (data) ? data->gobj() : 0);
+ g_value_set_object(&gobject_, (data) ? data->gobj() : nullptr);
}
Glib::ObjectBase* ValueBase_Object::get_object() const
if(G_VALUE_HOLDS_OBJECT(&gobject_))
{
return g_param_spec_object(
- name.c_str(), 0, 0, G_VALUE_TYPE(&gobject_),
+ name.c_str(), nullptr, nullptr, G_VALUE_TYPE(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
else
{
- g_return_val_if_fail(G_VALUE_HOLDS_POINTER(&gobject_), 0);
+ g_return_val_if_fail(G_VALUE_HOLDS_POINTER(&gobject_), nullptr);
return g_param_spec_pointer(
- name.c_str(), 0, 0,
+ name.c_str(), nullptr, nullptr,
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
}
GParamSpec* ValueBase_Enum::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_enum(
- name.c_str(), 0, 0,
+ name.c_str(), nullptr, nullptr,
G_VALUE_TYPE(&gobject_), g_value_get_enum(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
GParamSpec* ValueBase_Flags::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_flags(
- name.c_str(), 0, 0,
+ name.c_str(), nullptr, nullptr,
G_VALUE_TYPE(&gobject_), g_value_get_flags(&gobject_),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
GParamSpec* ValueBase_String::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_string(
- name.c_str(), 0, 0, get_cstring(),
+ name.c_str(), nullptr, nullptr, get_cstring(),
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
-// -*- c++ -*-
#ifndef _GLIBMM_VALUE_H
#define _GLIBMM_VALUE_H
protected:
void set_cstring(const char* data);
- const char* get_cstring() const; // never returns 0
+ const char* get_cstring() const; // never returns nullptr
};
} // namespace Glib
init_func,
free_func,
copy_func,
- 0, // value_peek_pointer
- 0, // collect_format
- 0, // collect_value
- 0, // lcopy_format
- 0, // lcopy_value
+ nullptr, // value_peek_pointer
+ nullptr, // collect_format
+ nullptr, // collect_value
+ nullptr, // lcopy_format
+ nullptr, // lcopy_value
};
const GTypeInfo type_info =
{
0, // class_size
- 0, // base_init
- 0, // base_finalize
- 0, // class_init_func
- 0, // class_finalize
- 0, // class_data
+ nullptr, // base_init
+ nullptr, // base_finalize
+ nullptr, // class_init_func
+ nullptr, // class_finalize
+ nullptr, // class_data
0, // instance_size
0, // n_preallocs
- 0, // instance_init
+ nullptr, // instance_init
&value_table,
};
const GTypeInfo type_info =
{
0, // class_size
- 0, // base_init
- 0, // base_finalize
- 0, // class_init_func
- 0, // class_finalize
- 0, // class_data
+ nullptr, // base_init
+ nullptr, // base_finalize
+ nullptr, // class_init_func
+ nullptr, // class_finalize
+ nullptr, // class_data
0, // instance_size
0, // n_preallocs
- 0, // instance_init
- 0, // value_table
+ nullptr, // instance_init
+ nullptr, // value_table
};
// We could probably use g_pointer_type_register_static(), but I want
-// -*- c++ -*-
-/* $Id$ */
-
/* Copyright 2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
GType Value_Pointer<T,PtrT>::value_type()
{
// Dispatch to the specific value_type_() overload.
- return Value_Pointer<T,PtrT>::value_type_(static_cast<T*>(0));
+ return Value_Pointer<T,PtrT>::value_type_(static_cast<T*>(nullptr));
}
template <class T, class PtrT> inline
void Value_Pointer<T,PtrT>::set(PtrT data)
{
// Dispatch to the specific set_() overload.
- this->set_(data, static_cast<T*>(0));
+ this->set_(data, static_cast<T*>(nullptr));
}
template <class T, class PtrT> inline
PtrT Value_Pointer<T,PtrT>::get() const
{
// Dispatch to the specific get_() overload.
- return this->get_(static_cast<T*>(0));
+ return this->get_(static_cast<T*>(nullptr));
}
GList* create_glist(const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
typename std::vector<typename Tr::CppType>::const_iterator pend)
{
- GList* head(0);
+ GList* head(nullptr);
while(pend != pbegin)
{
GSList* create_gslist(const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
typename std::vector<typename Tr::CppType>::const_iterator pend)
{
- GSList* head(0);
+ GSList* head(nullptr);
while(pend != pbegin)
{
// it will handle destroying data depending on passed ownership.
GListKeeperType keeper(glist, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType(ListIteratorType(glist), ListIteratorType(0));
+ return VectorType(ListIteratorType(glist), ListIteratorType(nullptr));
#else
VectorType temp;
temp.reserve(g_list_length(glist));
- Glib::Container_Helpers::fill_container(temp, ListIteratorType(glist), ListIteratorType(0));
+ Glib::Container_Helpers::fill_container(temp, ListIteratorType(glist), ListIteratorType(nullptr));
return temp;
#endif
}
// it will handle destroying data depending on passed ownership.
GSListKeeperType keeper(gslist, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType(SListIteratorType(gslist), SListIteratorType(0));
+ return VectorType(SListIteratorType(gslist), SListIteratorType(nullptr));
#else
VectorType temp;
temp.reserve(g_slist_length(gslist));
- Glib::Container_Helpers::fill_container(temp, SListIteratorType(gslist), SListIteratorType(0));
+ Glib::Container_Helpers::fill_container(temp, SListIteratorType(gslist), SListIteratorType(nullptr));
return temp;
#endif
}
static Glib::ObjectBase* wrap_create_new_wrapper(GObject* object)
{
- g_return_val_if_fail(wrap_func_table != nullptr, 0);
+ g_return_val_if_fail(wrap_func_table != nullptr, nullptr);
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
if(gtkmm_wrapper_already_deleted)
{
g_warning("Glib::wrap_create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted.");
- return 0;
+ return nullptr;
}
// Traverse upwards through the inheritance hierarchy
}
}
- return 0;
+ return nullptr;
}
static gboolean gtype_wraps_interface(GType implementer_type, GType interface_type)
Glib::ObjectBase* wrap_create_new_wrapper_for_interface(GObject* object, GType interface_gtype)
{
- g_return_val_if_fail(wrap_func_table != nullptr, 0);
+ g_return_val_if_fail(wrap_func_table != nullptr, nullptr);
const bool gtkmm_wrapper_already_deleted = (bool)g_object_get_qdata((GObject*)object, Glib::quark_cpp_wrapper_deleted_);
if(gtkmm_wrapper_already_deleted)
{
g_warning("Glib::wrap_create_new_wrapper: Attempted to create a 2nd C++ wrapper for a C instance whose C++ wrapper has been deleted.");
- return 0;
+ return nullptr;
}
// Traverse upwards through the inheritance hierarchy
}
}
- return 0;
+ return nullptr;
}
ObjectBase* wrap_auto(GObject* object, bool take_copy)
{
if(!object)
- return 0;
+ return nullptr;
// Look up current C++ wrapper instance:
ObjectBase* pCppObject = ObjectBase::_get_current_wrapper(object);
if(!pCppObject)
{
g_warning("Failed to wrap object of type '%s'. Hint: this error is commonly caused by failing to call a library init() function.", G_OBJECT_TYPE_NAME(object));
- return 0;
+ return nullptr;
}
}
TInterface* wrap_auto_interface(GObject* object, bool take_copy = false)
{
if(!object)
- return 0;
+ return nullptr;
// Look up current C++ wrapper instance:
ObjectBase* pCppObject = ObjectBase::_get_current_wrapper(object);
template <class T> inline
typename T::BaseObjectType* unwrap(T* ptr)
{
- return (ptr) ? ptr->gobj() : 0;
+ return (ptr) ? ptr->gobj() : nullptr;
}
/** Get the underlying C instance from the C++ instance. This is just
template <class T> inline
const typename T::BaseObjectType* unwrap(const T* ptr)
{
- return (ptr) ? ptr->gobj() : 0;
+ return (ptr) ? ptr->gobj() : nullptr;
}
/** Get the underlying C instance from the C++ instance. This is just
template <class T> inline
typename T::BaseObjectType* unwrap(const Glib::RefPtr<T>& ptr)
{
- return (ptr) ? ptr->gobj() : 0;
+ return (ptr) ? ptr->gobj() : nullptr;
}
/** Get the underlying C instance from the C++ instance. This is just
template <class T> inline
const typename T::BaseObjectType* unwrap(const Glib::RefPtr<const T>& ptr)
{
- return (ptr) ? ptr->gobj() : 0;
+ return (ptr) ? ptr->gobj() : nullptr;
}
// This unwrap_copy() overload is intended primarily for classes wrapped as
template <class T> inline
typename T::BaseObjectType* unwrap_copy(const T& obj)
{
- return obj.gobj() ? obj.gobj_copy() : 0;
+ return obj.gobj() ? obj.gobj_copy() : nullptr;
}
/** Get the underlying C instance from the C++ instance and acquire a
template <class T> inline
typename T::BaseObjectType* unwrap_copy(const Glib::RefPtr<T>& ptr)
{
- return (ptr) ? ptr->gobj_copy() : 0;
+ return (ptr) ? ptr->gobj_copy() : nullptr;
}
/** Get the underlying C instance from the C++ instance and acquire a
template <class T> inline
const typename T::BaseObjectType* unwrap_copy(const Glib::RefPtr<const T>& ptr)
{
- return (ptr) ? ptr->gobj_copy() : 0;
+ return (ptr) ? ptr->gobj_copy() : nullptr;
}
} // namespace Glib
# define GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED 1
# pragma warning (disable: 4786 4355 4800 4181)
-#if (_MSC_VER < 1900)
-/* The C++-11 keywords noexcept and thread_local are supported on
- * Visual Studio 2013 via Microsoft-specific extensions, but are
- * supported directly in Visual Studio 2015
- */
-
+#if (_MSC_VER < 1900) && !defined (noexcept)
#define _ALLOW_KEYWORD_MACROS 1
-
-#ifndef noexcept
#define noexcept _NOEXCEPT
#endif
-
-#ifndef thread_local
-#define thread_local __declspec (thread)
#endif
-#endif /* _MSC_VER < 1900 */
-#endif /* GLIBMM_MSC */
-
/* Dummy macro definition for compatibility with old code that expects
* it to be defined. Remove after grace period. */
#define GLIBMM_USING_STD(Symbol)
* fast.
*
* @param key The key to look up.
- * @result The value corresponding to the key, or 0 if the key was
+ * @result The value corresponding to the key, or <tt>nullptr</tt> if the key was
* not found.
*/
V* lookup(const K &key)
*
* @param search_func A function used to search the BalancedTree.
* @param key The key to search for.
- * @result The value corresponding to the found key, or <tt>0</tt> if the key
+ * @result The value corresponding to the found key, or <tt>nullptr</tt> if the key
* was not found.
*/
V* search(const CompareFunc &search_func, const K& key)
*
* @param search_func A function used to search the BalancedTree.
* @param key The key to search for.
- * @result The value corresponding to the found key, or <tt>0</tt> if the key
+ * @result The value corresponding to the found key, or <tt>nullptr</tt> if the key
* was not found.
*/
const V* search(const CompareFunc &search_func, const K& key) const
source_property.get_object()->gobj(), source_property.get_name(),
target_property.get_object()->gobj(), target_property.get_name(),
(GBindingFlags)flags,
- transform_to.empty() ? 0 : &Binding_transform_to_callback,
- transform_from.empty() ? 0 : &Binding_transform_from_callback,
+ transform_to.empty() ? nullptr : &Binding_transform_to_callback,
+ transform_from.empty() ? nullptr : &Binding_transform_from_callback,
slots_copy, &Binding_transform_callback_destroy);
}
* @param transform_from The transformation function from the target to the source,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @newin{2,44}
*/
* @param target_property The target property to bind.
* @param flags Flags to pass to Binding.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @see bind_property_value()
*
* @param transform_to The transformation function from the source to the target,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @tparam T_source Type of the source property. Must be a type that can be
* stored in a Glib::Value<T_source> object.
* @param transform_to The transformation function from the source to the target,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @tparam T_source Type of the source property. Must be a type that can be
* stored in a Glib::Value<T_source> object.
* @param transform_to The transformation function from the source to the target,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @tparam T_source Type of the source property. Must be a type that can be
* stored in a Glib::Value<T_source> object.
* @param transform_to The transformation function from the source to the target,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @tparam T_source Type of the source property. Must be a type that can be
* stored in a Glib::Value<T_source> object.
* @param transform_from The transformation function from the target to the source,
* or an empty slot to use the default.
* @return The Binding instance representing the binding between the two
- * Glib::ObjectBase instances, or <tt>0</tt> in case of error.
+ * Glib::ObjectBase instances, or <tt>nullptr</tt> in case of error.
*
* @tparam T_source Type of the source property. Must be a type that can be
* stored in a Glib::Value<T_source> object.
// Abuse g_convert() to create a GError object. This may seem a weird
// thing to do, but it gives us consistently translated error messages
// at no further cost.
- g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), 0, 0, &gerror);
+ g_convert("", 0, to_codeset.c_str(), from_codeset.c_str(), nullptr, nullptr, &gerror);
// If this should ever fail we're fucked.
g_assert(gerror != nullptr);
gsize inbytes_left = 0;
gsize outbytes_left = 0;
- g_iconv(gobject_, 0, &inbytes_left, &outbuf, &outbytes_left);
+ g_iconv(gobject_, nullptr, &inbytes_left, &outbuf, &outbytes_left);
}
std::string IConv::convert(const std::string& str)
GError* gerror = nullptr;
char *const buf = g_convert_with_iconv(
- str.data(), str.size(), gobject_, 0, &bytes_written, &gerror);
+ str.data(), str.size(), gobject_, nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
bool get_charset()
{
- return g_get_charset(0);
+ return g_get_charset(nullptr);
}
bool get_charset(std::string& charset)
char *const buf = g_convert(
str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(),
- 0, &bytes_written, &gerror);
+ nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
const std::string& from_codeset)
{
gsize bytes_written = 0;
- GError* gerror = 0;
+ GError* gerror = nullptr;
char *const buf = g_convert_with_fallback(
- str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), 0,
- 0, &bytes_written, &gerror);
+ str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(), nullptr,
+ nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
const Glib::ustring& fallback)
{
gsize bytes_written = 0;
- GError* gerror = 0;
+ GError* gerror = nullptr;
char *const buf = g_convert_with_fallback(
str.data(), str.size(), to_codeset.c_str(), from_codeset.c_str(),
- const_cast<char*>(fallback.c_str()), 0, &bytes_written, &gerror);
+ const_cast<char*>(fallback.c_str()), nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char *const buf = g_locale_to_utf8(
- opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror);
+ opsys_string.data(), opsys_string.size(), nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char *const buf = g_locale_from_utf8(
- utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror);
+ utf8_string.data(), utf8_string.bytes(), nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char *const buf = g_filename_to_utf8(
- opsys_string.data(), opsys_string.size(), 0, &bytes_written, &gerror);
+ opsys_string.data(), opsys_string.size(), nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
char *const buf = g_filename_from_utf8(
- utf8_string.data(), utf8_string.bytes(), 0, &bytes_written, &gerror);
+ utf8_string.data(), utf8_string.bytes(), nullptr, &bytes_written, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
std::string filename_from_uri(const Glib::ustring& uri)
{
GError* gerror = nullptr;
- char *const buf = g_filename_from_uri(uri.c_str(), 0, &gerror);
+ char *const buf = g_filename_from_uri(uri.c_str(), nullptr, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
Glib::ustring filename_to_uri(const std::string& filename)
{
GError* gerror = nullptr;
- char *const buf = g_filename_to_uri(filename.c_str(), 0, &gerror);
+ char *const buf = g_filename_to_uri(filename.c_str(), nullptr, &gerror);
if(gerror) ::Glib::Error::throw_exception(gerror);
void Date::set_time_current()
{
//As suggested in the C documentation:
- g_date_set_time_t(&gobject_, time(0));
+ g_date_set_time_t(&gobject_, time(nullptr));
}
void Date::set_time(const GTimeVal& timeval)
Date& Date::clamp_min(const Date& min_date)
{
- g_date_clamp(&gobject_, &min_date.gobject_, 0 /* see the C docs */);
+ g_date_clamp(&gobject_, &min_date.gobject_, nullptr /* see the C docs */);
return *this;
}
Date& Date::clamp_max(const Date& max_date)
{
- g_date_clamp(&gobject_, 0 /* see the C docs */, &max_date.gobject_);
+ g_date_clamp(&gobject_, nullptr /* see the C docs */, &max_date.gobject_);
return *this;
}
DirIterator Dir::end()
{
- return DirIterator(gobject_, 0);
+ return DirIterator(gobject_, nullptr);
}
DirIterator::DirIterator()
:
- gobject_ (0),
- current_ (0)
+ gobject_ (nullptr),
+ current_ (nullptr)
{}
DirIterator::DirIterator(GDir* gobject, const char* current)
GError* error = nullptr;
ScopedPtr<char> buf_name_used;
- const auto fileno = g_file_open_tmp(0, buf_name_used.addr(), &error);
+ const auto fileno = g_file_open_tmp(nullptr, buf_name_used.addr(), &error);
if(error)
Glib::Error::throw_exception(error);
<parameter_description> Warang Citi. Since: 2.42
</parameter_description>
</parameter>
+<parameter name="G_UNICODE_SCRIPT_AHOM">
+<parameter_description> Ahom. Since 2.48
+</parameter_description>
+</parameter>
+<parameter name="G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS">
+<parameter_description> Anatolian Hieroglyphs. Since 2.48
+</parameter_description>
+</parameter>
+<parameter name="G_UNICODE_SCRIPT_HATRAN">
+<parameter_description> Hatran. Since 2.48
+</parameter_description>
+</parameter>
+<parameter name="G_UNICODE_SCRIPT_MULTANI">
+<parameter_description> Multani. Since 2.48
+</parameter_description>
+</parameter>
+<parameter name="G_UNICODE_SCRIPT_OLD_HUNGARIAN">
+<parameter_description> Old Hungarian. Since 2.48
+</parameter_description>
+</parameter>
+<parameter name="G_UNICODE_SCRIPT_SIGNWRITING">
+<parameter_description> Signwriting. Since 2.48
+</parameter_description>
+</parameter>
</parameters>
</enum>
</parameter_description>
</parameter>
<parameter name="endptr">
-<parameter_description> if non-%NULL, it returns the character after
-the last character used in the conversion.
+<parameter_description> if non-%NULL, it returns the
+character after the last character used in the conversion.
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="endptr">
-<parameter_description> if non-%NULL, it returns the character after
-the last character used in the conversion.
+<parameter_description> if non-%NULL, it returns the
+character after the last character used in the conversion.
</parameter_description>
</parameter>
<parameter name="base">
</parameter_description>
</parameter>
<parameter name="endptr">
-<parameter_description> if non-%NULL, it returns the character after
-the last character used in the conversion.
+<parameter_description> if non-%NULL, it returns the
+character after the last character used in the conversion.
</parameter_description>
</parameter>
<parameter name="base">
<return></return>
</function>
+<function name="g_assert_cmpmem">
+<description>
+Debugging macro to compare memory regions. If the comparison fails,
+an error message is logged and the application is either terminated
+or the testcase marked as failed.
+
+The effect of `g_assert_cmpmem (m1, l1, m2, l2)` is
+the same as `g_assert_true (l1 == l2 && memcmp (m1, m2, l1) == 0)`.
+The advantage of this macro is that it can produce a message that
+includes the actual values of @l1 and @l2.
+
+|[<!-- language="C" -->
+g_assert_cmpmem (buf->data, buf->len, expected, sizeof (expected));
+]|
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="m1">
+<parameter_description> pointer to a buffer
+</parameter_description>
+</parameter>
+<parameter name="l1">
+<parameter_description> length of @m1
+</parameter_description>
+</parameter>
+<parameter name="m2">
+<parameter_description> pointer to another buffer
+</parameter_description>
+</parameter>
+<parameter name="l2">
+<parameter_description> length of @m2
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_assert_cmpstr">
<description>
Debugging macro to compare two strings. If the comparison fails,
<return></return>
</function>
+<function name="g_assertion_message_expr">
+<description>
+
+</description>
+<parameters>
+<parameter name="domain">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="file">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="line">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="func">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="expr">
+<parameter_description>
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_async_queue_length">
<description>
Returns the length of the queue.
<function name="g_async_queue_push_front">
<description>
-Pushes the @data into the @queue. @data must not be %NULL.
+Pushes the @item into the @queue. @item must not be %NULL.
In contrast to g_async_queue_push(), this function
pushes the new item ahead of the items already in the queue,
so that it will be the next one to be popped off the queue.
<parameter_description> a #GAsyncQueue
</parameter_description>
</parameter>
-<parameter name="data">
-<parameter_description> @data to push into the @queue
+<parameter name="item">
+<parameter_description> data to push into the @queue
</parameter_description>
</parameter>
</parameters>
<function name="g_async_queue_push_front_unlocked">
<description>
-Pushes the @data into the @queue. @data must not be %NULL.
+Pushes the @item into the @queue. @item must not be %NULL.
In contrast to g_async_queue_push_unlocked(), this function
pushes the new item ahead of the items already in the queue,
so that it will be the next one to be popped off the queue.
<parameter_description> a #GAsyncQueue
</parameter_description>
</parameter>
-<parameter name="data">
-<parameter_description> @data to push into the @queue
+<parameter name="item">
+<parameter_description> data to push into the @queue
</parameter_description>
</parameter>
</parameters>
<parameter_description> a #GAsyncQueue
</parameter_description>
</parameter>
-<parameter name="data">
-<parameter_description> the @data to remove from the @queue
+<parameter name="item">
+<parameter_description> the data to remove from the @queue
</parameter_description>
</parameter>
</parameters>
<parameter_description> a #GAsyncQueue
</parameter_description>
</parameter>
-<parameter name="data">
-<parameter_description> the @data to remove from the @queue
+<parameter name="item">
+<parameter_description> the data to remove from the @queue
</parameter_description>
</parameter>
</parameters>
{
g_auto(GQueue) queue = G_QUEUE_INIT;
g_auto(GVariantBuilder) builder;
+g_auto(GStrv) strv;
g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+strv = g_strsplit("a:b:c", ":", -1);
...
}
]|
-You must initialise the variable in some way -- either by use of an
+You must initialize the variable in some way -- either by use of an
initialiser or by ensuring that an _init function will be called on
it unconditionally before it goes out of scope.
gboolean
check_exists(GVariant *dict)
{
-g_autoptr(GVariant) dirname;
-g_autoptr(GVariant) basename = NULL;
-g_autoptr(gchar) path = NULL;
+g_autoptr(GVariant) dirname, basename = NULL;
+g_autofree gchar *path = NULL;
dirname = g_variant_lookup_value (dict, "dirname", G_VARIANT_TYPE_STRING);
initialiser or by ensuring that it is assigned to unconditionally
before it goes out of scope.
+See also g_auto(), g_autofree() and g_steal_pointer().
+
Since: 2.44
</description>
</parameter_description>
</parameter>
</parameters>
-<return> the index of the first bit set which is higher than @nth_bit
+<return> the index of the first bit set which is higher than @nth_bit, or -1
+if no higher bits are set
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> the index of the first bit set which is lower than @nth_bit
+<return> the index of the first bit set which is lower than @nth_bit, or -1
+if no lower bits are set
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> The newly created copy of the boxed structure.
+<return> The newly created copy of the boxed
+structure.
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the
-byte data, or %NULL
+<return>
+a pointer to the byte data, or %NULL
</return>
</function>
</description>
<parameters>
<parameter name="data">
-<parameter_description> the data to be used for the bytes
+<parameter_description>
+ the data to be used for the bytes
</parameter_description>
</parameter>
<parameter name="size">
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the same byte data, which should
-be freed with g_free()
+<return> (transfer full) (array length=size) (element-type guint8)
+(not nullable): a pointer to the same byte data, which should be
+freed with g_free()
</return>
</function>
</parameter_description>
</parameter>
<parameter name="instance">
-<parameter_description> the instance on which the closure is invoked.
+<parameter_description> the instance on which the closure is
+invoked.
</parameter_description>
</parameter>
<parameter name="args_list">
</description>
<parameters>
<parameter name="pp">
-<parameter_description> a pointer to a variable, struct member etc. holding a pointer
+<parameter_description> a pointer to a variable, struct member etc. holding a
+pointer
</parameter_description>
</parameter>
<parameter name="destroy">
</parameter_description>
</parameter>
<parameter name="pre_marshal_data">
-<parameter_description> data to pass to @pre_marshal_notify
+<parameter_description> data to pass
+to @pre_marshal_notify
</parameter_description>
</parameter>
<parameter name="pre_marshal_notify">
</parameter_description>
</parameter>
<parameter name="post_marshal_data">
-<parameter_description> data to pass to @post_marshal_notify
+<parameter_description> data to pass
+to @post_marshal_notify
</parameter_description>
</parameter>
<parameter name="post_marshal_notify">
</parameter_description>
</parameter>
<parameter name="marshal_data">
-<parameter_description> context-dependent data to pass to @meta_marshal
+<parameter_description> context-dependent data to pass
+to @meta_marshal
</parameter_description>
</parameter>
<parameter name="meta_marshal">
</description>
<parameters>
<parameter name="error">
-<parameter_description> a #GError or %NULL
+<parameter_description> a #GError
</parameter_description>
</parameter>
<parameter name="domain">
</parameter_description>
</parameter>
<parameter name="hostname">
-<parameter_description> Location to store hostname for the URI, or %NULL.
+<parameter_description> Location to store hostname for the
+URI.
If there is no hostname in the URI, %NULL will be
stored in this location.
</parameter_description>
</parameter_description>
</parameter>
<parameter name="bytes_read">
-<parameter_description> location to store the number of bytes in the
+<parameter_description> location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
</parameter_description>
</parameter>
<parameter name="bytes_written">
-<parameter_description> the number of bytes stored in the output buffer (not
-including the terminating nul).
+<parameter_description> the number of bytes stored in the output
+buffer (not including the terminating nul).
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
</parameters>
-<return> a #GList containing all the keys inside the hash
-table. The content of the list is owned by the hash table and
-should not be modified or freed. Use g_list_free() when done
-using the list.
+<return> a #GList containing all the keys
+inside the hash table. The content of the list is owned by the
+hash table and should not be modified or freed. Use g_list_free()
+when done using the list.
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> a #GList containing all the values inside the hash
-table. The content of the list is owned by the hash table and
-should not be modified or freed. Use g_list_free() when done
-using the list.
+<return> a #GList containing all the values
+inside the hash table. The content of the list is owned by the
+hash table and should not be modified or freed. Use g_list_free()
+when done using the list.
</return>
</function>
</parameter_description>
</parameter>
<parameter name="key">
-<parameter_description> a location to store the key, or %NULL
+<parameter_description> a location to store the key
</parameter_description>
</parameter>
<parameter name="value">
-<parameter_description> a location to store the value, or %NULL
+<parameter_description> a location to store the value
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="orig_key">
-<parameter_description> return location for the original key, or %NULL
+<parameter_description> return location for the original key
</parameter_description>
</parameter>
<parameter name="value">
-<parameter_description> return location for the value associated with the key, or %NULL
+<parameter_description> return location for the value associated
+with the key
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="bytes_read">
-<parameter_description> location to store the number of bytes in the
+<parameter_description> location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
</parameter_description>
</parameter>
<parameter name="bytes_written">
-<parameter_description> the number of bytes stored in the output buffer (not
-including the terminating nul).
+<parameter_description> the number of bytes stored in the output
+buffer (not including the terminating nul).
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
<parameter name="bytes_read">
-<parameter_description> location to store the number of bytes in the
+<parameter_description> location to store the number of bytes in the
input string that were successfully converted, or %NULL.
Even if the conversion was successful, this may be
less than @len if there were partial characters
</parameter_description>
</parameter>
<parameter name="bytes_written">
-<parameter_description> the number of bytes stored in the output buffer (not
-including the terminating nul).
+<parameter_description> the number of bytes stored in the output
+buffer (not including the terminating nul).
</parameter_description>
</parameter>
<parameter name="error">
</description>
<parameters>
<parameter name="log_domain">
-<parameter_description> the log domain, usually #G_LOG_DOMAIN
+<parameter_description> the log domain, usually #G_LOG_DOMAIN, or %NULL
+for the default
</parameter_description>
</parameter>
<parameter name="log_level">
</description>
<parameters>
<parameter name="log_domain">
-<parameter_description> the log domain of the message
+<parameter_description> the log domain of the message, or %NULL for the
+default "" application domain
</parameter_description>
</parameter>
<parameter name="log_level">
</description>
<parameters>
<parameter name="log_domain">
-<parameter_description> the log domain
+<parameter_description> the log domain, or %NULL for the default ""
+application domain
</parameter_description>
</parameter>
<parameter name="log_level">
</parameter_description>
</parameter>
<parameter name="weak_pointer_location">
-<parameter_description> The memory address of a pointer.
+<parameter_description> The memory address
+of a pointer.
</parameter_description>
</parameter>
</parameters>
</description>
<parameters>
<parameter name="g_iface">
-<parameter_description> any interface vtable for the interface, or the default
-vtable for the interface
+<parameter_description> any interface vtable for the
+interface, or the default vtable for the interface
</parameter_description>
</parameter>
<parameter name="property_name">
</description>
<parameters>
<parameter name="g_iface">
-<parameter_description> any interface vtable for the interface, or the default
+<parameter_description> any interface vtable for the
+interface, or the default
vtable for the interface.
</parameter_description>
</parameter>
</description>
<parameters>
<parameter name="g_iface">
-<parameter_description> any interface vtable for the interface, or the default
-vtable for the interface
+<parameter_description> any interface vtable for the
+interface, or the default vtable for the interface
</parameter_description>
</parameter>
<parameter name="n_properties_p">
</parameter_description>
</parameter>
</parameters>
-<return> a new instance of @object_type
+<return> a new instance of
+@object_type
</return>
</function>
</parameter_description>
</parameter>
<parameter name="weak_pointer_location">
-<parameter_description> The memory address of a pointer.
+<parameter_description> The memory address
+of a pointer.
</parameter_description>
</parameter>
</parameters>
</description>
<parameters>
<parameter name="location">
-<parameter_description> location of a static initializable variable containing 0
+<parameter_description> location of a static initializable variable
+containing 0
</parameter_description>
</parameter>
</parameters>
</description>
<parameters>
<parameter name="location">
-<parameter_description> location of a static initializable variable containing 0
+<parameter_description> location of a static initializable variable
+containing 0
</parameter_description>
</parameter>
<parameter name="result">
<function name="g_param_spec_get_default_value">
<description>
-Gets the default value of @param as a pointer to a #GValue.
+Gets the default value of @pspec as a pointer to a #GValue.
-The #GValue will remain value for the life of @param.
+The #GValue will remain value for the life of @pspec.
Since: 2.38
</description>
<parameters>
-<parameter name="param">
+<parameter name="pspec">
<parameter_description> a #GParamSpec
</parameter_description>
</parameter>
</return>
</function>
+<function name="g_param_spec_get_name_quark">
+<description>
+Gets the GQuark for the name.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="pspec">
+<parameter_description> a #GParamSpec
+</parameter_description>
+</parameter>
+</parameters>
+<return> the GQuark for @pspec->name.
+
+</return>
+</function>
+
<function name="g_param_spec_get_nick">
<description>
Get the nickname of a #GParamSpec.
</description>
<parameters>
<parameter name="err">
-<parameter_description> a return location for a #GError, or %NULL
+<parameter_description> a return location for a #GError
</parameter_description>
</parameter>
<parameter name="format">
If @dest is %NULL, free @src; otherwise, moves @src into *@dest.
The error variable @dest points to must be %NULL.
+@src must be non-%NULL.
+
Note that @src is no longer valid after this call. If you want
to keep using the same GError*, you need to set it to %NULL
after calling this function on it.
<return></return>
</function>
+<function name="g_return_if_fail_warning">
+<description>
+
+</description>
+<parameters>
+<parameter name="log_domain">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="pretty_function">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="expression">
+<parameter_description>
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_return_if_reached">
<description>
Logs a critical message and returns from the current function.
<function name="g_sequence_get_length">
<description>
-Returns the length of @seq
+Returns the length of @seq. Note that this method is O(h) where `h' is the
+height of the tree. It is thus more efficient to use g_sequence_is_empty()
+when comparing the length to zero.
Since: 2.14
</return>
</function>
+<function name="g_sequence_is_empty">
+<description>
+Returns %TRUE if the sequence contains zero items.
+
+This function is functionally identical to checking the result of
+g_sequence_get_length() being equal to zero. However this function is
+implemented in O(1) running time.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="seq">
+<parameter_description> a #GSequence
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the sequence is empty, otherwise %FALSE.
+
+</return>
+</function>
+
<function name="g_sequence_iter_compare">
<description>
Returns a negative number if @a comes before @b, 0 if they are equal,
</description>
<parameters>
<parameter name="err">
-<parameter_description> a return location for a #GError, or %NULL
+<parameter_description> a return location for a #GError
</parameter_description>
</parameter>
<parameter name="domain">
</description>
<parameters>
<parameter name="err">
-<parameter_description> a return location for a #GError, or %NULL
+<parameter_description> a return location for a #GError
</parameter_description>
</parameter>
<parameter name="domain">
</parameter_description>
</parameter>
<parameter name="argcp">
-<parameter_description> return location for number of args, or %NULL
+<parameter_description> return location for number of args
</parameter_description>
</parameter>
<parameter name="argvp">
<parameter_description> return
-location for array of args, or %NULL
+location for array of args
</parameter_description>
</parameter>
<parameter name="error">
-<parameter_description> return location for error, or %NULL
+<parameter_description> return location for error
</parameter_description>
</parameter>
</parameters>
</description>
<parameters>
<parameter name="instance">
-<parameter_description> the instance the signal is being emitted on.
+<parameter_description> the instance the signal is being
+emitted on.
</parameter_description>
</parameter>
<parameter name="Varargs">
</parameter_description>
</parameter>
<parameter name="gobject">
-<parameter_description> the object to pass as data to @c_handler.
+<parameter_description> the object to pass as data
+to @c_handler.
</parameter_description>
</parameter>
<parameter name="connect_flags">
</description>
<parameters>
<parameter name="instance">
-<parameter_description> the instance the signal is being emitted on.
+<parameter_description> the instance the signal is being
+emitted on.
</parameter_description>
</parameter>
<parameter name="signal_id">
consistent with how a signal emitted with @detail would be delivered
to those handlers.
+Since 2.46 this also checks for a non-default class closure being
+installed, as this is basically always what you want.
+
One example of when you might use this is when the arguments to the
signal are difficult to compute. A class implementor may opt to not
emit the signal if no one is attached anyway, thus saving the cost
</return>
</function>
+<function name="g_size_checked_add">
+<description>
+Performs a checked addition of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #gsize destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #gsize left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #gsize right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
+<function name="g_size_checked_mul">
+<description>
+Performs a checked multiplication of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #gsize destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #gsize left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #gsize right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
<function name="g_slice_alloc">
<description>
Allocates a block of memory from the slice allocator.
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the allocated memory block
+<return> a pointer to the allocated memory block, which will be %NULL if and
+only if @mem_size is 0
</return>
</function>
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the allocated block
+<return> a pointer to the allocated block, which will be %NULL if and only
+if @mem_size is 0
</return>
</function>
Allocates a block of memory from the slice allocator
and copies @block_size bytes into it from @mem_block.
+@mem_block must be non-%NULL if @block_size is non-zero.
+
Since: 2.14
</description>
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the allocated memory block
+<return> a pointer to the allocated memory block, which will be %NULL if and
+only if @mem_size is 0
</return>
</function>
be changed with the [`G_SLICE=always-malloc`][G_SLICE]
environment variable.
+This can never return %NULL.
+
Since: 2.14
</description>
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the allocated block, cast to a pointer to @type
+<return> a pointer to the allocated block, cast to a pointer
+to @type
</return>
</function>
[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable, also see
[`G_SLICE`][G_SLICE] for related debugging options.
+If @mem is %NULL, this macro does nothing.
+
Since: 2.10
</description>
can be changed with the [`G_DEBUG=gc-friendly`][G_DEBUG] environment
variable, also see [`G_SLICE`][G_SLICE] for related debugging options.
+If @mem_block is %NULL, this function does nothing.
+
Since: 2.10
</description>
[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable, also see
[`G_SLICE`][G_SLICE] for related debugging options.
+If @mem_chain is %NULL, this function does nothing.
+
Since: 2.10
</description>
[`G_DEBUG=gc-friendly`][G_DEBUG] environment variable, also see
[`G_SLICE`][G_SLICE] for related debugging options.
+If @mem_chain is %NULL, this function does nothing.
+
Since: 2.10
</description>
mechanism can be changed with the [`G_SLICE=always-malloc`][G_SLICE]
environment variable.
+This can never return %NULL as the minimum allocation size from
+`sizeof (@type)` is 1 byte.
+
Since: 2.10
</description>
</parameter_description>
</parameter>
</parameters>
-<return> a pointer to the allocated block, cast to a pointer to @type
+<return> a pointer to the allocated block, cast to a pointer
+to @type
</return>
</function>
be changed with the [`G_SLICE=always-malloc`][G_SLICE]
environment variable.
+This can never return %NULL as the minimum allocation size from
+`sizeof (@type)` is 1 byte.
+
Since: 2.10
</description>
</parameter_description>
</parameter>
</parameters>
-<return></return>
+<return> a pointer to the allocated block, cast to a pointer
+to @type
+
+</return>
</function>
<function name="g_slist_alloc">
<function name="g_strerror">
<description>
-Returns a string corresponding to the given error code, e.g.
-"no such process". You should use this function in preference to
-strerror(), because it returns a string in UTF-8 encoding, and since
-not all platforms support the strerror() function.
+Returns a string corresponding to the given error code, e.g. "no
+such process". Unlike strerror(), this always returns a string in
+UTF-8 encoding, and the pointer is guaranteed to remain valid for
+the lifetime of the process.
+
+Note that the string may be translated according to the current locale.
+
+The value of %errno will not be changed by this function.
</description>
</parameter>
</parameters>
<return> a UTF-8 string describing the error code. If the error code
-is unknown, it returns "unknown error (<code>)".
+is unknown, it returns a string like "unknown error (<code>)".
</return>
</function>
<parameters>
<parameter name="init">
<parameter_description> the initial text to copy into the string, or %NULL to
-start with an empty string.
+start with an empty string
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="endptr">
-<parameter_description> if non-%NULL, it returns the character after
-the last character used in the conversion.
+<parameter_description> if non-%NULL, it returns the
+character after the last character used in the conversion.
</parameter_description>
</parameter>
</parameters>
|[<!-- language="C" -->
static void
-test_create_large_object_subprocess (void)
+test_create_large_object (void)
{
if (g_test_subprocess ())
{
Note that execution of this function is of O(N) complexity
where N denotes the number of items on the stack.
+Deprecated: 2.48: #GTrashStack is deprecated without replacement
</description>
<parameters>
Returns the element at the top of a #GTrashStack
which may be %NULL.
+Deprecated: 2.48: #GTrashStack is deprecated without replacement
</description>
<parameters>
<description>
Pops a piece of memory off a #GTrashStack.
+Deprecated: 2.48: #GTrashStack is deprecated without replacement
</description>
<parameters>
<function name="g_trash_stack_push">
<description>
Pushes a piece of memory onto a #GTrashStack.
+Deprecated: 2.48: #GTrashStack is deprecated without replacement
</description>
<parameters>
to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts
the program on failure.
The returned pointer is cast to a pointer to the given type.
-The function returns %NULL when @n_structs is 0 of if an overflow occurs.
+The function returns %NULL when @n_structs is 0 or if an overflow occurs.
Since: 2.8
</description>
<parameters>
<parameter name="g_class">
-<parameter_description> class structure for an instantiatable type
+<parameter_description> class structure for an instantiatable
+type
</parameter_description>
</parameter>
<parameter name="private_size">
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of bytes read,
-or %NULL. If an error occurs then the index of the invalid input
-is stored here.
+<parameter_description> location to store number of
+bytes read, or %NULL. If an error occurs then the index of the invalid
+input is stored here.
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of #gunichar2
-written, or %NULL. The value stored here does not include the
-trailing 0.
+<parameter_description> location to store number
+of #gunichar2 written, or %NULL. The value stored here does not include
+the trailing 0.
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of characters
-read, or %NULL.
+<parameter_description> location to store number of
+characters read, or %NULL.
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of bytes
-written or %NULL. The value here stored does not include the
-trailing 0 byte.
+<parameter_description> location to store number
+of bytes written or %NULL. The value here stored does not include the
+trailing 0 byte.
</parameter_description>
</parameter>
<parameter name="error">
</return>
</function>
+<function name="g_uint64_checked_add">
+<description>
+Performs a checked addition of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #guint64 destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #guint64 left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #guint64 right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
+<function name="g_uint64_checked_mul">
+<description>
+Performs a checked multiplication of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #guint64 destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #guint64 left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #guint64 right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
+<function name="g_uint_checked_add">
+<description>
+Performs a checked addition of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #guint destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #guint left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #guint right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
+<function name="g_uint_checked_mul">
+<description>
+Performs a checked multiplication of @a and @b, storing the result in
+@dest.
+
+If the operation is successful, %TRUE is returned. If the operation
+overflows then the state of @dest is undefined and %FALSE is
+returned.
+
+Since: 2.48
+
+</description>
+<parameters>
+<parameter name="dest">
+<parameter_description> a pointer to the #guint destination
+</parameter_description>
+</parameter>
+<parameter name="a">
+<parameter_description> the #guint left operand
+</parameter_description>
+</parameter>
+<parameter name="b">
+<parameter_description> the #guint right operand
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if there was no overflow
+</return>
+</function>
+
<function name="g_unichar_break_type">
<description>
Determines the break type of @c. @c should be a Unicode character
</parameter_description>
</parameter>
<parameter name="outbuf">
-<parameter_description> output buffer, must have at least 6 bytes of space.
-If %NULL, the length will be computed and returned
-and nothing will be written to @outbuf.
+<parameter_description> output buffer, must have at
+least 6 bytes of space. If %NULL, the length will be computed and
+returned and nothing will be written to @outbuf.
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of words read,
-or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
-returned in case @str contains a trailing partial character. If
+<parameter_description> location to store number of
+words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will
+be returned in case @str contains a trailing partial character. If
an error occurs then the index of the invalid input is stored here.
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of characters
-written, or %NULL. The value stored here does not include the trailing
-0 character.
+<parameter_description> location to store number
+of characters written, or %NULL. The value stored here does not include
+the trailing 0 character.
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of words read,
-or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
-returned in case @str contains a trailing partial character. If
+<parameter_description> location to store number of
+words read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will
+be returned in case @str contains a trailing partial character. If
an error occurs then the index of the invalid input is stored here.
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of bytes written,
-or %NULL. The value stored here does not include the trailing 0 byte.
+<parameter_description> location to store number
+of bytes written, or %NULL. The value stored here does not include the
+trailing 0 byte.
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of bytes read, or %NULL.
+<parameter_description> location to store number of
+bytes read, or %NULL.
If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
returned in case @str contains a trailing partial
character. If an error occurs then the index of the
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of characters
-written or %NULL. The value here stored does not include the
-trailing 0 character.
+<parameter_description> location to store number
+of characters written or %NULL. The value here stored does not include
+the trailing 0 character.
</parameter_description>
</parameter>
<parameter name="error">
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store the number of
-characters in the result, or %NULL.
+<parameter_description> location to store the
+number of characters in the result, or %NULL.
</parameter_description>
</parameter>
</parameters>
</parameter_description>
</parameter>
<parameter name="items_read">
-<parameter_description> location to store number of bytes read,
-or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will be
-returned in case @str contains a trailing partial character. If
+<parameter_description> location to store number of
+bytes read, or %NULL. If %NULL, then %G_CONVERT_ERROR_PARTIAL_INPUT will
+be returned in case @str contains a trailing partial character. If
an error occurs then the index of the invalid input is stored here.
</parameter_description>
</parameter>
<parameter name="items_written">
-<parameter_description> location to store number of #gunichar2
-written, or %NULL. The value stored here does not include the
-trailing 0.
+<parameter_description> location to store number
+of #gunichar2 written, or %NULL. The value stored here does not include
+the trailing 0.
</parameter_description>
</parameter>
<parameter name="error">
<function name="g_value_unset">
<description>
-Clears the current value in @value and "unsets" the type,
-this releases all resources associated with this GValue.
-An unset value is the same as an uninitialized (zero-filled)
-#GValue structure.
+Clears the current value in @value (if any) and "unsets" the type,
+this releases all resources associated with this GValue. An unset
+value is the same as an uninitialized (zero-filled) #GValue
+structure.
</description>
<parameters>
<return></return>
</function>
+<function name="g_warn_message">
+<description>
+
+</description>
+<parameters>
+<parameter name="domain">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="file">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="line">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="func">
+<parameter_description>
+</parameter_description>
+</parameter>
+<parameter name="warnexpr">
+<parameter_description>
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_warning">
<description>
A convenience function/macro to log a warning message.
<function name="glib_mem_profiler_table">
<description>
+Used to be a #GMemVTable containing profiling variants of the memory
+allocation functions, but this variable shouldn't be modified anymore.
+
Deprecated: 2.46: Use other memory profiling tools instead
</description>
;; G_UNICODE_SCRIPT_PSALTER_PAHLAVI, /* Phlp */
;; G_UNICODE_SCRIPT_SIDDHAM, /* Sidd */
;; G_UNICODE_SCRIPT_TIRHUTA, /* Tirh */
-;; G_UNICODE_SCRIPT_WARANG_CITI /* Wara */
+;; G_UNICODE_SCRIPT_WARANG_CITI, /* Wara */
+;;
+;; /* Unicode 8.0 additions */
+;; G_UNICODE_SCRIPT_AHOM, /* Ahom */
+;; G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, /* Hluw */
+;; G_UNICODE_SCRIPT_HATRAN, /* Hatr */
+;; G_UNICODE_SCRIPT_MULTANI, /* Mult */
+;; G_UNICODE_SCRIPT_OLD_HUNGARIAN, /* Hung */
+;; G_UNICODE_SCRIPT_SIGNWRITING /* Sgnw */
;; } GUnicodeScript;
(define-enum-extended UnicodeScript
'("siddham" "G_UNICODE_SCRIPT_SIDDHAM" "123")
'("tirhuta" "G_UNICODE_SCRIPT_TIRHUTA" "124")
'("warang-citi" "G_UNICODE_SCRIPT_WARANG_CITI" "125")
+ '("ahom" "G_UNICODE_SCRIPT_AHOM" "126")
+ '("anatolian-hieroglyphs" "G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS" "127")
+ '("hatran" "G_UNICODE_SCRIPT_HATRAN" "128")
+ '("multani" "G_UNICODE_SCRIPT_MULTANI" "129")
+ '("old-hungarian" "G_UNICODE_SCRIPT_OLD_HUNGARIAN" "130")
+ '("signwriting" "G_UNICODE_SCRIPT_SIGNWRITING" "131")
)
)
'("siddham" "G_UNICODE_SCRIPT_SIDDHAM")
'("tirhuta" "G_UNICODE_SCRIPT_TIRHUTA")
'("warang-citi" "G_UNICODE_SCRIPT_WARANG_CITI")
+ '("ahom" "G_UNICODE_SCRIPT_AHOM")
+ '("anatolian-hieroglyphs" "G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS")
+ '("hatran" "G_UNICODE_SCRIPT_HATRAN")
+ '("multani" "G_UNICODE_SCRIPT_MULTANI")
+ '("old-hungarian" "G_UNICODE_SCRIPT_OLD_HUNGARIAN")
+ '("signwriting" "G_UNICODE_SCRIPT_SIGNWRITING")
)
)
)
)
+(define-function g_autoptr_cleanup_gstring_free
+ (c-name "g_autoptr_cleanup_gstring_free")
+ (return-type "none")
+ (parameters
+ '("GString*" "string")
+ )
+)
+
;; From glibconfig.h
;; From glib-init.h
+(define-function glib_init
+ (c-name "glib_init")
+ (return-type "none")
+)
+
+(define-function g_quark_init
+ (c-name "g_quark_init")
+ (return-type "none")
+)
+
(define-function g_thread_win32_thread_detach
(c-name "g_thread_win32_thread_detach")
(return-type "none")
)
)
+(define-method is_empty
+ (of-object "GSequence")
+ (c-name "g_sequence_is_empty")
+ (return-type "gboolean")
+)
+
(define-method get_begin_iter
(of-object "GSequence")
(c-name "g_sequence_get_begin_iter")
)
)
-(define-function g_bit_nth_lsf
- (c-name "g_bit_nth_lsf")
+(define-function g_bit_nth_lsf_impl
+ (c-name "g_bit_nth_lsf_impl")
(return-type "gint")
(parameters
'("gulong" "mask")
)
)
-(define-function g_bit_nth_msf
- (c-name "g_bit_nth_msf")
+(define-function g_bit_nth_msf_impl
+ (c-name "g_bit_nth_msf_impl")
(return-type "gint")
(parameters
'("gulong" "mask")
)
)
-(define-function g_bit_storage
- (c-name "g_bit_storage")
+(define-function g_bit_storage_impl
+ (c-name "g_bit_storage_impl")
(return-type "guint")
(parameters
'("gulong" "number")
(return-type "const-GValue*")
)
+(define-method get_name_quark
+ (of-object "GParamSpec")
+ (c-name "g_param_spec_get_name_quark")
+ (return-type "GQuark")
+)
+
(define-function g_param_type_register_static
(c-name "g_param_type_register_static")
(return-type "GType")
GError* gerror = nullptr;
gsize bytes = 0;
- const auto status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
+ const auto status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, nullptr, &gerror);
if(gerror)
{
GError* gerror = nullptr;
const auto status = g_io_channel_set_encoding(
- gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &gerror);
+ gobj(), (encoding.empty()) ? nullptr : encoding.c_str(), &gerror);
if(gerror)
{
void IOChannel::set_line_term(const std::string& term)
{
if(term.empty())
- g_io_channel_set_line_term(gobj(), 0, 0);
+ g_io_channel_set_line_term(gobj(), nullptr, 0);
else
g_io_channel_set_line_term(gobj(), term.data(), term.size());
}
try
{
const auto source = wrapper->create_watch_vfunc((IOCondition) condition);
- return (source) ? source->gobj_copy() : 0;
+ return (source) ? source->gobj_copy() : nullptr;
}
catch(...)
{
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
// static
Glib::ustring KeyFile::to_data()
{
GError* gerror = nullptr;
- char *const str = g_key_file_to_data(gobj(), 0, &gerror);
+ char *const str = g_key_file_to_data(gobj(), nullptr, &gerror);
if(gerror)
Glib::Error::throw_exception(gerror);
char** const array = g_key_file_get_keys(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
+ (group_name.empty()) ? nullptr : group_name.c_str(),
&length, &gerror);
if(gerror)
GError* gerror = nullptr;
char *const str = g_key_file_get_locale_string(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
- key.c_str(), 0, &gerror);
+ (group_name.empty()) ? nullptr : group_name.c_str(),
+ key.c_str(), nullptr, &gerror);
if(gerror)
Glib::Error::throw_exception(gerror);
GError* gerror = nullptr;
const bool value =
static_cast<bool>(g_key_file_get_boolean(const_cast<GKeyFile*>(gobj()),
- 0, key.c_str(), &gerror));
+ nullptr, key.c_str(), &gerror));
if(gerror)
Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
const int value = g_key_file_get_integer(const_cast<GKeyFile*>(gobj()),
- 0, key.c_str(), &gerror);
+ nullptr, key.c_str(), &gerror);
if(gerror)
Glib::Error::throw_exception(gerror);
{
GError* gerror = nullptr;
- const gint64 value = g_key_file_get_int64(const_cast<GKeyFile*>(gobj()), 0,
+ const gint64 value = g_key_file_get_int64(const_cast<GKeyFile*>(gobj()), nullptr,
key.c_str(), &gerror);
if(gerror)
GError* gerror = nullptr;
const guint64 value = g_key_file_get_uint64(const_cast<GKeyFile*>(gobj()),
- 0, key.c_str(), &gerror);
+ nullptr, key.c_str(), &gerror);
if(gerror)
Glib::Error::throw_exception(gerror);
double KeyFile::get_double(const Glib::ustring& key) const
{
GError* gerror = nullptr;
- double retvalue = g_key_file_get_double(const_cast<GKeyFile*>(gobj()), 0, key.c_str(), &(gerror));
+ double retvalue = g_key_file_get_double(const_cast<GKeyFile*>(gobj()), nullptr, key.c_str(), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
void KeyFile::set_double(const Glib::ustring& key, double value)
{
- g_key_file_set_double(gobj(), 0, key.c_str(), value);
+ g_key_file_set_double(gobj(), nullptr, key.c_str(), value);
}
# define GLIBMM_ERROR_ARG
char** const array = g_key_file_get_string_list(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
+ (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), &length, &gerror);
GLIBMM_THROW(gerror);
char** const array = g_key_file_get_locale_string_list(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
+ (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), locale.c_str(), &length, &gerror);
GLIBMM_THROW(gerror);
gboolean *const array = g_key_file_get_boolean_list(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
+ (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), &length, &gerror);
GLIBMM_THROW(gerror);
int *const array = g_key_file_get_integer_list(
const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
+ (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), &length, &gerror);
GLIBMM_THROW(gerror);
void KeyFile::set_string_list(const Glib::ustring& group_name, const Glib::ustring& key,
const Glib::ArrayHandle<Glib::ustring>& list)
{
- g_key_file_set_string_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
+ g_key_file_set_string_list(gobj(), (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), list.data(), list.size());
}
const Glib::ustring& key, const Glib::ustring& locale,
const Glib::ArrayHandle<Glib::ustring>& list)
{
- g_key_file_set_locale_string_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
+ g_key_file_set_locale_string_list(gobj(), (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), locale.c_str(), list.data(), list.size());
}
void KeyFile::set_integer_list(const Glib::ustring& group_name, const Glib::ustring& key,
const Glib::ArrayHandle<int>& list)
{
- g_key_file_set_integer_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
+ g_key_file_set_integer_list(gobj(), (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), const_cast<int*>(list.data()), list.size());
}
void KeyFile::set_boolean_list(const Glib::ustring& group_name, const Glib::ustring& key,
const Glib::ArrayHandle<bool>& list)
{
- g_key_file_set_boolean_list(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
+ g_key_file_set_boolean_list(gobj(), (group_name.empty()) ? nullptr : group_name.c_str(),
key.c_str(), const_cast<gboolean*>(list.data()), list.size());
}
Glib::ustring KeyFile::get_comment() const
{
GError* gerror = nullptr;
- char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()), 0, 0, &gerror);
+ char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()), nullptr, nullptr, &gerror);
GLIBMM_THROW(gerror);
{
GError* gerror = nullptr;
char *const str = g_key_file_get_comment(const_cast<GKeyFile*>(gobj()),
- (group_name.empty()) ? 0 : group_name.c_str(),
- 0, &gerror);
+ (group_name.empty()) ? nullptr : group_name.c_str(),
+ nullptr, &gerror);
GLIBMM_THROW(gerror);
return Glib::convert_return_gchar_ptr_to_ustring(str);
void KeyFile::set_comment(const Glib::ustring& comment GLIBMM_ERROR_ARG)
{
GError* gerror = nullptr;
- g_key_file_set_comment(gobj(), 0, 0, comment.c_str(), &gerror);
+ g_key_file_set_comment(gobj(), nullptr, nullptr, comment.c_str(), &gerror);
GLIBMM_THROW(gerror);
}
GLIBMM_ERROR_ARG)
{
GError* gerror = nullptr;
- g_key_file_set_comment(gobj(), (group_name.empty()) ? 0 : group_name.c_str(),
- 0, comment.c_str(), &gerror);
+ g_key_file_set_comment(gobj(), (group_name.empty()) ? nullptr : group_name.c_str(),
+ nullptr, comment.c_str(), &gerror);
GLIBMM_THROW(gerror);
}
int ParseContext::get_line_number() const
{
int line_number = 0;
- g_markup_parse_context_get_position(gobject_, &line_number, 0);
+ g_markup_parse_context_get_position(gobject_, &line_number, nullptr);
return line_number;
}
int ParseContext::get_char_number() const
{
int char_number = 0;
- g_markup_parse_context_get_position(gobject_, 0, &char_number);
+ g_markup_parse_context_get_position(gobject_, nullptr, &char_number);
return char_number;
}
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)));
+ elem2.c_str(), nullptr));
}
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)));
+ elem2.c_str(), elem3.c_str(), nullptr));
}
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)));
+ elem2.c_str(), elem3.c_str(), elem4.c_str(), nullptr));
}
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(), elem3.c_str(), elem4.c_str(), elem5.c_str(),
- static_cast<char*>(0)));
+ nullptr));
}
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(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- static_cast<char*>(0)));
+ nullptr));
}
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(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- elem7.c_str(), static_cast<char*>(0)));
+ elem7.c_str(), nullptr));
}
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(), elem3.c_str(), elem4.c_str(), elem5.c_str(), elem6.c_str(),
- elem7.c_str(), elem8.c_str(), static_cast<char*>(0)));
+ elem7.c_str(), elem8.c_str(), nullptr));
}
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(), 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)));
+ elem7.c_str(), elem8.c_str(), elem9.c_str(), nullptr));
}
std::string build_path(const std::string& separator, const Glib::ArrayHandle<std::string>& elements)
static NodeTree<T>* wrap(GNode* node)
{
if (!node)
- return 0;
+ return nullptr;
return reinterpret_cast<NodeTree<T>* >(node->data);
}
*
* @param flags Which types of children are to be visited, one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES.
* @param the_data The data for which to search.
- * @return the found child, or 0 if the data is not found
+ * @return the found child, or <tt>nullptr</tt> if the data is not found
*/
NodeTree<T>* find_child(const T& the_data, TraverseFlags flags = TRAVERSE_ALL)
{
*
* @param flags Which types of children are to be visited, one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES.
* @param the_data The data for which to search.
- * @return the found child, or 0 if the data is not found
+ * @return the found child, or <tt>nullptr</tt> if the data is not found
*/
const NodeTree<T>* find_child(const T& the_data, TraverseFlags flags = TRAVERSE_ALL) const
{
* @param order The order in which nodes are visited: IN_ORDER, TRAVERSE_PRE_ORDER, TRAVERSE_POST_ORDER, or TRAVERSE_LEVEL_ORDER
* @param flags Which types of children are to be visited: one of TRAVERSE_ALL, TRAVERSE_LEAVES and TRAVERSE_NON_LEAVES.
* @param the_data The data for which to search.
- * @return The found node, or 0 if the data is not found.
+ * @return The found node, or <tt>nullptr</tt> if the data is not found.
*/
NodeTree<T>* find(const T& the_data, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL)
{
* @param order The order in which nodes are visited.
* @param flags Which types of children are to be visited.
* @param the_data The data for which to search.
- * @return The found node, or 0 if the data is not found.
+ * @return The found node, or <tt>nullptr</tt> if the data is not found.
*/
const NodeTree<T>* find(const T& the_data, TraverseType order = TRAVERSE_IN_ORDER, TraverseFlags flags = TRAVERSE_ALL) const
{
{
int n = 0;
- for(const NodeTree<T>* i = first_child(); i != 0; i = i->next_sibling())
+ for(const NodeTree<T>* i = first_child(); i != nullptr; i = i->next_sibling())
{
if((i->data()) == the_data)
return n;
/** Gets the first child.
*
- * @return The first child, or 0 if the node has no children.
+ * @return The first child, or <tt>nullptr</tt> if the node has no children.
*/
NodeTree<T>* first_child()
{
/** Gets the first child.
*
- * @return The first child, or 0 if the node has no children.
+ * @return The first child, or <tt>nullptr</tt> if the node has no children.
*/
const NodeTree<T>* first_child() const
{
/** Gets the last child.
*
- * @return The last child, or 0 if the node has no children.
+ * @return The last child, or <tt>nullptr</tt> if the node has no children.
*/
NodeTree<T>* last_child()
{
/** Gets the last child.
*
- * @return The last child, or 0 if the node has no children.
+ * @return The last child, or <tt>nullptr</tt> if the node has no children.
*/
const NodeTree<T>* last_child() const
{
/** Gets the nth child.
*
- * @return The nth child, or 0 if n is too large.
+ * @return The nth child, or <tt>nullptr</tt> if n is too large.
*/
NodeTree<T>* nth_child(int n)
{
/** Gets the nth child.
*
- * @return The nth child, or 0 if n is too large.
+ * @return The nth child, or <tt>nullptr</tt> if n is too large.
*/
const NodeTree<T>* nth_child(int n) const
{
_IGNORE(g_node_nth_child)
/** Gets the first sibling
- * @return The first sibling, or 0 if the node has no siblings.
+ * @return The first sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
NodeTree<T>* first_sibling()
{
}
/** Gets the first sibling
- * @return The first sibling, or 0 if the node has no siblings.
+ * @return The first sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
const NodeTree<T>* first_sibling() const
{
/** Gets the previous sibling.
*
- * @return The previous sibling, or 0 if the node has no siblings.
+ * @return The previous sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
NodeTree<T>* prev_sibling()
{
/** Gets the previous sibling.
*
- * @return The previous sibling, or 0 if the node has no siblings.
+ * @return The previous sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
const NodeTree<T>* prev_sibling() const
{
/** Gets the next sibling
*
- * @return The next sibling, or 0 if the node has no siblings.
+ * @return The next sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
NodeTree<T>* next_sibling()
{
/** Gets the next sibling
*
- * @return The next sibling, or 0 if the node has no siblings.
+ * @return The next sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
const NodeTree<T>* next_sibling() const
{
/** Gets the last sibling.
*
- * @return The last sibling, or 0 if the node has no siblings.
+ * @return The last sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
NodeTree<T>* last_sibling()
{
/** Gets the last sibling.
*
- * @return The last sibling, or 0 if the node has no siblings.
+ * @return The last sibling, or <tt>nullptr</tt> if the node has no siblings.
*/
const NodeTree<T>* last_sibling() const
{
/// Method for comparing a single child (Internal use).
static void on_compare_child(GNode* node, const T& needle, GNode** result)
{
- if((0 != result) && (wrap(node)->data() == needle))
+ if((nullptr != result) && (wrap(node)->data() == needle))
{
*result = node;
}
Glib::ustring OptionContext::get_help(bool main_help) const
{
- return Glib::convert_return_gchar_ptr_to_ustring(g_option_context_get_help(const_cast<GOptionContext*>(gobj()), static_cast<int>(main_help), 0));
+ return Glib::convert_return_gchar_ptr_to_ustring(g_option_context_get_help(
+ const_cast<GOptionContext*>(gobj()), static_cast<int>(main_help), nullptr));
}
} // namespace Glib
gobject_->long_name = nullptr;
}
- //Note that we do not use NULL for an empty string,
+ //Note that we do not use nullptr for an empty string,
//because G_OPTION_REMAINING is actually a "", so it actually has a distinct meaning:
//TODO: Wrap G_OPTION_REMAINING in C++ somehow, maybe as an explicit set_long_name(void) or set_is_remaining()? murrayc.
- gobj()->long_name = (value).c_str() ? g_strdup((value).c_str()) : 0;
+ gobj()->long_name = (value).c_str() ? g_strdup((value).c_str()) : nullptr;
}
void OptionEntry::set_description(const Glib::ustring& value)
gobject_->description = nullptr;
}
- gobj()->description = (value).empty() ? 0 : g_strdup((value).c_str());
+ gobj()->description = (value).empty() ? nullptr : g_strdup((value).c_str());
}
void OptionEntry::set_arg_description(const Glib::ustring& value)
gobject_->arg_description = nullptr;
}
- gobj()->arg_description = (value).empty() ? 0 : g_strdup((value).c_str());
+ gobj()->arg_description = (value).empty() ? nullptr : g_strdup((value).c_str());
}
OptionEntry& operator=(const OptionEntry& src);
- //#m4 _CONVERSION(`Glib::ustring',`const gchar*',`($3).empty() ? NULL : g_strdup(($3).c_str())')
+ //#m4 _CONVERSION(`Glib::ustring',`const gchar*',`($3).empty() ? nullptr : g_strdup(($3).c_str())')
_MEMBER_GET(long_name, long_name, Glib::ustring, const char*)
{
public:
explicit OptionArgCallback(const OptionGroup::SlotOptionArgString& slot)
- : slot_string_(new OptionGroup::SlotOptionArgString(slot)), slot_filename_(0)
+ : slot_string_(new OptionGroup::SlotOptionArgString(slot)), slot_filename_(nullptr)
{ }
explicit OptionArgCallback(const OptionGroup::SlotOptionArgFilename& slot)
- : slot_string_(0), slot_filename_(new OptionGroup::SlotOptionArgFilename(slot))
+ : slot_string_(nullptr), slot_filename_(new OptionGroup::SlotOptionArgFilename(slot))
{ }
bool is_filename_option() const
Glib::exception_handlers_invoke();
}
- return 0;
+ return nullptr;
}
static void OptionGroup_Translate_glibmm_callback_destroy(void* data)
OptionGroup::OptionGroup(const Glib::ustring& name, const Glib::ustring& description, const Glib::ustring& help_description)
: gobject_( g_option_group_new(name.c_str(), description.c_str(), help_description.c_str(),
- this /* user_data */, 0 /* destroy_func */) ),
+ this /* user_data */, nullptr /* destroy_func */) ),
has_ownership_(true)
{
//g_callback_pre_parse(), post_parse_callback(), g_callback_error(), and
OptionGroup::CppOptionEntry::CppOptionEntry()
-: carg_type_(G_OPTION_ARG_NONE), carg_(0), cpparg_(0), entry_(0)
+: carg_type_(G_OPTION_ARG_NONE), carg_(nullptr), cpparg_(nullptr), entry_(nullptr)
{}
void OptionGroup::CppOptionEntry::allocate_c_arg()
{
char*** typed_arg = new char**;
//The C code will allocate a char** and put it here, for us to g_strfreev() later.
- *typed_arg = 0;
+ *typed_arg = nullptr;
carg_ = typed_arg;
break;
bool Regex::match(const Glib::ustring& string, RegexMatchFlags match_options)
{
- return g_regex_match(gobj(), string.c_str(), (GRegexMatchFlags)(match_options), 0);
+ return g_regex_match(gobj(), string.c_str(), (GRegexMatchFlags)(match_options), nullptr);
}
bool Regex::match(
bool Regex::match(const Glib::ustring& string, int start_position, RegexMatchFlags match_options)
{
GError* gerror = nullptr;
- bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror));
+ bool retvalue = g_regex_match_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool Regex::match(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options)
{
GError* gerror = nullptr;
- bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror));
+ bool retvalue = g_regex_match_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool Regex::match_all(const Glib::ustring& string, RegexMatchFlags match_options)
{
- return g_regex_match_all(gobj(), string.c_str(), ((GRegexMatchFlags)(match_options)), 0);
+ return g_regex_match_all(gobj(), string.c_str(), ((GRegexMatchFlags)(match_options)), nullptr);
}
bool Regex::match_all(
bool Regex::match_all(const Glib::ustring& string, int start_position, RegexMatchFlags match_options)
{
GError* gerror = nullptr;
- bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror));
+ bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
bool Regex::match_all(const Glib::ustring& string, gssize string_len, int start_position, RegexMatchFlags match_options)
{
GError* gerror = nullptr;
- bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), 0, &(gerror));
+ bool retvalue = g_regex_match_all_full(gobj(), string.c_str(), string_len, start_position, ((GRegexMatchFlags)(match_options)), nullptr, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
MatchInfo::MatchInfo()
-: gobject_(0),
+: gobject_(nullptr),
take_ownership(false)
{
}
{
const auto pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
- // Return 0 if the connection is blocked.
- return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0;
+ // Return nullptr if the connection is blocked.
+ return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : nullptr;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
GError* gerror = nullptr;
g_spawn_async_with_pipes(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
const_cast<char**>(argv.data()),
const_cast<char**>(envp.data()),
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
child_pid,
standard_input, standard_output, standard_error,
&gerror);
GError* gerror = nullptr;
g_spawn_async_with_pipes(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
+ const_cast<char**>(argv.data()), nullptr,
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
child_pid,
standard_input, standard_output, standard_error,
&gerror);
GError* gerror = nullptr;
g_spawn_async(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
const_cast<char**>(argv.data()),
const_cast<char**>(envp.data()),
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
child_pid,
&gerror);
GError* gerror = nullptr;
g_spawn_async(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
+ const_cast<char**>(argv.data()), nullptr,
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
child_pid,
&gerror);
GError* gerror = nullptr;
g_spawn_sync(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
const_cast<char**>(argv.data()),
const_cast<char**>(envp.data()),
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
- (standard_output) ? buf_standard_output.addr() : 0,
- (standard_error) ? buf_standard_error.addr() : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
+ (standard_output) ? buf_standard_output.addr() : nullptr,
+ (standard_error) ? buf_standard_error.addr() : nullptr,
exit_status,
&gerror);
GError* gerror = nullptr;
g_spawn_sync(
- (working_directory.empty()) ? 0 : working_directory.c_str(),
- const_cast<char**>(argv.data()), 0,
+ (working_directory.empty()) ? nullptr : working_directory.c_str(),
+ const_cast<char**>(argv.data()), nullptr,
static_cast<GSpawnFlags>(unsigned(flags)),
- (setup_slot) ? &child_setup_callback : 0,
- (setup_slot) ? &child_setup_ : 0,
- (standard_output) ? buf_standard_output.addr() : 0,
- (standard_error) ? buf_standard_error.addr() : 0,
+ (setup_slot) ? &child_setup_callback : nullptr,
+ (setup_slot) ? &child_setup_ : nullptr,
+ (standard_output) ? buf_standard_output.addr() : nullptr,
+ (standard_error) ? buf_standard_error.addr() : nullptr,
exit_status,
&gerror);
g_spawn_command_line_sync(
command_line.c_str(),
- (standard_output) ? buf_standard_output.addr() : 0,
- (standard_error) ? buf_standard_error.addr() : 0,
+ (standard_output) ? buf_standard_output.addr() : nullptr,
+ (standard_error) ? buf_standard_error.addr() : nullptr,
exit_status,
&gerror);
* will be looked for in the user's PATH.
* SPAWN_STDOUT_TO_DEV_NULL means that the child's standard output will
* be discarded, instead of going to the same location as the parent's
- * standard output. If you use this flag, @a standard_output must be NULL.
+ * standard output. If you use this flag, @a standard_output must be nullptr.
* SPAWN_STDERR_TO_DEV_NULL means that the child's standard error
* will be discarded, instead of going to the same location as the parent's
- * standard error. If you use this flag, @a standard_error must be NULL.
+ * standard error. If you use this flag, @a standard_error must be nullptr.
* SPAWN_CHILD_INHERITS_STDIN means that the child will inherit the parent's
* standard input (by default, the child's standard input is attached to
- * /dev/null). If you use this flag, @a standard_input must be NULL.
+ * /dev/null). If you use this flag, @a standard_input must be nullptr.
* G_SPAWN_FILE_AND_ARGV_ZERO means that the first element of @a argv is
* the file to execute, while the remaining elements are the
* actual argument vector to pass to the file. Normally
* process. You should carefully consider what you do in @a child_setup
* if you intend your software to be portable to Windows.
*
- * If non-NULL, @a child_pid will on Unix be filled with the child's
+ * If non-nullptr, @a child_pid will on Unix be filled with the child's
* process ID. You can use the process ID to send signals to the
* child, or to use child_watch_add() (or waitpid()) if you specified the
* SPAWN_DO_NOT_REAP_CHILD flag. On Windows, @a child_pid will be
* exit code with GetExitCodeProcess(). You should close the handle
* with CloseHandle() or spawn_close_pid() when you no longer need it.
*
- * If non-NULL, the @a standard_input, @a standard_output, @a standard_error
+ * If non-nullptr, the @a standard_input, @a standard_output, @a standard_error
* locations will be filled with file descriptors for writing to the child's
* standard input or reading from its standard output or standard error.
* The caller of pawn_async_with_pipes() must close these file descriptors
- * when they are no longer in use. If these parameters are NULL, the corresponding
+ * when they are no longer in use. If these parameters are nullptr, the corresponding
* pipe won't be created.
*
- * If @a standard_input is NULL, the child's standard input is attached to
+ * If @a standard_input is nullptr, the child's standard input is attached to
* /dev/null unless SPAWN_CHILD_INHERITS_STDIN is set.
*
- * If @a standard_error is NULL, the child's standard error goes to the same
+ * If @a standard_error is nullptr, the child's standard error goes to the same
* location as the parent's standard error unless SPAWN_STDERR_TO_DEV_NULL
* is set.
*
- * If @a standard_output is NULL, the child's standard output goes to the same
+ * If @a standard_output is nullptr, the child's standard output goes to the same
* location as the parent's standard output unless SPAWN_STDOUT_TO_DEV_NULL
* is set.
*
- * If @a child_pid is not NULL and an error does not occur then the returned
+ * If @a child_pid is not nullptr and an error does not occur then the returned
* pid must be closed using spawn_close_pid().
*
* @note
* @param envp Child's environment.
* @param flags Flags from SpawnFlags
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param child_pid Return location for child process ID, or NULL.
- * @param standard_input Return location for file descriptor to write to child's stdin, or NULL.
- * @param standard_output Return location for file descriptor to read child's stdout, or NULL.
- * @param standard_error Return location for file descriptor to read child's stderr, or NULL.
+ * @param child_pid Return location for child process ID, or nullptr.
+ * @param standard_input Return location for file descriptor to write to child's stdin, or nullptr.
+ * @param standard_output Return location for file descriptor to read child's stdout, or nullptr.
+ * @param standard_error Return location for file descriptor to read child's stderr, or nullptr.
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
* @param argv Child's argument vector.
* @param flags Flags from SpawnFlags
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param child_pid Return location for child process ID, or NULL.
- * @param standard_input Return location for file descriptor to write to child's stdin, or NULL.
- * @param standard_output Return location for file descriptor to read child's stdout, or NULL.
- * @param standard_error Return location for file descriptor to read child's stderr, or NULL.
+ * @param child_pid Return location for child process ID, or nullptr.
+ * @param standard_input Return location for file descriptor to write to child's stdin, or nullptr.
+ * @param standard_output Return location for file descriptor to read child's stdout, or nullptr.
+ * @param standard_error Return location for file descriptor to read child's stderr, or nullptr.
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
* @param envp Child's environment.
* @param flags Flags from SpawnFlags.
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param child_pid Return location for child process ID, or NULL
+ * @param child_pid Return location for child process ID, or nullptr
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
* @param argv Child's argument vector.
* @param flags Flags from SpawnFlags.
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param child_pid Return location for child process ID, or NULL
+ * @param child_pid Return location for child process ID, or nullptr
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
/** Executes a child synchronously (waits for the child to exit before returning).
* All output from the child is stored in @a standard_output and @a standard_error,
- * if those parameters are non-NULL. Note that you must set the
+ * if those parameters are non-nullptr. Note that you must set the
* SPAWN_STDOUT_TO_DEV_NULL and SPAWN_STDERR_TO_DEV_NULL flags when
- * passing NULL for @a standard_output and @a standard_error.
- * If @a exit_status is non-NULL, the exit status of the child is stored
+ * passing nullptr for @a standard_output and @a standard_error.
+ * If @a exit_status is non-nullptr, the exit status of the child is stored
* there as it would be returned by waitpid(); standard UNIX macros such
* as WIFEXITED() and WEXITSTATUS() must be used to evaluate the exit status.
- * Note that this function calls waitpid() even if @a exit_status is NULL, and
+ * Note that this function calls waitpid() even if @a exit_status is nullptr, and
* does not accept the SPAWN_DO_NOT_REAP_CHILD flag.
* If an error occurs, no data is returned in @a standard_output,
* @a standard_error, or @a exit_status.
* @param envp Child's environment.
* @param flags Flags from SpawnFlags
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param standard_output Return location for file descriptor to read child's stdout, or NULL.
- * @param standard_error Return location for file descriptor to read child's stderr, or NULL.
- * @param exit_status Return location for child exit status, as returned by waitpid(), or NULL
+ * @param standard_output Return location for file descriptor to read child's stdout, or nullptr.
+ * @param standard_error Return location for file descriptor to read child's stderr, or nullptr.
+ * @param exit_status Return location for child exit status, as returned by waitpid(), or nullptr
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
* @param argv Child's argument vector.
* @param flags Flags from SpawnFlags
* @param child_setup Slot to run in the child just before exec(), or an empty slot.
- * @param standard_output Return location for file descriptor to read child's stdout, or NULL.
- * @param standard_error Return location for file descriptor to read child's stderr, or NULL.
- * @param exit_status Return location for child exit status, as returned by waitpid(), or NULL
+ * @param standard_output Return location for file descriptor to read child's stdout, or nullptr.
+ * @param standard_error Return location for file descriptor to read child's stderr, or nullptr.
+ * @param exit_status Return location for child exit status, as returned by waitpid(), or nullptr
*
* @throws SpawnError Errors are reported even if they occur in the child (for example if the
* executable in argv[0] is not found). Typically
* implications, so consider using spawn_sync() directly if
* appropriate.
*
- * If @a exit_status is non-NULL, the exit status of the child is stored there as
+ * If @a exit_status is non-nullptr, the exit status of the child is stored there as
* it would be returned by waitpid(); standard UNIX macros such as WIFEXITED()
* and WEXITSTATUS() must be used to evaluate the exit status.
*
}
delete slot;
- return 0;
+ return nullptr;
}
} //extern "C"
GError* error = nullptr;
- const auto thread = g_thread_try_new(NULL,
+ const auto thread = g_thread_try_new(nullptr,
&call_thread_entry_slot, slot_copy, &error);
if(error)
}
delete slot;
- return 0;
+ return nullptr;
}
} //extern "C"
const auto slot_copy = new sigc::slot<void>(slot);
GError* error = nullptr;
- auto thread = g_thread_try_new(name.empty() ? 0 : name.c_str(),
+ auto thread = g_thread_try_new(name.empty() ? nullptr : name.c_str(),
&call_thread_entry_slot, slot_copy, &error);
if (error)
_DEFS(glibmm,glib)
_CONFIGINCLUDE(glibmmconfig.h)
+_IS_DEPRECATED // This whole file is deprecated.
+
#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
// Don't let glibmm.h include thread.h. Pretend that it's already included.
// glib.h can then be included with G_DISABLE_DEPRECATED defined, and
namespace Glib
{
+/**
+ * @deprecated The entire Glib::Threads API is deprecated in favor of the
+ * standard C++ concurrency API in C++11 and C++14.
+ */
namespace Threads
{
//The GMMPROC_EXTRA_NAMESPACE() macro is a hint to generate_wrap_init.pl to put it in the Threads sub-namespace
* @{
*/
+/// @deprecated Please use std::lock_guard or std::unique_lock instead.
enum NotLock { NOT_LOCK };
+
+/// @deprecated Please use std::lock_guard or std::unique_lock instead.
enum TryLock { TRY_LOCK };
class Mutex;
class RWLock;
/** %Exception class for thread-related errors.
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead.
*/
_WRAP_GERROR(ThreadError, GThreadError, G_THREAD_ERROR, NO_GTYPE)
* @note The thread entry slot doesn't have the void* return value that a
* GThreadFunc has. If you want to return any data from your thread,
* you can pass an additional output argument to the thread's entry slot.
+ *
+ * @deprecated Please use std::thread instead.
*/
class Thread
{
* Write this if you want to exit from a thread created by Threads::Thread::create().
* Of course you must make sure not to catch Threads::Thread::Exit by accident, i.e.
* when using <tt>catch(...)</tt> somewhere in your code.
+ *
+ * @deprecated Please use std::thread instead.
*/
class Thread::Exit
{};
* @return The C++ wrapper.
*
* @relates Glib::Threads::Thread
+ *
+ * @deprecated Please use std::thread instead.
*/
Thread* wrap(GThread* gobject);
* @note Glib::Threads::Mutex is not recursive, i.e. a thread will deadlock, if it
* already has locked the mutex while calling lock(). Use Glib::Threads::RecMutex
* instead, if you need recursive mutexes.
+ *
+ * @deprecated Please use std::mutex instead.
*/
class Mutex
{
* only exception-safe but also much less error-prone. You could even
* <tt>return</tt> while still holding the lock and it will be released
* properly.
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead.
*/
class Mutex::Lock
{
* that it is possible to lock a RecMutex multiple times in the same
* thread without deadlock. When doing so, care has to be taken to
* unlock the recursive mutex as often as it has been locked.
+ *
+ * @deprecated Please use std::recursive_mutex instead.
*/
class RecMutex
{
};
/** Utility class for exception-safe locking of recursive mutexes.
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead.
*/
class RecMutex::Lock
{
* lock via writer_lock()), multiple threads can gain
* simultaneous read-only access (by holding the 'reader' lock via
* reader_lock()).
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
*/
class RWLock
{
};
/** Utility class for exception-safe locking of read/write locks.
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
*/
class RWLock::ReaderLock
{
};
/** Utility class for exception-safe locking of read/write locks.
+ *
+ * @deprecated Please use std::lock_guard or std::unique_lock instead, with std::shared_timed_mutex.
*/
class RWLock::WriterLock
{
* A @a Cond is an object that threads can block on, if they find a certain
* condition to be false. If other threads change the state of this condition
* they can signal the @a Cond, such that the waiting thread is woken up.
+ *
+ * @deprecated Please use std::condition_variable instead.
+ *
* @par Usage example:
* @code
* Glib::Threads::Cond data_cond;
* const gint64 end_time = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
* while (!current_data)
* if (!data_cond.wait_until(data_mutex, end_time)
- * return 0; // timeout
+ * return nullptr; // timeout
*
* void* const data = current_data;
* current_data = nullptr;
* It is recommended that all instances of this class are statically allocated.
* The first time an instance is used (get(), set() or replace() is called)
* glib allocates a scarce OS resource that cannot be deallocated.
+ *
+ * @deprecated Please use the thread_local keyword instead.
*/
template <class T>
class Private
/** Constructor.
*
- * @param destructor_func Function pointer, or 0. If @a destructor_func is not 0
- * and the stored data pointer is not 0, this function is called when replace()
+ * @param destructor_func Function pointer, or <tt>nullptr</tt>. If @a destructor_func is not <tt>nullptr</tt>
+ * and the stored data pointer is not <tt>nullptr</tt>, this function is called when replace()
* is called and when the thread exits.
*/
explicit inline Private(DestructorFunc destructor_func = &Private<T>::delete_ptr);
/** Gets the pointer stored in the calling thread.
*
- * @return If no value has yet been set in this thread, 0 is returned.
+ * @return If no value has yet been set in this thread, <tt>nullptr</tt> is returned.
*/
inline T* get();
inline void set(T* data);
/** Sets the pointer in the calling thread and calls <tt>destructor_func()</tt>.
- * If a function pointer (and not 0) was specified in the constructor, and
- * the stored data pointer before the call to replace() is not 0, then
+ * If a function pointer (and not <tt>nullptr</tt>) was specified in the constructor, and
+ * the stored data pointer before the call to replace() is not <tt>nullptr</tt>, then
* <tt>destructor_func()</tt> is called with this old pointer value.
*
* @newin{2,32}
GParamSpec* Value<$1>::create_param_spec(const Glib::ustring& name) const
{
return g_param_spec_[]ifelse($2,schar,char,$2)(
- name.c_str(), 0, 0,ifelse($2,pointer,,[
+ name.c_str(), nullptr, nullptr,ifelse($2,pointer,,[
ifelse($3,,,[$3, $4, ])[]g_value_get_$2(&gobject_),])
GParamFlags(G_PARAM_READABLE | G_PARAM_WRITABLE));
}
VariantBase::operator const void*() const
{
- return gobj() ? GINT_TO_POINTER(1) : 0;
+ return gobj() ? GINT_TO_POINTER(1) : nullptr;
}
void VariantBase::init(const GVariant* cobject, bool take_a_reference)
Glib::ustring Variant<Glib::ustring>::get() const
{
- return convert_const_gchar_ptr_to_ustring(g_variant_get_string(gobject_, 0));
+ return convert_const_gchar_ptr_to_ustring(g_variant_get_string(gobject_, nullptr));
}
// Variant<Glib::ustring> makes sense for multiple types.
if(vtype.equal(VARIANT_TYPE_BYTESTRING))
pch = g_variant_get_bytestring(gobject_);
else //g_variant_get_string() can handle strings, object paths, and signatures.
- pch = g_variant_get_string(gobject_, 0);
+ pch = g_variant_get_string(gobject_, nullptr);
return convert_const_gchar_ptr_to_stdstring(pch);
}
}
// Terminate the string array.
- str_array[data.size()] = NULL;
+ str_array[data.size()] = nullptr;
// Create the variant using g_variant_new_bytestring_array() (passing the
// newly constructed array.
}
// Terminate the string array.
- str_array[data.size()] = NULL;
+ str_array[data.size()] = nullptr;
// Create the variant using g_variant_new_objv() (passing the
// newly constructed array.
const VariantType VARIANT_TYPE_TUPLE(G_VARIANT_TYPE_TUPLE);
-const VariantType VARIANT_TYPE_DICT_ENTRY(G_VARIANT_TYPE_DICT_ENTRY);
+const VariantType VARIANT_TYPE_DICTENTRY(G_VARIANT_TYPE_DICT_ENTRY);
const VariantType VARIANT_TYPE_DICTIONARY(G_VARIANT_TYPE_DICTIONARY);
// Add data that shall not be deleted by stream.
static const char data1[] = "Data not owned by stream.\n";
- stream->add_data(data1, sizeof data1 - 1, 0);
+ stream->add_data(data1, sizeof data1 - 1, nullptr);
// Add data that shall be deleted by destroy_func1().
char* data2 = new char[7];
if (!setup)
{
- std::srand (std::time (0));
+ std::srand (std::time (nullptr));
setup = true;
}
}
if(!setup)
{
setup = true;
- std::srand(std::time(0));
+ std::srand(std::time(nullptr));
}
}
{
const GTypeInfo info =
{
- sizeof (TestIface), /* class_size */
- test_Iface_init, /* base_init */
- 0, 0, 0, 0, 0, 0, 0, 0
+ sizeof (TestIface), // class_size
+ test_Iface_init, // base_init
+ nullptr, // base_finalize
+ nullptr, // class_init
+ nullptr, // class_finalize
+ nullptr, // class_data
+ 0, // instance_size
+ 0, // n_preallocs
+ nullptr, // instance_init
+ nullptr // value_table
};
type = g_type_register_static (G_TYPE_INTERFACE, "TestIface",
//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::ObjectBase(nullptr),
Glib::Object(Glib::ConstructParams(derived_object_class_.init())),
i_(i)
{
*/
#include <glibmm.h>
+#include <thread>
#include <iostream>
#include <cstdlib> // EXIT_SUCCESS, EXIT_FAILURE
mainloop->quit();
}
-bool mark_and_quit(const Glib::Threads::Thread* expected_thread,
+bool mark_and_quit(const std::thread::id& expected_thread_id,
int thread_nr, const Glib::RefPtr<Glib::MainLoop>& mainloop)
{
invoked_in_thread[thread_nr] =
- (Glib::Threads::Thread::self() == expected_thread) ?
+ (std::this_thread::get_id() == expected_thread_id) ?
INVOKED_IN_RIGHT_THREAD : INVOKED_IN_WRONG_THREAD;
mainloop->get_context()->signal_idle().connect_once(
sigc::bind(sigc::ptr_fun(quit_loop), mainloop));
return false;
}
-void thread_function(const Glib::Threads::Thread* first_thread,
+void thread_function(const std::thread::id& first_thread_id,
const Glib::RefPtr<Glib::MainLoop>& first_mainloop)
{
auto second_context = Glib::MainContext::create();
// Show how Glib::MainContext::invoke() can be used for calling a function,
// possibly executed in another thread.
Glib::MainContext::get_default()->invoke(sigc::bind(sigc::ptr_fun(mark_and_quit),
- first_thread, 0, first_mainloop));
+ first_thread_id, 0, first_mainloop));
// If this thread owns second_context, invoke() will call mark_and_quit() directly.
bool is_owner = second_context->acquire();
second_context->invoke(sigc::bind(sigc::ptr_fun(mark_and_quit),
- Glib::Threads::Thread::self(), 1, second_mainloop));
+ std::this_thread::get_id(), 1, second_mainloop));
if (is_owner)
second_context->release();
bool is_owner = Glib::MainContext::get_default()->acquire();
// Create a second thread.
- Glib::Threads::Thread* second_thread = Glib::Threads::Thread::create(
- sigc::bind(sigc::ptr_fun(thread_function),
- Glib::Threads::Thread::self(), first_mainloop));
+ const std::thread::id first_thread_id = std::this_thread::get_id();
+ std::thread second_thread(&thread_function, first_thread_id, first_mainloop);
// Start the first main loop.
first_mainloop->run();
// Wait until the second thread has finished.
- second_thread->join();
+ second_thread.join();
if (is_owner)
Glib::MainContext::get_default()->release();
Gio::init();
typedef Glib::RefPtr<Gio::Credentials> CrePtr;
- std::vector<CrePtr> v1(Glib::ArrayHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v2(Glib::ArrayHandle<CrePtr>(0, 5, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v3(Glib::ListHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v4(Glib::SListHandle<CrePtr>(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v5(Glib::ArrayHandle<bool>(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v6(Glib::ArrayHandle<bool>(0, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v1(Glib::ArrayHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v2(Glib::ArrayHandle<CrePtr>(nullptr, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v3(Glib::ListHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v4(Glib::SListHandle<CrePtr>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v5(Glib::ArrayHandle<bool>(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v6(Glib::ArrayHandle<bool>(nullptr, 5, Glib::OWNERSHIP_DEEP));
if (v1.empty() && v2.empty() && v3.empty() && v4.empty() && v5.empty() && v6.empty())
{
Gio::init();
typedef Glib::RefPtr<Gio::Credentials> CrePtr;
- std::vector<CrePtr> v1(Glib::ArrayHandler<CrePtr>::array_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v2(Glib::ArrayHandler<CrePtr>::array_to_vector(0, 5, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v3(Glib::ListHandler<CrePtr>::list_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<CrePtr> v4(Glib::SListHandler<CrePtr>::slist_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v5(Glib::ArrayHandler<bool>::array_to_vector(0, Glib::OWNERSHIP_DEEP));
- std::vector<bool> v6(Glib::ArrayHandler<bool>::array_to_vector(0, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v1(Glib::ArrayHandler<CrePtr>::array_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v2(Glib::ArrayHandler<CrePtr>::array_to_vector(nullptr, 5, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v3(Glib::ListHandler<CrePtr>::list_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<CrePtr> v4(Glib::SListHandler<CrePtr>::slist_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v5(Glib::ArrayHandler<bool>::array_to_vector(nullptr, Glib::OWNERSHIP_DEEP));
+ std::vector<bool> v6(Glib::ArrayHandler<bool>::array_to_vector(nullptr, 5, Glib::OWNERSHIP_DEEP));
if (v1.empty() && v2.empty() && v3.empty() && v4.empty() && v5.empty() && v6.empty())
{
GSList*
create_slist()
{
- GSList* head = 0;
+ GSList* head = nullptr;
for(unsigned int iter(0); iter < magic_limit; ++iter)
{
{
if(glist_)
{
- g_list_foreach(glist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_list_foreach(glist_, reinterpret_cast<GFunc>(g_object_unref), nullptr);
g_list_free(glist_);
}
if(gslist_)
{
- g_slist_foreach(gslist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_slist_foreach(gslist_, reinterpret_cast<GFunc>(g_object_unref), nullptr);
g_slist_free(gslist_);
}
if(garray_)
//Other information about the signal:
- GSignalQuery signalQuery = { 0, 0, 0, GSignalFlags(0), 0, 0, 0, };
+ GSignalQuery signalQuery = { 0, nullptr, 0, GSignalFlags(0), 0, 0, nullptr, };
g_signal_query(signal_id, &signalQuery);
//Return type:
__CPPNAME__::__CPPNAME__`'()
:
ifelse(__BOXEDTYPE_FUNC_NEW,NONE,`dnl
- gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
+ gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
',`dnl else
gobject_ (__BOXEDTYPE_FUNC_NEW`'())
')dnl
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
:
- gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : 0)
+ gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : nullptr)
{}
__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other) noexcept
__CPPNAME__::__CPPNAME__`'()
:
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
- gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
+ gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
',`dnl else
gobject_ (__OPAQUE_FUNC_NEW`'())
')dnl
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& src)
:
- gobject_ ((src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0)
+ gobject_ ((src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : nullptr)
{}
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
',`dnl else
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
{
- const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
+ const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : nullptr;
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
__CPPNAME__::__CPPNAME__`'()
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
+ Glib::ObjectBase(nullptr),
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()))
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
__CPPNAME__::$1`'($3)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
- __CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$4',,,`, $4, static_cast<char*>(0)')))
+ Glib::ObjectBase(nullptr),
+ __CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$4',,,`, $4, nullptr')))
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
m4_define(`_CONSTRUCT',
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
- __CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$1',,,`, $@, static_cast<char*>(0)')))')
+ Glib::ObjectBase(nullptr),
+ __CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$1',,,`, $@, nullptr')))')
dnl _CONSTRUCT() does not deal with multiple class definitions in one file.
dnl If necessary, _CONSTRUCT_SPECIFIC(BaseClass, Class) must be used instead.
dnl
m4_define(`_CONSTRUCT_SPECIFIC',
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
- Glib::ObjectBase(0),
- $1`'(Glib::ConstructParams(_LOWER(`$2')_class_.init()m4_ifelse(`$3',,,`, m4_shift(m4_shift($@)), static_cast<char*>(0)')))')
+ Glib::ObjectBase(nullptr),
+ $1`'(Glib::ConstructParams(_LOWER(`$2')_class_.init()m4_ifelse(`$3',,,`, m4_shift(m4_shift($@)), nullptr')))')
dnl Extra code for initialize_class.
dnl Not commonly used.
s"\%?\bFALSE\b"<tt>false</tt>"g;
s"\%?\bTRUE\b"<tt>true</tt>"g;
- s"\%?\bNULL\b"<tt>0</tt>"g;
+ s"\%?\bNULL\b"<tt>nullptr</tt>"g;
s"#?\bgboolean\b"<tt>bool</tt>"g;
s"#?\bg(int|short|long)\b"<tt>$1</tt>"g;
if(!($possible_arg_list =~ /\b$cpp_param_index\b/))
{
# If the C++ index is not found in the list of desired parameters, pass
- # NULL to the C func unless the param is not optional (applies to a
+ # nullptr to the C func unless the param is not optional (applies to a
# possibly added GError parameter).
if ($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OPTIONAL)
{
- push(@conversions, "0");
+ push(@conversions, "nullptr");
next;
}
}
# will be passed by C reference (&name).
$cOutputParamType =~ s/\*$//;
- # Only initialize pointers to zero. Otherwise, use the default
+ # Only initialize pointers to nullptr. Otherwise, use the default
# constructor of the type.
my $initialization = "";
if($cOutputParamType =~ /\*$/)
{
- $initialization = " = 0";
+ $initialization = " = nullptr";
}
else
{
if (($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OPTIONAL) &&
$cppParamType =~ /^(const\s+)?(std::string|Glib::ustring)&?/)
{
- push(@conversions, "$cppParamName.empty() ? 0 : " . $std_conversion);
+ push(@conversions, "$cppParamName.empty() ? nullptr : " . $std_conversion);
}
else
{
# Append the final slot copy parameter to the C function if the method
# has a slot. The m4 macros assume that that parameter name is
# "slot_copy". The m4 macros will either copy the slot to the
- # "slot_copy variable or set it to the address of the slot itself if
+ # "slot_copy" variable or set it to the address of the slot itself if
# the slot should not be copied.
if ($$objCppfunc{slot_name})
{
}
else
{
- push(@conversions, "0")
+ push(@conversions, "nullptr")
}
}
if(!($possible_arg_list =~ /\b$cpp_param_index\b/))
{
# If the C++ index is not found in the list of desired parameters, pass
- # NULL to the C func unless the param is not optional.
+ # nullptr to the C func unless the param is not optional.
if ($$cpp_param_flags[$cpp_param_index] & FLAG_PARAM_OPTIONAL)
{
- push(@result, "0");
+ push(@result, "nullptr");
next;
}
}