// Generated by gmmproc 2.66.9 -- DO NOT MODIFY!


#include <glibmm.h>

#include <giomm/tlsclientconnection.h>
#include <giomm/private/tlsclientconnection_p.h>


/* Copyright (C) 2013 The giomm 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, see <http://www.gnu.org/licenses/>.
 */

#include <gio/gio.h>
#include <giomm/socketconnectable.h>

namespace Gio
{

TlsClientConnection::TlsClientConnection(GTlsClientConnection* castitem)
: TlsConnection(G_TLS_CONNECTION(castitem))
{
}

} // namespace Gio

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::TlsClientConnection> wrap(GTlsClientConnection* object, bool take_copy)
{
  return Glib::RefPtr<Gio::TlsClientConnection>( dynamic_cast<Gio::TlsClientConnection*> (Glib::wrap_auto_interface<Gio::TlsClientConnection> ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gio
{


/* The *_Class implementation: */

const Glib::Interface_Class& TlsClientConnection_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_ = &TlsClientConnection_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = g_tls_client_connection_get_type();
  }

  return *this;
}

void TlsClientConnection_Class::iface_init_function(void* g_iface, void*)
{
  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
  g_assert(klass != nullptr);


}


Glib::ObjectBase* TlsClientConnection_Class::wrap_new(GObject* object)
{
  return new TlsClientConnection((GTlsClientConnection*)(object));
}


/* The implementation: */

TlsClientConnection::TlsClientConnection()
:
  Glib::Interface(tlsclientconnection_class_.init())
{}


TlsClientConnection::TlsClientConnection(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

TlsClientConnection::TlsClientConnection(TlsClientConnection&& src) noexcept
: Glib::Interface(std::move(src))
{}

TlsClientConnection& TlsClientConnection::operator=(TlsClientConnection&& src) noexcept
{
  Glib::Interface::operator=(std::move(src));
  return *this;
}

TlsClientConnection::~TlsClientConnection() noexcept
{}

// static
void TlsClientConnection::add_interface(GType gtype_implementer)
{
  tlsclientconnection_class_.init().add_interface(gtype_implementer);
}

TlsClientConnection::CppClassType TlsClientConnection::tlsclientconnection_class_; // initialize static member

GType TlsClientConnection::get_type()
{
  return tlsclientconnection_class_.init().get_type();
}


GType TlsClientConnection::get_base_type()
{
  return g_tls_client_connection_get_type();
}


Glib::RefPtr<TlsClientConnection> TlsClientConnection::create(const Glib::RefPtr<IOStream>& base_io_stream, const Glib::RefPtr<const SocketConnectable>& server_identity)
{
  GError* gerror = nullptr;
  Glib::RefPtr<TlsClientConnection> retvalue = Glib::wrap(G_TLS_CLIENT_CONNECTION(g_tls_client_connection_new(Glib::unwrap(base_io_stream), const_cast<GSocketConnectable*>(Glib::unwrap(server_identity)), &(gerror))));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<TlsClientConnection> TlsClientConnection::create(const Glib::RefPtr<IOStream>& base_io_stream)
{
  GError* gerror = nullptr;
  Glib::RefPtr<TlsClientConnection> retvalue = Glib::wrap(G_TLS_CLIENT_CONNECTION(g_tls_client_connection_new(Glib::unwrap(base_io_stream), nullptr, &(gerror))));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

void TlsClientConnection::set_server_identity(const Glib::RefPtr<SocketConnectable>& identity)
{
  g_tls_client_connection_set_server_identity(gobj(), const_cast<GSocketConnectable*>(Glib::unwrap(identity)));
}

Glib::RefPtr<SocketConnectable> TlsClientConnection::get_server_identity()
{
  Glib::RefPtr<SocketConnectable> retvalue = Glib::wrap(g_tls_client_connection_get_server_identity(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const SocketConnectable> TlsClientConnection::get_server_identity() const
{
  return const_cast<TlsClientConnection*>(this)->get_server_identity();
}

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void TlsClientConnection::set_validation_flags(TlsCertificateFlags flags)
{
  g_tls_client_connection_set_validation_flags(gobj(), ((GTlsCertificateFlags)(flags)));
}
G_GNUC_END_IGNORE_DEPRECATIONS

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
TlsCertificateFlags TlsClientConnection::get_validation_flags() const
{
  return ((TlsCertificateFlags)(g_tls_client_connection_get_validation_flags(const_cast<GTlsClientConnection*>(gobj()))));
}
G_GNUC_END_IGNORE_DEPRECATIONS

#ifndef GIOMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void TlsClientConnection::set_use_ssl3(bool use_ssl3)
{
  g_tls_client_connection_set_use_ssl3(gobj(), static_cast<int>(use_ssl3));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GIOMM_DISABLE_DEPRECATED

#ifndef GIOMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
bool TlsClientConnection::get_use_ssl3() const
{
  return g_tls_client_connection_get_use_ssl3(const_cast<GTlsClientConnection*>(gobj()));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GIOMM_DISABLE_DEPRECATED

std::vector< Glib::RefPtr<Glib::ByteArray> > TlsClientConnection::get_accepted_cas()
{
  return Glib::ListHandler< Glib::RefPtr<Glib::ByteArray> >::list_to_vector(g_tls_client_connection_get_accepted_cas(gobj()), Glib::OWNERSHIP_DEEP);
}

std::vector< Glib::RefPtr<const Glib::ByteArray> > TlsClientConnection::get_accepted_cas() const
{
  return Glib::ListHandler< Glib::RefPtr<const Glib::ByteArray> >::list_to_vector(g_tls_client_connection_get_accepted_cas(const_cast<GTlsClientConnection*>(gobj())), Glib::OWNERSHIP_DEEP);
}

void TlsClientConnection::copy_session_state(const Glib::RefPtr<TlsClientConnection>& source)
{
  g_tls_client_connection_copy_session_state(gobj(), Glib::unwrap(source));
}


#ifndef GIOMM_DISABLE_DEPRECATED

Glib::PropertyProxy_ReadOnly< std::vector< Glib::RefPtr<Glib::ByteArray> > > TlsClientConnection::property_accepted_cas() const
{
  return Glib::PropertyProxy_ReadOnly< std::vector< Glib::RefPtr<Glib::ByteArray> > >(this, "accepted-cas");
}
#endif // GIOMM_DISABLE_DEPRECATED


Glib::PropertyProxy< Glib::RefPtr<SocketConnectable> > TlsClientConnection::property_server_identity() 
{
  return Glib::PropertyProxy< Glib::RefPtr<SocketConnectable> >(this, "server-identity");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketConnectable> > TlsClientConnection::property_server_identity() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SocketConnectable> >(this, "server-identity");
}

#ifndef GIOMM_DISABLE_DEPRECATED

Glib::PropertyProxy< bool > TlsClientConnection::property_use_ssl3() 
{
  return Glib::PropertyProxy< bool >(this, "use-ssl3");
}
#endif // GIOMM_DISABLE_DEPRECATED


#ifndef GIOMM_DISABLE_DEPRECATED

Glib::PropertyProxy_ReadOnly< bool > TlsClientConnection::property_use_ssl3() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "use-ssl3");
}
#endif // GIOMM_DISABLE_DEPRECATED


Glib::PropertyProxy< TlsCertificateFlags > TlsClientConnection::property_validation_flags() 
{
  return Glib::PropertyProxy< TlsCertificateFlags >(this, "validation-flags");
}

Glib::PropertyProxy_ReadOnly< TlsCertificateFlags > TlsClientConnection::property_validation_flags() const
{
  return Glib::PropertyProxy_ReadOnly< TlsCertificateFlags >(this, "validation-flags");
}


} // namespace Gio


