// Generated by gmmproc 2.54.1 -- DO NOT MODIFY!
#include <glibmm.h>
#include <glibmm/timezone.h>
#include <glibmm/private/timezone_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, see <http://www.gnu.org/licenses/>.
*/
#include <glibmm/utility.h>
namespace Glib
{
} // namespace Glib
namespace
{
} // anonymous namespace
namespace Glib
{
Glib::TimeZone wrap(GTimeZone* object, bool take_copy /* = false */)
{
return Glib::TimeZone(object, take_copy);
}
} // namespace Glib
namespace Glib
{
TimeZone::TimeZone()
:
gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}
TimeZone::TimeZone(const TimeZone& src)
:
gobject_ ((src.gobject_) ? g_time_zone_ref(src.gobject_) : nullptr)
{}
TimeZone::TimeZone(GTimeZone* 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_time_zone_ref(castitem);
else
gobject_ = nullptr;
}
}
TimeZone& TimeZone::operator=(const TimeZone& src)
{
const auto new_gobject = (src.gobject_) ? g_time_zone_ref(src.gobject_) : nullptr;
if(gobject_)
g_time_zone_unref(gobject_);
gobject_ = new_gobject;
return *this;
}
TimeZone::TimeZone(TimeZone&& other) noexcept
:
gobject_(other.gobject_)
{
other.gobject_ = nullptr;
}
TimeZone& TimeZone::operator=(TimeZone&& other) noexcept
{
TimeZone temp (other);
swap(temp);
return *this;
}
TimeZone::~TimeZone() noexcept
{
if(gobject_)
g_time_zone_unref(gobject_);
}
void TimeZone::swap(TimeZone& other) noexcept
{
std::swap(gobject_, other.gobject_);
}
GTimeZone* TimeZone::gobj_copy() const
{
return g_time_zone_ref(gobject_);
}
TimeZone TimeZone::create(const Glib::ustring& identifier)
{
return Glib::wrap(g_time_zone_new(identifier.c_str()));
}
TimeZone TimeZone::create_local()
{
return Glib::wrap(g_time_zone_new_local());
}
TimeZone TimeZone::create_utc()
{
return Glib::wrap(g_time_zone_new_utc());
}
int TimeZone::find_interval(TimeType type, gint64 time) const
{
return g_time_zone_find_interval(const_cast<GTimeZone*>(gobj()), ((GTimeType)(type)), time);
}
int TimeZone::adjust_time(TimeType type, gint64& time) const
{
return g_time_zone_adjust_time(const_cast<GTimeZone*>(gobj()), ((GTimeType)(type)), &(time));
}
Glib::ustring TimeZone::get_abbreviation(int interval) const
{
return Glib::convert_const_gchar_ptr_to_ustring(g_time_zone_get_abbreviation(const_cast<GTimeZone*>(gobj()), interval));
}
gint32 TimeZone::get_offset(int interval) const
{
return g_time_zone_get_offset(const_cast<GTimeZone*>(gobj()), interval);
}
bool TimeZone::is_dst(int interval) const
{
return g_time_zone_is_dst(const_cast<GTimeZone*>(gobj()), interval);
}
} // namespace Glib