// Generated by gtkmmproc -- DO NOT MODIFY!


#include <giomm/dbusmessage.h>
#include <giomm/private/dbusmessage_p.h>

// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* 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, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gio/gio.h>
#ifdef G_OS_UNIX
#include <giomm/unixfdlist.h>
#endif //G_OS_UNIX

namespace Gio
{

typedef DBusMessage::ByteOrder ByteOrder;

void DBusMessage::get_body(Glib::VariantBase& value) const
{
  GVariant* const g_value =
    g_dbus_message_get_body(const_cast<GDBusMessage*>(gobj()));

  if(!g_value)
    return;

  value.init(g_value, true /* take a reference */);
}

void DBusMessage::get_header(Glib::VariantBase& value,
  DBusMessageHeaderField header_field) const
{
  GVariant* const g_value =
    g_dbus_message_get_header(const_cast<GDBusMessage*>(gobj()),
    ((GDBusMessageHeaderField)(header_field)));

  if(!g_value)
    return;

  value.init(g_value, true /* take a reference */);
}

#ifdef G_OS_UNIX
void DBusMessage::unset_unix_fd_list()
{
  g_dbus_message_set_unix_fd_list(gobj(), 0);
}
#endif //G_OS_UNIX

} // namespace Gio

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::DBusMessage> wrap(GDBusMessage* object, bool take_copy)
{
  return Glib::RefPtr<Gio::DBusMessage>( dynamic_cast<Gio::DBusMessage*> (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& DBusMessage_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_ = &DBusMessage_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_dbus_message_get_type());

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

  }

  return *this;
}


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


}


Glib::ObjectBase* DBusMessage_Class::wrap_new(GObject* object)
{
  return new DBusMessage((GDBusMessage*)object);
}


/* The implementation: */

GDBusMessage* DBusMessage::gobj_copy()
{
  reference();
  return gobj();
}

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

}

DBusMessage::DBusMessage(GDBusMessage* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


DBusMessage::~DBusMessage()
{}


DBusMessage::CppClassType DBusMessage::dbusmessage_class_; // initialize static member

GType DBusMessage::get_type()
{
  return dbusmessage_class_.init().get_type();
}


GType DBusMessage::get_base_type()
{
  return g_dbus_message_get_type();
}


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

}

Glib::RefPtr<DBusMessage> DBusMessage::create()
{
  return Glib::RefPtr<DBusMessage>( new DBusMessage() );
}
Glib::RefPtr<DBusMessage> DBusMessage::create_signal(const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& signal)
{
  return Glib::wrap(g_dbus_message_new_signal(path.c_str(), interface.c_str(), signal.c_str()));
}


Glib::RefPtr<DBusMessage> DBusMessage::create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& method)
{
  return Glib::wrap(g_dbus_message_new_method_call(name.c_str(), path.c_str(), interface.c_str(), method.c_str()));
}


Glib::RefPtr<DBusMessage> DBusMessage::create_method_reply(const Glib::RefPtr<DBusMessage>& method_call_message)
{
  return Glib::wrap(g_dbus_message_new_method_reply(Glib::unwrap(method_call_message)));
}


Glib::RefPtr<DBusMessage> DBusMessage::create_method_error_literal(const Glib::RefPtr<const DBusMessage>& method_call_message, const Glib::ustring& error_name, const Glib::ustring& error_message)
{
  return Glib::wrap(g_dbus_message_new_method_error_literal(const_cast<GDBusMessage*>(Glib::unwrap(method_call_message)), error_name.c_str(), error_message.c_str()));
}


Glib::RefPtr<DBusMessage> DBusMessage::create_from_blob(const guchar* blob, gsize blob_len, DBusCapabilityFlags capabilities)
{
  GError* gerror = 0;
  Glib::RefPtr<DBusMessage> retvalue = Glib::wrap(g_dbus_message_new_from_blob(const_cast<guchar*>(blob), blob_len, ((GDBusCapabilityFlags)(capabilities)), &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


Glib::ustring DBusMessage::print(guint indent)
{
  return Glib::convert_return_gchar_ptr_to_ustring(g_dbus_message_print(gobj(), indent));
}

bool DBusMessage::get_locked() const
{
  return g_dbus_message_get_locked(const_cast<GDBusMessage*>(gobj()));
}

void DBusMessage::lock()
{
g_dbus_message_lock(gobj()); 
}

Glib::RefPtr<DBusMessage> DBusMessage::copy() const
{
  GError* gerror = 0;
  Glib::RefPtr<DBusMessage> retvalue = Glib::wrap(g_dbus_message_copy(const_cast<GDBusMessage*>(gobj()), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

DBusMessageType DBusMessage::get_message_type() const
{
  return ((DBusMessageType)(g_dbus_message_get_message_type(const_cast<GDBusMessage*>(gobj()))));
}

void DBusMessage::set_message_type(DBusMessageType type)
{
g_dbus_message_set_message_type(gobj(), ((GDBusMessageType)(type))); 
}

ByteOrder DBusMessage::get_byte_order() const
{
  return (ByteOrder)(g_dbus_message_get_byte_order(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_byte_order(ByteOrder byte_order)
{
g_dbus_message_set_byte_order(gobj(), (GDBusMessageByteOrder)(byte_order)); 
}

guint32 DBusMessage::get_serial() const
{
  return g_dbus_message_get_serial(const_cast<GDBusMessage*>(gobj()));
}

void DBusMessage::set_serial(guint32 serial)
{
g_dbus_message_set_serial(gobj(), serial); 
}

DBusMessageFlags DBusMessage::get_flags() const
{
  return ((DBusMessageFlags)(g_dbus_message_get_flags(const_cast<GDBusMessage*>(gobj()))));
}

void DBusMessage::set_flags(DBusMessageFlags flags)
{
g_dbus_message_set_flags(gobj(), ((GDBusMessageFlags)(flags))); 
}

void DBusMessage::set_body(const Glib::VariantBase& body)
{
g_dbus_message_set_body(gobj(), const_cast<GVariant*>((body).gobj())); 
}

#ifdef G_OS_UNIX
Glib::RefPtr<UnixFDList> DBusMessage::get_unix_fd_list()
{
  return Glib::wrap(g_dbus_message_get_unix_fd_list(gobj()));
}


#endif // G_OS_UNIX
#ifdef G_OS_UNIX
Glib::RefPtr<const UnixFDList> DBusMessage::get_unix_fd_list() const
{
  return const_cast<DBusMessage*>(this)->get_unix_fd_list();
}


#endif // G_OS_UNIX
#ifdef G_OS_UNIX
void DBusMessage::set_unix_fd_list(const Glib::RefPtr<UnixFDList>& fd_list)
{
g_dbus_message_set_unix_fd_list(gobj(), Glib::unwrap(fd_list)); 
}


#endif // G_OS_UNIX
guint32 DBusMessage::get_num_unix_fds() const
{
  return g_dbus_message_get_num_unix_fds(const_cast<GDBusMessage*>(gobj()));
}

void DBusMessage::set_num_unix_fds(guint32 value)
{
g_dbus_message_set_num_unix_fds(gobj(), value); 
}

void DBusMessage::set_header(DBusMessageHeaderField header_field, const Glib::VariantBase& value)
{
g_dbus_message_set_header(gobj(), ((GDBusMessageHeaderField)(header_field)), const_cast<GVariant*>((value).gobj())); 
}

Glib::ArrayHandle<guchar> DBusMessage::get_header_fields() const
{
  return Glib::ArrayHandle<guchar>(g_dbus_message_get_header_fields(const_cast<GDBusMessage*>(gobj())));
}

Glib::ustring DBusMessage::get_destination() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_destination(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_destination(const Glib::ustring& value)
{
g_dbus_message_set_destination(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_error_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_error_name(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_error_name(const Glib::ustring& value)
{
g_dbus_message_set_error_name(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_interface() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_interface(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_interface(const Glib::ustring& value)
{
g_dbus_message_set_interface(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_member() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_member(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_member(const Glib::ustring& value)
{
g_dbus_message_set_member(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_path() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_path(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_path(const Glib::ustring& value)
{
g_dbus_message_set_path(gobj(), value.c_str()); 
}

guint32 DBusMessage::get_reply_serial() const
{
  return g_dbus_message_get_reply_serial(const_cast<GDBusMessage*>(gobj()));
}

void DBusMessage::set_reply_serial(guint32 value)
{
g_dbus_message_set_reply_serial(gobj(), value); 
}

Glib::ustring DBusMessage::get_sender() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_sender(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_sender(const Glib::ustring& value)
{
g_dbus_message_set_sender(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_signature() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_signature(const_cast<GDBusMessage*>(gobj())));
}

void DBusMessage::set_signature(const Glib::ustring& value)
{
g_dbus_message_set_signature(gobj(), value.c_str()); 
}

Glib::ustring DBusMessage::get_arg0() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_message_get_arg0(const_cast<GDBusMessage*>(gobj())));
}

gssize DBusMessage::bytes_needed(const guchar* blob, gsize blob_len)
{
  GError* gerror = 0;
  gssize retvalue = g_dbus_message_bytes_needed(const_cast<guchar*>(blob), blob_len, &(gerror));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


guchar* DBusMessage::to_blob(gsize& out_size, DBusCapabilityFlags capabilities)
{
  GError* gerror = 0;
  guchar* retvalue = g_dbus_message_to_blob(gobj(), &(out_size), ((GDBusCapabilityFlags)(capabilities)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;

}

void DBusMessage::to_exception()
{
  GError* gerror = 0;
  g_dbus_message_to_gerror(gobj(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);


}


} // namespace Gio


