+2.45.31 (unstable):
+
+Glib:
+* HelperList: fix iterator check in operator[]
+ (Maks Naumov) Bug #751530.
+
+Build:
+* Use (and require) C++11.
+ (Murray Cumming, Kjell Ahlstedt)
+* Use some simple C++11 syntax.
+ (Murray Cumming)
+* Fix the build with -Wshadow.
+ (Murray Cumming)
+
+gmmproc:
+* Generate code that uses some simple C++11 syntax.
+ (Murray Cumming)
+* _WRAP_SIGNAL: Accept apostrophes in a preceding comment.
+ (Kjell Ahlstedt)
+
+
2.45.3 (unstable):
* Add SettingsSchema, SettingsSchemaKey and SettingsSchemaSource.
## You should have received a copy of the GNU Lesser General Public License
## along with this library. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([glibmm], [2.45.3],
+AC_INIT([glibmm], [2.45.31],
[http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm],
[glibmm], [http://www.gtkmm.org/])
AC_PREREQ([2.59])
AM_MAINTAINER_MODE
AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
-MM_PREREQ([0.9.7])
+MM_PREREQ([0.9.8])
MM_INIT_MODULE([glibmm-2.4])
MM_INIT_MODULE([giomm-2.4])
AC_SUBST([LIBGLIBMM_SO_VERSION], [4:0:3])
AC_PROG_CXX
+MM_AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
+
AC_DISABLE_STATIC
LT_INIT([win32-dll])
MM_PATH_PERL
# Evaluate the --enable-warnings=level option.
MM_ARG_ENABLE_WARNINGS([GLIBMM_WXXFLAGS],
[-Wall],
- [-pedantic -Wall -Wextra -Wformat-security -Wno-long-long],
+ [-pedantic -Wall -Wextra -Wformat-security -Wsuggest-override -Wshadow -Wno-long-long],
[G SIGCXX])
# Offer the ability to omit some API from the library,
{
GPid pid = fork();
- if(pid==0)
+ if(!pid)
{
sleep(5);
exit(0);
int main()
{
- Glib::RefPtr<Glib::MainLoop> mainLoop = Glib::MainLoop::create();
+ auto mainLoop = Glib::MainLoop::create();
ChildWatch cwatch(mainLoop);
cwatch.run();
// method.
void on_dbus_proxy_available(Glib::RefPtr<Gio::AsyncResult>& result)
{
- Glib::RefPtr<Gio::DBus::Proxy> proxy = Gio::DBus::Proxy::create_finish(result);
+ const auto proxy = Gio::DBus::Proxy::create_finish(result);
if(!proxy)
{
{
// The proxy's call method returns a tuple of the value(s) that the method
// call produces so just get the tuple as a VariantContainerBase.
- const Glib::VariantContainerBase result = proxy->call_sync("ListNames");
+ const auto call_result = proxy->call_sync("ListNames");
// Now extract the single item in the variant container which is the
// array of strings (the names).
- Glib::Variant< std::vector<Glib::ustring> > names_variant;
- result.get_child(names_variant);
+ Glib::Variant< std::vector<Glib::ustring>> names_variant;
+ call_result.get_child(names_variant);
// Get the vector of strings.
- std::vector<Glib::ustring> names = names_variant.get();
+ auto names = names_variant.get();
std::cout << "The names on the message bus are:" << std::endl;
- for(unsigned i = 0; i < names.size(); i++)
- std::cout << names[i] << "." << std::endl;
+ for(const auto& i : names)
+ std::cout << i << "." << std::endl;
}
catch(const Glib::Error& error)
{
loop = Glib::MainLoop::create();
// Get the user session bus connection.
- Glib::RefPtr<Gio::DBus::Connection> connection =
+ auto connection =
Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION);
// Check for an unavailable connection.
curr_time.assign_current_time();
const Glib::ustring time_str = curr_time.as_iso8601();
- const Glib::Variant<Glib::ustring> time_var =
+ const auto time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
bool on_server_new_connection(const Glib::RefPtr<Gio::DBus::Connection>& connection)
{
- Glib::RefPtr<Gio::Credentials> credentials =
+ auto credentials =
connection->get_peer_credentials();
std::string credentials_str;
std::locale::global(std::locale(""));
Gio::init();
- try
+ try
{
introspection_data = Gio::DBus::NodeInfo::create_for_xml(introspection_xml);
}
server->signal_new_connection().connect(sigc::ptr_fun(&on_server_new_connection));
//Keep the server running until the process is killed:
- Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
+ auto loop = Glib::MainLoop::create();
loop->run();
return EXIT_SUCCESS;
curr_time.assign_current_time();
const Glib::ustring time_str = curr_time.as_iso8601();
- const Glib::Variant<Glib::ustring> time_var =
+ const auto time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
return 1;
}
- const guint id = Gio::DBus::own_name(Gio::DBus::BUS_TYPE_SESSION,
+ const auto id = Gio::DBus::own_name(Gio::DBus::BUS_TYPE_SESSION,
"org.glibmm.DBusExample",
sigc::ptr_fun(&on_bus_acquired),
sigc::ptr_fun(&on_name_acquired),
sigc::ptr_fun(&on_name_lost));
//Keep the service running until the process is killed:
- Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
+ auto loop = Glib::MainLoop::create();
loop->run();
Gio::DBus::unown_name(id);
*putback_buffer = *(gptr() - 1);
putback_count = 2;
}
- else putback_count = 1;
+ else
+ putback_count = 1;
}
*(putback_buffer + 1) = *(dest + (chars_read - 1));
}
fdstream::fdstream(int fd, bool manage)
-: std::istream(0),
- std::ostream(0),
+: std::istream(nullptr),
+ std::ostream(nullptr),
buf(fd, manage)
{
std::istream::rdbuf(&buf);
}
fdstream::fdstream()
-: std::istream(0),
- std::ostream(0)
+: std::istream(nullptr),
+ std::ostream(nullptr)
{
std::istream::rdbuf(&buf);
std::ostream::rdbuf(&buf);
}
}
- int read_fd = open("testfifo", O_RDONLY);
+ const auto read_fd = open("testfifo", O_RDONLY);
if(read_fd == -1)
{
std::cerr << "error opening fifo" << std::endl;
// An exception will be thrown if the value is not in the file:
try
{
- const std::vector<int> values = keyfile.get_integer_list("Another Group", "Numbers");
+ const auto values = keyfile.get_integer_list("Another Group", "Numbers");
- for(std::vector<int>::const_iterator p = values.begin(); p != values.end(); ++p)
- std::cout << "Number list value: item=" << *p << std::endl;
+ for(const auto& p : values)
+ std::cout << "Number list value: item=" << p << std::endl;
}
catch(const Glib::KeyFileError& ex)
{
void file_get_contents(const std::string& filename, Glib::ustring& contents)
{
- const Glib::RefPtr<Glib::IOChannel> channel = Glib::IOChannel::create_from_file(filename, "r");
+ const auto channel = Glib::IOChannel::create_from_file(filename, "r");
channel->read_to_end(contents);
}
virtual ~DumpParser();
protected:
- virtual void on_start_element(Glib::Markup::ParseContext& context,
+ void on_start_element(Glib::Markup::ParseContext& context,
const Glib::ustring& element_name,
- const AttributeMap& attributes);
+ const AttributeMap& attributes) override;
- virtual void on_end_element(Glib::Markup::ParseContext& context,
- const Glib::ustring& element_name);
+ void on_end_element(Glib::Markup::ParseContext& context,
+ const Glib::ustring& element_name) override;
- virtual void on_text(Glib::Markup::ParseContext& context, const Glib::ustring& text);
+ void on_text(Glib::Markup::ParseContext& context, const Glib::ustring& text) override;
private:
int parse_depth_;
indent();
std::cout << '<' << element_name;
- for(AttributeMap::const_iterator p = attributes.begin(); p != attributes.end(); ++p)
+ for(const auto& p : attributes)
{
- std::cout << ' ' << p->first << "=\"" << p->second << '"';
+ std::cout << ' ' << p.first << "=\"" << p.second << '"';
}
std::cout << ">\n";
static void
print_resolved_addresses (const Glib::ustring& name,
- const std::list<Glib::RefPtr<Gio::InetAddress> >& addresses)
+ const std::list<Glib::RefPtr<Gio::InetAddress>>& addresses)
{
G_LOCK (response);
std::cout << Glib::ustring::compose ("Name: %1\n", name);
- for (std::list<Glib::RefPtr<Gio::InetAddress> >::const_iterator iter = addresses.begin ();
- iter != addresses.end (); ++iter)
+ for (const auto& i : addresses)
{
- std::cout << Glib::ustring::compose ("Address: %1\n", (*iter)->to_string ());
+ std::cout << Glib::ustring::compose ("Address: %1\n", i->to_string ());
}
std::cout << std::endl;
{
G_LOCK (response);
std::cout << Glib::ustring::compose ("Service: %1\n", service);
- for (std::list<Gio::SrvTarget>::const_iterator iter = targets.begin ();
- iter != targets.end (); ++iter)
+ for (const auto& i : targets)
{
std::cout <<
Glib::ustring::compose ("%1:%2 (pri %3, weight %4)\n",
- iter->get_hostname (),
- iter->get_port (),
- iter->get_priority (),
- iter->get_weight ());
+ i.get_hostname (),
+ i.get_port (),
+ i.get_priority (),
+ i.get_weight ());
}
std::cout << std::endl;
{
if (arg.find ('/') != std::string::npos)
{
- std::list<Gio::SrvTarget> targets;
/* service/protocol/domain */
- std::vector<Glib::ustring> parts = split_service_parts (arg);
+ const auto parts = split_service_parts (arg);
if (parts.size () != 3) {
usage ();
return;
try
{
- targets = resolver->lookup_service (parts[0], parts[1], parts[2],
+ const auto targets = resolver->lookup_service (parts[0], parts[1], parts[2],
cancellable);
print_resolved_service (arg, targets);
}
}
else if (Gio::hostname_is_ip_address (arg))
{
- Glib::RefPtr<Gio::InetAddress> addr = Gio::InetAddress::create (arg);
+ auto addr = Gio::InetAddress::create (arg);
try
{
Glib::ustring name = resolver->lookup_by_address (addr, cancellable);
static void
start_threaded_lookups (char **argv, int argc)
{
- int i;
-
- for (i = 0; i < argc; i++)
- {
- Glib::Threads::Thread::create (sigc::bind (sigc::ptr_fun (lookup_thread),
- argv[i]));
- }
+ for (auto i = 0; i < argc; i++)
+ {
+ Glib::Threads::Thread::create (sigc::bind (sigc::ptr_fun (lookup_thread),
+ argv[i]));
+ }
}
static void
static void
start_async_lookups (char **argv, int argc)
{
- for (int i = 0; i < argc; i++)
+ for (auto i = 0; i < argc; i++)
{
Glib::ustring arg (argv[i]);
if (arg.find ('/') != std::string::npos)
{
/* service/protocol/domain */
- std::vector<Glib::ustring> parts = split_service_parts (arg);
+ auto parts = split_service_parts (arg);
if (parts.size () != 3) {
usage ();
return;
}
else if (Gio::hostname_is_ip_address (argv[i]))
{
- Glib::RefPtr<Gio::InetAddress> addr = Gio::InetAddress::create (argv[i]);
+ auto addr = Gio::InetAddress::create (argv[i]);
resolver->lookup_by_address_async (addr,
sigc::bind (sigc::ptr_fun
print_connectable_sockaddr (Glib::RefPtr<Gio::SocketAddress> sockaddr)
{
Glib::ustring phys;
- Glib::RefPtr<Gio::InetSocketAddress> isa =
+ auto isa =
Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (sockaddr);
if (!isa)
{
try
{
- Glib::RefPtr<Gio::SocketAddress> sockaddr = enumerator->next_finish (result);
+ const auto sockaddr = enumerator->next_finish (result);
if (sockaddr)
{
print_connectable_sockaddr (sockaddr);
{
std::vector<Glib::ustring> parts;
Glib::RefPtr<Gio::SocketConnectable> connectable;
- Glib::RefPtr<Gio::SocketAddressEnumerator> enumerator;
if (arg.find ('/') != std::string::npos)
{
std::string host, port_str;
guint16 port;
- std::size_t pos = arg.find (':');
+ const auto pos = arg.find (':');
if (pos != std::string::npos)
{
host = arg.substr (0, pos);
port_str = arg.substr(pos);
- port = strtoul (port_str.c_str (), NULL, 10);
+ port = strtoul (port_str.c_str (), nullptr, 10);
}
else
port = 0;
if (Gio::hostname_is_ip_address (host))
{
- Glib::RefPtr<Gio::InetAddress> addr = Gio::InetAddress::create (host);
+ const auto addr = Gio::InetAddress::create (host);
connectable = Gio::InetSocketAddress::create (addr, port);
}
else
connectable = Gio::NetworkAddress::create (arg, port);
}
- enumerator = connectable->enumerate ();
-
+ const auto enumerator = connectable->enumerate ();
if (synchronous)
do_sync_connectable (enumerator);
else
}
static bool
-async_cancel (Glib::IOCondition /*cond*/, Glib::RefPtr<Gio::Cancellable> cancellable)
+async_cancel (Glib::IOCondition /*cond*/, Glib::RefPtr<Gio::Cancellable> the_cancellable)
{
- cancellable->cancel ();
+ the_cancellable->cancel ();
return false;
}
#endif
int
main (int argc, char **argv)
{
- bool synchronous = false;
- bool use_connectable = false;
+ auto synchronous = false;
+ auto use_connectable = false;
#ifdef G_OS_UNIX
Glib::RefPtr<Glib::IOChannel> chan;
sigc::connection watch_conn;
signal (SIGINT, interrupted);
chan = Glib::IOChannel::create_from_fd (cancel_fds[0]);
- Glib::RefPtr<Glib::IOSource> source = chan->create_watch (Glib::IO_IN);
+ const auto source = chan->create_watch (Glib::IO_IN);
watch_conn = source->connect (sigc::bind (sigc::ptr_fun (async_cancel), cancellable));
#endif
Glib::ustring str, res;
int port;
- Glib::RefPtr<Gio::InetSocketAddress> isockaddr =
+ auto isockaddr =
Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (address);
if (!isockaddr)
return Glib::ustring ();
if (use_source)
{
- Glib::RefPtr<Gio::SocketSource> source = socket->create_source(condition, cancellable);
+ auto source = socket->create_source(condition, cancellable);
source->connect(sigc::ptr_fun(&source_ready));
source->attach();
loop->run();
if (argc != 2)
{
- const char* error_message = "Need to specify hostname";
+ const auto error_message = "Need to specify hostname";
std::cerr << Glib::ustring::compose ("%1: %2\n", argv[0], error_message);
return 1;
}
Glib::ustring
socket_address_to_string (const Glib::RefPtr<Gio::SocketAddress>& address)
{
- Glib::RefPtr<Gio::InetAddress> inet_address;
- Glib::ustring str, res;
- int port;
-
- Glib::RefPtr<Gio::InetSocketAddress> isockaddr =
- Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (address);
- if (!isockaddr)
- return Glib::ustring ();
- inet_address = isockaddr->get_address ();
- str = inet_address->to_string ();
- port = isockaddr->get_port ();
- res = Glib::ustring::compose ("%1:%2", str, port);
- return res;
+ auto isockaddr =
+ Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (address);
+ if (!isockaddr)
+ return Glib::ustring ();
+
+ auto inet_address = isockaddr->get_address ();
+ auto str = inet_address->to_string ();
+ auto the_port = isockaddr->get_port ();
+ auto res = Glib::ustring::compose ("%1:%2", str, the_port);
+ return res;
}
static bool
char *argv[])
{
Glib::RefPtr<Gio::Socket> socket, new_socket, recv_socket;
- Glib::RefPtr<Gio::SocketAddress> src_address;
Glib::RefPtr<Gio::SocketAddress> address;
- Gio::SocketType socket_type;
- Gio::SocketFamily socket_family;
Glib::RefPtr<Gio::Cancellable> cancellable;
Gio::init ();
loop = Glib::MainLoop::create ();
- socket_type = use_udp ? Gio::SOCKET_TYPE_DATAGRAM : Gio::SOCKET_TYPE_STREAM;
- socket_family = use_ipv6 ? Gio::SOCKET_FAMILY_IPV6 : Gio::SOCKET_FAMILY_IPV4;
+ auto socket_type = use_udp ? Gio::SOCKET_TYPE_DATAGRAM : Gio::SOCKET_TYPE_STREAM;
+ auto socket_family = use_ipv6 ? Gio::SOCKET_FAMILY_IPV6 : Gio::SOCKET_FAMILY_IPV4;
try {
socket = Gio::Socket::create (socket_family, socket_type, Gio::SOCKET_PROTOCOL_DEFAULT);
if (non_blocking)
socket->set_blocking (false);
- src_address = Gio::InetSocketAddress::create (Gio::InetAddress::create_any (socket_family), port);
+ auto src_address = Gio::InetSocketAddress::create (Gio::InetAddress::create_any (socket_family), port);
try {
socket->bind (src_address, !dont_reuse_address);
} catch (const Gio::Error& error) {
{
gchar buffer[4096] = { };
gssize size;
- gsize to_send;
ensure_condition (recv_socket, "receive", cancellable, Glib::IO_IN);
try {
"-------------------------\n",
(int)size, buffer);
- to_send = size;
+ auto to_send = size;
while (to_send > 0)
{
public:
ExampleOptionGroup();
- virtual bool on_pre_parse(Glib::OptionContext& context, Glib::OptionGroup& group);
- virtual bool on_post_parse(Glib::OptionContext& context, Glib::OptionGroup& group);
- virtual void on_error(Glib::OptionContext& context, Glib::OptionGroup& group);
+private:
+ bool on_pre_parse(Glib::OptionContext& context, Glib::OptionGroup& group) override;
+ bool on_post_parse(Glib::OptionContext& context, Glib::OptionGroup& group) override;
+ void on_error(Glib::OptionContext& context, Glib::OptionGroup& group) override;
bool on_option_arg_string(const Glib::ustring& option_name,
const Glib::ustring& value, bool has_value);
bool on_option_arg_filename(const Glib::ustring& option_name,
const std::string& value, bool has_value);
+public:
//These members should live as long as the OptionGroup to which they are added,
//and as long as the OptionContext to which that OptionGroup is added.
int m_arg_foo;
//This one shows the results of multiple instance of the same option, such as --list=1 --list=a --list=b
std::cout << " list = ";
- for(Glib::OptionGroup::vecustrings::const_iterator iter = group.m_arg_list.begin(); iter != group.m_arg_list.end(); ++iter)
+ for(const auto& i : group.m_arg_list)
+
{
- std::cout << *iter << ", ";
+ std::cout << i << ", ";
}
std::cout << std::endl;
//This one shows the remaining arguments on the command line, which had no name= form:
std::cout << " remaining = ";
- for(Glib::OptionGroup::vecustrings::const_iterator iter = group.m_remaining_list.begin(); iter != group.m_remaining_list.end(); ++iter)
+ for(const auto& i : group.m_remaining_list)
{
- std::cout << *iter << ", ";
+ std::cout << i << ", ";
}
std::cout << std::endl;
Glib::init();
/* Reusing one regex pattern: */
- Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create("(a)?(b)");
+ const auto regex = Glib::Regex::create("(a)?(b)");
std::cout << "Pattern=" << regex->get_pattern()
<< ", with string=abcd, result="
<< std::boolalpha << regex->match("abcd")
Glib::setenv("GSETTINGS_SCHEMA_DIR", ".", true);
Glib::setenv("GSETTINGS_BACKEND", "memory", true);
- const Glib::RefPtr<Gio::Settings> settings =
+ const auto settings =
Gio::Settings::create("org.gtkmm.demo");
settings->signal_changed().connect(sigc::bind(sigc::ptr_fun(&on_key_changed), settings));
class ThreadProgress
{
public:
- explicit ThreadProgress(int id);
+ explicit ThreadProgress(int the_id);
virtual ~ThreadProgress();
int id() const;
void operator()(T ptr) const { delete ptr; }
};
-ThreadProgress::ThreadProgress(int id)
+ThreadProgress::ThreadProgress(int the_id)
:
- thread_ (0),
- id_ (id),
+ thread_ (nullptr),
+ id_ (the_id),
progress_ (0)
{
// Connect to the cross-thread signal.
ThreadProgress::~ThreadProgress()
{
// It is an error if the thread is still running at this point.
- g_return_if_fail(thread_ == 0);
+ g_return_if_fail(thread_ == nullptr);
}
int ThreadProgress::id() const
{
Glib::Rand rand;
- for (int i = 0; i < ITERATIONS; ++i)
+ for (auto i = 0; i < ITERATIONS; ++i)
{
Glib::usleep(rand.get_int_range(2000, 20000));
// 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_ (NULL)
+ signal_finished_ptr_ (nullptr)
{
// Connect the cross-thread signal.
signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment));
sigc::mem_fun(*this, &ThreadTimer::thread_function));
// Wait for the 2nd thread's startup notification.
- while(signal_finished_ptr_ == NULL)
+ while(!signal_finished_ptr_)
startup_cond_.wait(startup_mutex_);
}
signal_finished_ptr_->emit();
// wait for the thread to join
- if(thread_ != NULL)
+ if(thread_)
thread_->join();
- signal_finished_ptr_ = NULL;
+ signal_finished_ptr_ = nullptr;
}
void ThreadTimer::print() const
void ThreadTimer::thread_function()
{
// create a new Main Context
- Glib::RefPtr<Glib::MainContext> context = Glib::MainContext::create();
+ auto context = Glib::MainContext::create();
// create a new Main Loop
- Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(context, true);
+ auto mainloop = Glib::MainLoop::create(context, true);
// attach a timeout handler, that is called every second, to the
// newly created MainContext
ThreadDispatcher::ThreadDispatcher()
:
- timer_ (NULL)
+ timer_ (nullptr)
{
std::cout << "Thread Dispatcher Example #2" << std::endl;
{
Glib::Rand rand (1234);
- for(int i = 0; i < 200; ++i)
+ for(auto i = 0; i < 200; ++i)
{
{
Glib::Threads::Mutex::Lock lock (mutex_);
{
Glib::Rand rand;
- for(int i = 0; i < 100; ++i)
+ for(auto i = 0; i < 100; ++i)
{
{
Glib::Threads::Mutex::Lock lock (mutex);
{
Glib::ThreadPool pool (10);
- for(char c = 'a'; c <= 'z'; ++c)
+ for(auto c = 'a'; c <= 'z'; ++c)
{
pool.push(sigc::bind<1>(sigc::ptr_fun(&print_char), c));
}
Glib::RefPtr<Gio::Icon> content_type_get_icon(const Glib::ustring& type)
{
- Glib::RefPtr<Icon> retvalue = Glib::wrap(g_content_type_get_icon(type.c_str()));
+ auto retvalue = Glib::wrap(g_content_type_get_icon(type.c_str()));
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
return retvalue;
#ifdef G_OS_UNIX
Glib::RefPtr<Gio::Icon> content_type_get_symbolic_icon(const Glib::ustring& type)
{
- Glib::RefPtr<Icon> retvalue = Glib::wrap(g_content_type_get_symbolic_icon(type.c_str()));
+ auto retvalue = Glib::wrap(g_content_type_get_symbolic_icon(type.c_str()));
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
return retvalue;
try
{
- Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
+ auto result = Glib::wrap(res, true /* take copy */);
(*the_slot)(result);
}
catch(...)
* is equivalent to:
* @code
* bool io_handler(Glib::IOCondition io_condition) { ... }
- * const Glib::RefPtr<Gio::SocketSource> socket_source = Gio::SocketSource::create(socket, Glib::IO_IN | Glib::IO_OUT);
+ * const auto socket_source = Gio::SocketSource::create(socket, Glib::IO_IN | Glib::IO_OUT);
* socket_source->connect(sigc::ptr_fun(&io_handler));
* socket_source->attach(Glib::MainContext::get_default());
* @endcode
g_return_if_fail(
g_variant_type_equal(g_action_get_state_type(const_cast<GAction*>(gobj())), type_glib_variant::variant_type().gobj()));
- const Glib::VariantBase variantBase = get_state_variant();
- const type_glib_variant variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
+ const auto variantBase = get_state_variant();
+ const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
value = variantDerived.get();
}
typedef Glib::Variant<T_Value> type_glib_variant;
- const Glib::VariantBase variantBase = get_state_hint_variant();
+ const auto variantBase = get_state_hint_variant();
// We can't check the type (a range) that will be returned before getting the range hint.
g_return_if_fail(
variantBase.is_of_type(type_glib_variant::variant_type()) );
- const type_glib_variant variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
+ const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
value = variantDerived.get();
}
g_return_if_fail(
g_variant_type_equal(g_action_group_get_action_state_type(const_cast<GActionGroup*>(gobj()), action_name.c_str()), type_glib_variant::variant_type().gobj()));
- const Glib::VariantBase variantBase = get_action_state_variant(action_name);
+ const auto variantBase = get_action_state_variant(action_name);
//TODO: Add a bool return instead of letting a std::bad_cast from the cast_dynamic() be thrown up to the caller?
- const type_glib_variant variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
+ const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
value = variantDerived.get();
}
typedef Glib::Variant<T_Value> type_glib_variant;
- const Glib::VariantBase variantBase = get_action_state_hint_variant(action_name);
+ const auto variantBase = get_action_state_hint_variant(action_name);
// We can't check the type (a range) that will be returned before getting the range hint.
g_return_if_fail(
variantBase.is_of_type(type_glib_variant::variant_type()) );
- const type_glib_variant variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
+ const auto variantDerived = variantBase.cast_dynamic<type_glib_variant>(variantBase);
value = variantDerived.get();
}
Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name)
{
- Glib::RefPtr<SimpleAction> action = SimpleAction::create(name);
+ auto action = SimpleAction::create(name);
add_action(action);
return action;
}
Glib::RefPtr<SimpleAction> ActionMap::add_action_with_parameter(const Glib::ustring& name, const ActivateWithParameterSlot& slot)
{
- Glib::RefPtr<SimpleAction> action = add_action(name);
+ auto action = add_action(name);
action->signal_activate().connect(slot);
return action;
}
Glib::RefPtr<SimpleAction> ActionMap::add_action(const Glib::ustring& name, const ActivateSlot& slot)
{
- Glib::RefPtr<SimpleAction> action = add_action(name);
+ auto action = add_action(name);
action->signal_activate().connect(
sigc::hide(slot));
return action;
Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, bool state)
{
- Glib::RefPtr<SimpleAction> action = SimpleAction::create_bool(name, state);
+ auto action = SimpleAction::create_bool(name, state);
add_action(action);
return action;
}
//TODO: Use a slot that takes a bool?
Glib::RefPtr<SimpleAction> ActionMap::add_action_bool(const Glib::ustring& name, const ActivateSlot& slot, bool state)
{
- Glib::RefPtr<SimpleAction> action = add_action_bool(name, state);
+ auto action = add_action_bool(name, state);
action->signal_activate().connect(
sigc::hide(slot));
return action;
//TODO: Use a slot that takes a string?
Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustring& name, const Glib::ustring& state)
{
- Glib::RefPtr<SimpleAction> action = SimpleAction::create_radio_string(name, state);
+ auto action = SimpleAction::create_radio_string(name, state);
add_action(action);
return action;
}
static void on_action_radio_string(const Glib::VariantBase& parameter, const Gio::ActionMap::ActivateWithStringParameterSlot& slot)
{
//TODO: This syntax is odd:
- const Glib::Variant<Glib::ustring> variantDerived =
+ const auto variantDerived =
parameter.cast_dynamic< Glib::Variant<Glib::ustring> >(parameter);
- const Glib::ustring str = variantDerived.get();
+ const auto str = variantDerived.get();
slot(str);
}
Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_string(const Glib::ustring& name, const ActivateWithStringParameterSlot& slot, const Glib::ustring& state)
{
- Glib::RefPtr<SimpleAction> action = add_action_radio_string(name, state);
+ auto action = add_action_radio_string(name, state);
action->signal_activate().connect(
sigc::bind(sigc::ptr_fun(&on_action_radio_string), slot));
return action;
static void on_action_radio_int(const Glib::VariantBase& parameter, const Gio::ActionMap::ActivateWithIntParameterSlot& slot)
{
//TODO: This syntax is odd:
- const Glib::Variant<int> variantDerived =
+ const auto variantDerived =
parameter.cast_dynamic< Glib::Variant<int> >(parameter);
- const int str = variantDerived.get();
+ const auto str = variantDerived.get();
slot(str);
}
//TODO: Use a slot that takes an integer?
Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustring& name, gint32 state)
{
- Glib::RefPtr<SimpleAction> action = SimpleAction::create_radio_integer(name, state);
+ auto action = SimpleAction::create_radio_integer(name, state);
add_action(action);
return action;
}
Glib::RefPtr<SimpleAction> ActionMap::add_action_radio_integer(const Glib::ustring& name, const ActivateWithIntParameterSlot& slot, gint32 state)
{
- Glib::RefPtr<SimpleAction> action = add_action_radio_integer(name, state);
+ auto action = add_action_radio_integer(name, state);
action->signal_activate().connect(
sigc::bind(sigc::ptr_fun(&on_action_radio_int), slot));
return action;
~ExtraApplicationData()
{
- for (std::vector<gchar*>::iterator iter = option_entry_strings.begin();
- iter != option_entry_strings.end(); ++iter)
+ for(auto str : option_entry_strings)
{
- g_free(*iter);
- *iter = 0;
+ g_free(str);
}
}
};
vec_files[i] = Glib::wrap(files[i], true);
}
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
+ const auto hint_str = (hint ? hint : Glib::ustring());
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
try
{
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data)) {
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) {
(*static_cast<SlotType*>(slot))(vec_files, hint_str);
return;
}
vec_files[i] = Glib::wrap(files[i], true);
}
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
+ const auto hint_str = (hint ? hint : Glib::ustring());
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
try
{
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
{
(*static_cast<SlotType*>(slot))(vec_files, hint_str);
return;
if (option_name[1] == '-')
{
// Long option name.
- const Glib::ustring long_option_name = Glib::ustring(option_name+2);
+ const auto long_option_name = Glib::ustring(option_name+2);
iterFind = option_arg_callback_data.find(long_option_name);
}
else
{
// Short option name.
- const gchar short_option_name = option_name[1];
+ const auto short_option_name = option_name[1];
for (iterFind = option_arg_callback_data.begin();
iterFind != option_arg_callback_data.end(); ++iterFind)
{
{
if (option_arg->is_filename_option())
{
- const Glib::OptionGroup::SlotOptionArgFilename* the_slot = option_arg->get_slot_filename();
+ const auto the_slot = option_arg->get_slot_filename();
lock.release();
const std::string cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
}
else
{
- const Glib::OptionGroup::SlotOptionArgString* the_slot = option_arg->get_slot_string();
+ const auto the_slot = option_arg->get_slot_string();
lock.release();
const Glib::ustring cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
void Application_Class::open_callback(GApplication* self, GFile** files,
gint n_files, const gchar *hint)
{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
if(obj_base && obj_base->is_derived_())
{
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
vec_files[i] = Glib::wrap(files[i], true);
}
- const Glib::ustring hint_str = (hint ? hint : Glib::ustring());
+ const auto hint_str = (hint ? hint : Glib::ustring());
obj->on_open(vec_files, hint_str);
return;
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
);
void Gio::Application::on_open(const Application::type_vec_files& files, const Glib::ustring& hint)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
if (iterFind != option_arg_callback_data.end())
return; // Ignore duplicates
- OptionArgCallbackData* callback_data = new OptionArgCallbackData(this, short_name, slot);
+ auto callback_data = new OptionArgCallbackData(this, short_name, slot);
option_arg_callback_data[long_name] = callback_data;
lock.release();
if (iterFind != option_arg_callback_data.end())
return; // Ignore duplicates
- OptionArgCallbackData* callback_data = new OptionArgCallbackData(this, short_name, slot);
+ auto callback_data = new OptionArgCallbackData(this, short_name, slot);
option_arg_callback_data[long_name] = callback_data;
lock.release();
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_async_initable_init_async(gobj(), io_priority, Glib::unwrap(cancellable),
&SignalProxy_async_callback, slot_copy);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_async_initable_init_async(gobj(), io_priority, 0,
&SignalProxy_async_callback, slot_copy);
int io_priority, GCancellable* cancellable, GAsyncReadyCallback callback,
gpointer user_data)
{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// being overridden:
if(obj_base && obj_base->is_derived_())
{
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
void Gio::AsyncInitable::init_async_vfunc(const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
gboolean AsyncInitable_Class::init_finish_vfunc_callback(GAsyncInitable* self,
GAsyncResult* res, GError** error)
{
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
// Non-gtkmmproc-generated custom classes implicitly call the default
// being overridden:
if(obj_base && obj_base->is_derived_())
{
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
}
bool Gio::AsyncInitable::init_finish_vfunc(const Glib::RefPtr<AsyncResult>& res)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
Glib::RefPtr<Glib::ObjectBase> AsyncResult::get_source_object_base()
{
- GObject* cobj = g_async_result_get_source_object(gobj());
- ObjectBase* cppobj = Glib::wrap_auto(cobj); //ObjectBase::_get_current_wrapper(cobj);
+ auto cobj = g_async_result_get_source_object(gobj());
+ auto cppobj = Glib::wrap_auto(cobj); //ObjectBase::_get_current_wrapper(cobj);
return Glib::RefPtr<Glib::ObjectBase>(cppobj); //g_async_result_get_source_object() gives us a ref, unusually.
//TODO: For some reason this fails: Glib::wrap(cobj);
}
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_buffered_input_stream_fill_async(gobj(),
count,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_buffered_input_stream_fill_async(gobj(),
count,
gulong
Cancellable::connect(const SlotCancelledCallback& slot)
{
- SlotCancelledCallback* slot_copy = new SlotCancelledCallback(slot);
+ auto slot_copy = new SlotCancelledCallback(slot);
return g_cancellable_connect (gobj(),
G_CALLBACK(slot_cancelled_proxy),
slot_copy,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_data_input_stream_read_line_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_data_input_stream_read_until_async(gobj(), stop_chars.c_str(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_data_input_stream_read_upto_async(gobj(), stop_chars.c_str(), -1, /* null-terminated */
io_priority,
void get_stream(const std::string& address, const SlotAsyncReady slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_address_get_stream(address.c_str(), Glib::unwrap(cancellable),
&SignalProxy_async_callback, slot_copy);
}
void get_stream(const std::string& address, const SlotAsyncReady slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_address_get_stream(address.c_str(), 0, &SignalProxy_async_callback,
slot_copy);
}
GError* gerror = 0;
gchar* g_out_guid = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_finish(Glib::unwrap(res),
&g_out_guid, &gerror));
{
GError* gerror = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_finish(Glib::unwrap(res), 0,
&gerror));
GError* gerror = 0;
gchar* g_out_guid = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(),
&g_out_guid, Glib::unwrap(cancellable), &gerror));
GError* gerror = 0;
gchar* g_out_guid = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(),
&g_out_guid, 0, &gerror));
{
GError* gerror = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), 0,
Glib::unwrap(cancellable), &gerror));
{
GError* gerror = 0;
- Glib::RefPtr<IOStream> result =
+ auto result =
Glib::wrap(g_dbus_address_get_stream_sync(address.c_str(), 0, 0, &gerror));
if(gerror)
try
{
- Glib::RefPtr<Gio::DBus::Message> result = (*the_slot)(
+ auto result = (*the_slot)(
Glib::wrap(connection, true), Glib::wrap(message, true),
static_cast<bool>(incoming));
return (result) ? result->gobj_copy() : 0;
void Connection::get(BusType bus_type, const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_bus_get(static_cast<GBusType>(bus_type), Glib::unwrap(cancellable),
&SignalProxy_async_callback, slot_copy);
//static
void Connection::get(BusType bus_type, const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_bus_get(static_cast<GBusType>(bus_type), 0, &SignalProxy_async_callback,
slot_copy);
void Connection::close(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_close(gobj(),
Glib::unwrap(cancellable),
void Connection::close(const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_close(gobj(),
0,
void Connection::flush(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_flush(gobj(),
Glib::unwrap(cancellable),
void Connection::flush(const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_flush(gobj(),
0,
void Connection::send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec,const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
volatile guint32 out_serial = 0;
g_dbus_connection_send_message_with_reply(gobj(), Glib::unwrap(message),
static_cast<GDBusSendMessageFlags>(message->get_flags()),
void Connection::send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec,const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
volatile guint32 out_serial = 0;
g_dbus_connection_send_message_with_reply(gobj(), Glib::unwrap(message),
static_cast<GDBusSendMessageFlags>(message->get_flags()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_call(gobj(), bus_name.c_str(), object_path.c_str(),
interface_name.c_str(), method_name.c_str(),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_call(gobj(), bus_name.c_str(), object_path.c_str(),
interface_name.c_str(), method_name.c_str(),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_call_with_unix_fd_list(gobj(), bus_name.c_str(),
object_path.c_str(), interface_name.c_str(), method_name.c_str(),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_connection_call_with_unix_fd_list(gobj(), bus_name.c_str(),
object_path.c_str(), interface_name.c_str(), method_name.c_str(),
const Glib::ustring& arg0,
SignalFlags flags)
{
- SlotSignal* slot_copy = new SlotSignal(slot);
+ auto slot_copy = new SlotSignal(slot);
return g_dbus_connection_signal_subscribe(gobj(), sender.c_str(),
interface_name.c_str(), member.c_str(), object_path.c_str(), arg0.c_str(),
guint Connection::add_filter(const SlotMessageFilter& slot)
{
- SlotMessageFilter* slot_copy = new SlotMessageFilter(slot);
+ auto slot_copy = new SlotMessageFilter(slot);
return g_dbus_connection_add_filter(gobj(),
&DBusConnection_Message_Filter_giomm_callback, slot_copy,
static void Bus_Acquired_giomm_callback(GDBusConnection* connection,
const gchar* name, gpointer data)
{
- OwnSlots* slots = static_cast<OwnSlots*>(data);
- Gio::DBus::SlotBusAcquired* the_slot = slots->bus_acquired_slot;
+ auto slots = static_cast<OwnSlots*>(data);
+ auto the_slot = slots->bus_acquired_slot;
try
{
static void Bus_Name_Acquired_giomm_callback(GDBusConnection* connection,
const gchar* name, gpointer data)
{
- OwnSlots* slots = static_cast<OwnSlots*>(data);
- Gio::DBus::SlotNameAcquired* the_slot = slots->name_acquired_slot;
+ auto slots = static_cast<OwnSlots*>(data);
+ auto the_slot = slots->name_acquired_slot;
try
{
static void Bus_Name_Lost_giomm_callback(GDBusConnection* connection,
const gchar* name, gpointer data)
{
- OwnSlots* slots = static_cast<OwnSlots*>(data);
- Gio::DBus::SlotNameLost* the_slot = slots->name_lost_slot;
+ auto slots = static_cast<OwnSlots*>(data);
+ auto the_slot = slots->name_lost_slot;
try
{
static void Bus_Own_Name_giomm_callback_destroy(void* data)
{
- OwnSlots* slots = static_cast<OwnSlots*>(data);
+ auto slots = static_cast<OwnSlots*>(data);
if(slots->bus_acquired_slot)
delete slots->bus_acquired_slot;
BusNameOwnerFlags flags
)
{
- struct OwnSlots* slots = new OwnSlots;
+ auto slots = new OwnSlots;
// Make copies of the slots which will be deleted on destroy notification.
slots->bus_acquired_slot = new SlotBusAcquired(bus_acquired_slot);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_proxy_call(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_proxy_call(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_proxy_call_with_unix_fd_list(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_dbus_proxy_call_with_unix_fd_list(gobj(), method_name.c_str(),
const_cast<GVariant*>(parameters.gobj()),
try
{
- std::vector<Glib::ustring> result =
+ auto result =
(*the_slot)(Glib::wrap(connection, true), sender, object_path);
// This will be freed by the caller.
try
{
- std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> > result =
+ auto result =
(*the_slot)(Glib::wrap(connection, true), sender, object_path, node);
// This will be freed by the caller, along with unreferencing its members.
const char* interface_name, const char* node, void** out_user_data,
void* user_data)
{
- Gio::DBus::SubtreeVTable* vtable =
+ Gio::DBus::SubtreeVTable* vtable_subtree =
static_cast<Gio::DBus::SubtreeVTable*>(user_data);
Gio::DBus::SubtreeVTable::SlotSubtreeDispatch* the_slot =
- vtable->get_slot_dispatch();
+ vtable_subtree->get_slot_dispatch();
try
{
- const Gio::DBus::InterfaceVTable* vtable =
+ const Gio::DBus::InterfaceVTable* vtable_iface =
(*the_slot)(Glib::wrap(connection, true), sender, object_path,
interface_name, (node ? node : ""));
- *out_user_data = const_cast<Gio::DBus::InterfaceVTable*>(vtable);
+ *out_user_data = const_cast<Gio::DBus::InterfaceVTable*>(vtable_iface);
- return vtable->gobj();
+ return vtable_iface->gobj();
}
catch(...)
{
static void Bus_Name_Appeared_giomm_callback(GDBusConnection* connection,
const gchar* name, const char* name_owner, gpointer data)
{
- WatchSlots* slots = static_cast<WatchSlots*>(data);
- Gio::DBus::SlotNameAppeared* the_slot = slots->name_appeared_slot;
+ auto slots = static_cast<WatchSlots*>(data);
+ auto the_slot = slots->name_appeared_slot;
try
{
static void Bus_Name_Vanished_giomm_callback(GDBusConnection* connection,
const gchar* name, gpointer data)
{
- WatchSlots* slots = static_cast<WatchSlots*>(data);
- Gio::DBus::SlotNameVanished* the_slot = slots->name_vanished_slot;
+ auto slots = static_cast<WatchSlots*>(data);
+ auto the_slot = slots->name_vanished_slot;
try
{
static void Bus_Watch_Name_giomm_callback_destroy(void* data)
{
- WatchSlots* slots = static_cast<WatchSlots*>(data);
+ auto slots = static_cast<WatchSlots*>(data);
if(slots->name_appeared_slot)
delete slots->name_appeared_slot;
BusNameWatcherFlags flags
)
{
- struct WatchSlots* slots = new WatchSlots;
+ auto slots = new WatchSlots;
// Make copies of the slots which will be deleted on destroy notification.
slots->name_appeared_slot = new SlotNameAppeared(name_appeared_slot);
BusNameWatcherFlags flags
)
{
- struct WatchSlots* slots = new WatchSlots;
+ auto slots = new WatchSlots;
// Make copies of the slots which will be deleted on destroy notification.
slots->name_appeared_slot = new SlotNameAppeared(name_appeared_slot);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_poll_for_media(gobj(),
Glib::unwrap(cancellable),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_poll_for_media(gobj(),
0, // cancellable
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_stop(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_stop(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_start(gobj(),
static_cast<GDriveStartFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_drive_start(gobj(),
static_cast<GDriveStartFlags>(flags),
goffset total_num_bytes,
gpointer data)
{
- Gio::File::SlotFileProgress* the_slot = static_cast<Gio::File::SlotFileProgress*>(data);
+ auto the_slot = static_cast<Gio::File::SlotFileProgress*>(data);
try
{
static void
SignalProxy_file_copy_async_callback(GObject*, GAsyncResult* res, void* data)
{
- CopySlots* slot_pair = static_cast<CopySlots*>(data);
- Gio::SlotAsyncReady* the_slot = slot_pair->second;
+ auto slot_pair = static_cast<CopySlots*>(data);
+ auto the_slot = slot_pair->second;
try
{
if(*the_slot)
{
- Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
+ auto result = Glib::wrap(res, true /* take copy */);
(*the_slot)(result);
}
}
static void
SignalProxy_file_measure_async_callback(GObject*, GAsyncResult* res, void* data)
{
- MeasureSlots* slot_pair = static_cast<MeasureSlots*>(data);
- Gio::SlotAsyncReady* the_slot = slot_pair->second;
+ auto slot_pair = static_cast<MeasureSlots*>(data);
+ auto the_slot = slot_pair->second;
try
{
if(*the_slot)
{
- Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
+ auto result = Glib::wrap(res, true /* take copy */);
(*the_slot)(result);
}
}
static gboolean
SignalProxy_load_partial_contents_read_more_callback(const char* file_contents, goffset file_size, gpointer data)
{
- LoadPartialSlots* slot_pair = static_cast<LoadPartialSlots*>(data);
- Gio::File::SlotReadMore* the_slot = slot_pair->first;
+ auto slot_pair = static_cast<LoadPartialSlots*>(data);
+ auto the_slot = slot_pair->first;
bool result = false;
try
{
- Glib::RefPtr<Gio::AsyncResult> result = Glib::wrap(res, true /* take copy */);
+ auto result = Glib::wrap(res, true /* take copy */);
(*the_slot)(result);
}
catch(...)
Glib::RefPtr<FileInfo> File::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) const
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_query_info(const_cast<GFile*>(gobj()), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> File::query_info(const std::string& attributes, FileQueryInfoFlags flags) const
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> 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)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> 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(), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileEnumerator> retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_enumerate_children(gobj(), attributes.c_str(), ((GFileQueryInfoFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileEnumerator> File::enumerate_children(const std::string& attributes, FileQueryInfoFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileEnumerator> 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)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::replace(const Glib::RefPtr<Cancellable>& cancellable, const std::string& etag, bool make_backup, FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileOutputStream> 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() ? 0 : 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 = 0;
- Glib::RefPtr<FileOutputStream> 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() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(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 = 0;
- Glib::RefPtr<FileIOStream> 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() ? 0 : 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 = 0;
- Glib::RefPtr<FileIOStream> 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() ? 0 : etag.c_str(), static_cast<int>(make_backup), ((GFileCreateFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_directory(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_directory(FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_directory(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_file(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor_file(FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor_file(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor(const Glib::RefPtr<Cancellable>& cancellable, FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileMonitor> File::monitor(FileMonitorFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileMonitor> retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_monitor(gobj(), ((GFileMonitorFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::create_file(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::create_file(FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileIOStream> File::create_file_readwrite(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileIOStream> File::create_file_readwrite(FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileIOStream> retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_create_readwrite(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::append_to(const Glib::RefPtr<Cancellable>& cancellable, FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileOutputStream> File::append_to(FileCreateFlags flags)
{
GError* gerror = 0;
- Glib::RefPtr<FileOutputStream> retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
+ auto retvalue = Glib::wrap(g_file_append_to(gobj(), ((GFileCreateFlags)(flags)), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
FileAttributeInfo
FileAttributeInfoList::lookup(const std::string& name) const
{
- GFileAttributeInfoList* cobject = const_cast<GFileAttributeInfoList*>(gobj());
+ auto cobject = const_cast<GFileAttributeInfoList*>(gobj());
const GFileAttributeInfo* cinfo =
g_file_attribute_info_list_lookup (cobject, name.c_str());
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_next_files_async(gobj(),
num_files,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_next_files_async(gobj(),
num_files,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_close_async(gobj(),
io_priority,
// helper setters
_WRAP_METHOD(void set_file_type(FileType type), g_file_info_set_file_type)
- _WRAP_METHOD(void set_is_hidden(bool is_hidden = true), g_file_info_set_is_hidden)
- _WRAP_METHOD(void set_is_symlink(bool is_symlink = true), g_file_info_set_is_symlink)
+ _WRAP_METHOD(void set_is_hidden(bool hidden = true), g_file_info_set_is_hidden)
+ _WRAP_METHOD(void set_is_symlink(bool symlink = true), g_file_info_set_is_symlink)
_WRAP_METHOD(void set_name(const std::string& name), g_file_info_set_name)
//TODO: This should take a ustring instead. See https://bugzilla.gnome.org/show_bug.cgi?id=615950#c4
Glib::RefPtr<FileInfo> FileInputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> 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()), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_input_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_input_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
Glib::RefPtr<FileInfo> FileIOStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_io_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> FileIOStream::query_info(const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> 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()), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_io_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_io_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
+ auto retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes)
{
GError* gerror = 0;
- Glib::RefPtr<FileInfo> 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()), 0, &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_output_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_file_output_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
invocation.
</parameter_description>
</parameter>
+<parameter name="G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION">
+<parameter_description> the caller is prepared to
+wait for interactive authorization. Since 2.46.
+</parameter_description>
+</parameter>
</parameters>
</enum>
owner for the destination name in response to this message.
</parameter_description>
</parameter>
+<parameter name="G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION">
+<parameter_description> If set on a method
+call, this flag means that the caller is prepared to wait for interactive
+authorization. Since 2.46.
+</parameter_description>
+</parameter>
</parameters>
</enum>
</description>
</property>
+<property name="GPropertyAction:invert-boolean">
+<description>
+If %TRUE, the state of the action will be the negation of the
+property value, provided the property is boolean.
+
+Since: 2.46
+
+</description>
+</property>
+
<property name="GPropertyAction:name">
<description>
The name of the action. This is mostly meaningful for identifying
</description>
</property>
+<property name="GWin32RegistryKey:path">
+<description>
+A path to the key in the registry, in UTF-8.
+
+Since: 2.46
+
+</description>
+</property>
+
+<property name="GWin32RegistryKey:path-utf16">
+<description>
+A path to the key in the registry, in UTF-16.
+
+Since: 2.46
+
+</description>
+</property>
+
<property name="GZlibCompressor:file-info">
<description>
If set to a non-%NULL #GFileInfo object, and #GZlibCompressor:format is
</parameter_description>
</parameter>
</parameters>
-<return> the state type, if the action
-is stateful
+<return> the state type, if the action is stateful
</return>
</function>
or the error %G_IO_ERROR_WRONG_ETAG will be returned.
If @make_backup is %TRUE, this function will attempt to make a backup
-of @file.
+of @file. Internally, it uses g_file_replace(), so will try to replace the
+file contents in the safest way possible. For example, atomic renames are
+used when replacing local files’ contents.
If @cancellable is not %NULL, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
<return></return>
</function>
+<function name="g_native_socket_address_new">
+<description>
+Creates a new #GNativeSocketAddress for @address and @port.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="address">
+<parameter_description> a #GNativeAddress
+</parameter_description>
+</parameter>
+<parameter name="port">
+<parameter_description> a port number
+</parameter_description>
+</parameter>
+</parameters>
+<return> a new #GNativeSocketAddress
+
+</return>
+</function>
+
<function name="g_network_address_get_hostname">
<description>
Gets @addr's hostname. This might be either UTF-8 or ASCII-encoded,
<function name="g_resource_ref">
<description>
-Atomically increments the reference count of @array by one. This
+Atomically increments the reference count of @resource by one. This
function is MT-safe and may be called from any thread.
Since: 2.32
<function name="g_resource_unref">
<description>
Atomically decrements the reference count of @resource by one. If the
-reference count drops to 0, all memory allocated by the array is
+reference count drops to 0, all memory allocated by the resource is
released. This function is MT-safe and may be called from any
thread.
</return>
</function>
+<function name="g_settings_schema_list_keys">
+<description>
+Introspects the list of keys on @schema.
+
+You should probably not be calling this function from "normal" code
+(since you should already know what keys are in your schema). This
+function is intended for introspection reasons.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="schema">
+<parameter_description> a #GSettingsSchema
+</parameter_description>
+</parameter>
+</parameters>
+<return> a list of the keys on
+@schema
+
+</return>
+</function>
+
<function name="g_settings_schema_ref">
<description>
Increase the reference count of @schema, returning a new reference.
On success, the returned #GSocket takes ownership of @fd. On failure, the
caller must close @fd themselves.
+Since GLib 2.46, it is no longer a fatal error to call this on a non-socket
+descriptor. Instead, a GError will be set with code %G_IO_ERROR_FAILED
+
Since: 2.22
</description>
Returns the value of the environment variable @variable in the
environment of processes launched from this launcher.
-The returned string is in the GLib file name encoding. On UNIX, this
-means that it can be an arbitrary byte string. On Windows, it will
-be UTF-8.
+On UNIX, the returned string can be an arbitrary byte string.
+On Windows, it will be UTF-8.
Since: 2.40
As an alternative, you can use g_subprocess_launcher_setenv(),
g_subprocess_launcher_unsetenv(), etc.
-All strings in this array are expected to be in the GLib file name
-encoding. On UNIX, this means that they can be arbitrary byte
-strings. On Windows, they should be in UTF-8.
+On UNIX, all strings in this array can be arbitrary byte strings.
+On Windows, they should be in UTF-8.
Since: 2.40
Sets the environment variable @variable in the environment of
processes launched from this launcher.
-Both the variable's name and value should be in the GLib file name
-encoding. On UNIX, this means that they can be arbitrary byte
-strings. On Windows, they should be in UTF-8.
-
+On UNIX, both the variable's name and value can be arbitrary byte
+strings, except that the variable's name cannot contain '='.
+On Windows, they should be in UTF-8.
Since: 2.40
Removes the environment variable @variable from the environment of
processes launched from this launcher.
-The variable name should be in the GLib file name encoding. On UNIX,
-this means that they can be arbitrary byte strings. On Windows, they
-should be in UTF-8.
+On UNIX, the variable's name can be an arbitrary byte string not
+containing '='. On Windows, it should be in UTF-8.
Since: 2.40
<return></return>
</function>
+<function name="g_win32_registry_key_erase_change_indicator">
+<description>
+Erases change indicator of the @key.
+
+Subsequent calls to g_win32_registry_key_has_changed() will return %FALSE
+until the key is put on watch again by calling
+g_win32_registry_key_watch() again.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_key_get_child">
+<description>
+Opens a @subkey of the @key.
+
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a parent #GWin32RegistryKey
+</parameter_description>
+</parameter>
+<parameter name="subkey">
+<parameter_description> name of a child key to open (in UTF-8), relative to @key
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to a %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> a #GWin32RegistryKey or %NULL if can't be opened. Free
+with g_object_unref().
+</return>
+</function>
+
+<function name="g_win32_registry_key_get_child_w">
+<description>
+Opens a @subkey of the @key.
+
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a parent #GWin32RegistryKey
+</parameter_description>
+</parameter>
+<parameter name="subkey">
+<parameter_description> name of a child key to open (in UTF-8), relative to @key
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to a %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> a #GWin32RegistryKey or %NULL if can't be opened. Free
+with g_object_unref().
+</return>
+</function>
+
+<function name="g_win32_registry_key_get_path">
+<description>
+Get full path to the key
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+</parameters>
+<return> a full path to the key (in UTF-8),
+or %NULL if it can't be converted to UTF-8.
+
+</return>
+</function>
+
+<function name="g_win32_registry_key_get_path_w">
+<description>
+Get full path to the key
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+</parameters>
+<return> a full path to the key (in UTF-16)
+
+</return>
+</function>
+
+<function name="g_win32_registry_key_get_value">
+<description>
+Get data from a value of a key. String data is guaranteed to be
+appropriately terminated and will be in UTF-8.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+<parameter name="auto_expand">
+<parameter_description> (in) %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR
+to G_WIN32_REGISTRY_VALUE_STR.
+</parameter_description>
+</parameter>
+<parameter name="value_name">
+<parameter_description> name of the value to get (in UTF-8).
+Empty string means the '(Default)' value.
+</parameter_description>
+</parameter>
+<parameter name="value_type">
+<parameter_description> type of the value retrieved.
+</parameter_description>
+</parameter>
+<parameter name="value_data">
+<parameter_description> contents of the value.
+</parameter_description>
+</parameter>
+<parameter name="value_data_size">
+<parameter_description> size of the buffer pointed
+by @value_data.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE on success, %FALSE on failure.
+
+</return>
+</function>
+
+<function name="g_win32_registry_key_get_value_w">
+<description>
+Get data from a value of a key.
+
+Get data from a value of a key. String data is guaranteed to be
+appropriately terminated and will be in UTF-16.
+
+When calling with value_data == NULL (to get data size without getting
+the data itself) remember that returned size corresponds to possibly
+unterminated string data (if value is some kind of string), because
+termination cannot be checked and fixed unless the data is retreived
+too.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+<parameter name="auto_expand">
+<parameter_description> (in) %TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR
+to G_WIN32_REGISTRY_VALUE_STR.
+</parameter_description>
+</parameter>
+<parameter name="value_name">
+<parameter_description> name of the value to get (in UTF-16).
+Empty string means the '(Default)' value.
+</parameter_description>
+</parameter>
+<parameter name="value_type">
+<parameter_description> type of the value retrieved.
+</parameter_description>
+</parameter>
+<parameter name="value_data">
+<parameter_description> contents of the value.
+</parameter_description>
+</parameter>
+<parameter name="value_data_size">
+<parameter_description> size of the buffer pointed
+by @value_data.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE on success, %FALSE on failure.
+
+</return>
+</function>
+
+<function name="g_win32_registry_key_has_changed">
+<description>
+Check the @key's status indicator.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the @key was put under watch at some point and has changed
+since then, %FALSE if it either wasn't changed or wasn't watched at all.
+
+</return>
+</function>
+
+<function name="g_win32_registry_key_new">
+<description>
+Creates an object that represents a registry key specified by @path.
+@path must start with one of the following pre-defined names:
+- HKEY_CLASSES_ROOT
+- HKEY_CURRENT_CONFIG
+- HKEY_CURRENT_USER
+- HKEY_CURRENT_USER_LOCAL_SETTINGS
+- HKEY_LOCAL_MACHINE
+- HKEY_PERFORMANCE_DATA
+- HKEY_PERFORMANCE_NLSTEXT
+- HKEY_PERFORMANCE_TEXT
+- HKEY_USERS
+@path must not end with '\\'.
+
+
+</description>
+<parameters>
+<parameter name="path">
+<parameter_description> absolute full name of a key to open (in UTF-8)
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to a %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> a #GWin32RegistryKey or %NULL if can't
+be opened. Free with g_object_unref().
+</return>
+</function>
+
+<function name="g_win32_registry_key_new_w">
+<description>
+Creates an object that represents a registry key specified by @path.
+@path must start with one of the following pre-defined names:
+- HKEY_CLASSES_ROOT
+- HKEY_CURRENT_CONFIG
+- HKEY_CURRENT_USER
+- HKEY_CURRENT_USER_LOCAL_SETTINGS
+- HKEY_LOCAL_MACHINE
+- HKEY_PERFORMANCE_DATA
+- HKEY_PERFORMANCE_NLSTEXT
+- HKEY_PERFORMANCE_TEXT
+- HKEY_USERS
+@path must not end with L'\\'.
+
+
+</description>
+<parameters>
+<parameter name="path">
+<parameter_description> absolute full name of a key to open (in UTF-16)
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to a %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> a #GWin32RegistryKey or %NULL if can't
+be opened. Free with g_object_unref().
+</return>
+</function>
+
+<function name="g_win32_registry_key_watch">
+<description>
+Puts @key under a watch.
+
+When the key changes, an APC will be queued in the current thread. The APC
+will run when the current thread enters alertable state (GLib main loop
+should do that; if you are not using it, see MSDN documentation for W32API
+calls that put thread into alertable state). When it runs, it will
+atomically switch an indicator in the @key. If a callback was specified,
+it is invoked at that point. Subsequent calls to
+g_win32_registry_key_has_changed() will return %TRUE, and the callback (if
+it was specified) will not be invoked anymore.
+Calling g_win32_registry_key_erase_change_indicator() will reset the indicator,
+and g_win32_registry_key_has_changed() will start returning %FALSE.
+To resume the watch, call g_win32_registry_key_watch_for_changes() again.
+
+Calling g_win32_registry_key_watch_for_changes() for a key that is already
+being watched is allowed and affects nothing.
+
+The fact that the key is being watched will be used internally to update
+key path (if it changes).
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey
+</parameter_description>
+</parameter>
+<parameter name="watch_children">
+<parameter_description> (in) %TRUE also watch the children of the @key, %FALSE
+to watch the key only.
+</parameter_description>
+</parameter>
+<parameter name="change_flags">
+<parameter_description> specifies the types of changes to watch for.
+</parameter_description>
+</parameter>
+<parameter name="callback">
+<parameter_description> a function to invoke when a change occurs.
+</parameter_description>
+</parameter>
+<parameter name="user_data">
+<parameter_description> a pointer to pass to @callback on invocation.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE on success, %FALSE on failure.
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_assign">
+<description>
+Assigns the value of @other to @iter. This function
+is not useful in applications, because iterators can be assigned
+with `GWin32RegistrySubkeyIter i = j;`. The
+function is used by language bindings.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+<parameter name="other">
+<parameter_description> another #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_clear">
+<description>
+Frees internal buffers of a #GWin32RegistrySubkeyIter.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_copy">
+<description>
+Creates a dynamically-allocated copy of an iterator. Dynamically-allocated
+state of the iterator is duplicated too.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> an iterator
+</parameter_description>
+</parameter>
+</parameters>
+<return> a copy of the @iter,
+free with g_win32_registry_subkey_iter_free ()
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_free">
+<description>
+Free an iterator allocated on the heap. For iterators that are allocated
+on the stack use g_win32_registry_subkey_iter_clear () instead.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a dynamically-allocated iterator
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_get_name">
+<description>
+Gets the name of the subkey at the @iter potision.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+<parameter name="subkey_name">
+<parameter_description> Pointer to a location
+to store the name of a subkey (in UTF-8). Free with g_free().
+</parameter_description>
+</parameter>
+<parameter name="subkey_name_len">
+<parameter_description> Pointer to a location to store the
+length of @subkey_name, in gchars, excluding NUL-terminator.
+%NULL if length is not needed.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the name was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_get_name_w">
+<description>
+Same as g_win32_registry_subkey_iter_get_next(), but outputs UTF-16-encoded
+data, without converting it to UTF-8 first.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+<parameter name="subkey_name">
+<parameter_description> Pointer to a location
+to store the name of a subkey (in UTF-16).
+</parameter_description>
+</parameter>
+<parameter name="subkey_name_len">
+<parameter_description> Pointer to a location
+to store the length of @subkey_name, in gunichar2s, excluding
+NUL-terminator.
+%NULL if length is not needed.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the name was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_init">
+<description>
+Initialises (without allocating) a #GWin32RegistrySubkeyIter. @iter may be
+completely uninitialised prior to this call; its old value is
+ignored.
+
+The iterator remains valid for as long as @key exists.
+Clean up its internal buffers with a call to
+g_win32_registry_subkey_iter_clear() when done.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a pointer to a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey to iterate over
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if iterator was initialized successfully, %FALSE on error.
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_n_subkeys">
+<description>
+Queries the number of subkeys items in the key that we are
+iterating over. This is the total number of subkeys -- not the number
+of items remaining.
+
+This information is accurate at the point of iterator initialization,
+and may go out of sync with reality even while subkeys are enumerated.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+</parameters>
+<return> the number of subkeys in the key
+
+</return>
+</function>
+
+<function name="g_win32_registry_subkey_iter_next">
+<description>
+Moves iterator to the next subkey.
+Enumeration errors can be ignored if @skip_errors is %TRUE
+
+Here is an example for iterating with g_win32_registry_subkey_iter_next():
+|[<!-- language="C" -->
+// recursively iterate a key
+void
+iterate_key_recursive (GWin32RegistryKey *key)
+{
+GWin32RegistrySubkeyIter iter;
+gchar *name;
+GWin32RegistryKey *child;
+
+if (!g_win32_registry_subkey_iter_init (&iter, key, NULL))
+return;
+
+while (g_win32_registry_subkey_iter_next (&iter, TRUE, NULL))
+{
+if (!g_win32_registry_subkey_iter_get_name (&iter, &name, NULL, NULL))
+continue;
+
+g_print ("subkey '%s'\n", name);
+child = g_win32_registry_key_get_child (key, name, NULL);
+
+if (child)
+iterate_key_recursive (child);
+}
+
+g_win32_registry_subkey_iter_clear (&iter);
+}
+]|
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistrySubkeyIter
+</parameter_description>
+</parameter>
+<parameter name="skip_errors">
+<parameter_description> %TRUE if iterator should silently ignore errors (such as
+the actual number of subkeys being less than expected) and
+proceed forward
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if next subkey info was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_assign">
+<description>
+Assigns the value of @other to @iter. This function
+is not useful in applications, because iterators can be assigned
+with `GWin32RegistryValueIter i = j;`. The
+function is used by language bindings.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="other">
+<parameter_description> another #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_value_iter_clear">
+<description>
+Frees internal buffers of a #GWin32RegistryValueIter.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_value_iter_copy">
+<description>
+Creates a dynamically-allocated copy of an iterator. Dynamically-allocated
+state of the iterator is duplicated too.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> an iterator
+</parameter_description>
+</parameter>
+</parameters>
+<return> a copy of the @iter,
+free with g_win32_registry_value_iter_free ().
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_free">
+<description>
+Free an iterator allocated on the heap. For iterators that are allocated
+on the stack use g_win32_registry_value_iter_clear () instead.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a dynamically-allocated iterator
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_win32_registry_value_iter_get_data">
+<description>
+Stores the data of the value currently being iterated over in @value_data,
+and its length - in @value_data_len (if not %NULL).
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</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).
+</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.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if value data was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_get_data_w">
+<description>
+Stores the data of the value currently being iterated over in @value_data,
+and its length - in @value_data_len (if not %NULL).
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<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-16, if it's a string).
+</parameter_description>
+</parameter>
+<parameter name="value_data_len">
+<parameter_description> Pointer to a location to store the size
+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_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if value data was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_get_name">
+<description>
+Stores the name of the value currently being iterated over in @value_name,
+and its length - in @value_name_len (if not %NULL).
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="value_name">
+<parameter_description> Pointer to a location
+to store the name of a value (in UTF-8).
+</parameter_description>
+</parameter>
+<parameter name="value_name_len">
+<parameter_description> Pointer to a location to store the length
+of @value_name, in gchars, excluding NUL-terminator.
+%NULL if length is not needed.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if value name was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_get_name_w">
+<description>
+Stores the name of the value currently being iterated over in @value_name,
+and its length - in @value_name (if not %NULL).
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="value_name">
+<parameter_description> Pointer to a location
+to store the name of a value (in UTF-16).
+</parameter_description>
+</parameter>
+<parameter name="value_name_len">
+<parameter_description> Pointer to a location to store the length
+of @value_name, in gunichar2s, excluding NUL-terminator.
+%NULL if length is not needed.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if value name was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_get_value_type">
+<description>
+Stores the type of the value currently being iterated over in @value_type.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="value_type">
+<parameter_description> Pointer to a location to store the type of
+the value.
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if value type was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_init">
+<description>
+Initialises (without allocating) a #GWin32RegistryValueIter. @iter may be
+completely uninitialised prior to this call; its old value is
+ignored.
+
+The iterator remains valid for as long as @key exists.
+Clean up its internal buffers with a call to
+g_win32_registry_value_iter_clear() when done.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a pointer to a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="key">
+<parameter_description> a #GWin32RegistryKey to iterate over
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if iterator was initialized successfully, %FALSE on error.
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_n_values">
+<description>
+Queries the number of values items in the key that we are
+iterating over. This is the total number of values -- not the number
+of items remaining.
+
+This information is accurate at the point of iterator initialization,
+and may go out of sync with reality even while values are enumerated.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+</parameters>
+<return> the number of values in the key
+
+</return>
+</function>
+
+<function name="g_win32_registry_value_iter_next">
+<description>
+Advances iterator to the next value in the key. If no more values remain then
+FALSE is returned.
+Enumeration errors can be ignored if @skip_errors is %TRUE
+
+Here is an example for iterating with g_win32_registry_value_iter_next():
+|[<!-- language="C" -->
+// iterate values of a key
+void
+iterate_values_recursive (GWin32RegistryKey *key)
+{
+GWin32RegistryValueIter iter;
+gchar *name;
+GWin32RegistryValueType val_type;
+gchar *val_data;
+
+if (!g_win32_registry_value_iter_init (&iter, key, NULL))
+return;
+
+while (g_win32_registry_value_iter_next (&iter, TRUE, NULL))
+{
+if ((!g_win32_registry_value_iter_get_value_type (&iter, &value)) ||
+((val_type != G_WIN32_REGISTRY_VALUE_STR) &&
+(val_type != G_WIN32_REGISTRY_VALUE_EXPAND_STR)))
+continue;
+
+if (g_win32_registry_value_iter_get_value (&iter, TRUE, &name, NULL,
+&val_data, NULL, NULL))
+g_print ("value '%s' = '%s'\n", name, val_data);
+}
+
+g_win32_registry_value_iter_clear (&iter);
+}
+]|
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="iter">
+<parameter_description> a #GWin32RegistryValueIter
+</parameter_description>
+</parameter>
+<parameter name="skip_errors">
+<parameter_description> %TRUE if iterator should silently ignore errors (such as
+the actual number of values being less than expected) and
+proceed forward
+</parameter_description>
+</parameter>
+<parameter name="error">
+<parameter_description> a pointer to %NULL #GError, or %NULL
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if next value info was retrieved, %FALSE otherwise.
+
+</return>
+</function>
+
<function name="g_zlib_compressor_get_file_info">
<description>
Returns the #GZlibCompressor:file-info property.
Glib::RefPtr<Icon> Icon::create(const std::string& str)
{
GError* gerror = 0;
- GIcon* icon = g_icon_new_for_string(str.c_str(), &gerror);
+ auto icon = g_icon_new_for_string(str.c_str(), &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_all_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_all_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_bytes_async(gobj(),
count,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_bytes_async(gobj(),
count,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_skip_async(gobj(),
count,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_skip_async(gobj(),
count,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_input_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_io_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_io_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_io_stream_splice_async(gobj(), Glib::unwrap(stream2),
static_cast<GIOStreamSpliceFlags>(flags), io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_io_stream_splice_async(gobj(), Glib::unwrap(stream2),
static_cast<GIOStreamSpliceFlags>(flags), io_priority, 0,
{
char* c_type;
GError* gerror = 0;
- Glib::RefPtr<InputStream> retval =
+ auto retval =
Glib::wrap(g_loadable_icon_load(gobj(),
size,
&c_type,
{
char* c_type;
GError* gerror = 0;
- Glib::RefPtr<InputStream> retval =
+ auto retval =
Glib::wrap(g_loadable_icon_load(gobj(),
size,
&c_type,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_loadable_icon_load_async(gobj(),
size,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_loadable_icon_load_async(gobj(),
size,
void destroy_data_callback(void* user_data)
{
- SlotWithData* slot_with_data = static_cast<SlotWithData*>(user_data);
+ auto slot_with_data = static_cast<SlotWithData*>(user_data);
g_return_if_fail(slot_with_data != 0);
try
void MemoryInputStream::add_data(const void* data, gssize len, const SlotDestroyData& destroy_slot)
{
- SlotWithData* slot_with_data = new SlotWithData(destroy_slot, const_cast<void*>(data));
- GBytes* bytes = g_bytes_new_with_free_func(data, len, &destroy_data_callback, slot_with_data);
+ auto slot_with_data = new SlotWithData(destroy_slot, const_cast<void*>(data));
+ auto bytes = g_bytes_new_with_free_func(data, len, &destroy_data_callback, slot_with_data);
g_memory_input_stream_add_bytes(gobj(), bytes);
g_bytes_unref(bytes); // g_memory_input_stream_add_bytes() takes a reference
}
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_unmount_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_eject_with_operation(gobj(),
GMountUnmountFlags(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_guess_content_type(gobj(),
force_rescan,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_mount_guess_content_type(gobj(),
force_rescan,
NetworkAddress::parse(const std::string& host_and_port, guint16 default_port)
{
GError *error = 0;
- GNetworkAddress *address = G_NETWORK_ADDRESS
+ auto *address = G_NETWORK_ADDRESS
(g_network_address_parse (host_and_port.c_str (), default_port,
&error));
if (error)
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_network_monitor_can_reach_async(gobj(),
Glib::unwrap(connectable),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_all_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_all_async(gobj(),
buffer,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_splice_async(gobj(),
Glib::unwrap(source),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_splice_async(gobj(),
Glib::unwrap(source),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_flush_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_flush_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_output_stream_close_async(gobj(),
io_priority,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_proxy_connect_async(gobj(),
Glib::unwrap(connection),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_proxy_connect_async(gobj(),
Glib::unwrap(connection),
std::vector<Glib::ustring> ProxyResolver::lookup(const Glib::ustring& uri)
{
GError* gerror = 0;
- std::vector<Glib::ustring> retvalue =
+ auto retvalue =
Glib::ArrayHandler<Glib::ustring>::array_to_vector(g_proxy_resolver_lookup(gobj(), uri.c_str(), 0, &(gerror)), Glib::OWNERSHIP_DEEP);
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_proxy_resolver_lookup_async(gobj(),
uri.c_str(),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_proxy_resolver_lookup_async(gobj(),
uri.c_str(),
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_by_name_async (gobj(),
hostname.c_str(),
Resolver::lookup_by_name_async(const Glib::ustring& hostname,
const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_by_name_async (gobj(),
hostname.c_str(),
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_by_address_async (gobj(),
Glib::unwrap(address),
Resolver::lookup_by_address_async(const Glib::RefPtr<InetAddress>& address,
const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_by_address_async (gobj(),
Glib::unwrap(address),
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_service_async (gobj(),
service.c_str(),
const Glib::ustring& domain,
const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_service_async (gobj(),
service.c_str(),
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_records_async(gobj(),
(rrname.empty() ? 0 : rrname.c_str()),
ResolverRecordType record_type,
const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_resolver_lookup_records_async(gobj(),
(rrname.empty() ? 0 : rrname.c_str()),
void Settings::get_value(const Glib::ustring& key, Glib::VariantBase& value) const
{
- GVariant* const g_value = g_settings_get_value(const_cast<GSettings*>(gobj()), key.c_str());
+ const auto g_value = g_settings_get_value(const_cast<GSettings*>(gobj()), key.c_str());
if(!g_value)
return;
bool Settings::get_user_value(const Glib::ustring& key, Glib::VariantBase& value) const
{
- GVariant* const g_value = g_settings_get_user_value(const_cast<GSettings*>(gobj()), key.c_str());
+ const auto g_value = g_settings_get_user_value(const_cast<GSettings*>(gobj()), key.c_str());
if(!g_value)
return false;
void Settings::get_default_value(const Glib::ustring& key, Glib::VariantBase& value) const
{
- GVariant* const g_value = g_settings_get_default_value(const_cast<GSettings*>(gobj()), key.c_str());
+ const auto g_value = g_settings_get_default_value(const_cast<GSettings*>(gobj()), key.c_str());
if(!g_value)
return;
{
GError* gerror = 0;
GSocketAddress* caddr = 0;
- gssize retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
+ auto retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = 0;
GSocketAddress* caddr = 0;
- gssize retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, 0, &(gerror));
+ auto retvalue = g_socket_receive_from(gobj(), &caddr, buffer, size, 0, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
- gssize const retvalue = g_socket_receive_with_blocking(gobj(), buffer, size,
+ const auto retvalue = g_socket_receive_with_blocking(gobj(), buffer, size,
blocking, Glib::unwrap(cancellable), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
- gssize const retvalue = g_socket_send_with_blocking(gobj(), buffer, size,
+ const auto retvalue = g_socket_send_with_blocking(gobj(), buffer, size,
blocking, Glib::unwrap(cancellable), &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_address_enumerator_next_async(gobj(),
Glib::unwrap(cancellable),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_async (gobj(),
connectable->gobj (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_async (gobj(),
connectable->gobj (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_host_async (gobj(),
host_and_port.c_str (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_host_async (gobj(),
host_and_port.c_str (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_service_async (gobj(),
domain.c_str (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_service_async (gobj(),
domain.c_str (),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_uri_async (gobj(),
uri.c_str(), default_port,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_client_connect_to_uri_async (gobj(),
uri.c_str(), default_port,
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_connection_connect_async(gobj(),
Glib::unwrap(address),
SocketConnection::connect_async(const Glib::RefPtr<SocketAddress>& address,
const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_connection_connect_async(gobj(),
Glib::unwrap(address),
guint16 SocketListener::add_any_inet_port()
{
GError* gerror = 0;
- const guint16 retvalue = g_socket_listener_add_any_inet_port(gobj(), 0, &gerror);
+ const auto retvalue = g_socket_listener_add_any_inet_port(gobj(), 0, &gerror);
if(gerror)
::Glib::Error::throw_exception(gerror);
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocket* retvalue = g_socket_listener_accept_socket(gobj(),
+ auto retvalue = g_socket_listener_accept_socket(gobj(),
&retobj,
Glib::unwrap(cancellable),
&gerror);
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocket* retvalue = g_socket_listener_accept_socket(gobj(),
+ auto retvalue = g_socket_listener_accept_socket(gobj(),
&retobj,
0,
&gerror);
Glib::RefPtr<Socket> SocketListener::accept_socket(const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
- GSocket* retvalue = g_socket_listener_accept_socket(gobj(),
+ auto retvalue = g_socket_listener_accept_socket(gobj(),
0,
Glib::unwrap(cancellable),
&gerror);
Glib::RefPtr<Socket> SocketListener::accept_socket()
{
GError* gerror = 0;
- GSocket* retvalue = g_socket_listener_accept_socket(gobj(),
+ auto retvalue = g_socket_listener_accept_socket(gobj(),
0,
0,
&gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_socket_async(gobj(),
Glib::unwrap(cancellable),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_socket_async(gobj(),
0,
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocket* retvalue = g_socket_listener_accept_socket_finish(gobj(),
+ auto retvalue = g_socket_listener_accept_socket_finish(gobj(),
Glib::unwrap(result),
&retobj,
&gerror);
Glib::RefPtr<Socket> SocketListener::accept_socket_finish(const Glib::RefPtr<AsyncResult>& result)
{
GError* gerror = 0;
- GSocket* retvalue = g_socket_listener_accept_socket_finish(gobj(),
+ auto retvalue = g_socket_listener_accept_socket_finish(gobj(),
Glib::unwrap(result),
0,
&gerror);
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocketConnection* retvalue = g_socket_listener_accept(gobj(),
+ auto retvalue = g_socket_listener_accept(gobj(),
&retobj,
Glib::unwrap(cancellable),
&gerror);
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocketConnection* retvalue = g_socket_listener_accept(gobj(),
+ auto retvalue = g_socket_listener_accept(gobj(),
&retobj,
0,
&gerror);
Glib::RefPtr<SocketConnection> SocketListener::accept(const Glib::RefPtr<Cancellable>& cancellable)
{
GError* gerror = 0;
- GSocketConnection* retvalue = g_socket_listener_accept(gobj(),
+ auto retvalue = g_socket_listener_accept(gobj(),
0,
Glib::unwrap(cancellable),
&gerror);
Glib::RefPtr<SocketConnection> SocketListener::accept()
{
GError* gerror = 0;
- GSocketConnection* retvalue = g_socket_listener_accept(gobj(),
+ auto retvalue = g_socket_listener_accept(gobj(),
0,
0,
&gerror);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_async(gobj(),
0,
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_socket_listener_accept_async(gobj(),
Glib::unwrap(cancellable),
{
GError* gerror = 0;
GObject *retobj = 0;
- GSocketConnection* retvalue = g_socket_listener_accept_finish(gobj(),
+ auto retvalue = g_socket_listener_accept_finish(gobj(),
Glib::unwrap(result),
&retobj,
&gerror);
Glib::RefPtr<SocketConnection> SocketListener::accept_finish(const Glib::RefPtr<AsyncResult>& result)
{
GError* gerror = 0;
- GSocketConnection* retvalue = g_socket_listener_accept_finish(gobj(),
+ auto retvalue = g_socket_listener_accept_finish(gobj(),
Glib::unwrap(result),
0,
&gerror);
void UnixConnection::receive_credentials_async(const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_receive_credentials_async(gobj(),
Glib::unwrap(cancellable),
void UnixConnection::receive_credentials_async(const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_receive_credentials_async(gobj(),
0,
UnixConnection::send_credentials_async(const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_send_credentials_async(gobj(),
Glib::unwrap(cancellable),
UnixConnection::send_credentials_async(const SlotAsyncReady& slot)
{
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_unix_connection_send_credentials_async(gobj(),
0,
const Glib::ArrayHandle<int> UnixFDList::peek_fds() const
{
int length = 0;
- const int* fds = g_unix_fd_list_peek_fds(const_cast<GUnixFDList*>(gobj()), &length);
+ const auto fds = g_unix_fd_list_peek_fds(const_cast<GUnixFDList*>(gobj()), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_list_peek_fds() returns.
return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_NONE);
Glib::ArrayHandle<int> UnixFDList::steal_fds()
{
int length = 0;
- const int* fds = g_unix_fd_list_steal_fds(gobj(), &length);
+ const auto fds = g_unix_fd_list_steal_fds(gobj(), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_list_steal_fds() returns.
return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_DEEP);
Glib::ArrayHandle<int> UnixFDMessage::steal_fds()
{
int length = 0;
- const int* fds = g_unix_fd_message_steal_fds(gobj(), &length);
+ const auto fds = g_unix_fd_message_steal_fds(gobj(), &length);
// The array is terminated with a -1, but that terminating element is
// not included in the length that g_unix_fd_message_steal_fds() returns.
return Glib::ArrayHandle<int>(fds, length, Glib::OWNERSHIP_DEEP);
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
- SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+ auto slot_copy = new SlotAsyncReady(slot);
g_volume_eject_with_operation(gobj(),
static_cast<GMountUnmountFlags>(flags),
// sigc::mem_fun(*this, &DispatchNotifier::pipe_io_handler), fd, Glib::IO_IN);
// except for source->set_can_recurse(true).
- const Glib::RefPtr<IOSource> source = IOSource::create(fd, Glib::IO_IN);
+ const auto source = IOSource::create(fd, Glib::IO_IN);
// If the signal emission in pipe_io_handler() starts a new main loop,
// the event source shall not be blocked while that loop runs. (E.g. while
gobject_ (0)
{}
-Error::Error(GQuark domain, int code, const Glib::ustring& message)
+Error::Error(GQuark error_domain, int error_code, const Glib::ustring& message)
:
- gobject_ (g_error_new_literal(domain, code, message.c_str()))
+ gobject_ (g_error_new_literal(error_domain, error_code, message.c_str()))
{}
Error::Error(GError* gobject, bool take_copy)
return gobject_->message;
}
-bool Error::matches(GQuark domain, int code) const
+bool Error::matches(GQuark error_domain, int error_code) const
{
- return g_error_matches(gobject_, domain, code);
+ return g_error_matches(gobject_, error_domain, error_code);
}
GError* Error::gobj()
}
// static
-void Error::register_domain(GQuark domain, Error::ThrowFunc throw_func)
+void Error::register_domain(GQuark error_domain, Error::ThrowFunc throw_func)
{
g_assert(throw_func_table != 0);
- (*throw_func_table)[domain] = throw_func;
+ (*throw_func_table)[error_domain] = throw_func;
}
// static, noreturn
{
public:
Error();
- Error(GQuark domain, int code, const Glib::ustring& message);
+ Error(GQuark error_domain, int error_code, const Glib::ustring& message);
explicit Error(GError* gobject, bool take_copy = false);
Error(const Error& other);
int code() const;
virtual Glib::ustring what() const;
- bool matches(GQuark domain, int code) const;
+ bool matches(GQuark error_domain, int error_code) const;
GError* gobj();
const GError* gobj() const;
static void register_init();
static void register_cleanup();
- static void register_domain(GQuark domain, ThrowFunc throw_func);
+ static void register_domain(GQuark error_domain, ThrowFunc throw_func);
static void throw_exception(GError* gobject) G_GNUC_NORETURN;
{
size_type j = 0;
iterator i;
- for(i = begin(), j = 0; i != end(), j < l; ++i, ++j)
+ for(i = begin(), j = 0; i != end() && j < l; ++i, ++j)
;
return (*i);
}
sigc::connection SignalIO::connect(const sigc::slot<bool,IOCondition>& slot,
int fd, IOCondition condition, int priority)
{
- const Glib::RefPtr<IOSource> source = IOSource::create(fd, condition);
+ const auto source = IOSource::create(fd, condition);
if(priority != G_PRIORITY_DEFAULT)
source->set_priority(priority);
const Glib::RefPtr<IOChannel>& channel,
IOCondition condition, int priority)
{
- const Glib::RefPtr<IOSource> source = IOSource::create(channel, condition);
+ const auto source = IOSource::create(channel, condition);
if(priority != G_PRIORITY_DEFAULT)
source->set_priority(priority);
* is equivalent to:
* @code
* bool timeout_handler() { ... }
- * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(1000);
+ * const auto timeout_source = Glib::TimeoutSource::create(1000);
* timeout_source->connect(sigc::ptr_fun(&timeout_handler));
* timeout_source->attach(Glib::MainContext::get_default());
* @endcode
* is equivalent to:
* @code
* bool timeout_handler() { ... }
- * const Glib::RefPtr<Glib::TimeoutSource> timeout_source = Glib::TimeoutSource::create(5000);
+ * const auto timeout_source = Glib::TimeoutSource::create(5000);
* timeout_source->connect(sigc::ptr_fun(&timeout_handler));
* timeout_source->attach(Glib::MainContext::get_default());
* @endcode
* is equivalent to:
* @code
* bool idle_handler() { ... }
- * const Glib::RefPtr<Glib::IdleSource> idle_source = Glib::IdleSource::create();
+ * const auto idle_source = Glib::IdleSource::create();
* idle_source->connect(sigc::ptr_fun(&idle_handler));
* idle_source->attach(Glib::MainContext::get_default());
* @endcode
* is equivalent to:
* @code
* bool io_handler(Glib::IOCondition io_condition) { ... }
- * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP);
+ * const auto io_source = Glib::IOSource::create(fd, Glib::IO_IN | Glib::IO_HUP);
* io_source->connect(sigc::ptr_fun(&io_handler));
* io_source->attach(Glib::MainContext::get_default());
* @endcode
* is equivalent to:
* @code
* bool io_handler(Glib::IOCondition io_condition) { ... }
- * const Glib::RefPtr<Glib::IOSource> io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP);
+ * const auto io_source = Glib::IOSource::create(channel, Glib::IO_IN | Glib::IO_HUP);
* io_source->connect(sigc::ptr_fun(&io_handler));
* io_source->attach(Glib::MainContext::get_default());
* @endcode
{
bool failed = false;
- if(std::fstream *const stream = dynamic_cast<std::fstream*>(stream_in_))
+ if(std::fstream *const fstream = dynamic_cast<std::fstream*>(stream_in_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ fstream->clear();
+ fstream->close();
+ failed = fstream->fail();
}
- else if(std::ifstream *const stream = dynamic_cast<std::ifstream*>(stream_in_))
+ else if(std::ifstream *const ifstream = dynamic_cast<std::ifstream*>(stream_in_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ ifstream->clear();
+ ifstream->close();
+ failed = ifstream->fail();
}
- else if(std::ofstream *const stream = dynamic_cast<std::ofstream*>(stream_out_))
+ else if(std::ofstream *const ofstream = dynamic_cast<std::ofstream*>(stream_out_))
{
- stream->clear();
- stream->close();
- failed = stream->fail();
+ ofstream->clear();
+ ofstream->close();
+ failed = ofstream->fail();
}
else
{
struct tm tm_data;
g_date_to_struct_tm(&gobject_, &tm_data);
- const std::string locale_format = locale_from_utf8(format);
+ const auto locale_format = locale_from_utf8(format);
gsize bufsize = std::max<gsize>(2 * locale_format.size(), 128);
// Set the first byte to something other than '\0', to be able to
// recognize whether strftime actually failed or just returned "".
buf.get()[0] = '\1';
- const gsize len = strftime(buf.get(), bufsize, locale_format.c_str(), &tm_data);
+ const auto len = strftime(buf.get(), bufsize, locale_format.c_str(), &tm_data);
if(len != 0 || buf.get()[0] == '\0')
{
_WRAP_METHOD(DateTime to_timezone(const TimeZone& tz) const, g_date_time_to_timezone)
_WRAP_METHOD(DateTime to_local() const, g_date_time_to_local)
_WRAP_METHOD(DateTime to_utc() const, g_date_time_to_utc)
- _WRAP_METHOD(Glib::ustring format(const Glib::ustring& format) const, g_date_time_format)
+ _WRAP_METHOD(Glib::ustring format(const Glib::ustring& format_str) const, g_date_time_format)
};
} // namespace Glib
int mkstemp(std::string& filename_template)
{
const ScopedPtr<char> buf (g_strndup(filename_template.data(), filename_template.size()));
- const int fileno = g_mkstemp(buf.get());
+ const auto fileno = g_mkstemp(buf.get());
filename_template = buf.get();
return fileno;
GError* error = 0;
ScopedPtr<char> buf_name_used;
- const int fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error);
+ const auto fileno = g_file_open_tmp(basename_template.c_str(), buf_name_used.addr(), &error);
if(error)
Glib::Error::throw_exception(error);
GError* error = 0;
ScopedPtr<char> buf_name_used;
- const int fileno = g_file_open_tmp(0, buf_name_used.addr(), &error);
+ const auto fileno = g_file_open_tmp(0, buf_name_used.addr(), &error);
if(error)
Glib::Error::throw_exception(error);
<return></return>
</function>
+<function name="g_async_queue_push_front">
+<description>
+Pushes the @data into the @queue. @data 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.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="queue">
+<parameter_description> a #GAsyncQueue
+</parameter_description>
+</parameter>
+<parameter name="data">
+<parameter_description> @data to push into the @queue
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="g_async_queue_push_front_unlocked">
+<description>
+Pushes the @data into the @queue. @data 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.
+
+This function must be called while holding the @queue's lock.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="queue">
+<parameter_description> a #GAsyncQueue
+</parameter_description>
+</parameter>
+<parameter name="data">
+<parameter_description> @data to push into the @queue
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
<function name="g_async_queue_push_sorted">
<description>
Inserts @data into @queue using @func to determine the new
<return></return>
</function>
+<function name="g_async_queue_remove">
+<description>
+Remove an item from the queue. This function does not block.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="queue">
+<parameter_description> a #GAsyncQueue
+</parameter_description>
+</parameter>
+<parameter name="data">
+<parameter_description> the @data to remove from the @queue
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the item was removed
+
+</return>
+</function>
+
+<function name="g_async_queue_remove_unlocked">
+<description>
+Remove an item from the queue. This function does not block.
+
+This function must be called while holding the @queue's lock.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="queue">
+<parameter_description> a #GAsyncQueue
+</parameter_description>
+</parameter>
+<parameter name="data">
+<parameter_description> the @data to remove from the @queue
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the item was removed
+
+</return>
+</function>
+
<function name="g_async_queue_sort">
<description>
Sorts @queue using @func.
</return>
</function>
+<function name="g_thread_pool_move_to_front">
+<description>
+Moves the item to the front of the queue of unprocessed
+items, so that it will be processed next.
+
+Since: 2.46
+
+</description>
+<parameters>
+<parameter name="pool">
+<parameter_description> a #GThreadPool
+</parameter_description>
+</parameter>
+<parameter name="data">
+<parameter_description> an unprocessed item in the pool
+</parameter_description>
+</parameter>
+</parameters>
+<return> %TRUE if the item was found and moved
+
+</return>
+</function>
+
<function name="g_thread_pool_new">
<description>
This function creates a new thread pool.
)
)
+(define-method remove
+ (of-object "GAsyncQueue")
+ (c-name "g_async_queue_remove")
+ (return-type "gboolean")
+ (parameters
+ '("gpointer" "item")
+ )
+)
+
+(define-method remove_unlocked
+ (of-object "GAsyncQueue")
+ (c-name "g_async_queue_remove_unlocked")
+ (return-type "gboolean")
+ (parameters
+ '("gpointer" "item")
+ )
+)
+
+(define-method push_front
+ (of-object "GAsyncQueue")
+ (c-name "g_async_queue_push_front")
+ (return-type "none")
+ (parameters
+ '("gpointer" "item")
+ )
+)
+
+(define-method push_front_unlocked
+ (of-object "GAsyncQueue")
+ (c-name "g_async_queue_push_front_unlocked")
+ (return-type "none")
+ (parameters
+ '("gpointer" "item")
+ )
+)
+
(define-method timed_pop
(of-object "GAsyncQueue")
(c-name "g_async_queue_timed_pop")
)
)
+(define-method move_to_front
+ (of-object "GThreadPool")
+ (c-name "g_thread_pool_move_to_front")
+ (return-type "gboolean")
+ (parameters
+ '("gpointer" "data")
+ )
+)
+
(define-method set_max_threads
(of-object "GThreadPool")
(c-name "g_thread_pool_set_max_threads")
reinterpret_cast<GlibmmIOChannel*>(gobject_)->wrapper = 0;
}
- GIOChannel *const tmp_gobject = gobject_;
+ const auto tmp_gobject = gobject_;
gobject_ = 0;
g_io_channel_unref(tmp_gobject);
Glib::RefPtr<IOChannel> IOChannel::create_from_file(const std::string& filename, const std::string& mode)
{
GError* gerror = 0;
- GIOChannel *const channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
+ const auto channel = g_io_channel_new_file(filename.c_str(), mode.c_str(), &gerror);
if(gerror)
{
GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
+ const auto status = g_io_channel_read_line(gobj(), buf.addr(), &bytes, 0, &gerror);
if(gerror)
{
GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror);
+ const auto status = g_io_channel_read_to_end(gobj(), buf.addr(), &bytes, &gerror);
if(gerror)
{
GError* gerror = 0;
gsize bytes = 0;
- const GIOStatus status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
+ const auto status = g_io_channel_read_chars(gobj(), buf.get(), count, &bytes, &gerror);
if(gerror)
{
{
GError* gerror = 0;
- const GIOStatus status = g_io_channel_set_encoding(
+ const auto status = g_io_channel_set_encoding(
gobj(), (encoding.empty()) ? 0 : encoding.c_str(), &gerror);
if(gerror)
GIOStatus GlibmmIOChannel::io_read(GIOChannel* channel, char* buf, gsize count,
gsize* bytes_read, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
GIOStatus GlibmmIOChannel::io_write(GIOChannel* channel, const char* buf, gsize count,
gsize* bytes_written, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
GIOStatus GlibmmIOChannel::io_seek(GIOChannel* channel, gint64 offset, GSeekType type, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
GIOStatus GlibmmIOChannel::io_close(GIOChannel* channel, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
// static
GSource* GlibmmIOChannel::io_create_watch(GIOChannel* channel, GIOCondition condition)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
- const Glib::RefPtr<Source> source = wrapper->create_watch_vfunc((IOCondition) condition);
+ const auto source = wrapper->create_watch_vfunc((IOCondition) condition);
return (source) ? source->gobj_copy() : 0;
}
catch(...)
GIOStatus GlibmmIOChannel::io_set_flags(GIOChannel* channel, GIOFlags flags, GError** err)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
// static
GIOFlags GlibmmIOChannel::io_get_flags(GIOChannel* channel)
{
- IOChannel *const wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
+ const auto wrapper = reinterpret_cast<GlibmmIOChannel*>(channel)->wrapper;
try
{
* Any pending data to be written will be flushed if @a flush is <tt>true</tt>.
* The channel will not be freed until the last reference is dropped.
* Accessing the channel after closing it is considered an error.
- * @param flush Whether to flush() pending data before closing the channel.
+ * @param flush_pending Whether to flush() pending data before closing the channel.
* @return The status of the operation.
* @throw Glib::IOChannelError
*/
- _WRAP_METHOD(IOStatus close(bool flush = true), g_io_channel_shutdown, errthrow)
+ _WRAP_METHOD(IOStatus close(bool flush_pending = true), g_io_channel_shutdown, errthrow)
/** Get the IOChannel internal buffer size.
* @return The buffer size.
/*
OptionGroup OptionContext::get_main_group() const
{
- const GOptionGroup* cobj = g_option_context_get_main_group(const_cast<GOptionContext*>( gobj()) );
+ const auto cobj = g_option_context_get_main_group(const_cast<GOptionContext*>( gobj()) );
OptionGroup cppObj(const_cast<GOptionGroup*>(cobj), true); // take_copy
return cppObj;
}
{
//Create a copy of the slot. A pointer to this will be passed through the callback's data parameter.
//It will be deleted when SignalProxy_translate_gtk_callback_destroy() is called.
- SlotTranslate* slot_copy = new SlotTranslate(slot);
+ auto slot_copy = new SlotTranslate(slot);
g_option_context_set_translate_func(
gobj(), &OptionContextPrivate::SignalProxy_translate_gtk_callback, slot_copy,
{
OptionContext cppContext(context, false /* take_ownership */);
- OptionGroup* option_group = static_cast<OptionGroup*>(data);
+ auto option_group = static_cast<OptionGroup*>(data);
if(!option_group)
{
OptionError(OptionError::FAILED, "Glib::OptionGroup: g_callback_pre_parse(): "
OptionContext cppContext(context, false /* take_ownership */);
- OptionGroup* option_group = static_cast<OptionGroup*>(data);
+ auto option_group = static_cast<OptionGroup*>(data);
if(option_group)
return option_group->on_error(cppContext, *option_group);
}
//The C args have now been given values by g_option_context_parse().
//Convert C values to C++ values:
- for(type_map_entries::iterator iter = option_group->map_entries_.begin();
- iter != option_group->map_entries_.end(); ++iter)
+ for(auto& the_pair : option_group->map_entries_)
{
- CppOptionEntry& cpp_entry = iter->second;
+ auto& cpp_entry = the_pair.second;
cpp_entry.convert_c_to_cpp();
}
if(option_name[1] == '-')
{
//Long option name.
- const Glib::ustring long_option_name = Glib::ustring(option_name+2);
+ const auto long_option_name = Glib::ustring(option_name+2);
iterFind = option_group->map_entries_.find(long_option_name);
}
else
{
//Short option name.
- const gchar short_option_name = option_name[1];
+ const auto short_option_name = option_name[1];
for(iterFind = option_group->map_entries_.begin();
iterFind != option_group->map_entries_.end(); ++iterFind)
{
- const OptionGroup::CppOptionEntry& cppOptionEntry = iterFind->second;
+ const auto& cppOptionEntry = iterFind->second;
if (cppOptionEntry.entry_ &&
cppOptionEntry.entry_->get_short_name() == short_option_name)
break;
return false;
}
- const OptionGroup::CppOptionEntry& cppOptionEntry = iterFind->second;
+ const auto& cppOptionEntry = iterFind->second;
if (cppOptionEntry.carg_type_ != G_OPTION_ARG_CALLBACK)
{
OptionError(OptionError::FAILED, "Glib::OptionGroup::option_arg_callback() "
{
if (option_arg->is_filename_option())
{
- const OptionGroup::SlotOptionArgFilename* the_slot = option_arg->get_slot_filename();
+ const auto the_slot = option_arg->get_slot_filename();
const std::string cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
}
else
{
- const OptionGroup::SlotOptionArgString* the_slot = option_arg->get_slot_string();
+ const auto the_slot = option_arg->get_slot_string();
const Glib::ustring cpp_value(value ? value : "");
return (*the_slot)(cpp_option_name, cpp_value, has_value);
}
OptionGroup::~OptionGroup()
{
//Free any C types that were allocated during add_entry():
- for(type_map_entries::iterator iter = map_entries_.begin(); iter != map_entries_.end(); ++iter)
+ for(auto& the_pair : map_entries_)
{
- CppOptionEntry& cpp_entry = iter->second;
+ auto& cpp_entry = the_pair.second;
cpp_entry.release_c_arg();
}
void OptionGroup::add_entry_with_wrapper(const OptionEntry& entry, GOptionArg arg_type, void* cpp_arg)
{
- const Glib::ustring name = entry.get_long_name();
+ const auto name = entry.get_long_name();
type_map_entries::iterator iterFind = map_entries_.find(name);
if (iterFind == map_entries_.end()) //If we have not added this entry already
{
for (type_map_entries::iterator iter = map_entries_.begin();
iter != map_entries_.end(); ++iter)
{
- const CppOptionEntry& cpp_entry = iter->second;
+ const auto& cpp_entry = iter->second;
if (cpp_entry.cpparg_ == cpp_arg &&
cpp_entry.carg_type_ == arg_type &&
cpp_entry.carg_)
{
//Delete the OptionArgCallback instance that was allocated by add_entry()
//or add_entry_filename().
- OptionArgCallback* option_arg = static_cast<OptionArgCallback*>(cpp_arg);
+ auto option_arg = static_cast<OptionArgCallback*>(cpp_arg);
delete option_arg;
}
}
// Create a copy of the slot. A pointer to this will be passed through the
// callback's data parameter. It will be deleted when
// OptionGroup_Translate_glibmm_callback_destroy() is called.
- SlotTranslate* slot_copy = new SlotTranslate(slot);
+ auto slot_copy = new SlotTranslate(slot);
g_option_group_set_translate_func(gobj(),
&OptionGroup_Translate_glibmm_callback, slot_copy,
&OptionGroup_Translate_glibmm_callback_destroy);
{
//Delete the OptionArgCallback instance that was allocated by add_entry()
//or add_entry_filename().
- OptionArgCallback* option_arg = static_cast<OptionArgCallback*>(cpparg_);
+ auto option_arg = static_cast<OptionArgCallback*>(cpparg_);
delete option_arg;
cpparg_ = 0;
case G_OPTION_ARG_STRING:
{
char** typed_arg = static_cast<char**>(carg_);
- Glib::ustring* typed_cpp_arg = static_cast<Glib::ustring*>(cpparg_);
+ auto typed_cpp_arg = static_cast<Glib::ustring*>(cpparg_);
if(typed_arg && *typed_arg && typed_cpp_arg)
{
*typed_cpp_arg = *typed_arg;
case G_OPTION_ARG_FILENAME:
{
char** typed_arg = static_cast<char**>(carg_);
- std::string* typed_cpp_arg = static_cast<std::string*>(cpparg_);
+ auto typed_cpp_arg = static_cast<std::string*>(cpparg_);
if(typed_arg && *typed_arg && typed_cpp_arg)
{
*typed_cpp_arg = *typed_arg;
case G_OPTION_ARG_STRING_ARRAY:
{
char*** typed_arg = static_cast<char***>(carg_);
- vecustrings* typed_cpp_arg = static_cast<vecustrings*>(cpparg_);
+ auto typed_cpp_arg = static_cast<vecustrings*>(cpparg_);
if(typed_arg && *typed_arg && typed_cpp_arg)
{
typed_cpp_arg->clear();
case G_OPTION_ARG_FILENAME_ARRAY:
{
char*** typed_arg = static_cast<char***>(carg_);
- vecstrings* typed_cpp_arg = static_cast<vecstrings*>(cpparg_);
+ auto typed_cpp_arg = static_cast<vecstrings*>(cpparg_);
if(typed_arg && *typed_arg && typed_cpp_arg)
{
typed_cpp_arg->clear();
RegexMatchFlags match_options)
{
GError* gerror = 0;
- GRegex* regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options,
+ auto regex = g_regex_new(pattern.c_str(), (GRegexCompileFlags)compile_options,
(GRegexMatchFlags)match_options, &gerror);
if(gerror)
Glib::ustring Regex::replace(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options)
{
GError* gerror = 0;
- Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror)));
+ auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::ustring Regex::replace_literal(const Glib::ustring& string, int start_position, const Glib::ustring& replacement, RegexMatchFlags match_options)
{
GError* gerror = 0;
- Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace_literal(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror)));
+ auto retvalue = Glib::convert_return_gchar_ptr_to_ustring(g_regex_replace_literal(gobj(), string.c_str(), -1, start_position, replacement.c_str(), ((GRegexMatchFlags)(match_options)), &(gerror)));
if(gerror)
::Glib::Error::throw_exception(gerror);
Glib::StringArrayHandle Regex::split(const Glib::ustring& string, int start_position, RegexMatchFlags match_options, int max_tokens) const
{
GError* gerror = 0;
- Glib::StringArrayHandle retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP);
+ auto retvalue = Glib::StringArrayHandle(g_regex_split_full(const_cast<GRegex*>(gobj()), string.c_str(), -1, start_position, ((GRegexMatchFlags)(match_options)), max_tokens, &(gerror)), Glib::OWNERSHIP_DEEP);
if(gerror)
::Glib::Error::throw_exception(gerror);
{
}
-MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_ownership)
+MatchInfo::MatchInfo(GMatchInfo* castitem, bool take_the_ownership)
: gobject_(castitem),
- take_ownership(take_ownership)
+ take_ownership(take_the_ownership)
{
}
-void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_ownership)
+void MatchInfo::set_gobject(GMatchInfo* castitem, bool take_the_ownership)
{
- if(gobject_ && take_ownership)
+ if(gobject_ && this->take_ownership)
g_match_info_free(gobject_);
gobject_ = castitem;
- this->take_ownership = take_ownership;
+ this->take_ownership = take_the_ownership;
}
MatchInfo::~MatchInfo()
/** C object constructor.
* @param castitem The C object.
- * @param take_ownership Whether to destroy the C object with the wrapper or
+ * @param take_the_ownership Whether to destroy the C object with the wrapper or
* not.
*/
- explicit MatchInfo(GMatchInfo* castitem, bool take_ownership = true);
+ explicit MatchInfo(GMatchInfo* castitem, bool take_the_ownership = true); //TODO: Rename to take_ownership when we can rename the member variable.
/// Destructor.
virtual ~MatchInfo();
protected:
GMatchInfo* gobject_; // The C object.
- bool take_ownership; // Bool signaling ownership.
+ bool take_ownership; // Bool signaling ownership. //TODO: Give this a _ suffix when we can break API.
protected:
// So that Glib::Regex::match() can set the C object.
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static inline sigc::slot_base* data_to_slot(void* data)
{
- SignalProxyConnectionNode *const pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
+ const auto pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
// Return 0 if the connection is blocked.
return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0;
int* standard_error)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
GError* gerror = 0;
g_spawn_async_with_pipes(
int* standard_error)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
GError* gerror = 0;
g_spawn_async_with_pipes(
Pid* child_pid)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
GError* gerror = 0;
g_spawn_async(
Pid* child_pid)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
GError* gerror = 0;
g_spawn_async(
int* exit_status)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
Glib::ScopedPtr<char> buf_standard_output;
Glib::ScopedPtr<char> buf_standard_error;
int* exit_status)
{
const bool setup_slot = !child_setup.empty();
- SlotSpawnChildSetup child_setup_ = child_setup;
+ auto child_setup_ = child_setup;
Glib::ScopedPtr<char> buf_standard_output;
Glib::ScopedPtr<char> buf_standard_error;
static void* call_thread_entry_slot(void* data)
{
- sigc::slot_base *const slot = reinterpret_cast<sigc::slot_base*>(data);
+ const auto slot = reinterpret_cast<sigc::slot_base*>(data);
try
{
Thread* Thread::create(const sigc::slot<void>& slot, bool /* joinable */)
{
// Make a copy of slot on the heap
- sigc::slot_base *const slot_copy = new sigc::slot<void>(slot);
+ const auto slot_copy = new sigc::slot<void>(slot);
GError* error = 0;
- GThread *const thread = g_thread_try_new(NULL,
+ const auto thread = g_thread_try_new(NULL,
&call_thread_entry_slot, slot_copy, &error);
if(error)
bool joinable, bool bound, ThreadPriority priority)
{
// Make a copy of slot on the heap
- sigc::slot_base *const slot_copy = new sigc::slot<void>(slot);
+ const auto slot_copy = new sigc::slot<void>(slot);
GError* error = 0;
- GThread *const thread = g_thread_create_full(
+ const auto thread = g_thread_create_full(
&call_thread_entry_slot, slot_copy, stack_size, joinable,
bound, (GThreadPriority) priority, &error);
static void* call_thread_entry_slot(void* data)
{
- sigc::slot_base *const slot = reinterpret_cast<sigc::slot_base*>(data);
+ const auto slot = reinterpret_cast<sigc::slot_base*>(data);
try
{
Thread* Thread::create(const sigc::slot<void>& slot, const std::string& name)
{
// Make a copy of slot on the heap.
- sigc::slot_base *const slot_copy = new sigc::slot<void>(slot);
+ const auto slot_copy = new sigc::slot<void>(slot);
GError* error = 0;
- GThread* thread = g_thread_try_new(name.empty() ? 0 : name.c_str(),
+ auto thread = g_thread_try_new(name.empty() ? 0 : name.c_str(),
&call_thread_entry_slot, slot_copy, &error);
if (error)
bool ValueArray::get_nth(guint index, Glib::ValueBase& value)
{
- GValue* const g_value = g_value_array_get_nth(gobj(), index);
+ const auto g_value = g_value_array_get_nth(gobj(), index);
if(g_value)
{
Variant<VariantBase> Variant<VariantBase>::create(const VariantBase& data)
{
- Variant<VariantBase> result = Variant<VariantBase>(g_variant_new_variant(const_cast<GVariant*>(data.gobj())));
+ auto result = Variant<VariantBase>(g_variant_new_variant(const_cast<GVariant*>(data.gobj())));
return result;
}
Variant<Glib::ustring>
Variant<Glib::ustring>::create(const Glib::ustring& data)
{
- Variant<Glib::ustring> result =
+ auto result =
Variant<Glib::ustring>(g_variant_new_string(data.c_str()));
return result;
}
Variant<std::string>
Variant<std::string>::create(const std::string& data)
{
- Variant<std::string> result =
+ auto result =
Variant<std::string>(g_variant_new_bytestring(data.c_str()));
return result;
}
GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj());
// Add the elements of the vector into the builder.
- for(type_vec_ustring::const_iterator iter = data.begin();
- iter < data.end(); iter++)
+ for(const auto& str : data)
{
g_variant_builder_add(builder,
- element_variant_type.get_string().c_str(), iter->c_str());
+ element_variant_type.get_string().c_str(), str.c_str());
}
// Create the variant using the builder.
- Variant<type_vec_ustring> result =
+ auto result =
Variant<type_vec_ustring>(g_variant_new(
array_variant_type.get_string().c_str(), builder));
// Create the variant using g_variant_new_bytestring_array() (passing the
// newly constructed array.
- Variant<type_vec_string> result =
+ auto result =
Variant<type_vec_string>(g_variant_new_bytestring_array(str_array,
data.size()));
// Create the variant using g_variant_new_objv() (passing the
// newly constructed array.
- Variant<type_vec_string> result =
+ auto result =
Variant<type_vec_string>(g_variant_new_objv(str_array, data.size()));
g_strfreev(str_array);
GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj());
// Add the elements of the vector into the builder.
- for(typename std::vector<T>::const_iterator iter = data.begin();
- iter < data.end(); iter++)
+ for(const auto& element : data)
{
- Glib::Variant<T> variant = Glib::Variant<T>::create(*iter);
+ Glib::Variant<T> variant = Glib::Variant<T>::create(element);
g_variant_builder_add_value(builder, variant.gobj());
}
GVariantBuilder* builder = g_variant_builder_new(array_variant_type.gobj());
// Add the elements of the map into the builder.
- for(typename std::map<K, V>::const_iterator iter = data.begin();
- iter != data.end(); iter++)
+ for(const auto& element : data)
{
- Variant< std::pair<K, V> > dict_entry =
- Variant< std::pair<K, V> >::create(*iter);
+ auto dict_entry =
+ Variant< std::pair<K, V> >::create(element);
g_variant_builder_add_value(builder, dict_entry.gobj());
}
Variant<$1> Variant<$1>::create($1 data)
{
- Variant<$1> result = Variant<$1>(g_variant_new_$3(data));
+ auto result = Variant<$1>(g_variant_new_$3(data));
return result;
}
ifelse($4,,,[
Variant<$1> Variant<$1>::create_$4($1 data)
{
- Variant<$1> result = Variant<$1>(g_variant_new_$4(data));
+ auto result = Variant<$1>(g_variant_new_$4(data));
return result;
}
])dnl
VariantType VariantType::create_tuple(const std::vector<VariantType>& items)
{
typedef GVariantType* var_ptr;
- var_ptr* const var_array = new var_ptr[items.size()];
+ const auto var_array = new var_ptr[items.size()];
for(std::vector<VariantType>::size_type i = 0; i < items.size(); i++)
{
var_array[i] = const_cast<GVariantType*>(items[i].gobj());
}
- VariantType result = Glib::wrap(g_variant_type_new_tuple(var_array, items.size()));
+ auto result = Glib::wrap(g_variant_type_new_tuple(var_array, items.size()));
delete[] var_array;
return result;
}
Glib::init();
Gio::init();
- Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create();
+ auto mainloop = Glib::MainLoop::create();
- Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/etc/passwd");
+ auto file = Gio::File::create_for_path("/etc/passwd");
file->read_async(&on_read_async);
mainloop->run();
try
{
- Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(TEST_FILE);
+ auto file = Gio::File::create_for_path(TEST_FILE);
if(!file)
{
std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
return EXIT_FAILURE;
}
- Glib::RefPtr<Gio::FileInputStream> stream = file->read();
+ auto stream = file->read();
if(!stream)
{
std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl;
std::memset(buffer, 0, sizeof buffer);
try
{
- Glib::RefPtr<Gio::MemoryInputStream> stream = Gio::MemoryInputStream::create();
+ auto stream = Gio::MemoryInputStream::create();
if (!stream)
{
std::cerr << "Could not create a MemoryInputStream." << std::endl;
try
{
- Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(TEST_FILE);
+ auto file = Gio::File::create_for_path(TEST_FILE);
if(!file)
{
std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
return EXIT_FAILURE;
}
- Glib::RefPtr<Gio::FileInputStream> stream = file->read();
+ auto stream = file->read();
if(!stream)
{
std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl;
std::cout << "Outputing certificate data:" << std::endl <<
cert->property_certificate_pem().get_value();
- Glib::RefPtr<const Gio::TlsCertificate> issuer = cert->get_issuer();
+ auto issuer = cert->get_issuer();
std::cout << "Outputing the issuer's certificate data:" << std::endl <<
issuer->property_certificate_pem().get_value();
std::cout << "Successfully resolved address of test host '" << test_host <<
"'." << std::endl;
- Glib::RefPtr<Gio::InetAddress> first_inet_address = inet_addresses[0];
+ auto first_inet_address = inet_addresses[0];
std::cout << "First address of test host is " <<
first_inet_address->to_string() << "." << std::endl;
- Glib::RefPtr<Gio::Socket> socket =
+ auto socket =
Gio::Socket::create(first_inet_address->get_family(),
Gio::SOCKET_TYPE_STREAM, Gio::SOCKET_PROTOCOL_TCP);
- Glib::RefPtr<Gio::InetSocketAddress> address =
+ auto address =
Gio::InetSocketAddress::create(first_inet_address, 443);
try
"." << std::endl;
}
- Glib::RefPtr<Gio::TcpConnection> conn = Glib::RefPtr<Gio::TcpConnection>::cast_dynamic(Gio::SocketConnection::create(socket));
+ auto conn = Glib::RefPtr<Gio::TcpConnection>::cast_dynamic(Gio::SocketConnection::create(socket));
if(!conn || !conn->is_connected())
{
address->get_address()->to_string() << ":" << address->get_port() <<
"." << std::endl;
- Glib::RefPtr<Gio::TlsClientConnection> tls_connection;
-
try
{
- Glib::RefPtr<Gio::TlsClientConnection> tls_connection =
+ auto tls_connection =
Gio::TlsClientConnection::create(conn, address);
tls_connection->signal_accept_certificate().connect(
std::cout << "Attempting to get the issuer's certificate from the "
"connection." << std::endl;
- Glib::RefPtr<Gio::TlsCertificate> issuer_certificate =
+ auto issuer_certificate =
tls_connection->get_peer_certificate()->get_issuer();
if(!issuer_certificate)
std::endl;
std::cout << "Attempting to use the connection's database." << std::endl;
- Glib::RefPtr<Gio::TlsDatabase> database = tls_connection->get_database();
+ auto database = tls_connection->get_database();
std::cout << "Looking up the certificate's issuer in the database." <<
std::endl;
- Glib::RefPtr<Gio::TlsCertificate> db_certificate =
+ auto db_certificate =
database->lookup_certificate_issuer(issuer_certificate);
if(!db_certificate)
int
main()
{
- type_key_value::const_iterator i;
- Glib::RefPtr< Glib::BalancedTree<type_key_value, type_key_value> > tree = Glib::BalancedTree<type_key_value, type_key_value>::create();
+ auto tree = Glib::BalancedTree<type_key_value, type_key_value>::create();
for (type_key_value::size_type i = 0; i < str.size(); ++i)
tree->insert(str.substr(i, 1), str.substr(i, 1));
value = tree->search(sigc::ptr_fun(my_search), "|");
g_assert(value == NULL);
- Glib::RefPtr< Glib::BalancedTree<type_p_key_value, type_p_key_value> > ptree = Glib::BalancedTree<type_p_key_value, type_p_key_value>::create(sigc::ptr_fun(my_p_key_compare));
+ auto ptree = Glib::BalancedTree<type_p_key_value, type_p_key_value>::create(sigc::ptr_fun(my_p_key_compare));
for (type_key_value::size_type i = 0; i < str.size(); ++i)
pstr.push_back(new type_key_value(str.substr(i, 1)));
protected:
//Implement vfuncs:
- virtual Glib::ustring get_name_vfunc() const;
- virtual Glib::VariantType get_state_type_vfunc() const;
- virtual Glib::VariantBase get_state_hint_vfunc() const;
+ Glib::ustring get_name_vfunc() const override;
+ Glib::VariantType get_state_type_vfunc() const override;
+ Glib::VariantBase get_state_hint_vfunc() const override;
};
CustomAction::CustomAction()
void thread_function(const Glib::Threads::Thread* first_thread,
const Glib::RefPtr<Glib::MainLoop>& first_mainloop)
{
- Glib::RefPtr<Glib::MainContext> second_context = Glib::MainContext::create();
- Glib::RefPtr<Glib::MainLoop> second_mainloop = Glib::MainLoop::create(second_context);
+ auto second_context = Glib::MainContext::create();
+ auto second_mainloop = Glib::MainLoop::create(second_context);
// Show how Glib::MainContext::invoke() can be used for calling a function,
// possibly executed in another thread.
{
Glib::init();
- Glib::RefPtr<Glib::MainLoop> first_mainloop = Glib::MainLoop::create();
+ auto first_mainloop = Glib::MainLoop::create();
// This thread shall be the owner of the default main context, when
// thread_function() calls mark_and_quit() via Glib::MainContext::invoke(),
int main(int, char**)
{
- const int VALUES = 10;
+ const int VALUES_COUNT = 10;
Glib::init();
- Glib::Value<int> value[VALUES];
+ Glib::Value<int> values[VALUES_COUNT];
Glib::ValueArray array;
- for(int i = 0; i < VALUES; i++)
+ for(int i = 0; i < VALUES_COUNT; i++)
{
- value[i].init(Glib::Value<int>::value_type());
- value[i].set(i + 1); // (i + 1) ==> Set to natural counting numbers.
- array.prepend(value[i]);
+ values[i].init(Glib::Value<int>::value_type());
+ values[i].set(i + 1); // (i + 1) ==> Set to natural counting numbers.
+ array.prepend(values[i]);
}
ostr << "Array members before sorting:" << std::endl;
- for(int i = 0; i < VALUES; i++)
+ for(int i = 0; i < VALUES_COUNT; i++)
{
Glib::ValueBase value;
break;
}
- Glib::Value<int> int_val = static_cast< Glib::Value<int>& >(value);
+ auto int_val = static_cast< Glib::Value<int>& >(value);
ostr << int_val.get() << " ";
}
ostr << std::endl; // End of line for list of array elements.
// Sort array and remove last element:
- array.sort(sigc::ptr_fun(&on_compare)).remove(VALUES - 1);
+ array.sort(sigc::ptr_fun(&on_compare)).remove(VALUES_COUNT - 1);
ostr << "Array members after sorting without last element:" <<
std::endl;
- for(int i = 0; i < VALUES - 1; i++)
+ for(int i = 0; i < VALUES_COUNT - 1; i++)
{
Glib::ValueBase value;
break;
}
- Glib::Value<int> int_val = static_cast< Glib::Value<int>& >(value);
+ auto int_val = static_cast< Glib::Value<int>& >(value);
ostr << int_val.get() << " ";
}
ostr << std::endl; // End of line for list of array elements.
for(guint i = 0; i < int_vector.size(); i++)
ostr << int_vector[i] << std::endl;
- Glib::Variant< std::vector<int> > integers_variant =
+ auto integers_variant =
Glib::Variant< std::vector<int> >::create(int_vector);
- std::vector<int> int_vector2 = integers_variant.get();
+ auto int_vector2 = integers_variant.get();
ostr << "The size of the copied vector is " << int_vector2.size() <<
'.' << std::endl;
//vector<std::string>:
std::vector<std::string> vec_strings;
vec_strings.push_back("a");
- Glib::Variant<std::vector<std::string> > variant_vec_strings =
+ auto variant_vec_strings =
Glib::Variant<std::vector<std::string> >::create(vec_strings);
//Dict:
ostr << "The original dictionary entry is (" << dict_entry.first <<
", " << dict_entry.second << ")." << std::endl;
- Glib::Variant<TypeDictEntry> dict_entry_variant =
+ auto dict_entry_variant =
Glib::Variant<TypeDictEntry>::create(dict_entry);
TypeDictEntry copy_entry = dict_entry_variant.get();
ostr << "(" << i << ", " << orig_dict[i] << ")." << std::endl;
}
- Glib::Variant<TypeDict> orig_dict_variant =
+ auto orig_dict_variant =
Glib::Variant<TypeDict>::create(orig_dict);
TypeDict dict_copy = orig_dict_variant.get();
index = 3;
- std::pair<unsigned, Glib::ustring> a_pair = orig_dict_variant.get_child(index);
+ auto a_pair = orig_dict_variant.get_child(index);
ostr << "Element number " << index + 1 << " in the variant is: (" <<
a_pair.first << ", " << a_pair.second << ")." << std::endl;
Glib::ustring s = "String " + ss.str();
- Glib::Variant<int> v = Glib::Variant<int>::create(i);
+ auto v = Glib::Variant<int>::create(i);
complex_dict1.insert(
std::pair< Glib::ustring, Glib::Variant<int> >("Map 1 " + s, v));
complex_vector.push_back(complex_dict1);
complex_vector.push_back(complex_dict2);
- Glib::Variant<ComplexVecType> complex_variant =
+ auto complex_variant =
Glib::Variant<ComplexVecType>::create(complex_vector);
// This will output the type string aa{sv}.
ComplexDictType map = copy_complex_vector[i];
- for(ComplexDictType::const_iterator iter = map.begin();
- iter != map.end(); iter++)
+ for(const auto& entry : map)
{
- std::pair< Glib::ustring, Glib::Variant<int> > entry = *iter;
ostr << entry.first << " -> " << entry.second.get() << "." << std::endl;
}
ostr << std::endl;
try
{
- Glib::Variant<Glib::ustring> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<Glib::ustring> >(vbase_string);
ostr << "Casted string Glib::Variant<Glib::ustring>: " << derived.get() << std::endl;
}
try
{
- Glib::Variant<Glib::ustring> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<Glib::ustring> >(vbase_objectpath);
ostr << "Casted object path Glib::Variant<Glib::ustring>: " << derived.get() << std::endl;
}
try
{
- Glib::Variant<Glib::ustring> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<Glib::ustring> >(vbase_signature);
ostr << "Casted signature Glib::Variant<Glib::ustring>: " << derived.get() << std::endl;
}
try
{
- Glib::Variant<std::string> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<std::string> >(vbase_string);
ostr << "Casted string Glib::Variant<std::string>: " << derived.get() << std::endl;
}
try
{
- Glib::Variant<std::string> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<std::string> >(vbase_objectpath);
ostr << "Casted object path Glib::Variant<std::string>: " << derived.get() << std::endl;
}
try
{
- Glib::Variant<std::string> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic< Glib::Variant<std::string> >(vbase_signature);
ostr << "Casted signature Glib::Variant<std::string>: " << derived.get() << std::endl;
}
try
{
typedef std::map<Glib::ustring, std::vector<std::string> > composite_type;
- Glib::Variant<composite_type> derived =
+ auto derived =
Glib::VariantBase::cast_dynamic<Glib::Variant<composite_type> >(cppdict);
ostr << "Cast composite type (get_type_string()=" << derived.get_type_string()
<< ", variant_type().get_string()=" << derived.variant_type().get_string() << "): ";
composite_type var = derived.get();
- for (composite_type::const_iterator iter1 = var.begin(); iter1 != var.end(); ++iter1)
+ for (const auto& the_pair : var)
{
- ostr << "\n " << iter1->first << ":";
- const std::vector<std::string>& vec = iter1->second;
- for (std::vector<std::string>::const_iterator iter2 = vec.begin(); iter2 != vec.end(); ++iter2)
- ostr << " " << *iter2;
+ ostr << "\n " << the_pair.first << ":";
+ const auto& vec = the_pair.second;
+ for (const auto& str : vec)
+ ostr << " " << str;
}
ostr << std::endl;
}
try
{
- Glib::Variant<std::map<Glib::ustring, std::string > > derived =
+ auto derived =
Glib::VariantBase::cast_dynamic<Glib::Variant<std::map<Glib::ustring, std::string> > >(cppdict);
g_assert_not_reached();
}
static void test_dynamic_cast()
{
- Glib::Variant<int> v1 = Glib::Variant<int>::create(10);
+ auto v1 = Glib::Variant<int>::create(10);
Glib::VariantBase& v2 = v1;
- Glib::Variant<int> v3 = Glib::VariantBase::cast_dynamic<Glib::Variant<int> >(v2);
+ auto v3 = Glib::VariantBase::cast_dynamic<Glib::Variant<int> >(v2);
g_assert(v3.get() == 10);
Glib::VariantBase v5 = v1;
type_dict_sv var_map;
type_map_sv map;
- Glib::Variant<Glib::ustring> var_string =
+ auto var_string =
Glib::Variant<Glib::ustring>::create("test variant");
map["test key"] = var_string;
var_map = type_dict_sv::create(map);
try
{
- Glib::Variant<std::map<Glib::ustring, Glib::ustring> > var_wrong_map =
+ auto var_wrong_map =
Glib::VariantBase::cast_dynamic<Glib::Variant<std::map<Glib::ustring, Glib::ustring> > >(ref_var_base);
g_assert_not_reached();
}
g_assert(var_string.get() == "test variant");
// A variant of type v
- Glib::Variant<Glib::VariantBase> var_v = Glib::Variant<Glib::VariantBase>::create(var_string);
+ auto var_v = Glib::Variant<Glib::VariantBase>::create(var_string);
g_assert(var_v.get_type_string() == "v");
- Glib::Variant<Glib::ustring> var_s2 =
+ auto var_s2 =
Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring> >(var_v.get());
g_assert(var_s2.get() == "test variant");
{
strResult += " (parameters\n";
- for(unsigned i = 0; i < signalQuery.n_params; i++)
+ for(unsigned j = 0; j < signalQuery.n_params; j++)
{
- GType typeParamMangled = pParameters[i];
+ GType typeParamMangled = pParameters[j];
//Parameter name:
//We can't get the real parameter name from the GObject system. It's not registered with g_signal_new().
- gchar* pchNum = g_strdup_printf("%d", i);
+ gchar* pchNum = g_strdup_printf("%d", j);
std::string strParamName = "p" + std::string(pchNum);
g_free(pchNum);
pchNum = 0;
gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : 0)
{}
+__CPPNAME__::__CPPNAME__`'(__CPPNAME__&& other)
+:
+ gobject_(other.gobject_)
+{
+ other.gobject_ = 0;
+}
+
+__CPPNAME__& __CPPNAME__::operator=(__CPPNAME__`'&& other)
+{
+ __CPPNAME__ temp (other);
+ swap(temp);
+ return *this;
+}
+
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__::__CPPNAME__`'(__CNAME__* gobject, bool make_a_copy)
:
__CPPNAME__`'(const __CPPNAME__& other);
__CPPNAME__& operator=(const __CPPNAME__& other);
+ __CPPNAME__`'(__CPPNAME__&& other);
+ __CPPNAME__& operator=(__CPPNAME__&& other);
+
_IMPORT(SECTION_DTOR_DOCUMENTATION)
~__CPPNAME__`'();
void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*)
{
- BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
+ const auto klass = static_cast<BaseClassType*>(g_iface);
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
',`dnl else
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
{
- __CNAME__ *const new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
+ const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
__CNAME__* __CPPNAME__::gobj_copy() const
{
// See the comment at the top of this file, if you want to know why the cast works.
- __CNAME__ *const gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
+ const auto gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
__OPAQUE_FUNC_REF`'(gobject);
return gobject;
}
void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data)
{
- BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
+ const auto klass = static_cast<BaseClassType*>(g_class);
CppClassParent::class_init_function(klass, class_data);
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
dnl See if the slot should or should not be copied
`ifelse(`$20',,dnl
` // Create a copy of the slot.
- $18* slot_copy = new $18($19); ',dnl
+ auto slot_copy = new $18($19); ',dnl
dnl
` // Use the original slot (not a copy).
- $18* slot_copy = const_cast<$18*>(&$19);')
+ auto slot_copy = const_cast<$18*>(&$19);')
')`'dnl
dnl Insert the declarations for C output parameters
dnl See if the slot should or should not be copied
`ifelse(`$20',,dnl
` // Create a copy of the slot.
- $18* slot_copy = new $18($19); ',dnl
+ auto slot_copy = new $18($19); ',dnl
dnl
` // Use the original slot (not a copy).
- $18* slot_copy = const_cast<$18*>(&$19);')
+ auto slot_copy = const_cast<$18*>(&$19);')
')`'dnl
dnl Insert the declarations for C output parameters
dnl See if the slot should or should not be copied
`ifelse(`$17',,dnl
` // Create a copy of the slot.
- $15* slot_copy = new $15($16); ',dnl
+ auto slot_copy = new $15($16); ',dnl
dnl
` // Use the original slot (not a copy).
- $15* slot_copy = const_cast<$15*>(&$16);')
+ auto slot_copy = const_cast<$15*>(&$16);')
')`'dnl
dnl Insert declarations for C the output parameters
dnl See if the slot should or should not be copied
`ifelse(`$17',,dnl
` // Create a copy of the slot.
- $15* slot_copy = new $15($16); ',dnl
+ auto slot_copy = new $15($16); ',dnl
dnl
` // Use the original slot (not a copy).
- $15* slot_copy = const_cast<$15*>(&$16);')
+ auto slot_copy = const_cast<$15*>(&$16);')
')`'dnl
dnl Insert the declarations for the C output parameters
using namespace __NAMESPACE__;
typedef sigc::slot< $5`'_COMMA_PREFIX($6) > SlotType;
- __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+ auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
if(obj)
{
try
{
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
ifelse(`$2',void,`dnl
(*static_cast<SlotType*>(slot))($7);
',`dnl else
using namespace __NAMESPACE__;
typedef sigc::slot< void`'_COMMA_PREFIX($6) > SlotType;
- __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+ auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
// Do not try to call a signal on a disassociated wrapper.
if(obj)
{
try
{
- if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+ if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
(*static_cast<SlotType*>(slot))($7);
}
catch(...)
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
}
}
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT($8)dnl
',`dnl
)dnl
$3 __NAMESPACE__::__CPPNAME__::on_$1`'($5)
{
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
$4 __CPPNAME__`'_Class::$2_vfunc_callback`'($5)
{
ifelse(`$14',,,dnl
-` const $13* slot = static_cast<$13*>($14);
+` const auto slot = static_cast<$13*>($14);
')dnl
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
- Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+ const auto obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
- CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+ const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
try // Trap C++ exceptions which would normally be lost because this is a C callback.
return Glib::unwrap_copy`'(`obj->$1'($7));
',`dnl not refreturn_ctype
ifelse($10,keep_return,`dnl
- static GQuark quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
+ static auto quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
- $3* return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
+ auto return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
if (!return_value)
{
return_value = new $3`'();
dnl See if the slot should or should not be copied
`ifelse(`$13',,dnl
` // Create a copy of the slot.
- $11* slot_copy = new $11($12); ',dnl
+ auto slot_copy = new $11($12); ',dnl
dnl
` // Use the original slot (not a copy).
- $11* slot_copy = const_cast<$11*>(&$12);')
+ auto slot_copy = const_cast<$11*>(&$12);')
')dnl
- BaseClassType *const base = static_cast<BaseClassType*>(
+ const auto base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
{
# Strip leading whitespace
$doxycomment =~ s/^\s+//;
+ # Add a level of m4 quotes. Necessary if $commentblock contains __FT__ or __BT__.
+ # DocsParser::lookup_documentation() adds it in $documentation.
+ $commentblock = "`" . $commentblock . "'";
# We don't have something to add, so just use $commentblock with
# opening and closing tokens added.