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


#include <glibmm.h>

#include <libgdamm/metastruct.h>
#include <libgdamm/private/metastruct_p.h>


// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* metastruct.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 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 <libgdamm/metastruct.h>
#include <libgdamm/metastore.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{


} /* namespace Gnome */


namespace
{
} // anonymous namespace


Gnome::Gda::MetaStructError::MetaStructError(Gnome::Gda::MetaStructError::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GDA_META_STRUCT_ERROR, error_code, error_message)
{}

Gnome::Gda::MetaStructError::MetaStructError(GError* gobject)
:
  Glib::Error (gobject)
{}

Gnome::Gda::MetaStructError::Code Gnome::Gda::MetaStructError::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Gnome::Gda::MetaStructError::throw_func(GError* gobject)
{
  throw Gnome::Gda::MetaStructError(gobject);
}

// static
GType Glib::Value<Gnome::Gda::MetaStructError::Code>::value_type()
{
  return gda_meta_struct_error_get_type();
}

// static
GType Glib::Value<Gnome::Gda::MetaStructFeature>::value_type()
{
  return gda_meta_struct_feature_get_type();
}

// static
GType Glib::Value<Gnome::Gda::MetaDbObjectType>::value_type()
{
  return gda_meta_db_object_type_get_type();
}

// static
GType Glib::Value<Gnome::Gda::MetaSortType>::value_type()
{
  return gda_meta_sort_type_get_type();
}

// static
GType Glib::Value<Gnome::Gda::MetaGraphInfo>::value_type()
{
  return gda_meta_graph_info_get_type();
}


namespace Glib
{

Glib::RefPtr<Gnome::Gda::MetaStruct> wrap(GdaMetaStruct* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::MetaStruct>( dynamic_cast<Gnome::Gda::MetaStruct*> (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& MetaStruct_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_ = &MetaStruct_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_meta_struct_get_type());

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

  }

  return *this;
}


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


}


Glib::ObjectBase* MetaStruct_Class::wrap_new(GObject* object)
{
  return new MetaStruct((GdaMetaStruct*)object);
}


/* The implementation: */

GdaMetaStruct* MetaStruct::gobj_copy()
{
  reference();
  return gobj();
}

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

}

MetaStruct::MetaStruct(GdaMetaStruct* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


MetaStruct::~MetaStruct()
{}


MetaStruct::CppClassType MetaStruct::metastruct_class_; // initialize static member

GType MetaStruct::get_type()
{
  return metastruct_class_.init().get_type();
}


GType MetaStruct::get_base_type()
{
  return gda_meta_struct_get_type();
}


MetaStruct::MetaStruct(const Glib::RefPtr<MetaStore>& meta_store, MetaStructFeature features)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(metastruct_class_.init(), "meta_store", const_cast<GdaMetaStore*>(Glib::unwrap(meta_store)), "features", ((GdaMetaStructFeature)(features)), static_cast<char*>(0)))
{
  

}

Glib::RefPtr<MetaStruct> MetaStruct::create(const Glib::RefPtr<MetaStore>& store, MetaStructFeature features)
{
  return Glib::RefPtr<MetaStruct>( new MetaStruct(store, features) );
}

GdaMetaDbObject* MetaStruct::complement(MetaDbObjectType type, const Value& catalog, const Value& schema, const Value& name)
{
  GError* gerror = 0;
  GdaMetaDbObject* retvalue = gda_meta_struct_complement(gobj(), ((GdaMetaDbObjectType)(type)), (catalog).gobj(), (schema).gobj(), (name).gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool MetaStruct::complement_schema(const Value& catalog, const Value& schema)
{
  GError* gerror = 0;
  bool retvalue = gda_meta_struct_complement_schema(gobj(), (catalog).gobj(), (schema).gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool MetaStruct::complement_default()
{
  GError* gerror = 0;
  bool retvalue = gda_meta_struct_complement_default(gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool MetaStruct::sort_db_object(MetaSortType sort_type)
{
  GError* gerror = 0;
  bool retvalue = gda_meta_struct_sort_db_objects(gobj(), ((GdaMetaSortType)(sort_type)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

GdaMetaDbObject* MetaStruct::get_db_object(const Value& catalog, const Value& schema, const Value& name)
{
  return gda_meta_struct_get_db_object(gobj(), (catalog).gobj(), (schema).gobj(), (name).gobj());
}

GdaMetaTableColumn* MetaStruct::get_table_column(GdaMetaTable* table, const Value& col_name)
{
  return gda_meta_struct_get_table_column(gobj(), table, (col_name).gobj());
}

Glib::ustring MetaStruct::dump_as_graph(MetaGraphInfo info)
{
  GError* gerror = 0;
  Glib::ustring retvalue = Glib::convert_return_gchar_ptr_to_ustring(gda_meta_struct_dump_as_graph(gobj(), ((GdaMetaGraphInfo)(info)), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool MetaStruct::complement_all()
{
  GError* gerror = 0;
  bool retvalue = gda_meta_struct_complement_all(gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

GSList* MetaStruct::get_all_db_objects()
{
  return gda_meta_struct_get_all_db_objects(gobj());
}


Glib::PropertyProxy_ReadOnly< guint > MetaStruct::property_features() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "features");
}


} // namespace Gda

} // namespace Gnome


