// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/dicttable.h>
#include <libgdamm/private/dicttable_p.h>

/* $Id: dicttype.ccg,v 1.3 2006/11/08 00:52:25 murrayc Exp $ */
// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* dict.cc
 * 
 * Copyright 2006 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-dict-table.h>
#include <libgdamm/dictdatabase.h>
#include <libgdamm/dictconstraint.h>
//#include <libgdamm/connection.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{


} /* namespace Gnome */


namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gnome::Gda::DictTable> wrap(GdaDictTable* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::DictTable>( dynamic_cast<Gnome::Gda::DictTable*> (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& DictTable_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_ = &DictTable_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_dict_table_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  XmlStorage::add_interface(get_type());
  Entity::add_interface(get_type());

  }

  return *this;
}

void DictTable_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
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* DictTable_Class::wrap_new(GObject* object)
{
  return new DictTable((GdaDictTable*)object);
}


/* The implementation: */

GdaDictTable* DictTable::gobj_copy()
{
  reference();
  return gobj();
}

DictTable::DictTable(const Glib::ConstructParams& construct_params)
:
  Gda::Object(construct_params)
{

}

DictTable::DictTable(GdaDictTable* castitem)
:
  Gda::Object((GdaObject*)(castitem))
{}

DictTable::~DictTable()
{}


DictTable::CppClassType DictTable::dicttable_class_; // initialize static member

GType DictTable::get_type()
{
  return dicttable_class_.init().get_type();
}

GType DictTable::get_base_type()
{
  return gda_dict_table_get_type();
}


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

}

Glib::RefPtr<DictTable> DictTable::create()
{
  return Glib::RefPtr<DictTable>( new DictTable() );
}
Glib::RefPtr<DictDatabase> DictTable::get_database()
{
  return Glib::wrap(gda_dict_table_get_database(gobj()));
}

Glib::RefPtr<const DictDatabase> DictTable::get_database() const
{
  return Glib::wrap(gda_dict_table_get_database(const_cast<GdaDictTable*>(gobj())));
}

bool DictTable::is_view() const
{
  return gda_dict_table_is_view(const_cast<GdaDictTable*>(gobj()));
}

Glib::SListHandle< Glib::RefPtr<const DictTable> > DictTable::get_parents() const
{
  return Glib::SListHandle< Glib::RefPtr<const DictTable> >((GSList*)gda_dict_table_get_parents(const_cast<GdaDictTable*>(gobj())), Glib::OWNERSHIP_NONE);
}

Glib::SListHandle< Glib::RefPtr<DictConstraint> > DictTable::get_constraints()
{
  return Glib::SListHandle< Glib::RefPtr<DictConstraint> >(gda_dict_table_get_constraints(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle< Glib::RefPtr<const DictConstraint> > DictTable::get_constraints() const
{
  return Glib::SListHandle< Glib::RefPtr<const DictConstraint> >((GSList*)gda_dict_table_get_constraints(const_cast<GdaDictTable*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

Glib::RefPtr<DictConstraint> DictTable::get_pk_constraint()
{

  Glib::RefPtr<DictConstraint> retvalue = Glib::wrap(gda_dict_table_get_pk_constraint(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const DictConstraint> DictTable::get_pk_constraint() const
{
  return const_cast<DictTable*>(this)->get_pk_constraint();
}

#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DictTable::update_dbms_data()
#else
bool DictTable::update_dbms_data(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_table_update_dbms_data(gobj(), &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
#else
  if(gerror)
    error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED

  return retvalue;

}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gda

} // namespace Gnome


