1 // Generated by gmmproc 2.64.2 -- DO NOT MODIFY!
2 
3 
4 #include <glibmm.h>
5 
6 #include <glibmm/timezone.h>
7 #include <glibmm/private/timezone_p.h>
8 
9 
10 /* Copyright (C) 2011 The glibmm Development Team
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #include <glibmm/utility.h>
27 
28 namespace Glib
29 {
30 
31 // Glib::Value<Glib::TimeZone>
value_type()32 GType Value<TimeZone>::value_type()
33 {
34   return G_TYPE_TIME_ZONE;
35 }
36 
set(const CppType & data)37 void Value<TimeZone>::set(const CppType& data)
38 {
39   set_boxed(data.gobj());
40 }
41 
get() const42 Value<TimeZone>::CppType Value<TimeZone>::get() const
43 {
44   return Glib::wrap(static_cast<CType>(get_boxed()), true);
45 }
46 
47 } // namespace Glib
48 
49 namespace
50 {
51 } // anonymous namespace
52 
53 
54 namespace Glib
55 {
56 
wrap(GTimeZone * object,bool take_copy)57 Glib::TimeZone wrap(GTimeZone* object, bool take_copy /* = false */)
58 {
59   return Glib::TimeZone(object, take_copy);
60 }
61 
62 } // namespace Glib
63 
64 
65 namespace Glib
66 {
67 
68 
TimeZone()69 TimeZone::TimeZone()
70 :
71   gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
72 {}
73 
TimeZone(const TimeZone & src)74 TimeZone::TimeZone(const TimeZone& src)
75 :
76   gobject_ ((src.gobject_) ? g_time_zone_ref(src.gobject_) : nullptr)
77 {}
78 
TimeZone(GTimeZone * castitem,bool make_a_copy)79 TimeZone::TimeZone(GTimeZone* castitem, bool make_a_copy /* = false */)
80 {
81   if(!make_a_copy)
82   {
83     // It was given to us by a function which has already made a copy for us to keep.
84     gobject_ = castitem;
85   }
86   else
87   {
88     // We are probably getting it via direct access to a struct,
89     // so we can not just take it - we have to take a copy of it.
90     if(castitem)
91       gobject_ = g_time_zone_ref(castitem);
92     else
93       gobject_ = nullptr;
94   }
95 }
96 
97 
operator =(const TimeZone & src)98 TimeZone& TimeZone::operator=(const TimeZone& src)
99 {
100   const auto new_gobject = (src.gobject_) ? g_time_zone_ref(src.gobject_) : nullptr;
101 
102   if(gobject_)
103     g_time_zone_unref(gobject_);
104 
105   gobject_ = new_gobject;
106 
107   return *this;
108 }
109 
TimeZone(TimeZone && other)110 TimeZone::TimeZone(TimeZone&& other) noexcept
111 :
112   gobject_(other.gobject_)
113 {
114   other.gobject_ = nullptr;
115 }
116 
operator =(TimeZone && other)117 TimeZone& TimeZone::operator=(TimeZone&& other) noexcept
118 {
119   TimeZone temp (other);
120   swap(temp);
121   return *this;
122 }
123 
~TimeZone()124 TimeZone::~TimeZone() noexcept
125 {
126   if(gobject_)
127     g_time_zone_unref(gobject_);
128 }
129 
swap(TimeZone & other)130 void TimeZone::swap(TimeZone& other) noexcept
131 {
132   std::swap(gobject_, other.gobject_);
133 }
134 
gobj_copy() const135 GTimeZone* TimeZone::gobj_copy() const
136 {
137   return g_time_zone_ref(gobject_);
138 }
139 
140 
create(const Glib::ustring & identifier)141 TimeZone TimeZone::create(const Glib::ustring& identifier)
142 {
143   return Glib::wrap(g_time_zone_new(identifier.c_str()));
144 }
145 
create_local()146 TimeZone TimeZone::create_local()
147 {
148   return Glib::wrap(g_time_zone_new_local());
149 }
150 
create_utc()151 TimeZone TimeZone::create_utc()
152 {
153   return Glib::wrap(g_time_zone_new_utc());
154 }
155 
find_interval(TimeType type,gint64 time) const156 int TimeZone::find_interval(TimeType type, gint64 time) const
157 {
158   return g_time_zone_find_interval(const_cast<GTimeZone*>(gobj()), ((GTimeType)(type)), time);
159 }
160 
adjust_time(TimeType type,gint64 & time) const161 int TimeZone::adjust_time(TimeType type, gint64& time) const
162 {
163   return g_time_zone_adjust_time(const_cast<GTimeZone*>(gobj()), ((GTimeType)(type)), &(time));
164 }
165 
get_abbreviation(int interval) const166 Glib::ustring TimeZone::get_abbreviation(int interval) const
167 {
168   return Glib::convert_const_gchar_ptr_to_ustring(g_time_zone_get_abbreviation(const_cast<GTimeZone*>(gobj()), interval));
169 }
170 
get_offset(int interval) const171 gint32 TimeZone::get_offset(int interval) const
172 {
173   return g_time_zone_get_offset(const_cast<GTimeZone*>(gobj()), interval);
174 }
175 
is_dst(int interval) const176 bool TimeZone::is_dst(int interval) const
177 {
178   return g_time_zone_is_dst(const_cast<GTimeZone*>(gobj()), interval);
179 }
180 
get_identifier() const181 Glib::ustring TimeZone::get_identifier() const
182 {
183   return Glib::convert_const_gchar_ptr_to_ustring(g_time_zone_get_identifier(const_cast<GTimeZone*>(gobj())));
184 }
185 
186 
187 } // namespace Glib
188 
189 
190