// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/datamodelindex.h>
#include <libgdamm/private/datamodelindex_p.h>

/* $Id: datamodelindex.ccg,v 1.2 2006/10/21 14:40:28 murrayc Exp $ */
// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* datamodelindex.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-data-model-index.h>
#include <libgda/gda-enum-types.h>

namespace
{
} // anonymous namespace


namespace Glib
{

Gnome::Gda::DataModelIndex wrap(GdaDataModelIndex* object, bool take_copy)
{
  return Gnome::Gda::DataModelIndex(object, take_copy);
}

} // namespace Glib


namespace Gnome
{

namespace Gda
{


// static
GType DataModelIndex::get_type()
{
  return gda_data_model_index_get_type();
}

DataModelIndex::DataModelIndex()
:
  gobject_ (gda_data_model_index_new())
{}

DataModelIndex::DataModelIndex(const DataModelIndex& other)
:
  gobject_ ((other.gobject_) ? gda_data_model_index_copy(other.gobject_) : 0)
{}

DataModelIndex::DataModelIndex(GdaDataModelIndex* gobject, bool make_a_copy)
:
  // For BoxedType wrappers, make_a_copy is true by default.  The static
  // BoxedType wrappers must always take a copy, thus make_a_copy = true
  // ensures identical behaviour if the default argument is used.
  gobject_ ((make_a_copy && gobject) ? gda_data_model_index_copy(gobject) : gobject)
{}

DataModelIndex& DataModelIndex::operator=(const DataModelIndex& other)
{
  DataModelIndex temp (other);
  swap(temp);
  return *this;
}

DataModelIndex::~DataModelIndex()
{
  if(gobject_)
    gda_data_model_index_free(gobject_);
}

void DataModelIndex::swap(DataModelIndex& other)
{
  GdaDataModelIndex *const temp = gobject_;
  gobject_ = other.gobject_;
  other.gobject_ = temp;
}

GdaDataModelIndex* DataModelIndex::gobj_copy() const
{
  return gda_data_model_index_copy(gobject_);
}


bool operator==(const DataModelIndex& lhs, const DataModelIndex& rhs)
{
  return (gda_data_model_index_equal(lhs.gobj(), rhs.gobj()) != 0);
}

bool operator!=(const DataModelIndex& lhs, const DataModelIndex& rhs)
{
  return (gda_data_model_index_equal(lhs.gobj(), rhs.gobj()) == 0);
}


Glib::ustring DataModelIndex::get_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_data_model_index_get_name(const_cast<GdaDataModelIndex*>(gobj())));
}

void DataModelIndex::gda_data_set_name(const Glib::ustring& name)
{
gda_data_model_index_set_name(gobj(), name.c_str()); 
}

Glib::ustring DataModelIndex::get_table_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_data_model_index_get_table_name(const_cast<GdaDataModelIndex*>(gobj())));
}

void DataModelIndex::set_table_name(const Glib::ustring& name)
{
gda_data_model_index_set_table_name(gobj(), name.c_str()); 
}

bool DataModelIndex::get_primary_key() const
{
  return gda_data_model_index_get_primary_key(const_cast<GdaDataModelIndex*>(gobj()));
}

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

bool DataModelIndex::get_unique_key() const
{
  return gda_data_model_index_get_unique_key(const_cast<GdaDataModelIndex*>(gobj()));
}

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

Glib::ustring DataModelIndex::get_references() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_data_model_index_get_references(const_cast<GdaDataModelIndex*>(gobj())));
}

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

Glib::ListHandle<Glib::RefPtr<ColumnIndex> > DataModelIndex::get_column_index_list()
{
  return Glib::ListHandle<Glib::RefPtr<ColumnIndex> >(gda_data_model_index_get_column_index_list(gobj()), Glib::OWNERSHIP_NONE);
}

Glib::ListHandle<Glib::RefPtr<const ColumnIndex> > DataModelIndex::get_column_index_list() const
{
  return Glib::ListHandle<Glib::RefPtr<const ColumnIndex> >(gda_data_model_index_get_column_index_list(const_cast<GdaDataModelIndex*>(gobj())), Glib::OWNERSHIP_NONE);
}

void DataModelIndex::set_column_index_list(const Glib::ListHandle<Glib::RefPtr<ColumnIndex> >& col_idx_list)
{
gda_data_model_index_set_column_index_list(gobj(), col_idx_list.data()); 
}


} // namespace Gda

} // namespace Gnome


