diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 14:00:27 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-02-26 14:00:27 +0100 |
commit | 85e4afa5584eabbdb331375186fb6273b210931b (patch) | |
tree | 65e6f40aedf4b984373f7ba8e891c5b03495f83a | |
parent | cdeaa23ae06d1871fae7e6c82c1e118b3cd8fbc1 (diff) | |
download | glibmm-85e4afa5584eabbdb331375186fb6273b210931b.tar.gz |
Run clang-format on gio .cc files.
-rw-r--r-- | gio/giomm/contenttype.cc | 83 | ||||
-rw-r--r-- | gio/giomm/init.cc | 9 | ||||
-rw-r--r-- | gio/giomm/slot_async.cc | 4 | ||||
-rw-r--r-- | gio/giomm/socketsource.cc | 54 |
4 files changed, 84 insertions, 66 deletions
diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc index ecd983fb..88cff778 100644 --- a/gio/giomm/contenttype.cc +++ b/gio/giomm/contenttype.cc @@ -23,102 +23,113 @@ namespace Gio { -bool content_type_equals(const Glib::ustring& type1, const Glib::ustring& type2) +bool +content_type_equals(const Glib::ustring& type1, const Glib::ustring& type2) { return g_content_type_equals(type1.c_str(), type2.c_str()); } -bool content_type_is_a(const Glib::ustring& type, const Glib::ustring& supertype) +bool +content_type_is_a(const Glib::ustring& type, const Glib::ustring& supertype) { return g_content_type_is_a(type.c_str(), supertype.c_str()); } -bool content_type_is_unknown(const Glib::ustring& type) +bool +content_type_is_unknown(const Glib::ustring& type) { return g_content_type_is_unknown(type.c_str()); } -Glib::ustring content_type_get_description(const Glib::ustring& type) +Glib::ustring +content_type_get_description(const Glib::ustring& type) { return Glib::convert_return_gchar_ptr_to_ustring(g_content_type_get_description(type.c_str())); } -Glib::ustring content_type_get_mime_type(const Glib::ustring& type) +Glib::ustring +content_type_get_mime_type(const Glib::ustring& type) { return Glib::convert_return_gchar_ptr_to_ustring(g_content_type_get_mime_type(type.c_str())); } -Glib::RefPtr<Gio::Icon> content_type_get_icon(const Glib::ustring& type) +Glib::RefPtr<Gio::Icon> +content_type_get_icon(const Glib::ustring& type) { - 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. + 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<Gio::Icon> +content_type_get_symbolic_icon(const Glib::ustring& type) { 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. + if (retvalue) + retvalue->reference(); // The function does not do a ref for us. return retvalue; } #endif -bool content_type_can_be_executable(const Glib::ustring& type) +bool +content_type_can_be_executable(const Glib::ustring& type) { return g_content_type_can_be_executable(type.c_str()); } -Glib::ustring content_type_from_mime_type(const Glib::ustring& mime_type) +Glib::ustring +content_type_from_mime_type(const Glib::ustring& mime_type) { - return Glib::convert_return_gchar_ptr_to_ustring(g_content_type_from_mime_type(mime_type.c_str())); + return Glib::convert_return_gchar_ptr_to_ustring( + g_content_type_from_mime_type(mime_type.c_str())); } -Glib::ustring content_type_guess(const std::string& filename, - const std::basic_string<guchar>& data, bool& result_uncertain) +Glib::ustring +content_type_guess( + const std::string& filename, const std::basic_string<guchar>& data, bool& result_uncertain) { gboolean c_result_uncertain = FALSE; - const gchar *c_filename = filename.empty () ? nullptr : filename.c_str (); - gchar* cresult = g_content_type_guess(c_filename, data.c_str(), - data.size(), &c_result_uncertain); + const gchar* c_filename = filename.empty() ? nullptr : filename.c_str(); + gchar* cresult = g_content_type_guess(c_filename, data.c_str(), data.size(), &c_result_uncertain); result_uncertain = c_result_uncertain; return Glib::convert_return_gchar_ptr_to_ustring(cresult); } -Glib::ustring content_type_guess(const std::string& filename, - const guchar* data, gsize data_size, bool& result_uncertain) +Glib::ustring +content_type_guess( + const std::string& filename, const guchar* data, gsize data_size, bool& result_uncertain) { gboolean c_result_uncertain = FALSE; - const gchar *c_filename = filename.empty () ? nullptr : filename.c_str (); - gchar* cresult = g_content_type_guess(c_filename, data, - data_size, &c_result_uncertain); + const gchar* c_filename = filename.empty() ? nullptr : filename.c_str(); + gchar* cresult = g_content_type_guess(c_filename, data, data_size, &c_result_uncertain); result_uncertain = c_result_uncertain; return Glib::convert_return_gchar_ptr_to_ustring(cresult); } -Glib::ustring content_type_guess(const std::string& filename, - const std::string& data, bool& result_uncertain) +Glib::ustring +content_type_guess(const std::string& filename, const std::string& data, bool& result_uncertain) { gboolean c_result_uncertain = FALSE; - const gchar *c_filename = filename.empty () ? nullptr : filename.c_str (); - gchar* cresult = g_content_type_guess(c_filename, (const guchar*)data.c_str(), - data.size(), &c_result_uncertain); + const gchar* c_filename = filename.empty() ? nullptr : filename.c_str(); + gchar* cresult = + g_content_type_guess(c_filename, (const guchar*)data.c_str(), data.size(), &c_result_uncertain); result_uncertain = c_result_uncertain; return Glib::convert_return_gchar_ptr_to_ustring(cresult); } -Glib::StringArrayHandle content_type_guess_for_tree(const Glib::RefPtr<const File>& root) +Glib::StringArrayHandle +content_type_guess_for_tree(const Glib::RefPtr<const File>& root) { - return Glib::StringArrayHandle(g_content_type_guess_for_tree(const_cast<GFile*>(root->gobj())), - Glib::OWNERSHIP_DEEP); + return Glib::StringArrayHandle( + g_content_type_guess_for_tree(const_cast<GFile*>(root->gobj())), Glib::OWNERSHIP_DEEP); } -Glib::ListHandle<Glib::ustring> content_types_get_registered() +Glib::ListHandle<Glib::ustring> +content_types_get_registered() { - return Glib::ListHandle<Glib::ustring>(g_content_types_get_registered(), - Glib::OWNERSHIP_DEEP); + return Glib::ListHandle<Glib::ustring>(g_content_types_get_registered(), Glib::OWNERSHIP_DEEP); } } // namespace Gio diff --git a/gio/giomm/init.cc b/gio/giomm/init.cc index df20dba0..a00c3b40 100644 --- a/gio/giomm/init.cc +++ b/gio/giomm/init.cc @@ -23,10 +23,11 @@ namespace Gio { -void init() +void +init() { - static bool s_init = false ; - if(!s_init) + static bool s_init = false; + if (!s_init) { Glib::init(); Gio::wrap_init(); @@ -34,4 +35,4 @@ void init() } } -} //namespace Gio +} // namespace Gio diff --git a/gio/giomm/slot_async.cc b/gio/giomm/slot_async.cc index 31f90778..06dc7c58 100644 --- a/gio/giomm/slot_async.cc +++ b/gio/giomm/slot_async.cc @@ -34,7 +34,7 @@ SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data) auto result = Glib::wrap(res, true /* take copy */); (*the_slot)(result); } - catch(...) + catch (...) { Glib::exception_handlers_invoke(); } @@ -42,4 +42,4 @@ SignalProxy_async_callback(GObject*, GAsyncResult* res, void* data) delete the_slot; } -} //namespace Gio +} // namespace Gio diff --git a/gio/giomm/socketsource.cc b/gio/giomm/socketsource.cc index 5018598a..af1e9740 100644 --- a/gio/giomm/socketsource.cc +++ b/gio/giomm/socketsource.cc @@ -23,7 +23,8 @@ namespace { -gboolean giomm_generic_socket_callback(sigc::slot_base* slot, GIOCondition condition) +gboolean +giomm_generic_socket_callback(sigc::slot_base* slot, GIOCondition condition) { g_return_val_if_fail(slot != nullptr, FALSE); @@ -39,13 +40,15 @@ gboolean giomm_generic_socket_callback(sigc::slot_base* slot, GIOCondition condi return 0; } -gboolean giomm_signalsocket_callback(GSocket*, GIOCondition condition, void* user_data) +gboolean +giomm_signalsocket_callback(GSocket*, GIOCondition condition, void* user_data) { sigc::slot_base* const slot = Glib::Source::get_slot_from_connection_node(user_data); return giomm_generic_socket_callback(slot, condition); } -gboolean giomm_socketsource_callback(GSocket*, GIOCondition condition, void* user_data) +gboolean +giomm_socketsource_callback(GSocket*, GIOCondition condition, void* user_data) { sigc::slot_base* const slot = Glib::Source::get_slot_from_callback_data(user_data); return giomm_generic_socket_callback(slot, condition); @@ -53,28 +56,28 @@ gboolean giomm_socketsource_callback(GSocket*, GIOCondition condition, void* use } // anonymous namespace - namespace Gio { /**** Glib::SignalSocket *******************************************************/ -inline -SignalSocket::SignalSocket(GMainContext* context) -: - context_(context) -{} +inline SignalSocket::SignalSocket(GMainContext* context) : context_(context) +{ +} -sigc::connection SignalSocket::connect(const sigc::slot<bool,Glib::IOCondition>& slot, - const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition, - const Glib::RefPtr<Cancellable>& cancellable, int priority) +sigc::connection +SignalSocket::connect(const sigc::slot<bool, Glib::IOCondition>& slot, + const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition, + const Glib::RefPtr<Cancellable>& cancellable, int priority) { - GSource* const source = g_socket_create_source(socket->gobj(), (GIOCondition)condition, Glib::unwrap(cancellable)); - return Glib::Source::attach_signal_source(slot, priority, source, context_, - (GSourceFunc)&giomm_signalsocket_callback); + GSource* const source = + g_socket_create_source(socket->gobj(), (GIOCondition)condition, Glib::unwrap(cancellable)); + return Glib::Source::attach_signal_source( + slot, priority, source, context_, (GSourceFunc)&giomm_signalsocket_callback); } -SignalSocket signal_socket(const Glib::RefPtr<Glib::MainContext>& context) +SignalSocket +signal_socket(const Glib::RefPtr<Glib::MainContext>& context) { return SignalSocket(Glib::unwrap(context)); // 0 means default context } @@ -82,20 +85,23 @@ SignalSocket signal_socket(const Glib::RefPtr<Glib::MainContext>& context) /**** Glib::SocketSource *******************************************************/ // static -Glib::RefPtr<SocketSource> SocketSource::create(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition, - const Glib::RefPtr<Cancellable>& cancellable) +Glib::RefPtr<SocketSource> +SocketSource::create(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition, + const Glib::RefPtr<Cancellable>& cancellable) { return Glib::RefPtr<SocketSource>(new SocketSource(socket, condition, cancellable)); } SocketSource::SocketSource(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition, - const Glib::RefPtr<Cancellable>& cancellable) -: - IOSource(g_socket_create_source(socket->gobj(), (GIOCondition)condition, Glib::unwrap(cancellable)), - (GSourceFunc)&giomm_socketsource_callback) -{} + const Glib::RefPtr<Cancellable>& cancellable) +: IOSource( + g_socket_create_source(socket->gobj(), (GIOCondition)condition, Glib::unwrap(cancellable)), + (GSourceFunc)&giomm_socketsource_callback) +{ +} SocketSource::~SocketSource() noexcept -{} +{ +} } // namespace Gio |