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


#include <glibmm.h>

#include <pangomm/coverage.h>
#include <pangomm/private/coverage_p.h>


/* Copyright 1998-1999 The gtkmm Development Team
 * Copyright 2001      Free Software Foundation
 *
 * 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, see <https://www.gnu.org/licenses/>.
 */

using Level = Pango::Coverage::Level;

// The g_object_ref() preprocessor macro can't be used in a _CLASS_OPAQUE_REFCOUNTED.
// The g_object_ref() function is fine.
//-- pango/pangomm/coverage.cc: In member function ‘PangoCoverage* Pango::Coverage::gobj_copy() const’:
//-- glib-2.0/gobject/gobject.h:548:28: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
//--   548 | #define g_object_ref(Obj) ((glib_typeof (Obj)) (g_object_ref) (Obj))
//--       |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//-- pango/pangomm/coverage.cc:109:3: note: in expansion of macro ‘g_object_ref’
//--   109 |   g_object_ref(gobject);
//--       |   ^~~~~~~~~~~~
// gobject is defined as a const pointer to a non-const object (const auto).
#undef g_object_ref

namespace
{
} // anonymous namespace

// static
GType Glib::Value<Pango::Coverage::Level>::value_type()
{
  return pango_coverage_level_get_type();
}


/* Why reinterpret_cast<Coverage*>(gobject) is needed:
 *
 * A Coverage instance is in fact always a PangoCoverage instance.
 * Unfortunately, PangoCoverage cannot be a member of Coverage,
 * because it is an opaque struct.  Also, the C interface does not provide
 * any hooks to install a destroy notification handler, thus we cannot
 * wrap it dynamically either.
 *
 * The cast works because Coverage does not have any member data, and
 * it is impossible to derive from it.  This is ensured by using final on the
 * class and by using = delete on the default constructor.
 */

namespace Glib
{

Glib::RefPtr<Pango::Coverage> wrap(PangoCoverage* object, bool take_copy)
{
  if(take_copy && object)
    g_object_ref(object);

  // See the comment at the top of this file, if you want to know why the cast works.
  return Glib::make_refptr_for_instance<Pango::Coverage>(reinterpret_cast<Pango::Coverage*>(object));
}

} // namespace Glib


namespace Pango
{

// static
Glib::RefPtr<Coverage> Coverage::create()
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return Glib::make_refptr_for_instance<Coverage>(reinterpret_cast<Coverage*>(pango_coverage_new()));
}

void Coverage::reference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  g_object_ref(reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this)));
}

void Coverage::unreference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  g_object_unref(reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this)));
}

PangoCoverage* Coverage::gobj()
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<PangoCoverage*>(this);
}

const PangoCoverage* Coverage::gobj() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<const PangoCoverage*>(this);
}

PangoCoverage* Coverage::gobj_copy() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  const auto gobject = reinterpret_cast<PangoCoverage*>(const_cast<Coverage*>(this));
  g_object_ref(gobject);
  return gobject;
}


Level Coverage::get(int index) const
{
  return static_cast<Level>(pango_coverage_get(const_cast<PangoCoverage*>(gobj()), index));
}

void Coverage::set(int index, Level level)
{
  pango_coverage_set(gobj(), index, static_cast<PangoCoverageLevel>(level));
}


} // namespace Pango


