// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/column.h>
#include <libgdamm/private/column_p.h>

/* $Id: column.ccg,v 1.5 2006/11/06 23:38:35 murrayc Exp $ */
// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* datamodel.cc
 * 
 * Copyright 2003 libgdamm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <libgda/gda-column.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{

namespace Gda
{
  
Value Column::get_default_value() const
{
  return Value(gda_column_get_default_value(const_cast<GdaColumn*>(gobj())));
}

bool Column::equal(const Glib::RefPtr<const Column>& src) const
{
  if(!src)
    return false;

  const bool result = get_title() == src->get_title() &&
                get_defined_size() == src->get_defined_size() &&
                get_name() == src->get_name() &&
                get_table() == src->get_table() &&
                get_caption() == src->get_caption() &&
                get_scale() == src->get_scale() &&
                get_dbms_type() == src->get_dbms_type() &&
                get_g_type() == src->get_g_type() &&
                get_allow_null() == src->get_allow_null() &&
                get_primary_key() == src->get_primary_key() &&
                get_unique_key() == src->get_unique_key() &&
                get_references() == src->get_references() &&
                get_auto_increment() == src->get_auto_increment() &&
                get_position() == src->get_position() &&
                get_default_value() == src->get_default_value();

  return result;
}


} // namespace Gda

} // namespace Gnome


namespace
{


static void Column_signal_name_changed_callback(GdaColumn* self, const gchar* p0,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,const Glib::ustring& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Column_signal_name_changed_info =
{
  "name-changed",
  (GCallback) &Column_signal_name_changed_callback,
  (GCallback) &Column_signal_name_changed_callback
};


static void Column_signal_g_type_changed_callback(GdaColumn* self, GType p0,GType p1,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,GType,GType > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0, p1);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Column_signal_g_type_changed_info =
{
  "g-type-changed",
  (GCallback) &Column_signal_g_type_changed_callback,
  (GCallback) &Column_signal_g_type_changed_callback
};


} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gnome
{

namespace Gda
{


/* The *_Class implementation: */

const Glib::Class& Column_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_ = &Column_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(gda_column_get_type());

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

  }

  return *this;
}

void Column_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);

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->name_changed = &name_changed_callback;
  klass->g_type_changed = &g_type_changed_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Column_Class::name_changed_callback(GdaColumn* self, const gchar* p0)
{
  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.
        obj->on_name_changed(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
        return;
      #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->name_changed)
    (*base->name_changed)(self, p0);
}
void Column_Class::g_type_changed_callback(GdaColumn* self, GType p0, GType p1)
{
  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.
        obj->on_g_type_changed(p0, p1);
        return;
      #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->g_type_changed)
    (*base->g_type_changed)(self, p0, p1);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* Column_Class::wrap_new(GObject* object)
{
  return new Column((GdaColumn*)object);
}


/* The implementation: */

GdaColumn* Column::gobj_copy()
{
  reference();
  return gobj();
}

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

}

Column::Column(GdaColumn* castitem)
:
  Glib::Object((GObject*)(castitem))
{}

Column::~Column()
{}


Column::CppClassType Column::column_class_; // initialize static member

GType Column::get_type()
{
  return column_class_.init().get_type();
}

GType Column::get_base_type()
{
  return gda_column_get_type();
}


Column::Column()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(column_class_.init()))
{
  

}

Glib::RefPtr<Column> Column::create()
{
  return Glib::RefPtr<Column>( new Column() );
}
Glib::RefPtr<Column> Column::copy() const
{
  return Glib::wrap(gda_column_copy(const_cast<GdaColumn*>(gobj())));
}

Glib::ustring Column::get_title() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_title(const_cast<GdaColumn*>(gobj())));
}

void Column::set_title(const Glib::ustring& title)
{
gda_column_set_title(gobj(), title.c_str()); 
}

glong Column::get_defined_size() const
{
  return gda_column_get_defined_size(const_cast<GdaColumn*>(gobj()));
}

void Column::set_defined_size(glong size)
{
gda_column_set_defined_size(gobj(), size); 
}

Glib::ustring Column::get_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_name(const_cast<GdaColumn*>(gobj())));
}

void Column::set_name(const Glib::ustring& name)
{
gda_column_set_name(gobj(), name.c_str()); 
}

Glib::ustring Column::get_table() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_table(const_cast<GdaColumn*>(gobj())));
}

void Column::set_table(const Glib::ustring& table)
{
gda_column_set_table(gobj(), table.c_str()); 
}

Glib::ustring Column::get_caption() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_caption(const_cast<GdaColumn*>(gobj())));
}

void Column::set_caption(const Glib::ustring& caption)
{
gda_column_set_caption(gobj(), caption.c_str()); 
}

glong Column::get_scale() const
{
  return gda_column_get_scale(const_cast<GdaColumn*>(gobj()));
}

void Column::set_scale(glong scale)
{
gda_column_set_scale(gobj(), scale); 
}

Glib::ustring Column::get_dbms_type() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_dbms_type(const_cast<GdaColumn*>(gobj())));
}

void Column::set_dbms_type(const Glib::ustring& dbms_type)
{
gda_column_set_dbms_type(gobj(), dbms_type.c_str()); 
}

GType Column::get_g_type() const
{
  return gda_column_get_g_type(const_cast<GdaColumn*>(gobj()));
}

void Column::set_g_type(GType type)
{
gda_column_set_g_type(gobj(), type); 
}

bool Column::get_allow_null() const
{
  return gda_column_get_allow_null(const_cast<GdaColumn*>(gobj()));
}

void Column::set_allow_null(bool allow)
{
gda_column_set_allow_null(gobj(), static_cast<int>(allow)); 
}

bool Column::get_primary_key() const
{
  return gda_column_get_primary_key(const_cast<GdaColumn*>(gobj()));
}

void Column::set_primary_key(bool pk)
{
gda_column_set_primary_key(gobj(), static_cast<int>(pk)); 
}

bool Column::get_unique_key() const
{
  return gda_column_get_unique_key(const_cast<GdaColumn*>(gobj()));
}

void Column::set_unique_key(bool uk)
{
gda_column_set_unique_key(gobj(), static_cast<int>(uk)); 
}

Glib::ustring Column::get_references() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_column_get_references(const_cast<GdaColumn*>(gobj())));
}

void Column::set_references(const Glib::ustring& ref)
{
gda_column_set_references(gobj(), ref.c_str()); 
}

bool Column::get_auto_increment() const
{
  return gda_column_get_auto_increment(const_cast<GdaColumn*>(gobj()));
}

void Column::set_auto_increment(bool is_auto)
{
gda_column_set_auto_increment(gobj(), static_cast<int>(is_auto)); 
}

gint Column::get_position() const
{
  return gda_column_get_position(const_cast<GdaColumn*>(gobj()));
}

void Column::set_position(gint position)
{
gda_column_set_position(gobj(), position); 
}

void Column::set_default_value(const Value& default_value)
{
gda_column_set_default_value(gobj(), (default_value).gobj()); 
}


Glib::SignalProxy1< void,const Glib::ustring& > Column::signal_name_changed()
{
  return Glib::SignalProxy1< void,const Glib::ustring& >(this, &Column_signal_name_changed_info);
}


Glib::SignalProxy2< void,GType,GType > Column::signal_g_type_changed()
{
  return Glib::SignalProxy2< void,GType,GType >(this, &Column_signal_g_type_changed_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> Column::property_id() 
{
  return Glib::PropertyProxy<Glib::ustring>(this, "id");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> Column::property_id() const
{
  return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "id");
}
#endif //GLIBMM_PROPERTIES_ENABLED


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gnome::Gda::Column::on_name_changed(const Glib::ustring& old_name)
{
  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->name_changed)
    (*base->name_changed)(gobj(),old_name.c_str());
}
void Gnome::Gda::Column::on_g_type_changed(GType old_type, GType new_type)
{
  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->g_type_changed)
    (*base->g_type_changed)(gobj(),old_type,new_type);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gda

} // namespace Gnome


