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


#include <glibmm.h>

#include <giomm/tlspassword.h>
#include <giomm/private/tlspassword_p.h>


/* Copyright (C) 2012 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, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gio/gio.h>

namespace
{
} // anonymous namespace

// static
GType Glib::Value<Gio::TlsPasswordFlags>::value_type()
{
  return g_tls_password_flags_get_type();
}


namespace Glib
{

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

} /* namespace Glib */


namespace Gio
{


/* The *_Class implementation: */

const Glib::Class& TlsPassword_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &TlsPassword_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(g_tls_password_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void TlsPassword_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

  klass->get_value = &get_value_vfunc_callback;
  klass->get_default_warning = &get_default_warning_vfunc_callback;

}

const guchar* TlsPassword_Class::get_value_vfunc_callback(GTlsPassword* self, gsize* length)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return obj->get_value_vfunc(*(length)
);
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->get_value)
  {
    const guchar* retval = (*base->get_value)(self, length);
    return retval;
  }

  typedef const guchar* RType;
  return RType();
}
const gchar* TlsPassword_Class::get_default_warning_vfunc_callback(GTlsPassword* self)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return g_strdup(obj->get_default_warning_vfunc().c_str());
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->get_default_warning)
  {
    const gchar* retval = (*base->get_default_warning)(self);
    return retval;
  }

  typedef const gchar* RType;
  return RType();
}


Glib::ObjectBase* TlsPassword_Class::wrap_new(GObject* object)
{
  return new TlsPassword((GTlsPassword*)object);
}


/* The implementation: */

GTlsPassword* TlsPassword::gobj_copy()
{
  reference();
  return gobj();
}

TlsPassword::TlsPassword(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

TlsPassword::TlsPassword(GTlsPassword* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


TlsPassword::~TlsPassword()
{}


TlsPassword::CppClassType TlsPassword::tlspassword_class_; // initialize static member

GType TlsPassword::get_type()
{
  return tlspassword_class_.init().get_type();
}


GType TlsPassword::get_base_type()
{
  return g_tls_password_get_type();
}


TlsPassword::TlsPassword(const Glib::ustring& description, TlsPasswordFlags flags)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(tlspassword_class_.init(), "flags", ((GTlsPasswordFlags)(flags)), "description", description.c_str(), static_cast<char*>(0)))
{
  

}

Glib::RefPtr<TlsPassword> TlsPassword::create(const Glib::ustring& description, TlsPasswordFlags flags)
{
  return Glib::RefPtr<TlsPassword>( new TlsPassword(description, flags) );
}

const guchar* TlsPassword::get_value(gsize& length) const
{
  return g_tls_password_get_value(const_cast<GTlsPassword*>(gobj()), &(length));
}

const guchar* TlsPassword::get_value() const
{
  return g_tls_password_get_value(const_cast<GTlsPassword*>(gobj()), 0);
}

void TlsPassword::set_value(const guchar* value, gssize length)
{
  g_tls_password_set_value(gobj(), value, length);
}

Glib::ustring TlsPassword::get_description() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_tls_password_get_description(const_cast<GTlsPassword*>(gobj())));
}

void TlsPassword::set_description(const Glib::ustring& description)
{
  g_tls_password_set_description(gobj(), description.c_str());
}

TlsPasswordFlags TlsPassword::get_flags() const
{
  return ((TlsPasswordFlags)(g_tls_password_get_flags(const_cast<GTlsPassword*>(gobj()))));
}

void TlsPassword::set_flags(TlsPasswordFlags flags)
{
  g_tls_password_set_flags(gobj(), ((GTlsPasswordFlags)(flags)));
}

Glib::ustring TlsPassword::get_warning() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_tls_password_get_warning(const_cast<GTlsPassword*>(gobj())));
}

void TlsPassword::set_warning(const Glib::ustring& warning)
{
  g_tls_password_set_warning(gobj(), warning.c_str());
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Glib::ustring > TlsPassword::property_description() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "description");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::ustring > TlsPassword::property_description() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "description");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< TlsPasswordFlags > TlsPassword::property_flags() 
{
  return Glib::PropertyProxy< TlsPasswordFlags >(this, "flags");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< TlsPasswordFlags > TlsPassword::property_flags() const
{
  return Glib::PropertyProxy_ReadOnly< TlsPasswordFlags >(this, "flags");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< Glib::ustring > TlsPassword::property_warning() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "warning");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::ustring > TlsPassword::property_warning() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "warning");
}
#endif //GLIBMM_PROPERTIES_ENABLED


const guchar* Gio::TlsPassword::get_value_vfunc(gsize& length) const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->get_value)
  {
    const guchar* retval((*base->get_value)(const_cast<GTlsPassword*>(gobj()),&(length)));
    return retval;
  }

  typedef const guchar* RType;
  return RType();
}
Glib::ustring Gio::TlsPassword::get_default_warning_vfunc() const
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->get_default_warning)
  {
    Glib::ustring retval(Glib::convert_const_gchar_ptr_to_ustring((*base->get_default_warning)(const_cast<GTlsPassword*>(gobj()))));
    return retval;
  }

  typedef Glib::ustring RType;
  return RType();
}


} // namespace Gio


