// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/querycondition.h>
#include <libgdamm/private/querycondition_p.h>

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

/* querycondition.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-enum-types.h>
#include <libgda/gda-query-condition.h>

#include <libgdamm/query.h>
#include <libgdamm/queryfield.h>
#include <libgdamm/querytarget.h>

namespace Gnome
{

namespace Gda
{

QueryCondition::QueryCondition(const Glib::RefPtr<Query>& query, QueryConditionType type)
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  QueryObject(Glib::ConstructParams(querycondition_class_.init(), "dict",gda_object_get_dict(GDA_OBJECT(query->gobj())),"query",Glib::unwrap(query),"cond_type",type, static_cast<char*>(0)))
{
}

} /* namespace Gda */

} /* namespace Gnome */


namespace
{
} // anonymous namespace

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

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


namespace Glib
{

Glib::RefPtr<Gnome::Gda::QueryCondition> wrap(GdaQueryCondition* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::QueryCondition>( dynamic_cast<Gnome::Gda::QueryCondition*> (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& QueryCondition_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_ = &QueryCondition_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_query_condition_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  XmlStorage::add_interface(get_type());
  Referer::add_interface(get_type());
  Renderer::add_interface(get_type());

  }

  return *this;
}

void QueryCondition_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* QueryCondition_Class::wrap_new(GObject* object)
{
  return new QueryCondition((GdaQueryCondition*)object);
}


/* The implementation: */

GdaQueryCondition* QueryCondition::gobj_copy()
{
  reference();
  return gobj();
}

QueryCondition::QueryCondition(const Glib::ConstructParams& construct_params)
:
  QueryObject(construct_params)
{

}

QueryCondition::QueryCondition(GdaQueryCondition* castitem)
:
  QueryObject((GdaQueryObject*)(castitem))
{}

QueryCondition::~QueryCondition()
{}


QueryCondition::CppClassType QueryCondition::querycondition_class_; // initialize static member

GType QueryCondition::get_type()
{
  return querycondition_class_.init().get_type();
}

GType QueryCondition::get_base_type()
{
  return gda_query_condition_get_type();
}


Glib::RefPtr<QueryCondition> QueryCondition::create(const Glib::RefPtr<Query>& query, QueryConditionType type)
{
  return Glib::RefPtr<QueryCondition>( new QueryCondition(query, type) );
}
void QueryCondition::set_cond_type(QueryConditionType type)
{
gda_query_condition_set_cond_type(gobj(), ((GdaQueryConditionType)(type))); 
}

QueryConditionType QueryCondition::get_cond_type() const
{
  return ((QueryConditionType)(gda_query_condition_get_cond_type(const_cast<GdaQueryCondition*>(gobj()))));
}

Glib::SListHandle<Glib::RefPtr<QueryCondition> > QueryCondition::get_children()
{
  return Glib::SListHandle<Glib::RefPtr<QueryCondition> >(gda_query_condition_get_children(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle<Glib::RefPtr<const QueryCondition> > QueryCondition::get_children() const
{
  return Glib::SListHandle<Glib::RefPtr<const QueryCondition> >(gda_query_condition_get_children(const_cast<GdaQueryCondition*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

Glib::RefPtr<QueryCondition> QueryCondition::get_parent()
{

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

}

Glib::RefPtr<const QueryCondition> QueryCondition::get_parent() const
{
  return const_cast<QueryCondition*>(this)->get_parent();
}

Glib::RefPtr<QueryCondition> QueryCondition::get_child_by_xml_id(const Glib::ustring& xml_id)
{

  Glib::RefPtr<QueryCondition> retvalue = Glib::wrap(gda_query_condition_get_child_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 QueryCondition> QueryCondition::get_child_by_xml_id(const Glib::ustring& xml_id) const
{

  Glib::RefPtr<const QueryCondition> retvalue = Glib::wrap(gda_query_condition_get_child_by_xml_id(const_cast<GdaQueryCondition*>(gobj()), xml_id.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

bool QueryCondition::is_ancestor(const Glib::RefPtr<QueryCondition>& ancestor) const
{
  return gda_query_condition_is_ancestor(const_cast<GdaQueryCondition*>(gobj()), Glib::unwrap(ancestor));
}

bool QueryCondition::is_leaf() const
{
  return gda_query_condition_is_leaf(const_cast<GdaQueryCondition*>(gobj()));
}

#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool QueryCondition::node_add_child(const Glib::RefPtr<QueryCondition>& child)
#else
bool QueryCondition::node_add_child(const Glib::RefPtr<QueryCondition>& child, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
  GError* gerror = 0;
  bool retvalue = gda_query_condition_node_add_child(gobj(), Glib::unwrap(child), &(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 QueryCondition::node_del_child(const Glib::RefPtr<QueryCondition>& child)
{
gda_query_condition_node_del_child(gobj(), Glib::unwrap(child)); 
}

void QueryCondition::leaf_set_operator(QueryConditionOperator op, const Glib::RefPtr<QueryField>& field)
{
gda_query_condition_leaf_set_operator(gobj(), ((GdaQueryConditionOperator)(op)), Glib::unwrap(field)); 
}

Glib::RefPtr<QueryField> QueryCondition::leaf_get_operator(QueryConditionOperator op)
{

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

}

Glib::RefPtr<const QueryField> QueryCondition::leaf_get_operator(QueryConditionOperator op) const
{
  return const_cast<QueryCondition*>(this)->leaf_get_operator(op);
}

Glib::SListHandle<Glib::RefPtr<QueryCondition> > QueryCondition::get_main_conditions()
{
  return Glib::SListHandle<Glib::RefPtr<QueryCondition> >(gda_query_condition_get_main_conditions(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle<Glib::RefPtr<const QueryCondition> > QueryCondition::get_main_conditions() const
{
  return Glib::SListHandle<Glib::RefPtr<const QueryCondition> >(gda_query_condition_get_main_conditions(const_cast<GdaQueryCondition*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<QueryConditionType> QueryCondition::property_cond_type() 
{
  return Glib::PropertyProxy<QueryConditionType>(this, "cond-type");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<QueryConditionType> QueryCondition::property_cond_type() const
{
  return Glib::PropertyProxy_ReadOnly<QueryConditionType>(this, "cond-type");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Query> > QueryCondition::property_query() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Query> >(this, "query");
}
#endif //GLIBMM_PROPERTIES_ENABLED


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gda

} // namespace Gnome


