// Generated by gtkmmproc -- DO NOT MODIFY!


#include <glibmm/datetime.h>
#include <glibmm/private/datetime_p.h>

/* Copyright (C) 2011 The glibmm 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 <glibmm/utility.h>
#include <glibmm/timeval.h>
#include <glibmm/timezone.h>
#include <glibmm/wrap.h>

namespace Glib
{

}// namespace Glib

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::DateTime wrap(GDateTime* object, bool take_copy /* = false */)
{
  return Glib::DateTime(object, take_copy);
}

} // namespace Glib


namespace Glib
{


DateTime::DateTime()
:
  gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}

DateTime::DateTime(const DateTime& src)
:
  gobject_ ((src.gobject_) ? g_date_time_ref(src.gobject_) : 0)
{}

DateTime::DateTime(GDateTime* castitem, bool make_a_copy /* = false */)
{
  if(!make_a_copy)
  {
    // It was given to us by a function which has already made a copy for us to keep.
    gobject_ = castitem;
  }
  else
  {
    // We are probably getting it via direct access to a struct,
    // so we can not just take it - we have to take a copy of it.
    if(castitem)
      gobject_ = g_date_time_ref(castitem);
    else
      gobject_ = 0;
  }
}

DateTime& DateTime::operator=(const DateTime& src)
{
  GDateTime *const new_gobject = (src.gobject_) ? g_date_time_ref(src.gobject_) : 0;

  if(gobject_)
    g_date_time_unref(gobject_);

  gobject_ = new_gobject;

  return *this;
}

DateTime::~DateTime()
{
  if(gobject_)
    g_date_time_unref(gobject_);
}

GDateTime* DateTime::gobj_copy() const
{
  return g_date_time_ref(gobject_);
}


DateTime DateTime::create_now(const TimeZone& tz)
{
  return Glib::wrap(g_date_time_new_now(const_cast<GTimeZone*>(tz.gobj())));
}


DateTime DateTime::create_now_local()
{
  return Glib::wrap(g_date_time_new_now_local());
}


DateTime DateTime::create_now_utc()
{
  return Glib::wrap(g_date_time_new_now_utc());
}


DateTime DateTime::create_now_local(gint64 t)
{
  return Glib::wrap(g_date_time_new_from_unix_local(t));
}


DateTime DateTime::create_now_utc(gint64 t)
{
  return Glib::wrap(g_date_time_new_from_unix_utc(t));
}


DateTime DateTime::create_now_local(const TimeVal& tv)
{
  return Glib::wrap(g_date_time_new_from_timeval_local(&(tv)));
}


DateTime DateTime::create_now_utc(const TimeVal& tv)
{
  return Glib::wrap(g_date_time_new_from_timeval_utc(&(tv)));
}


DateTime DateTime::create(const TimeZone& tz, int year, int month, int day, int hour, int minute, double seconds)
{
  return Glib::wrap(g_date_time_new(const_cast<GTimeZone*>(tz.gobj()), year, month, day, hour, minute, seconds));
}


DateTime DateTime::create_local(int year, int month, int day, int hour, int minute, double seconds)
{
  return Glib::wrap(g_date_time_new_local(year, month, day, hour, minute, seconds));
}


DateTime DateTime::create_utc(int year, int month, int day, int hour, int minute, double seconds)
{
  return Glib::wrap(g_date_time_new_utc(year, month, day, hour, minute, seconds));
}


DateTime DateTime::add(TimeSpan timespan) const
{
  return Glib::wrap(g_date_time_add(const_cast<GDateTime*>(gobj()), timespan));
}

DateTime DateTime::add_years(int years) const
{
  return Glib::wrap(g_date_time_add_years(const_cast<GDateTime*>(gobj()), years));
}

DateTime DateTime::add_months(int months) const
{
  return Glib::wrap(g_date_time_add_months(const_cast<GDateTime*>(gobj()), months));
}

DateTime DateTime::add_weeks(int weeks) const
{
  return Glib::wrap(g_date_time_add_weeks(const_cast<GDateTime*>(gobj()), weeks));
}

DateTime DateTime::add_days(int days) const
{
  return Glib::wrap(g_date_time_add_days(const_cast<GDateTime*>(gobj()), days));
}

DateTime DateTime::add_hours(int hours) const
{
  return Glib::wrap(g_date_time_add_hours(const_cast<GDateTime*>(gobj()), hours));
}

DateTime DateTime::add_minutes(int minutes) const
{
  return Glib::wrap(g_date_time_add_minutes(const_cast<GDateTime*>(gobj()), minutes));
}

DateTime DateTime::add_seconds(double seconds) const
{
  return Glib::wrap(g_date_time_add_seconds(const_cast<GDateTime*>(gobj()), seconds));
}

DateTime DateTime::add_full(int years, int months, int days, int hours, int minutes, double seconds) const
{
  return Glib::wrap(g_date_time_add_full(const_cast<GDateTime*>(gobj()), years, months, days, hours, minutes, seconds));
}

TimeSpan DateTime::difference(const DateTime& other) const
{
  return g_date_time_difference(const_cast<GDateTime*>(gobj()), const_cast<GDateTime*>(other.gobj()));
}

int DateTime::compare(const DateTime& other) const
{
  return g_date_time_compare(const_cast<GDateTime*>(gobj()), const_cast<GDateTime*>(other.gobj()));
}

guint DateTime::hash() const
{
  return g_date_time_hash(const_cast<GDateTime*>(gobj()));
}

bool DateTime::equal(const DateTime& other) const
{
  return g_date_time_equal(const_cast<GDateTime*>(gobj()), const_cast<GDateTime*>(other.gobj()));
}

void DateTime::get_ymd(int& year, int& month, int& day) const
{
g_date_time_get_ymd(const_cast<GDateTime*>(gobj()), &(year), &(month), &(day)); 
}

int DateTime::get_year() const
{
  return g_date_time_get_year(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_month() const
{
  return g_date_time_get_month(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_day_of_month() const
{
  return g_date_time_get_day_of_month(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_week_numbering_year() const
{
  return g_date_time_get_week_numbering_year(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_week_of_year() const
{
  return g_date_time_get_week_of_year(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_day_of_week() const
{
  return g_date_time_get_day_of_week(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_day_of_year() const
{
  return g_date_time_get_day_of_year(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_hour() const
{
  return g_date_time_get_hour(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_minute() const
{
  return g_date_time_get_minute(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_second() const
{
  return g_date_time_get_second(const_cast<GDateTime*>(gobj()));
}

int DateTime::get_microsecond() const
{
  return g_date_time_get_microsecond(const_cast<GDateTime*>(gobj()));
}

double DateTime::get_seconds() const
{
  return g_date_time_get_seconds(const_cast<GDateTime*>(gobj()));
}

gint64 DateTime::to_unix() const
{
  return g_date_time_to_unix(const_cast<GDateTime*>(gobj()));
}

bool DateTime::to_timeval(TimeVal& tv) const
{
  return g_date_time_to_timeval(const_cast<GDateTime*>(gobj()), &(tv));
}

TimeSpan DateTime::get_utc_offset() const
{
  return g_date_time_get_utc_offset(const_cast<GDateTime*>(gobj()));
}

Glib::ustring DateTime::get_timezone_abbreviation() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_date_time_get_timezone_abbreviation(const_cast<GDateTime*>(gobj())));
}

bool DateTime::is_daylight_savings() const
{
  return g_date_time_is_daylight_savings(const_cast<GDateTime*>(gobj()));
}

DateTime DateTime::to_timezone(const TimeZone& tz) const
{
  return Glib::wrap(g_date_time_to_timezone(const_cast<GDateTime*>(gobj()), const_cast<GTimeZone*>(tz.gobj())));
}

DateTime DateTime::to_local() const
{
  return Glib::wrap(g_date_time_to_local(const_cast<GDateTime*>(gobj())));
}

DateTime DateTime::to_utc() const
{
  return Glib::wrap(g_date_time_to_utc(const_cast<GDateTime*>(gobj())));
}

Glib::ustring DateTime::format(const Glib::ustring& format) const
{
  return Glib::convert_return_gchar_ptr_to_ustring(g_date_time_format(const_cast<GDateTime*>(gobj()), format.c_str()));
}


} // namespace Glib


