
/*

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

#include "gsiQtGui.h"
#include "gsiDeclQtTypeTraits.h"
#include "gsiDeclQTextItem_Enums.h"
#include <memory>

// -----------------------------------------------------------------------
// class QTextItem

//  Constructor QTextItem::QTextItem()


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

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

static qt_gsi::GenericStaticMethod *_create_ctor_QTextItem_0 ()
{
  return new qt_gsi::GenericStaticMethod ("new", "@brief Constructor QTextItem::QTextItem()\nThis method creates an object of class QTextItem.", &_init_ctor_QTextItem_0, &_call_ctor_QTextItem_0);
}

// double QTextItem::ascent()


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

static void _call_f_ascent_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<double > ((double)((QTextItem *)cls)->ascent ());
}

static qt_gsi::GenericMethod *_create_f_ascent_c0 ()
{
  return new qt_gsi::GenericMethod ("ascent", "@brief Method double QTextItem::ascent()\n", true, &_init_f_ascent_c0, &_call_f_ascent_c0);
}

// double QTextItem::descent()


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

static void _call_f_descent_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<double > ((double)((QTextItem *)cls)->descent ());
}

static qt_gsi::GenericMethod *_create_f_descent_c0 ()
{
  return new qt_gsi::GenericMethod ("descent", "@brief Method double QTextItem::descent()\n", true, &_init_f_descent_c0, &_call_f_descent_c0);
}

// QFont QTextItem::font()


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

static void _call_f_font_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<QFont > ((QFont)((QTextItem *)cls)->font ());
}

static qt_gsi::GenericMethod *_create_f_font_c0 ()
{
  return new qt_gsi::GenericMethod ("font", "@brief Method QFont QTextItem::font()\n", true, &_init_f_font_c0, &_call_f_font_c0);
}

// QFlags<QTextItem::RenderFlag> QTextItem::renderFlags()


static void _init_f_renderFlags_c0 (qt_gsi::GenericMethod *decl)
{
  decl->set_return<qt_gsi::Converter<QFlags<QTextItem::RenderFlag> >::target_type > ();
}

static void _call_f_renderFlags_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<qt_gsi::Converter<QFlags<QTextItem::RenderFlag> >::target_type > ((qt_gsi::Converter<QFlags<QTextItem::RenderFlag> >::target_type)qt_gsi::CppToQtAdaptor<QFlags<QTextItem::RenderFlag> >(((QTextItem *)cls)->renderFlags ()));
}

static qt_gsi::GenericMethod *_create_f_renderFlags_c0 ()
{
  return new qt_gsi::GenericMethod ("renderFlags", "@brief Method QFlags<QTextItem::RenderFlag> QTextItem::renderFlags()\n", true, &_init_f_renderFlags_c0, &_call_f_renderFlags_c0);
}

// QString QTextItem::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)((QTextItem *)cls)->text ());
}

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

// double QTextItem::width()


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

static void _call_f_width_c0 (const qt_gsi::GenericMethod *decl, void *cls, gsi::SerialArgs &args, gsi::SerialArgs &ret) 
{
  ret.write<double > ((double)((QTextItem *)cls)->width ());
}

static qt_gsi::GenericMethod *_create_f_width_c0 ()
{
  return new qt_gsi::GenericMethod ("width", "@brief Method double QTextItem::width()\n", true, &_init_f_width_c0, &_call_f_width_c0);
}


namespace gsi
{
gsi::Class<QTextItem> decl_QTextItem ("QTextItem",
  gsi::Methods(_create_ctor_QTextItem_0 ()) +
  gsi::Methods(_create_f_ascent_c0 ()) +
  gsi::Methods(_create_f_descent_c0 ()) +
  gsi::Methods(_create_f_font_c0 ()) +
  gsi::Methods(_create_f_renderFlags_c0 ()) +
  gsi::Methods(_create_f_text_c0 ()) +
  gsi::Methods(_create_f_width_c0 ()),
  "@qt\n@brief Binding of QTextItem");

}


//  Implementation of the enum wrapper class for QTextItem::RenderFlag
namespace qt_gsi
{

static QTextItem_RenderFlag_Enum *c_1_QTextItem_RenderFlag_Enum () { return new QTextItem_RenderFlag_Enum (QTextItem::RightToLeft); }
static QTextItem_RenderFlag_Enum *c_2_QTextItem_RenderFlag_Enum () { return new QTextItem_RenderFlag_Enum (QTextItem::Overline); }
static QTextItem_RenderFlag_Enum *c_3_QTextItem_RenderFlag_Enum () { return new QTextItem_RenderFlag_Enum (QTextItem::Underline); }
static QTextItem_RenderFlag_Enum *c_4_QTextItem_RenderFlag_Enum () { return new QTextItem_RenderFlag_Enum (QTextItem::StrikeOut); }
static QTextItem_RenderFlag_Enum *c_5_QTextItem_RenderFlag_Enum () { return new QTextItem_RenderFlag_Enum (QTextItem::Dummy); }

static gsi::Methods mkdefs_QTextItem_RenderFlag () {
  return
    gsi::constant ("RightToLeft", &qt_gsi::c_1_QTextItem_RenderFlag_Enum, "@brief Enum constant QTextItem::RightToLeft") +
    gsi::constant ("Overline", &qt_gsi::c_2_QTextItem_RenderFlag_Enum, "@brief Enum constant QTextItem::Overline") +
    gsi::constant ("Underline", &qt_gsi::c_3_QTextItem_RenderFlag_Enum, "@brief Enum constant QTextItem::Underline") +
    gsi::constant ("StrikeOut", &qt_gsi::c_4_QTextItem_RenderFlag_Enum, "@brief Enum constant QTextItem::StrikeOut") +
    gsi::constant ("Dummy", &qt_gsi::c_5_QTextItem_RenderFlag_Enum, "@brief Enum constant QTextItem::Dummy");
}

static std::string to_s_QTextItem_RenderFlag_Enum (const QTextItem_RenderFlag_Enum *e)
{
  if (e->value () == QTextItem::RightToLeft) { return tl::sprintf ("RightToLeft (%u)", (unsigned int) e->value ()); }
  if (e->value () == QTextItem::Overline) { return tl::sprintf ("Overline (%u)", (unsigned int) e->value ()); }
  if (e->value () == QTextItem::Underline) { return tl::sprintf ("Underline (%u)", (unsigned int) e->value ()); }
  if (e->value () == QTextItem::StrikeOut) { return tl::sprintf ("StrikeOut (%u)", (unsigned int) e->value ()); }
  if (e->value () == QTextItem::Dummy) { return tl::sprintf ("Dummy (%u)", (unsigned int) e->value ()); }
  return std::string ("(not a valid enum evalue)");
}

static unsigned int to_i_QTextItem_RenderFlag_Enum (const QTextItem_RenderFlag_Enum *e)
{
  return (unsigned int) e->value ();
}

static QTextItem_RenderFlag_Enum *from_i_QTextItem_RenderFlag_Enum (unsigned int i)
{
  return new QTextItem_RenderFlag_Enum ((QTextItem::RenderFlag) i);
}

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

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

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

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

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

static std::string to_s_QTextItem_RenderFlag_Enums (const QTextItem_RenderFlag_Enums *e)
{
  std::string l;
  if (e->testFlag (QTextItem::RightToLeft)) { if (!l.empty ()) l += "|"; l += "RightToLeft"; }
  if (e->testFlag (QTextItem::Overline)) { if (!l.empty ()) l += "|"; l += "Overline"; }
  if (e->testFlag (QTextItem::Underline)) { if (!l.empty ()) l += "|"; l += "Underline"; }
  if (e->testFlag (QTextItem::StrikeOut)) { if (!l.empty ()) l += "|"; l += "StrikeOut"; }
  if (e->testFlag (QTextItem::Dummy)) { if (!l.empty ()) l += "|"; l += "Dummy"; }
  return tl::sprintf ("%u (%s)", (unsigned int) (e->flags ()), l);
}

static int to_i_QTextItem_RenderFlag_Enums (const QTextItem_RenderFlag_Enums *e)
{
  return int (e->flags ());
}

static bool testFlag_QTextItem_RenderFlag_Enums (const QTextItem_RenderFlag_Enums *e, const QTextItem_RenderFlag_Enum &d)
{
  return e->flags ().testFlag (d.value ());
}

}

namespace gsi
{

//  Declarations for QFlags<enum> wrapper class
gsi::Class<qt_gsi::QTextItem_RenderFlag_Enums> decl_QTextItem_RenderFlag_Enums ("QTextItem_QFlags_RenderFlag",
  gsi::method_ext ("|", &qt_gsi::oropQTextItem_RenderFlag_Enums, gsi::arg ("other"), "@brief 'or' operator between two flag sets") +
  gsi::method_ext ("&", &qt_gsi::andopQTextItem_RenderFlag_Enums, gsi::arg ("other"), "@brief 'and' operator between two flag sets") +
  gsi::method_ext ("^", &qt_gsi::xoropQTextItem_RenderFlag_Enums, gsi::arg ("other"), "@brief 'xor' operator between two flag sets") +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QTextItem_RenderFlag_Enums, "@brief Converts the flag set to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QTextItem_RenderFlag_Enums, "@brief Returns the integer value encoding the flag set") +
  gsi::method_ext ("testFlag", &qt_gsi::testFlag_QTextItem_RenderFlag_Enums, gsi::arg ("flag"), "@brief Tests whether the flag is contained in the flag set"),
  "@qt\n@brief This class represents the QFlags<QTextItem::RenderFlag> flag set");

//  Declarations for enum wrapper class
gsi::Class<qt_gsi::QTextItem_RenderFlag_Enum> decl_QTextItem_RenderFlag_Enum (decl_QTextItem_RenderFlag_Enums, "QTextItem_RenderFlag",
  qt_gsi::mkdefs_QTextItem_RenderFlag () +
  gsi::method_ext ("to_s|inspect", &qt_gsi::to_s_QTextItem_RenderFlag_Enum, "@brief Converts the enum class to a string") +
  gsi::method_ext ("to_i", &qt_gsi::to_i_QTextItem_RenderFlag_Enum, "@brief Converts the enum class to an integer") +
  gsi::method_ext ("==", &qt_gsi::equalQTextItem_RenderFlag_Enum, gsi::arg ("other"), "@brief Compares the enum class against an enum of it's own type") +
  gsi::method_ext ("==", &qt_gsi::equal2QTextItem_RenderFlag_Enum, gsi::arg ("other"), "@brief Compares the enum class against an integer") +
  gsi::constructor ("new", &qt_gsi::from_i_QTextItem_RenderFlag_Enum, gsi::arg ("value"), "@brief Creates the enum object from an integer"),
  "@qt\n@brief This class represents the QTextItem::RenderFlag enum");

//  Inject the declarations into the parent
static gsi::ClassExt<QTextItem> inject_QTextItem_RenderFlag_Enum_in_parent (qt_gsi::mkdefs_QTextItem_RenderFlag ());
static gsi::ClassExt<QTextItem> decl_QTextItem_RenderFlag_Enum_as_child (decl_QTextItem_RenderFlag_Enum, "RenderFlag");

}

