
/*

  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 gsiDeclQReadWriteLock.cc 
*
*  DO NOT EDIT THIS FILE. 
*  This file has been created automatically
*/

#include "gsiQtCore.h"
#include "gsiDeclQtTypeTraits.h"
#include "gsiDeclQReadWriteLock_Enums.h"
#include <memory>

// -----------------------------------------------------------------------
// class QReadWriteLock

//  Constructor QReadWriteLock::QReadWriteLock()


static void _init_ctor_QReadWriteLock_0 (qt_gsi::GenericStaticMethod *decl)
{
  decl->set_return_new<QReadWriteLock *> ();
}

static void _call_ctor_QReadWriteLock_0 (const qt_gsi::GenericStaticMethod *decl, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<QReadWriteLock *> (new QReadWriteLock ());
}

static qt_gsi::GenericStaticMethod *_create_ctor_QReadWriteLock_0 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QReadWriteLock::QReadWriteLock()\nThis method creates an object of class QReadWriteLock.", &_init_ctor_QReadWriteLock_0, &_call_ctor_QReadWriteLock_0);
}

//  Constructor QReadWriteLock::QReadWriteLock(QReadWriteLock::RecursionMode recursionMode)


static void _init_ctor_QReadWriteLock_3272 (qt_gsi::GenericStaticMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("recursionMode");
  decl->add_arg<const qt_gsi::Converter<QReadWriteLock::RecursionMode>::target_type & > (argspec_0);
  decl->set_return_new<QReadWriteLock *> ();
}

static void _call_ctor_QReadWriteLock_3272 (const qt_gsi::GenericStaticMethod *decl, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  const qt_gsi::Converter<QReadWriteLock::RecursionMode>::target_type & arg1 = args.read<const qt_gsi::Converter<QReadWriteLock::RecursionMode>::target_type & > ();
  ret.write<QReadWriteLock *> (new QReadWriteLock (qt_gsi::QtToCppAdaptor<QReadWriteLock::RecursionMode>(arg1).cref()));
}

static qt_gsi::GenericStaticMethod *_create_ctor_QReadWriteLock_3272 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QReadWriteLock::QReadWriteLock(QReadWriteLock::RecursionMode recursionMode)\nThis method creates an object of class QReadWriteLock.", &_init_ctor_QReadWriteLock_3272, &_call_ctor_QReadWriteLock_3272);
}

// void QReadWriteLock::lockForRead()


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

static void _call_f_lockForRead_0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ((QReadWriteLock *)cls)->lockForRead ();
}

static qt_gsi::GenericMethod *_create_f_lockForRead_0 ()
{
  return new qt_gsi::GenericMethod ("lockForRead", "@brief Method void QReadWriteLock::lockForRead()\n", false, &_init_f_lockForRead_0, &_call_f_lockForRead_0);
}

// void QReadWriteLock::lockForWrite()


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

static void _call_f_lockForWrite_0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ((QReadWriteLock *)cls)->lockForWrite ();
}

static qt_gsi::GenericMethod *_create_f_lockForWrite_0 ()
{
  return new qt_gsi::GenericMethod ("lockForWrite", "@brief Method void QReadWriteLock::lockForWrite()\n", false, &_init_f_lockForWrite_0, &_call_f_lockForWrite_0);
}

// bool QReadWriteLock::tryLockForRead()


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

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

static qt_gsi::GenericMethod *_create_f_tryLockForRead_0 ()
{
  return new qt_gsi::GenericMethod ("tryLockForRead", "@brief Method bool QReadWriteLock::tryLockForRead()\n", false, &_init_f_tryLockForRead_0, &_call_f_tryLockForRead_0);
}

// bool QReadWriteLock::tryLockForRead(int timeout)


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

static void _call_f_tryLockForRead_767 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  int arg1 = args.read<int > ();
  ret.write<bool > ((bool)((QReadWriteLock *)cls)->tryLockForRead (arg1));
}

static qt_gsi::GenericMethod *_create_f_tryLockForRead_767 ()
{
  return new qt_gsi::GenericMethod ("tryLockForRead", "@brief Method bool QReadWriteLock::tryLockForRead(int timeout)\n", false, &_init_f_tryLockForRead_767, &_call_f_tryLockForRead_767);
}

// bool QReadWriteLock::tryLockForWrite()


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

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

static qt_gsi::GenericMethod *_create_f_tryLockForWrite_0 ()
{
  return new qt_gsi::GenericMethod ("tryLockForWrite", "@brief Method bool QReadWriteLock::tryLockForWrite()\n", false, &_init_f_tryLockForWrite_0, &_call_f_tryLockForWrite_0);
}

// bool QReadWriteLock::tryLockForWrite(int timeout)


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

static void _call_f_tryLockForWrite_767 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  int arg1 = args.read<int > ();
  ret.write<bool > ((bool)((QReadWriteLock *)cls)->tryLockForWrite (arg1));
}

static qt_gsi::GenericMethod *_create_f_tryLockForWrite_767 ()
{
  return new qt_gsi::GenericMethod ("tryLockForWrite", "@brief Method bool QReadWriteLock::tryLockForWrite(int timeout)\n", false, &_init_f_tryLockForWrite_767, &_call_f_tryLockForWrite_767);
}

// void QReadWriteLock::unlock()


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

static void _call_f_unlock_0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ((QReadWriteLock *)cls)->unlock ();
}

static qt_gsi::GenericMethod *_create_f_unlock_0 ()
{
  return new qt_gsi::GenericMethod ("unlock", "@brief Method void QReadWriteLock::unlock()\n", false, &_init_f_unlock_0, &_call_f_unlock_0);
}


namespace gsi
{
gsi::Class<QReadWriteLock> decl_QReadWriteLock ("QReadWriteLock",
  gsi::Methods(_create_ctor_QReadWriteLock_0 ()) +
  gsi::Methods(_create_ctor_QReadWriteLock_3272 ()) +
  gsi::Methods(_create_f_lockForRead_0 ()) +
  gsi::Methods(_create_f_lockForWrite_0 ()) +
  gsi::Methods(_create_f_tryLockForRead_0 ()) +
  gsi::Methods(_create_f_tryLockForRead_767 ()) +
  gsi::Methods(_create_f_tryLockForWrite_0 ()) +
  gsi::Methods(_create_f_tryLockForWrite_767 ()) +
  gsi::Methods(_create_f_unlock_0 ()),
  "@qt\n@brief Binding of QReadWriteLock");

}


//  Implementation of the enum wrapper class for QReadWriteLock::RecursionMode
namespace qt_gsi
{

static QReadWriteLock_RecursionMode_Enum *c_1_QReadWriteLock_RecursionMode_Enum () { return new QReadWriteLock_RecursionMode_Enum (QReadWriteLock::NonRecursive); }
static QReadWriteLock_RecursionMode_Enum *c_2_QReadWriteLock_RecursionMode_Enum () { return new QReadWriteLock_RecursionMode_Enum (QReadWriteLock::Recursive); }

static gsi::Methods mkdefs_QReadWriteLock_RecursionMode () {
  return
    gsi::constant ("NonRecursive", &qt_gsi::c_1_QReadWriteLock_RecursionMode_Enum, "@brief Enum constant QReadWriteLock::NonRecursive") +
    gsi::constant ("Recursive", &qt_gsi::c_2_QReadWriteLock_RecursionMode_Enum, "@brief Enum constant QReadWriteLock::Recursive");
}

static std::string to_s_QReadWriteLock_RecursionMode_Enum (const QReadWriteLock_RecursionMode_Enum *e)
{
  if (e->value () == QReadWriteLock::NonRecursive) { return tl::sprintf ("NonRecursive (%u)", (unsigned int) e->value ()); }
  if (e->value () == QReadWriteLock::Recursive) { return tl::sprintf ("Recursive (%u)", (unsigned int) e->value ()); }
  return std::string ("(not a valid enum evalue)");
}

static unsigned int to_i_QReadWriteLock_RecursionMode_Enum (const QReadWriteLock_RecursionMode_Enum *e)
{
  return (unsigned int) e->value ();
}

static QReadWriteLock_RecursionMode_Enum *from_i_QReadWriteLock_RecursionMode_Enum (unsigned int i)
{
  return new QReadWriteLock_RecursionMode_Enum ((QReadWriteLock::RecursionMode) i);
}

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

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

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

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

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

static std::string to_s_QReadWriteLock_RecursionMode_Enums (const QReadWriteLock_RecursionMode_Enums *e)
{
  std::string l;
  if (e->testFlag (QReadWriteLock::NonRecursive)) { if (!l.empty ()) l += "|"; l += "NonRecursive"; }
  if (e->testFlag (QReadWriteLock::Recursive)) { if (!l.empty ()) l += "|"; l += "Recursive"; }
  return tl::sprintf ("%u (%s)", (unsigned int) (e->flags ()), l);
}

static int to_i_QReadWriteLock_RecursionMode_Enums (const QReadWriteLock_RecursionMode_Enums *e)
{
  return int (e->flags ());
}

static bool testFlag_QReadWriteLock_RecursionMode_Enums (const QReadWriteLock_RecursionMode_Enums *e, const QReadWriteLock_RecursionMode_Enum &d)
{
  return e->flags ().testFlag (d.value ());
}

}

namespace gsi
{

//  Declarations for QFlags<enum> wrapper class
gsi::Class<qt_gsi::QReadWriteLock_RecursionMode_Enums> decl_QReadWriteLock_RecursionMode_Enums ("QReadWriteLock_QFlags_RecursionMode",
  gsi::method_ext ("|", &qt_gsi::oropQReadWriteLock_RecursionMode_Enums, gsi::arg ("other"), "@brief 'or' operator between two flag sets") +
  gsi::method_ext ("&", &qt_gsi::andopQReadWriteLock_RecursionMode_Enums, gsi::arg ("other"), "@brief 'and' operator between two flag sets") +
  gsi::method_ext ("^", &qt_gsi::xoropQReadWriteLock_RecursionMode_Enums, gsi::arg ("other"), "@brief 'xor' operator between two flag sets") +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QReadWriteLock_RecursionMode_Enums, "@brief Converts the flag set to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QReadWriteLock_RecursionMode_Enums, "@brief Returns the integer value encoding the flag set") +
  gsi::method_ext ("testFlag", &qt_gsi::testFlag_QReadWriteLock_RecursionMode_Enums, gsi::arg ("flag"), "@brief Tests whether the flag is contained in the flag set"),
  "@qt\n@brief This class represents the QFlags<QReadWriteLock::RecursionMode> flag set");

//  Declarations for enum wrapper class
gsi::Class<qt_gsi::QReadWriteLock_RecursionMode_Enum> decl_QReadWriteLock_RecursionMode_Enum (decl_QReadWriteLock_RecursionMode_Enums, "QReadWriteLock_RecursionMode",
  qt_gsi::mkdefs_QReadWriteLock_RecursionMode () +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QReadWriteLock_RecursionMode_Enum, "@brief Converts the enum class to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QReadWriteLock_RecursionMode_Enum, "@brief Converts the enum class to an integer") +
  gsi::method_ext ("==", &qt_gsi::equalQReadWriteLock_RecursionMode_Enum, gsi::arg ("other"), "@brief Compares the enum class against an enum of it's own type") +
  gsi::method_ext ("==", &qt_gsi::equal2QReadWriteLock_RecursionMode_Enum, gsi::arg ("other"), "@brief Compares the enum class against an integer") +
  gsi::constructor ("new", &qt_gsi::from_i_QReadWriteLock_RecursionMode_Enum, gsi::arg ("value"), "@brief Creates the enum object from an integer"),
  "@qt\n@brief This class represents the QReadWriteLock::RecursionMode enum");

//  Inject the declarations into the parent
static gsi::ClassExt<QReadWriteLock> inject_QReadWriteLock_RecursionMode_Enum_in_parent (qt_gsi::mkdefs_QReadWriteLock_RecursionMode ());
static gsi::ClassExt<QReadWriteLock> decl_QReadWriteLock_RecursionMode_Enum_as_child (decl_QReadWriteLock_RecursionMode_Enum, "RecursionMode");

}

