2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
20 internal static partial class Interop
22 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_building_number")]
23 internal static extern ErrorCode GetBuildingNumber(this AddressHandle /* maps_address_h */ address, out string buildingNumber);
25 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_building_number")]
26 internal static extern ErrorCode SetBuildingNumber(this AddressHandle /* maps_address_h */ address, string buildingNumber);
28 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_street")]
29 internal static extern ErrorCode GetStreet(this AddressHandle /* maps_address_h */ address, out string street);
31 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_street")]
32 internal static extern ErrorCode SetStreet(this AddressHandle /* maps_address_h */ address, string street);
34 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_district")]
35 internal static extern ErrorCode GetDistrict(this AddressHandle /* maps_address_h */ address, out string district);
37 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_district")]
38 internal static extern ErrorCode SetDistrict(this AddressHandle /* maps_address_h */ address, string district);
40 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_city")]
41 internal static extern ErrorCode GetCity(this AddressHandle /* maps_address_h */ address, out string city);
43 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_city")]
44 internal static extern ErrorCode SetCity(this AddressHandle /* maps_address_h */ address, string city);
46 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_state")]
47 internal static extern ErrorCode GetState(this AddressHandle /* maps_address_h */ address, out string state);
49 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_state")]
50 internal static extern ErrorCode SetState(this AddressHandle /* maps_address_h */ address, string state);
52 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country")]
53 internal static extern ErrorCode GetCountry(this AddressHandle /* maps_address_h */ address, out string country);
55 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country")]
56 internal static extern ErrorCode SetCountry(this AddressHandle /* maps_address_h */ address, string country);
58 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country_code")]
59 internal static extern ErrorCode GetCountryCode(this AddressHandle /* maps_address_h */ address, out string countryCode);
61 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country_code")]
62 internal static extern ErrorCode SetCountryCode(this AddressHandle /* maps_address_h */ address, string countryCode);
64 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_county")]
65 internal static extern ErrorCode GetCounty(this AddressHandle /* maps_address_h */ address, out string county);
67 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_county")]
68 internal static extern ErrorCode SetCounty(this AddressHandle /* maps_address_h */ address, string county);
70 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_postal_code")]
71 internal static extern ErrorCode GetPostalCode(this AddressHandle /* maps_address_h */ address, out string postalCode);
73 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_postal_code")]
74 internal static extern ErrorCode SetPostalCode(this AddressHandle /* maps_address_h */ address, string postalCode);
76 [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_freetext")]
77 internal static extern ErrorCode GetFreeText(this AddressHandle /* maps_address_h */ address, out string freetext);
79 [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_freetext")]
80 internal static extern ErrorCode SetFreeText(this AddressHandle /* maps_address_h */ address, string freetext);
82 internal class AddressHandle : SafeMapsHandle
84 [DllImport(Libraries.MapService, EntryPoint = "maps_address_create")]
85 internal static extern ErrorCode Create(out IntPtr /* maps_address_h */ address);
87 [DllImport(Libraries.MapService, EntryPoint = "maps_address_destroy")]
88 internal static extern ErrorCode Destroy(IntPtr /* maps_address_h */ address);
90 [DllImport(Libraries.MapService, EntryPoint = "maps_address_clone")]
91 internal static extern ErrorCode Clone(IntPtr /* maps_address_h */ origin, out IntPtr /* maps_address_h */ cloned);
93 internal string Building
95 get { return NativeGet(this.GetBuildingNumber); }
96 set { NativeSet(this.SetBuildingNumber, value); }
99 internal string Street
101 get { return NativeGet(this.GetStreet); }
102 set { NativeSet(this.SetStreet, value); }
107 get { return NativeGet(this.GetCity); }
108 set { NativeSet(this.SetCity, value); }
111 internal string District
113 get { return NativeGet(this.GetDistrict); }
114 set { NativeSet(this.SetDistrict, value); }
117 internal string State
119 get { return NativeGet(this.GetState); }
120 set { NativeSet(this.SetState, value); }
123 internal string Country
125 get { return NativeGet(this.GetCountry); }
126 set { NativeSet(this.SetCountry, value); }
129 internal string CountryCode
131 get { return NativeGet(this.GetCountryCode); }
132 set { NativeSet(this.SetCountryCode, value); }
135 internal string County
137 get { return NativeGet(this.GetCounty); }
138 set { NativeSet(this.SetCounty, value); }
141 internal string PostalCode
143 get { return NativeGet(this.GetPostalCode); }
144 set { NativeSet(this.SetPostalCode, value); }
147 internal string FreeText
149 get { return NativeGet(this.GetFreeText); }
150 set { NativeSet(this.SetFreeText, value); }
153 internal AddressHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
157 internal AddressHandle() : this(IntPtr.Zero, true)
159 Create(out handle).ThrowIfFailed("Failed to create native handle");
162 internal static AddressHandle CloneFrom(IntPtr nativeHandle)
165 Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle");
166 return new AddressHandle(handle, true);
169 internal static AddressHandle Create(IntPtr nativeHandle)
171 return new AddressHandle(nativeHandle, true);