
/*

  KLayout Layout Viewer
  Copyright (C) 2006-2016 Matthias Koefferlein

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program 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 General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

/**
*  @file gsiDeclQSqlError.cc 
*
*  DO NOT EDIT THIS FILE. 
*  This file has been created automatically
*/

#include "gsiQtSql.h"
#include "gsiDeclQtTypeTraits.h"
#include "gsiDeclQSqlError_Enums.h"
#include <memory>

// -----------------------------------------------------------------------
// class QSqlError

//  Constructor QSqlError::QSqlError(const QString &driverText, const QString &databaseText, QSqlError::ErrorType type, int number)


static void _init_ctor_QSqlError_6892 (qt_gsi::GenericStaticMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("driverText", true, "QString()");
  decl->add_arg<const QString & > (argspec_0);
  static gsi::ArgSpecBase argspec_1 ("databaseText", true, "QString()");
  decl->add_arg<const QString & > (argspec_1);
  static gsi::ArgSpecBase argspec_2 ("type", true, "QSqlError::NoError");
  decl->add_arg<const qt_gsi::Converter<QSqlError::ErrorType>::target_type & > (argspec_2);
  static gsi::ArgSpecBase argspec_3 ("number", true, "-1");
  decl->add_arg<int > (argspec_3);
  decl->set_return_new<QSqlError *> ();
}

static void _call_ctor_QSqlError_6892 (const qt_gsi::GenericStaticMethod *decl, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const QString &arg1 = args ? args.read<const QString & > () : (const QString &)(QString());
  const QString &arg2 = args ? args.read<const QString & > () : (const QString &)(QString());
  tl::Heap heap;
  const qt_gsi::Converter<QSqlError::ErrorType>::target_type & arg3 = args ? args.read<const qt_gsi::Converter<QSqlError::ErrorType>::target_type & > () : (const qt_gsi::Converter<QSqlError::ErrorType>::target_type &)(qt_gsi::CppToQtReadAdaptor<QSqlError::ErrorType>(heap, QSqlError::NoError));
  int arg4 = args ? args.read<int > () : (int)(-1);
  ret.write<QSqlError *> (new QSqlError (arg1, arg2, qt_gsi::QtToCppAdaptor<QSqlError::ErrorType>(arg3).cref(), arg4));
}

static qt_gsi::GenericStaticMethod *_create_ctor_QSqlError_6892 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QSqlError::QSqlError(const QString &driverText, const QString &databaseText, QSqlError::ErrorType type, int number)\nThis method creates an object of class QSqlError.", &_init_ctor_QSqlError_6892, &_call_ctor_QSqlError_6892);
}

//  Constructor QSqlError::QSqlError(const QSqlError &other)


static void _init_ctor_QSqlError_2220 (qt_gsi::GenericStaticMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("other");
  decl->add_arg<const QSqlError & > (argspec_0);
  decl->set_return_new<QSqlError *> ();
}

static void _call_ctor_QSqlError_2220 (const qt_gsi::GenericStaticMethod *decl, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const QSqlError &arg1 = args.read<const QSqlError & > ();
  ret.write<QSqlError *> (new QSqlError (arg1));
}

static qt_gsi::GenericStaticMethod *_create_ctor_QSqlError_2220 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QSqlError::QSqlError(const QSqlError &other)\nThis method creates an object of class QSqlError.", &_init_ctor_QSqlError_2220, &_call_ctor_QSqlError_2220);
}

// QString QSqlError::databaseText()


static void _init_f_databaseText_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<QString > ();
}

static void _call_f_databaseText_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<QString > ((QString)((QSqlError *)cls)->databaseText ());
}

static qt_gsi::GenericMethod *_create_f_databaseText_c0 ()
{
  return new qt_gsi::GenericMethod (":databaseText", "@brief Method QString QSqlError::databaseText()\n", true, &_init_f_databaseText_c0, &_call_f_databaseText_c0);
}

// QString QSqlError::driverText()


static void _init_f_driverText_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<QString > ();
}

static void _call_f_driverText_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<QString > ((QString)((QSqlError *)cls)->driverText ());
}

static qt_gsi::GenericMethod *_create_f_driverText_c0 ()
{
  return new qt_gsi::GenericMethod (":driverText", "@brief Method QString QSqlError::driverText()\n", true, &_init_f_driverText_c0, &_call_f_driverText_c0);
}

// bool QSqlError::isValid()


static void _init_f_isValid_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<bool > ();
}

static void _call_f_isValid_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<bool > ((bool)((QSqlError *)cls)->isValid ());
}

static qt_gsi::GenericMethod *_create_f_isValid_c0 ()
{
  return new qt_gsi::GenericMethod ("isValid?", "@brief Method bool QSqlError::isValid()\n", true, &_init_f_isValid_c0, &_call_f_isValid_c0);
}

// int QSqlError::number()


static void _init_f_number_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<int > ();
}

static void _call_f_number_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<int > ((int)((QSqlError *)cls)->number ());
}

static qt_gsi::GenericMethod *_create_f_number_c0 ()
{
  return new qt_gsi::GenericMethod (":number", "@brief Method int QSqlError::number()\n", true, &_init_f_number_c0, &_call_f_number_c0);
}

// QSqlError &QSqlError::operator=(const QSqlError &other)


static void _init_f_operator_eq__2220 (qt_gsi::GenericMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("other");
  decl->add_arg<const QSqlError & > (argspec_0);
  decl->set_return<QSqlError & > ();
}

static void _call_f_operator_eq__2220 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const QSqlError &arg1 = args.read<const QSqlError & > ();
  ret.write<QSqlError & > ((QSqlError &)((QSqlError *)cls)->operator= (arg1));
}

static qt_gsi::GenericMethod *_create_f_operator_eq__2220 ()
{
  return new qt_gsi::GenericMethod ("assign", "@brief Method QSqlError &QSqlError::operator=(const QSqlError &other)\n", false, &_init_f_operator_eq__2220, &_call_f_operator_eq__2220);
}

// void QSqlError::setDatabaseText(const QString &databaseText)


static void _init_f_setDatabaseText_2025 (qt_gsi::GenericMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("databaseText");
  decl->add_arg<const QString & > (argspec_0);
  decl->set_return<void > ();
}

static void _call_f_setDatabaseText_2025 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const QString &arg1 = args.read<const QString & > ();
  ((QSqlError *)cls)->setDatabaseText (arg1);
}

static qt_gsi::GenericMethod *_create_f_setDatabaseText_2025 ()
{
  return new qt_gsi::GenericMethod ("setDatabaseText|databaseText=", "@brief Method void QSqlError::setDatabaseText(const QString &databaseText)\n", false, &_init_f_setDatabaseText_2025, &_call_f_setDatabaseText_2025);
}

// void QSqlError::setDriverText(const QString &driverText)


static void _init_f_setDriverText_2025 (qt_gsi::GenericMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("driverText");
  decl->add_arg<const QString & > (argspec_0);
  decl->set_return<void > ();
}

static void _call_f_setDriverText_2025 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const QString &arg1 = args.read<const QString & > ();
  ((QSqlError *)cls)->setDriverText (arg1);
}

static qt_gsi::GenericMethod *_create_f_setDriverText_2025 ()
{
  return new qt_gsi::GenericMethod ("setDriverText|driverText=", "@brief Method void QSqlError::setDriverText(const QString &driverText)\n", false, &_init_f_setDriverText_2025, &_call_f_setDriverText_2025);
}

// void QSqlError::setNumber(int number)


static void _init_f_setNumber_767 (qt_gsi::GenericMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("number");
  decl->add_arg<int > (argspec_0);
  decl->set_return<void > ();
}

static void _call_f_setNumber_767 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  int arg1 = args.read<int > ();
  ((QSqlError *)cls)->setNumber (arg1);
}

static qt_gsi::GenericMethod *_create_f_setNumber_767 ()
{
  return new qt_gsi::GenericMethod ("setNumber|number=", "@brief Method void QSqlError::setNumber(int number)\n", false, &_init_f_setNumber_767, &_call_f_setNumber_767);
}

// void QSqlError::setType(QSqlError::ErrorType type)


static void _init_f_setType_2399 (qt_gsi::GenericMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("type");
  decl->add_arg<const qt_gsi::Converter<QSqlError::ErrorType>::target_type & > (argspec_0);
  decl->set_return<void > ();
}

static void _call_f_setType_2399 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const qt_gsi::Converter<QSqlError::ErrorType>::target_type & arg1 = args.read<const qt_gsi::Converter<QSqlError::ErrorType>::target_type & > ();
  ((QSqlError *)cls)->setType (qt_gsi::QtToCppAdaptor<QSqlError::ErrorType>(arg1).cref());
}

static qt_gsi::GenericMethod *_create_f_setType_2399 ()
{
  return new qt_gsi::GenericMethod ("setType|type=", "@brief Method void QSqlError::setType(QSqlError::ErrorType type)\n", false, &_init_f_setType_2399, &_call_f_setType_2399);
}

// QString QSqlError::text()


static void _init_f_text_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<QString > ();
}

static void _call_f_text_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<QString > ((QString)((QSqlError *)cls)->text ());
}

static qt_gsi::GenericMethod *_create_f_text_c0 ()
{
  return new qt_gsi::GenericMethod ("text", "@brief Method QString QSqlError::text()\n", true, &_init_f_text_c0, &_call_f_text_c0);
}

// QSqlError::ErrorType QSqlError::type()


static void _init_f_type_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<qt_gsi::Converter<QSqlError::ErrorType>::target_type > ();
}

static void _call_f_type_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<qt_gsi::Converter<QSqlError::ErrorType>::target_type > ((qt_gsi::Converter<QSqlError::ErrorType>::target_type)qt_gsi::CppToQtAdaptor<QSqlError::ErrorType>(((QSqlError *)cls)->type ()));
}

static qt_gsi::GenericMethod *_create_f_type_c0 ()
{
  return new qt_gsi::GenericMethod (":type", "@brief Method QSqlError::ErrorType QSqlError::type()\n", true, &_init_f_type_c0, &_call_f_type_c0);
}


namespace gsi
{
gsi::Class<QSqlError> decl_QSqlError ("QSqlError",
  gsi::Methods(_create_ctor_QSqlError_6892 ()) +
  gsi::Methods(_create_ctor_QSqlError_2220 ()) +
  gsi::Methods(_create_f_databaseText_c0 ()) +
  gsi::Methods(_create_f_driverText_c0 ()) +
  gsi::Methods(_create_f_isValid_c0 ()) +
  gsi::Methods(_create_f_number_c0 ()) +
  gsi::Methods(_create_f_operator_eq__2220 ()) +
  gsi::Methods(_create_f_setDatabaseText_2025 ()) +
  gsi::Methods(_create_f_setDriverText_2025 ()) +
  gsi::Methods(_create_f_setNumber_767 ()) +
  gsi::Methods(_create_f_setType_2399 ()) +
  gsi::Methods(_create_f_text_c0 ()) +
  gsi::Methods(_create_f_type_c0 ()),
  "@qt\n@brief Binding of QSqlError");

}


//  Implementation of the enum wrapper class for QSqlError::ErrorType
namespace qt_gsi
{

static QSqlError_ErrorType_Enum *c_1_QSqlError_ErrorType_Enum () { return new QSqlError_ErrorType_Enum (QSqlError::NoError); }
static QSqlError_ErrorType_Enum *c_2_QSqlError_ErrorType_Enum () { return new QSqlError_ErrorType_Enum (QSqlError::ConnectionError); }
static QSqlError_ErrorType_Enum *c_3_QSqlError_ErrorType_Enum () { return new QSqlError_ErrorType_Enum (QSqlError::StatementError); }
static QSqlError_ErrorType_Enum *c_4_QSqlError_ErrorType_Enum () { return new QSqlError_ErrorType_Enum (QSqlError::TransactionError); }
static QSqlError_ErrorType_Enum *c_5_QSqlError_ErrorType_Enum () { return new QSqlError_ErrorType_Enum (QSqlError::UnknownError); }

static gsi::Methods mkdefs_QSqlError_ErrorType () {
  return
    gsi::constant ("NoError", &qt_gsi::c_1_QSqlError_ErrorType_Enum, "@brief Enum constant QSqlError::NoError") +
    gsi::constant ("ConnectionError", &qt_gsi::c_2_QSqlError_ErrorType_Enum, "@brief Enum constant QSqlError::ConnectionError") +
    gsi::constant ("StatementError", &qt_gsi::c_3_QSqlError_ErrorType_Enum, "@brief Enum constant QSqlError::StatementError") +
    gsi::constant ("TransactionError", &qt_gsi::c_4_QSqlError_ErrorType_Enum, "@brief Enum constant QSqlError::TransactionError") +
    gsi::constant ("UnknownError", &qt_gsi::c_5_QSqlError_ErrorType_Enum, "@brief Enum constant QSqlError::UnknownError");
}

static std::string to_s_QSqlError_ErrorType_Enum (const QSqlError_ErrorType_Enum *e)
{
  if (e->value () == QSqlError::NoError) { return tl::sprintf ("NoError (%u)", (unsigned int) e->value ()); }
  if (e->value () == QSqlError::ConnectionError) { return tl::sprintf ("ConnectionError (%u)", (unsigned int) e->value ()); }
  if (e->value () == QSqlError::StatementError) { return tl::sprintf ("StatementError (%u)", (unsigned int) e->value ()); }
  if (e->value () == QSqlError::TransactionError) { return tl::sprintf ("TransactionError (%u)", (unsigned int) e->value ()); }
  if (e->value () == QSqlError::UnknownError) { return tl::sprintf ("UnknownError (%u)", (unsigned int) e->value ()); }
  return std::string ("(not a valid enum evalue)");
}

static unsigned int to_i_QSqlError_ErrorType_Enum (const QSqlError_ErrorType_Enum *e)
{
  return (unsigned int) e->value ();
}

static QSqlError_ErrorType_Enum *from_i_QSqlError_ErrorType_Enum (unsigned int i)
{
  return new QSqlError_ErrorType_Enum ((QSqlError::ErrorType) i);
}

static bool equalQSqlError_ErrorType_Enum (const QSqlError_ErrorType_Enum *e, QSqlError_ErrorType_Enum d)
{
  return e->value () == d.value ();
}

static bool equal2QSqlError_ErrorType_Enum (const QSqlError_ErrorType_Enum *e, unsigned int i)
{
  return (unsigned int) e->value () == i;
}

static QSqlError_ErrorType_Enums oropQSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e, const QSqlError_ErrorType_Enums &d)
{
  return e->flags () | d.flags ();
}

static QSqlError_ErrorType_Enums andopQSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e, const QSqlError_ErrorType_Enums &d)
{
  return e->flags () & d.flags ();
}

static QSqlError_ErrorType_Enums xoropQSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e, const QSqlError_ErrorType_Enums &d)
{
  return e->flags () ^ d.flags ();
}

static std::string to_s_QSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e)
{
  std::string l;
  if (e->testFlag (QSqlError::NoError)) { if (!l.empty ()) l += "|"; l += "NoError"; }
  if (e->testFlag (QSqlError::ConnectionError)) { if (!l.empty ()) l += "|"; l += "ConnectionError"; }
  if (e->testFlag (QSqlError::StatementError)) { if (!l.empty ()) l += "|"; l += "StatementError"; }
  if (e->testFlag (QSqlError::TransactionError)) { if (!l.empty ()) l += "|"; l += "TransactionError"; }
  if (e->testFlag (QSqlError::UnknownError)) { if (!l.empty ()) l += "|"; l += "UnknownError"; }
  return tl::sprintf ("%u (%s)", (unsigned int) (e->flags ()), l);
}

static int to_i_QSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e)
{
  return int (e->flags ());
}

static bool testFlag_QSqlError_ErrorType_Enums (const QSqlError_ErrorType_Enums *e, const QSqlError_ErrorType_Enum &d)
{
  return e->flags ().testFlag (d.value ());
}

}

namespace gsi
{

//  Declarations for QFlags<enum> wrapper class
gsi::Class<qt_gsi::QSqlError_ErrorType_Enums> decl_QSqlError_ErrorType_Enums ("QSqlError_QFlags_ErrorType",
  gsi::method_ext ("|", &qt_gsi::oropQSqlError_ErrorType_Enums, gsi::arg ("other"), "@brief 'or' operator between two flag sets") +
  gsi::method_ext ("&", &qt_gsi::andopQSqlError_ErrorType_Enums, gsi::arg ("other"), "@brief 'and' operator between two flag sets") +
  gsi::method_ext ("^", &qt_gsi::xoropQSqlError_ErrorType_Enums, gsi::arg ("other"), "@brief 'xor' operator between two flag sets") +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QSqlError_ErrorType_Enums, "@brief Converts the flag set to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QSqlError_ErrorType_Enums, "@brief Returns the integer value encoding the flag set") +
  gsi::method_ext ("testFlag", &qt_gsi::testFlag_QSqlError_ErrorType_Enums, gsi::arg ("flag"), "@brief Tests whether the flag is contained in the flag set"),
  "@qt\n@brief This class represents the QFlags<QSqlError::ErrorType> flag set");

//  Declarations for enum wrapper class
gsi::Class<qt_gsi::QSqlError_ErrorType_Enum> decl_QSqlError_ErrorType_Enum (decl_QSqlError_ErrorType_Enums, "QSqlError_ErrorType",
  qt_gsi::mkdefs_QSqlError_ErrorType () +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QSqlError_ErrorType_Enum, "@brief Converts the enum class to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QSqlError_ErrorType_Enum, "@brief Converts the enum class to an integer") +
  gsi::method_ext ("==", &qt_gsi::equalQSqlError_ErrorType_Enum, gsi::arg ("other"), "@brief Compares the enum class against an enum of it's own type") +
  gsi::method_ext ("==", &qt_gsi::equal2QSqlError_ErrorType_Enum, gsi::arg ("other"), "@brief Compares the enum class against an integer") +
  gsi::constructor ("new", &qt_gsi::from_i_QSqlError_ErrorType_Enum, gsi::arg ("value"), "@brief Creates the enum object from an integer"),
  "@qt\n@brief This class represents the QSqlError::ErrorType enum");

//  Inject the declarations into the parent
static gsi::ClassExt<QSqlError> inject_QSqlError_ErrorType_Enum_in_parent (qt_gsi::mkdefs_QSqlError_ErrorType ());
static gsi::ClassExt<QSqlError> decl_QSqlError_ErrorType_Enum_as_child (decl_QSqlError_ErrorType_Enum, "ErrorType");

}

