"Fossies" - the Fresh Open Source Software Archive

Member "glibmm-2.74.0/gio/src/asyncresult.ccg" (19 Sep 2022, 1813 Bytes) of package /linux/misc/glibmm-2.74.0.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 2007 The giomm Development Team
    2  *
    3  * This library is free software; you can redistribute it and/or
    4  * modify it under the terms of the GNU Lesser General Public
    5  * License as published by the Free Software Foundation; either
    6  * version 2.1 of the License, or (at your option) any later version.
    7  *
    8  * This library is distributed in the hope that it will be useful,
    9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11  * Lesser General Public License for more details.
   12  *
   13  * You should have received a copy of the GNU Lesser General Public
   14  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
   15  */
   16 
   17 //#include <gio/gasyncresult.h> //We are not allowed to include individual headers.
   18 #include <gio/gio.h>
   19 #include <glibmm/exceptionhandler.h>
   20 
   21 namespace Gio
   22 {
   23 
   24 static GObject*
   25 unwrap_objectbase_custom(const Glib::RefPtr<Glib::ObjectBase>& cpp_instance)
   26 {
   27   return (cpp_instance ? cpp_instance->gobj() : nullptr);
   28 }
   29 
   30 Glib::RefPtr<Glib::ObjectBase>
   31 AsyncResult::get_source_object_base()
   32 {
   33   // Glib::wrap(cobj) can't be used here. See tests/giomm_asyncresult_sourceobject
   34   // for a case where it would fail, and an explanation of why.
   35   // In short, the source object is not necessarily a Glib::Object. It may be
   36   // a Glib::Interface.
   37 
   38   auto cobj = g_async_result_get_source_object(gobj());
   39   auto cppobj = Glib::wrap_auto(cobj); // ObjectBase::_get_current_wrapper(cobj);
   40   return Glib::make_refptr_for_instance<Glib::ObjectBase>(
   41     cppobj); // g_async_result_get_source_object() gives us a ref, unusually.
   42 }
   43 
   44 Glib::RefPtr<const Glib::ObjectBase>
   45 AsyncResult::get_source_object_base() const
   46 {
   47   return const_cast<AsyncResult*>(this)->get_source_object_base();
   48 }
   49 
   50 } // namespace Gio