4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 #include "location-address.h"
27 #include "location-log.h"
30 location_address_get_type (void)
32 static volatile gsize type_volatile = 0;
33 if(g_once_init_enter(&type_volatile)) {
34 GType type = g_boxed_type_register_static (
35 g_intern_static_string ("LocationAddress"),
36 (GBoxedCopyFunc) location_address_copy,
37 (GBoxedFreeFunc) location_address_free);
38 g_once_init_leave(&type_volatile, type);
43 EXPORT_API LocationAddress*
44 location_address_new (const gchar *building_number,
46 const gchar *district,
49 const gchar *country_code,
50 const gchar *postal_code)
52 LocationAddress* address = g_slice_new0(LocationAddress);
54 address->building_number = g_strdup(building_number);
55 address->street = g_strdup(street);
56 address->district = g_strdup(district);
57 address->city = g_strdup(city);
58 address->state = g_strdup(state);
59 address->country_code = g_strdup(country_code);
60 address->postal_code = g_strdup(postal_code);
66 location_address_free (LocationAddress* address)
68 g_return_if_fail(address);
69 g_free(address->building_number);
70 g_free(address->street);
71 g_free(address->district);
72 g_free(address->city);
73 g_free(address->state);
74 g_free(address->country_code);
75 g_free(address->postal_code);
76 g_slice_free(LocationAddress, address);
79 EXPORT_API LocationAddress*
80 location_address_copy (const LocationAddress *address)
82 g_return_val_if_fail(address, NULL);
83 return location_address_new(address->building_number,
88 address->country_code,
89 address->postal_code);