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


#include <glibmm.h>

#include <libgdamm/sqlparser.h>
#include <libgdamm/private/sqlparser_p.h>


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

/* sqlparser.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/sqlparser.h>
#include <sql-parser/gda-sql-parser.h>
#include <sql-parser/gda-sql-parser-enum-types.h>

namespace Gnome
{

namespace Gda
{

Glib::RefPtr<Statement> SqlParser::parse_string(const Glib::ustring& sql, Glib::ustring& remain)
{
  GError* gerror = 0;
  const gchar* c_remain = 0;
  Glib::RefPtr<Statement> retvalue = Glib::wrap(gda_sql_parser_parse_string(gobj(), sql.c_str(), &c_remain, &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  if (c_remain)
  {
    remain = c_remain;
  }

  return retvalue;
}

Glib::RefPtr<Statement> SqlParser::parse_string(const Glib::ustring& sql)
{
  GError* gerror = 0;
  Glib::RefPtr<Statement> retvalue = Glib::wrap(gda_sql_parser_parse_string(gobj(), sql.c_str(), 0, &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<Batch> SqlParser::parse_string_as_batch(const Glib::ustring& sql, Glib::ustring& remain)
{
  GError* gerror = 0;
  const gchar* c_remain = 0;
  Glib::RefPtr<Batch> retvalue = Glib::wrap(gda_sql_parser_parse_string_as_batch(gobj(), sql.c_str(), &c_remain, &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  if (c_remain)
  {
    remain = c_remain;
  }

  return retvalue;
}

Glib::RefPtr<Batch> SqlParser::parse_string_as_batch(const Glib::ustring& sql)
{
  GError* gerror = 0;
  Glib::RefPtr<Batch> retvalue = Glib::wrap(gda_sql_parser_parse_string_as_batch(gobj(), sql.c_str(), 0, &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}

} /* namespace Gda */

} /* namespace Gnome */


namespace
{
} // anonymous namespace

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


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

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

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

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

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


namespace Glib
{

Glib::RefPtr<Gnome::Gda::SqlParser> wrap(GdaSqlParser* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::SqlParser>( dynamic_cast<Gnome::Gda::SqlParser*> (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& SqlParser_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_ = &SqlParser_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_sql_parser_get_type());

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

  }

  return *this;
}


void SqlParser_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);


}


Glib::ObjectBase* SqlParser_Class::wrap_new(GObject* object)
{
  return new SqlParser((GdaSqlParser*)object);
}


/* The implementation: */

GdaSqlParser* SqlParser::gobj_copy()
{
  reference();
  return gobj();
}

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

}

SqlParser::SqlParser(GdaSqlParser* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


SqlParser::~SqlParser()
{}


SqlParser::CppClassType SqlParser::sqlparser_class_; // initialize static member

GType SqlParser::get_type()
{
  return sqlparser_class_.init().get_type();
}


GType SqlParser::get_base_type()
{
  return gda_sql_parser_get_type();
}


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

}

Glib::RefPtr<SqlParser> SqlParser::create()
{
  return Glib::RefPtr<SqlParser>( new SqlParser() );
}

Glib::RefPtr<Batch> SqlParser::parse_file_as_batch(const std::string& filename)
{
  GError* gerror = 0;
  Glib::RefPtr<Batch> retvalue = Glib::wrap(gda_sql_parser_parse_file_as_batch(gobj(), filename.c_str(), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< int > SqlParser::property_column_error() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "column-error");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< int > SqlParser::property_line_error() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "line-error");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< int > SqlParser::property_mode() 
{
  return Glib::PropertyProxy< int >(this, "mode");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< int > SqlParser::property_mode() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "mode");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy< int > SqlParser::property_tokenizer_flavour() 
{
  return Glib::PropertyProxy< int >(this, "tokenizer-flavour");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< int > SqlParser::property_tokenizer_flavour() const
{
  return Glib::PropertyProxy_ReadOnly< int >(this, "tokenizer-flavour");
}
#endif //GLIBMM_PROPERTIES_ENABLED


} // namespace Gda

} // namespace Gnome


