// Generated by gmmproc 2.50.1 -- DO NOT MODIFY! #include #include #include /* gstreamermm - a C++ wrapper for gstreamer * * Copyright 2008 The gstreamermm Development Team * * 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; either * version 2.1 of the License, or (at your option) any later version. * * 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. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include namespace Gst { URIType URIHandler::get_type_vfunc() { BaseClassType *const base = static_cast( g_type_interface_peek_parent( g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) ) ); if(base && base->get_type) { return static_cast((*base->get_type)(CppObjectType::get_type())); } return URIType(); } GstURIType URIHandler_Class::get_type_vfunc_callback(GType type) { gpointer self = g_object_new(type, nullptr); Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) { #ifdef GLIBMM_EXCEPTIONS_ENABLED try { #endif //GLIBMM_EXCEPTIONS_ENABLED return static_cast(obj->get_type_vfunc()); #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_interface_peek_parent( g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) ) ); if(base && base->get_type) { return (*base->get_type)(type); } return GstURIType(); } const gchar * const * URIHandler::get_protocols_vfunc() const { BaseClassType *const base = static_cast( g_type_interface_peek_parent( g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) ) ); if(base && base->get_protocols) { return (*base->get_protocols)(CppObjectType::get_type()); } static const gchar* protocols[] = {nullptr}; return protocols; } const gchar * const * URIHandler_Class::get_protocols_vfunc_callback(GType type) { gpointer self = g_object_new(type, nullptr); Glib::ObjectBase *const obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); if(obj_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) { #ifdef GLIBMM_EXCEPTIONS_ENABLED try { #endif //GLIBMM_EXCEPTIONS_ENABLED return obj->get_protocols_vfunc(); #ifdef GLIBMM_EXCEPTIONS_ENABLED } catch(...) { Glib::exception_handlers_invoke(); } #endif //GLIBMM_EXCEPTIONS_ENABLED } } BaseClassType *const base = static_cast( g_type_interface_peek_parent( g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) ) ); if(base && base->get_protocols) { return (*base->get_protocols)(type); } static const gchar *protocols[] = { nullptr }; return protocols; } } namespace { } // anonymous namespace // static GType Glib::Value::value_type() { return gst_uri_type_get_type(); } // static GType Glib::Value::value_type() { return gst_uri_error_get_type(); } namespace Glib { Glib::RefPtr wrap(GstURIHandler* object, bool take_copy) { return Glib::RefPtr( dynamic_cast (Glib::wrap_auto_interface ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } } // namespace Glib namespace Gst { /* The *_Class implementation: */ const Glib::Interface_Class& URIHandler_Class::init() { if(!gtype_) // create the GType if necessary { // Glib::Interface_Class has to know the interface init function // in order to add interfaces to implementing types. class_init_func_ = &URIHandler_Class::iface_init_function; // We can not derive from another interface, and it is not necessary anyway. gtype_ = gst_uri_handler_get_type(); } return *this; } void URIHandler_Class::iface_init_function(void* g_iface, void*) { const auto klass = static_cast(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 g_assert(klass != nullptr); klass->get_uri = &get_uri_vfunc_callback; klass->set_uri = &set_uri_vfunc_callback; klass->get_type = &get_type_vfunc_callback; klass->get_protocols = &get_protocols_vfunc_callback; } gchar* URIHandler_Class::get_uri_vfunc_callback(GstURIHandler* self) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(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. { // Call the virtual member method, which derived classes might override. return g_strdup((obj->get_uri_vfunc()).c_str()); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( 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. ) ); // Call the original underlying C function: if(base && base->get_uri) return (*base->get_uri)(self); using RType = gchar*; return RType(); } gboolean URIHandler_Class::set_uri_vfunc_callback(GstURIHandler* self, const gchar* uri, GError** error) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(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. { // Call the virtual member method, which derived classes might override. return static_cast(obj->set_uri_vfunc(Glib::convert_const_gchar_ptr_to_ustring(uri) , error)); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( 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. ) ); // Call the original underlying C function: if(base && base->set_uri) return (*base->set_uri)(self, uri, error); using RType = gboolean; return RType(); } Glib::ObjectBase* URIHandler_Class::wrap_new(GObject* object) { return new URIHandler((GstURIHandler*)(object)); } /* The implementation: */ URIHandler::URIHandler() : Glib::Interface(urihandler_class_.init()) {} URIHandler::URIHandler(GstURIHandler* castitem) : Glib::Interface((GObject*)(castitem)) {} URIHandler::URIHandler(const Glib::Interface_Class& interface_class) : Glib::Interface(interface_class) { } URIHandler::URIHandler(URIHandler&& src) noexcept : Glib::Interface(std::move(src)) {} URIHandler& URIHandler::operator=(URIHandler&& src) noexcept { Glib::Interface::operator=(std::move(src)); return *this; } URIHandler::~URIHandler() noexcept {} // static void URIHandler::add_interface(GType gtype_implementer) { urihandler_class_.init().add_interface(gtype_implementer); } URIHandler::CppClassType URIHandler::urihandler_class_; // initialize static member GType URIHandler::get_type() { return urihandler_class_.init().get_type(); } GType URIHandler::get_base_type() { return gst_uri_handler_get_type(); } bool URIHandler::protocol_is_valid(const Glib::ustring& protocol) { return gst_uri_protocol_is_valid(protocol.c_str()); } bool URIHandler::protocol_is_supported(const Gst::URIType type, const Glib::ustring& protocol) { return gst_uri_protocol_is_supported((GstURIType)(type), protocol.c_str()); } bool URIHandler::uri_is_valid(const Glib::ustring& uri) { return gst_uri_is_valid(uri.c_str()); } bool URIHandler::uri_has_protocol(const Glib::ustring& uri, const Glib::ustring& protocol) { return gst_uri_has_protocol(uri.c_str(), protocol.c_str()); } Glib::ustring URIHandler::get_protocol(const Glib::ustring& uri) { return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_get_protocol(uri.c_str())); } Glib::ustring URIHandler::get_location(const Glib::ustring& uri) { return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_get_location(uri.c_str())); } Glib::ustring URIHandler::construct_uri(const Glib::ustring& protocol, const Glib::ustring& location) { return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_construct(protocol.c_str(), location.c_str())); } Glib::ustring URIHandler::filename_to_uri(const Glib::ustring& filename) { GError* gerror = nullptr; Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(gst_filename_to_uri(filename.c_str(), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); return retvalue; } Glib::RefPtr URIHandler::make_element_from_uri(const Gst::URIType type, const Glib::ustring& uri, const Glib::ustring& name) { GError* gerror = nullptr; Glib::RefPtr retvalue = Glib::wrap(gst_element_make_from_uri((GstURIType)(type), uri.c_str(), name.c_str(), &(gerror))); if(gerror) ::Glib::Error::throw_exception(gerror); return retvalue; } URIType URIHandler::get_uri_type() const { return ((URIType)(gst_uri_handler_get_uri_type(const_cast(gobj())))); } std::vector URIHandler::get_protocols() const { return Glib::ArrayHandler::array_to_vector(gst_uri_handler_get_protocols(const_cast(gobj())), Glib::OWNERSHIP_NONE); } Glib::ustring URIHandler::get_uri() const { return Glib::convert_return_gchar_ptr_to_ustring(gst_uri_handler_get_uri(const_cast(gobj()))); } bool URIHandler::set_uri(const Glib::ustring& uri) { GError* gerror = nullptr; bool retvalue = gst_uri_handler_set_uri(gobj(), uri.c_str(), &(gerror)); if(gerror) ::Glib::Error::throw_exception(gerror); return retvalue; } Glib::ustring Gst::URIHandler::get_uri_vfunc() const { const auto base = static_cast( 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. ) ); if(base && base->get_uri) { Glib::ustring retval(Glib::convert_const_gchar_ptr_to_ustring((*base->get_uri)(const_cast(gobj())))); return retval; } using RType = Glib::ustring; return RType(); } bool Gst::URIHandler::set_uri_vfunc(const Glib::ustring& uri, GError** error) { const auto base = static_cast( 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. ) ); if(base && base->set_uri) { bool retval((*base->set_uri)(gobj(),uri.c_str(),error)); return retval; } using RType = bool; return RType(); } } // namespace Gst