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


#include <glibmm.h>

#include <giomm/credentials.h>
#include <giomm/private/credentials_p.h>


/* Copyright (C) 2010 The giomm Development Team
 *
 * 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 <http://www.gnu.org/licenses/>.
 */

#include <gio/gio.h>
#include <glibmm/error.h>

namespace Gio
{

} // namespace Gio

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::Credentials> wrap(GCredentials* object, bool take_copy)
{
  return Glib::RefPtr<Gio::Credentials>( dynamic_cast<Gio::Credentials*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gio
{


/* The *_Class implementation: */

const Glib::Class& Credentials_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Credentials_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(g_credentials_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void Credentials_Class::class_init_function(void* g_class, void* class_data)
{
  const auto klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


}


Glib::ObjectBase* Credentials_Class::wrap_new(GObject* object)
{
  return new Credentials((GCredentials*)object);
}


/* The implementation: */

GCredentials* Credentials::gobj_copy()
{
  reference();
  return gobj();
}

Credentials::Credentials(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

Credentials::Credentials(GCredentials* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Credentials::Credentials(Credentials&& src) noexcept
: Glib::Object(std::move(src))
{}

Credentials& Credentials::operator=(Credentials&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  return *this;
}


Credentials::~Credentials() noexcept
{}


Credentials::CppClassType Credentials::credentials_class_; // initialize static member

GType Credentials::get_type()
{
  return credentials_class_.init().get_type();
}


GType Credentials::get_base_type()
{
  return g_credentials_get_type();
}


Credentials::Credentials()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Glib::Object(Glib::ConstructParams(credentials_class_.init()))
{
  

}

Glib::RefPtr<Credentials> Credentials::create()
{
  return Glib::RefPtr<Credentials>( new Credentials() );
}

Glib::ustring Credentials::to_string() const
{
  return Glib::convert_return_gchar_ptr_to_ustring(g_credentials_to_string(const_cast<GCredentials*>(gobj())));
}

gpointer Credentials::get_native(CredentialsType native_type)
{
  return g_credentials_get_native(gobj(), ((GCredentialsType)(native_type)));
}

void Credentials::set_native(CredentialsType native_type, gpointer native)
{
  g_credentials_set_native(gobj(), ((GCredentialsType)(native_type)), native);
}

bool Credentials::is_same_user(const Glib::RefPtr<const Credentials>& other_credentials)
{
  GError* gerror = nullptr;
  bool retvalue = g_credentials_is_same_user(gobj(), const_cast<GCredentials*>(Glib::unwrap<Gio::Credentials>(other_credentials)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

#ifdef G_OS_UNIX
uid_t Credentials::get_unix_user()
{
  GError* gerror = nullptr;
  uid_t retvalue = g_credentials_get_unix_user(gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}
#endif // G_OS_UNIX

#ifdef G_OS_UNIX
bool Credentials::set_unix_user(uid_t uid)
{
  GError* gerror = nullptr;
  bool retvalue = g_credentials_set_unix_user(gobj(), uid, &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}
#endif // G_OS_UNIX

#ifdef G_OS_UNIX
pid_t Credentials::get_unix_pid() const
{
  GError* gerror = nullptr;
  pid_t retvalue = g_credentials_get_unix_pid(const_cast<GCredentials*>(gobj()), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}
#endif // G_OS_UNIX


} // namespace Gio


