// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/quarklist.h>
#include <libgdamm/private/quarklist_p.h>

// -*- C++ -*- //

/* quarklist.ccg
 *
 * Copyright 2001      Free Software Foundation
 *
 * 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 <libgda/gda-quark-list.h>

namespace
{
static void quarklist_foreach_callback(gpointer ckey, gpointer cvalue, void* data)
{
  try
  {
    Gnome::Gda::QuarkList::ForeachSlot& slot = *static_cast<Gnome::Gda::QuarkList::ForeachSlot*>(data);
    Glib::ustring key(static_cast<gchar*>(ckey));
    Glib::ustring value(static_cast<gchar*>(cvalue));

    slot(key, value);
  }
  catch(...)
  {
    Glib::exception_handlers_invoke();
  }
} 
}

namespace Gnome
{

namespace Gda
{  

void QuarkList::foreach(const QuarkList::ForeachSlot& slot)
{
  ForeachSlot slot_copy (slot);
  gda_quark_list_foreach(gobj(), &quarklist_foreach_callback, &slot_copy);
}

} // namespace Gda

} // namesoace Gnome

namespace
{
} // anonymous namespace


namespace Glib
{

Gnome::Gda::QuarkList wrap(GdaQuarkList* object, bool take_copy)
{
  return Gnome::Gda::QuarkList(object, take_copy);
}

} // namespace Glib


namespace Gnome
{

namespace Gda
{


// static
GType QuarkList::get_type()
{
  return gda_quark_list_get_type();
}

QuarkList::QuarkList()
:
  gobject_ (gda_quark_list_new())
{}

QuarkList::QuarkList(const QuarkList& other)
:
  gobject_ ((other.gobject_) ? gda_quark_list_copy(other.gobject_) : 0)
{}

QuarkList::QuarkList(GdaQuarkList* 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_quark_list_copy(gobject) : gobject)
{}

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

QuarkList::~QuarkList()
{
  if(gobject_)
    gda_quark_list_free(gobject_);
}

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

GdaQuarkList* QuarkList::gobj_copy() const
{
  return gda_quark_list_copy(gobject_);
}


void QuarkList::clear()
{
gda_quark_list_clear(gobj()); 
}

void QuarkList::add_from_string(const Glib::ustring& name, bool cleanup)
{
gda_quark_list_add_from_string(gobj(), name.c_str(), static_cast<int>(cleanup)); 
}

Glib::ustring QuarkList::find(const Glib::ustring& name) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gda_quark_list_find(const_cast<GdaQuarkList*>(gobj()), name.c_str()));
}

void QuarkList::remove(const Glib::ustring& name)
{
gda_quark_list_remove(gobj(), name.c_str()); 
}


} // namespace Gda

} // namespace Gnome


