/** * @file glib_traits.hpp * * @brief @c GLib traits. * * This header contains traits specific to GLib types. * * @author Ossama Othman @ * * @copyright @par * Copyright 2013 Intel Corporation All Rights Reserved. * @par * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * @par * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * @par * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #ifndef IVI_SETTINGS_GLIB_TRAITS_HPP #define IVI_SETTINGS_GLIB_TRAITS_HPP #include namespace ivi { namespace settings { template struct traits; // GDBusConnection traits specialization. template<> struct traits { struct delete_functor { void operator()(GDBusConnection * p) const { if (p != nullptr) g_object_unref(p); } }; }; // GVariant traits specialization. template<> struct traits { struct delete_functor { void operator()(GVariant * p) const { if (p != nullptr) g_variant_unref(p); } }; }; // GVariantIter traits specialization. template<> struct traits { struct delete_functor { void operator()(GVariantIter * p) const { g_variant_iter_free(p); } }; }; // gchar traits specialization. template<> struct traits { struct delete_functor { void operator()(gchar * p) const { g_free(p); } }; }; // GError traits specialization. template<> struct traits { struct delete_functor { void operator()(GError * p) const { if (p != nullptr) g_error_free(p); } }; }; // GMainLoop traits specialization. template<> struct traits { struct delete_functor { void operator()(GMainLoop * p) const { if (p != nullptr) g_main_loop_quit(p); g_main_loop_unref(p); } }; }; } } #endif /* IVI_SETTINGS_GLIB_TRAITS_HPP */ // Local Variables: // mode:c++ // c-basic-offset:2 // indent-tabs-mode: nil // End: