// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _LIBGDAMM_DICTTABLE_H
#define _LIBGDAMM_DICTTABLE_H


#include <glibmm.h>

/* $Id: dicttable.hg,v 1.2 2006/11/08 00:07:37 murrayc Exp $ */
// -*- C++ -*- // this is for the .hg, I realize gensig puts one in

/* dicttable.h
 *
 * Copyright 2007 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 <libgdamm/object.h>
#include <libgdamm/xmlstorage.h>
#include <libgdamm/entity.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GdaDictTable GdaDictTable;
typedef struct _GdaDictTableClass GdaDictTableClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


namespace Gnome
{

namespace Gda
{ class DictTable_Class; } // namespace Gda

} // namespace Gnome
namespace Gnome
{

namespace Gda
{

class Connection;
class DictDatabase;
class DictConstraint;

/** Represents a table or a view in the database.
 * Use this object to query the real structure of the table it represents.
 * 
 * @ingroup Dictionaries
 */

class DictTable
: public Gda::Object,
  public XmlStorage,
  public Entity
{
  
#ifndef DOXYGEN_SHOULD_SKIP_THIS

public:
  typedef DictTable CppObjectType;
  typedef DictTable_Class CppClassType;
  typedef GdaDictTable BaseObjectType;
  typedef GdaDictTableClass BaseClassType;

private:  friend class DictTable_Class;
  static CppClassType dicttable_class_;

private:
  // noncopyable
  DictTable(const DictTable&);
  DictTable& operator=(const DictTable&);

protected:
  explicit DictTable(const Glib::ConstructParams& construct_params);
  explicit DictTable(GdaDictTable* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
  virtual ~DictTable();

#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;
  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GObject.
  GdaDictTable*       gobj()       { return reinterpret_cast<GdaDictTable*>(gobject_); }

  ///Provides access to the underlying C GObject.
  const GdaDictTable* gobj() const { return reinterpret_cast<GdaDictTable*>(gobject_); }

  ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
  GdaDictTable* gobj_copy();

private:

  
protected:

  DictTable();
  

public:
  
  static Glib::RefPtr<DictTable> create();


  /** Get the database to which the table belongs
   * @return A Gda::DictDatabase pointer.
   */
  Glib::RefPtr<DictDatabase> get_database();
  
  /** Get the database to which the table belongs
   * @return A Gda::DictDatabase pointer.
   */
  Glib::RefPtr<const DictDatabase> get_database() const;

  
  /** Does the object represent a view rather than a table?
   * @return <tt>true</tt> if it is a view.
   */
  bool is_view() const;


  /** Get the parent tables of the table given as argument. This is significant only
   * for DBMS which support tables inheritance (like PostgreSQL for example).
   * @return A constant list of Gda::DictTable objects.
   */
  Glib::SListHandle< Glib::RefPtr<const DictTable> > get_parents() const;

 
  /** Get all the constraints which apply to the given table (each constraint
   * can represent a NOT <tt>0</tt>, a primary key or foreign key or a check constraint.
   * @return A new list of Gda::DictConstraint objects.
   */
  Glib::SListHandle< Glib::RefPtr<DictConstraint> > get_constraints();

 
  /** Get all the constraints which apply to the given table (each constraint
   * can represent a NOT <tt>0</tt>, a primary key or foreign key or a check constraint.
   * @return A new list of Gda::DictConstraint objects.
   */
  Glib::SListHandle< Glib::RefPtr<const DictConstraint> > get_constraints() const;

  
  /** Get the primary key constraint of @a table, if there is any. If several
   * Gda::DictConstraint represent a primary key constraint for @a table, then
   * the first one in the list of constraints is returned.
   * @return A Gda::DictConstraint object or <tt>0</tt>.
   */
  Glib::RefPtr<DictConstraint> get_pk_constraint();
  
  /** Get the primary key constraint of @a table, if there is any. If several
   * Gda::DictConstraint represent a primary key constraint for @a table, then
   * the first one in the list of constraints is returned.
   * @return A Gda::DictConstraint object or <tt>0</tt>.
   */
  Glib::RefPtr<const DictConstraint> get_pk_constraint() const;

  
  /** Synchronises the Table representation with the table structure which is stored in
   * the DBMS. For this operation to succeed, the connection to the DBMS server MUST be opened
   * (using the corresponding Gda::Connection object).
   * @return <tt>true</tt> if no error.
   */
#ifdef GLIBMM_EXCEPTIONS_ENABLED
  bool update_dbms_data();
#else
  bool update_dbms_data(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED


  //gtkmmproc error: db : property defs lookup failed.
  //gtkmmproc error: is-view : property defs lookup failed.

 //There are no signals or vfuncs.


public:

public:
  //C++ methods used to invoke GTK+ virtual functions:
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

protected:
  //GTK+ Virtual Functions (override these to change behaviour):
#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED

  //Default Signal Handlers::
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


};

} // namespace Gda
} // namespace Gnome


namespace Glib
{
  /** A Glib::wrap() method for this object.
   * 
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gnome::Gda::DictTable
   */
  Glib::RefPtr<Gnome::Gda::DictTable> wrap(GdaDictTable* object, bool take_copy = false);
}


#endif /* _LIBGDAMM_DICTTABLE_H */

