
/*

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

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

// -----------------------------------------------------------------------
// class QMutex

//  Constructor QMutex::QMutex(QMutex::RecursionMode mode)


static void _init_ctor_QMutex_2507 (qt_gsi::GenericStaticMethod *decl)
{
  static gsi::ArgSpecBase argspec_0 ("mode", true, "QMutex::NonRecursive");
  decl->add_arg<const qt_gsi::Converter<QMutex::RecursionMode>::target_type & > (argspec_0);
  decl->set_return_new<QMutex *> ();
}

static void _call_ctor_QMutex_2507 (const qt_gsi::GenericStaticMethod *decl, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  tl::Heap heap;
  const qt_gsi::Converter<QMutex::RecursionMode>::target_type & arg1 = args ? args.read<const qt_gsi::Converter<QMutex::RecursionMode>::target_type & > () : (const qt_gsi::Converter<QMutex::RecursionMode>::target_type &)(qt_gsi::CppToQtReadAdaptor<QMutex::RecursionMode>(heap, QMutex::NonRecursive));
  ret.write<QMutex *> (new QMutex (qt_gsi::QtToCppAdaptor<QMutex::RecursionMode>(arg1).cref()));
}

static qt_gsi::GenericStaticMethod *_create_ctor_QMutex_2507 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QMutex::QMutex(QMutex::RecursionMode mode)\nThis method creates an object of class QMutex.", &_init_ctor_QMutex_2507, &_call_ctor_QMutex_2507);
}

// void QMutex::lock()


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

static void _call_f_lock_0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ((QMutex *)cls)->lock ();
}

static qt_gsi::GenericMethod *_create_f_lock_0 ()
{
  return new qt_gsi::GenericMethod ("lock", "@brief Method void QMutex::lock()\n", false, &_init_f_lock_0, &_call_f_lock_0);
}

// bool QMutex::tryLock()


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

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

static qt_gsi::GenericMethod *_create_f_tryLock_0 ()
{
  return new qt_gsi::GenericMethod ("tryLock", "@brief Method bool QMutex::tryLock()\n", false, &_init_f_tryLock_0, &_call_f_tryLock_0);
}

// bool QMutex::tryLock(int timeout)


static void _init_f_tryLock_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_tryLock_767 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  int arg1 = args.read<int > ();
  ret.write<bool > ((bool)((QMutex *)cls)->tryLock (arg1));
}

static qt_gsi::GenericMethod *_create_f_tryLock_767 ()
{
  return new qt_gsi::GenericMethod ("tryLock", "@brief Method bool QMutex::tryLock(int timeout)\n", false, &_init_f_tryLock_767, &_call_f_tryLock_767);
}

// void QMutex::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) 
{
  ((QMutex *)cls)->unlock ();
}

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


namespace gsi
{
gsi::Class<QMutex> decl_QMutex ("QMutex",
  gsi::Methods(_create_ctor_QMutex_2507 ()) +
  gsi::Methods(_create_f_lock_0 ()) +
  gsi::Methods(_create_f_tryLock_0 ()) +
  gsi::Methods(_create_f_tryLock_767 ()) +
  gsi::Methods(_create_f_unlock_0 ()),
  "@qt\n@brief Binding of QMutex");

}


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

static QMutex_RecursionMode_Enum *c_1_QMutex_RecursionMode_Enum () { return new QMutex_RecursionMode_Enum (QMutex::NonRecursive); }
static QMutex_RecursionMode_Enum *c_2_QMutex_RecursionMode_Enum () { return new QMutex_RecursionMode_Enum (QMutex::Recursive); }

static gsi::Methods mkdefs_QMutex_RecursionMode () {
  return
    gsi::constant ("NonRecursive", &qt_gsi::c_1_QMutex_RecursionMode_Enum, "@brief Enum constant QMutex::NonRecursive") +
    gsi::constant ("Recursive", &qt_gsi::c_2_QMutex_RecursionMode_Enum, "@brief Enum constant QMutex::Recursive");
}

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

static unsigned int to_i_QMutex_RecursionMode_Enum (const QMutex_RecursionMode_Enum *e)
{
  return (unsigned int) e->value ();
}

static QMutex_RecursionMode_Enum *from_i_QMutex_RecursionMode_Enum (unsigned int i)
{
  return new QMutex_RecursionMode_Enum ((QMutex::RecursionMode) i);
}

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

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

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

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

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

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

static int to_i_QMutex_RecursionMode_Enums (const QMutex_RecursionMode_Enums *e)
{
  return int (e->flags ());
}

static bool testFlag_QMutex_RecursionMode_Enums (const QMutex_RecursionMode_Enums *e, const QMutex_RecursionMode_Enum &d)
{
  return e->flags ().testFlag (d.value ());
}

}

namespace gsi
{

//  Declarations for QFlags<enum> wrapper class
gsi::Class<qt_gsi::QMutex_RecursionMode_Enums> decl_QMutex_RecursionMode_Enums ("QMutex_QFlags_RecursionMode",
  gsi::method_ext ("|", &qt_gsi::oropQMutex_RecursionMode_Enums, gsi::arg ("other"), "@brief 'or' operator between two flag sets") +
  gsi::method_ext ("&", &qt_gsi::andopQMutex_RecursionMode_Enums, gsi::arg ("other"), "@brief 'and' operator between two flag sets") +
  gsi::method_ext ("^", &qt_gsi::xoropQMutex_RecursionMode_Enums, gsi::arg ("other"), "@brief 'xor' operator between two flag sets") +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QMutex_RecursionMode_Enums, "@brief Converts the flag set to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QMutex_RecursionMode_Enums, "@brief Returns the integer value encoding the flag set") +
  gsi::method_ext ("testFlag", &qt_gsi::testFlag_QMutex_RecursionMode_Enums, gsi::arg ("flag"), "@brief Tests whether the flag is contained in the flag set"),
  "@qt\n@brief This class represents the QFlags<QMutex::RecursionMode> flag set");

//  Declarations for enum wrapper class
gsi::Class<qt_gsi::QMutex_RecursionMode_Enum> decl_QMutex_RecursionMode_Enum (decl_QMutex_RecursionMode_Enums, "QMutex_RecursionMode",
  qt_gsi::mkdefs_QMutex_RecursionMode () +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QMutex_RecursionMode_Enum, "@brief Converts the enum class to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QMutex_RecursionMode_Enum, "@brief Converts the enum class to an integer") +
  gsi::method_ext ("==", &qt_gsi::equalQMutex_RecursionMode_Enum, gsi::arg ("other"), "@brief Compares the enum class against an enum of it's own type") +
  gsi::method_ext ("==", &qt_gsi::equal2QMutex_RecursionMode_Enum, gsi::arg ("other"), "@brief Compares the enum class against an integer") +
  gsi::constructor ("new", &qt_gsi::from_i_QMutex_RecursionMode_Enum, gsi::arg ("value"), "@brief Creates the enum object from an integer"),
  "@qt\n@brief This class represents the QMutex::RecursionMode enum");

//  Inject the declarations into the parent
static gsi::ClassExt<QMutex> inject_QMutex_RecursionMode_Enum_in_parent (qt_gsi::mkdefs_QMutex_RecursionMode ());
static gsi::ClassExt<QMutex> decl_QMutex_RecursionMode_Enum_as_child (decl_QMutex_RecursionMode_Enum, "RecursionMode");

}

