// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/dict.h>
#include <libgdamm/private/dict_p.h>

/* $Id: dict.ccg,v 1.3 2006/11/30 06:58:55 murrayc Exp $ */
// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* dict.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-dict-reg-aggregates.h>
#include <libgda/gda-dict-type.h>
#include <libgda/gda-dict.h>
#include <libgdamm/connection.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{

namespace Gda
{

#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool Dict::update_dbms_meta_data(GType limit_to_type)
#else
bool Dict::update_dbms_meta_data(GType limit_to_type, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_update_dbms_meta_data(gobj(), limit_to_type, 0, &(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_EXCEPTIONS_ENABLED
bool Dict::update_dbms_meta_data()
#else
bool Dict::update_dbms_meta_data(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_update_dbms_meta_data(gobj(), 0, 0, &(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;

}

GSList* Dict::get_aggregates() const
{
  return gda_dict_get_aggregates(const_cast<GdaDict*>(gobj()));
}


} /* namespace Gda */
} /* namespace Gnome */


namespace
{
} // anonymous namespace


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

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

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

#ifdef GLIBMM_EXCEPTIONS_ENABLED
void Gnome::Gda::DictError::throw_func(GError* gobject)
{
  throw Gnome::Gda::DictError(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> Gnome::Gda::DictError::throw_func(GError* gobject)
{
  return std::auto_ptr<Glib::Error>(new Gnome::Gda::DictError(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED

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


namespace Glib
{

Glib::RefPtr<Gnome::Gda::Dict> wrap(GdaDict* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::Dict>( dynamic_cast<Gnome::Gda::Dict*> (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& Dict_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_ = &Dict_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_get_type());

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

  }

  return *this;
}

void Dict_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* Dict_Class::wrap_new(GObject* object)
{
  return new Dict((GdaDict*)object);
}


/* The implementation: */

GdaDict* Dict::gobj_copy()
{
  reference();
  return gobj();
}

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

}

Dict::Dict(GdaDict* castitem)
:
  Glib::Object((GObject*)(castitem))
{}

Dict::~Dict()
{}


Dict::CppClassType Dict::dict_class_; // initialize static member

GType Dict::get_type()
{
  return dict_class_.init().get_type();
}

GType Dict::get_base_type()
{
  return gda_dict_get_type();
}


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

}

Glib::RefPtr<Dict> Dict::create()
{
  return Glib::RefPtr<Dict>( new Dict() );
}
void Dict::set_connection(const Glib::RefPtr<Connection>& cnc)
{
gda_dict_set_connection(gobj(), Glib::unwrap(cnc)); 
}

Glib::RefPtr<Connection> Dict::get_connection()
{

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

}

Glib::RefPtr<const Connection> Dict::get_connection() const
{
  return const_cast<Dict*>(this)->get_connection();
}

void Dict::declare_object_string_id_change(const Glib::RefPtr<Gda::Object>& obj, const Glib::ustring& oldid)
{
gda_dict_declare_object_string_id_change(gobj(), Glib::unwrap(obj), oldid.c_str()); 
}

Glib::RefPtr<Gda::Object> Dict::get_object_by_string_id(const Glib::ustring& strid)
{

  Glib::RefPtr<Gda::Object> retvalue = Glib::wrap(gda_dict_get_object_by_string_id(gobj(), strid.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const Gda::Object> Dict::get_object_by_string_id(const Glib::ustring& strid) const
{
  return const_cast<Dict*>(this)->get_object_by_string_id(strid);
}

#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool Dict::update_dbms_meta_data(GType limit_to_type, const Glib::ustring& limit_obj_name)
#else
bool Dict::update_dbms_meta_data(GType limit_to_type, const Glib::ustring& limit_obj_name, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_update_dbms_meta_data(gobj(), limit_to_type, limit_obj_name.c_str(), &(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;

}

void Dict::stop_update_dbms_meta_data()
{
gda_dict_stop_update_dbms_meta_data(gobj()); 
}

#ifdef GLIBMM_EXCEPTIONS_ENABLED
std::string Dict::compute_xml_filename(const Glib::ustring& datasource, const Glib::ustring& app_id)
#else
std::string Dict::compute_xml_filename(const Glib::ustring& datasource, const Glib::ustring& app_id, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  std::string retvalue = Glib::convert_return_gchar_ptr_to_stdstring(gda_dict_compute_xml_filename(gobj(), datasource.c_str(), app_id.c_str(), &(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;

}

void Dict::set_xml_filename(const std::string& xmlfile)
{
gda_dict_set_xml_filename(gobj(), xmlfile.c_str()); 
}

std::string Dict::get_xml_filename() const
{
  return Glib::convert_const_gchar_ptr_to_stdstring(gda_dict_get_xml_filename(const_cast<GdaDict*>(gobj())));
}

#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool Dict::load()
#else
bool Dict::load(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_load(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_EXCEPTIONS_ENABLED
bool Dict::save()
#else
bool Dict::save(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_save(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_EXCEPTIONS_ENABLED
bool Dict::load_xml_file(const std::string& xmlfile)
#else
bool Dict::load_xml_file(const std::string& xmlfile, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_load_xml_file(gobj(), xmlfile.c_str(), &(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_EXCEPTIONS_ENABLED
bool Dict::save_xml_file(const std::string& xmlfile)
#else
bool Dict::save_xml_file(const std::string& xmlfile, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_dict_save_xml_file(gobj(), xmlfile.c_str(), &(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;

}

Glib::RefPtr<DataHandler> Dict::get_handler(GType for_type)
{

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

}

Glib::RefPtr<const DataHandler> Dict::get_handler(GType for_type) const
{
  return const_cast<Dict*>(this)->get_handler(for_type);
}

Glib::RefPtr<DataHandler> Dict::get_default_handler(GType for_type)
{

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

}

Glib::RefPtr<const DataHandler> Dict::get_default_handler(GType for_type) const
{
  return const_cast<Dict*>(this)->get_default_handler(for_type);
}

Glib::SListHandle<Glib::RefPtr<DictType> > Dict::get_dict_types()
{
  return Glib::SListHandle<Glib::RefPtr<DictType> >(gda_dict_get_dict_types(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle<Glib::RefPtr<const DictType> > Dict::get_dict_types() const
{
  return Glib::SListHandle<Glib::RefPtr<const DictType> >(gda_dict_get_dict_types(const_cast<GdaDict*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

Glib::RefPtr<DictType> Dict::get_dict_type_by_name(const Glib::ustring& type_name)
{

  Glib::RefPtr<DictType> retvalue = Glib::wrap(gda_dict_get_dict_type_by_name(gobj(), type_name.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const DictType> Dict::get_dict_type_by_name(const Glib::ustring& type_name) const
{
  return const_cast<Dict*>(this)->get_dict_type_by_name(type_name);
}

Glib::RefPtr<DictType> Dict::get_dict_type_by_xml_id(const Glib::ustring& xml_id)
{

  Glib::RefPtr<DictType> retvalue = Glib::wrap(gda_dict_get_dict_type_by_xml_id(gobj(), xml_id.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const DictType> Dict::get_dict_type_by_xml_id(const Glib::ustring& xml_id) const
{
  return const_cast<Dict*>(this)->get_dict_type_by_xml_id(xml_id);
}

Glib::RefPtr<DictDatabase> Dict::get_database()
{

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

}

Glib::RefPtr<const DictDatabase> Dict::get_database() const
{
  return const_cast<Dict*>(this)->get_database();
}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gda

} // namespace Gnome


