Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Tizen.Maps / PlaceAddress.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.ComponentModel;
19
20 namespace Tizen.Maps
21 {
22     /// <summary>
23     /// Address information for the map point used in Geocode and Reverse Geocode requests.
24     /// </summary>
25     /// <since_tizen>3</since_tizen>
26     public class PlaceAddress : IDisposable
27     {
28         internal Interop.AddressHandle handle;
29
30         /// <summary>
31         /// Constructs map address object.
32         /// </summary>
33         /// <since_tizen>3</since_tizen>
34         /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
35         public PlaceAddress()
36         {
37             handle = new Interop.AddressHandle();
38         }
39
40         internal PlaceAddress(Interop.AddressHandle nativeHandle)
41         {
42             handle = nativeHandle;
43         }
44
45         /// <summary>
46         /// Gets a building number for this address.
47         /// </summary>
48         /// <since_tizen>3</since_tizen>
49         public string Building
50         {
51             get
52             {
53                 return handle.Building;
54             }
55             set
56             {
57                 handle.Building = value;
58             }
59         }
60
61         /// <summary>
62         /// Gets a city name for this address.
63         /// </summary>
64         /// <since_tizen>3</since_tizen>
65         public string City
66         {
67             get
68             {
69                 return handle.City;
70             }
71             set
72             {
73                 handle.City = value;
74             }
75         }
76
77         /// <summary>
78         /// Gets a country name for this address.
79         /// </summary>
80         /// <since_tizen>3</since_tizen>
81         public string Country
82         {
83             get
84             {
85                 return handle.Country;
86             }
87             set
88             {
89                 handle.Country = value;
90             }
91         }
92
93         /// <summary>
94         /// Gets a country code for this address.
95         /// </summary>
96         /// <since_tizen>3</since_tizen>
97         public string CountryCode
98         {
99             get
100             {
101                 return handle.CountryCode;
102             }
103             set
104             {
105                 handle.CountryCode = value;
106             }
107         }
108
109         /// <summary>
110         /// Gets a county for this address.
111         /// </summary>
112         /// <since_tizen>3</since_tizen>
113         public string County
114         {
115             get
116             {
117                 return handle.County;
118             }
119             set
120             {
121                 handle.County = value;
122             }
123         }
124
125         /// <summary>
126         /// Gets a district name for this address.
127         /// </summary>
128         /// <since_tizen>3</since_tizen>
129         public string District
130         {
131             get
132             {
133                 return handle.District;
134             }
135             set
136             {
137                 handle.District = value;
138             }
139         }
140
141         /// <summary>
142         /// Gets a free text associated with this address.
143         /// </summary>
144         /// <since_tizen>3</since_tizen>
145         public string FreeText
146         {
147             get
148             {
149                 return handle.FreeText;
150             }
151             set
152             {
153                 handle.FreeText = value;
154             }
155         }
156
157         [EditorBrowsableAttribute(EditorBrowsableState.Never)]
158         [Obsolete("Freetext is deprecated. Please use FreeText instead.")]
159         public string Freetext
160         {
161             get
162             {
163                 return FreeText;
164             }
165             set
166             {
167                 FreeText = value;
168             }
169         }
170
171         /// <summary>
172         /// Gets a postal code for this address.
173         /// </summary>
174         /// <since_tizen>3</since_tizen>
175         public string PostalCode
176         {
177             get
178             {
179                 return handle.PostalCode;
180             }
181             set
182             {
183                 handle.PostalCode = value;
184             }
185         }
186
187         /// <summary>
188         /// Gets a state name for this address.
189         /// </summary>
190         /// <since_tizen>3</since_tizen>
191         public string State
192         {
193             get
194             {
195                 return handle.State;
196             }
197             set
198             {
199                 handle.State = value;
200             }
201         }
202
203         /// <summary>
204         /// Gets a street name for this address.
205         /// </summary>
206         /// <since_tizen>3</since_tizen>
207         public string Street
208         {
209             get
210             {
211                 return handle.Street;
212             }
213             set
214             {
215                 handle.Street = value;
216             }
217         }
218
219         /// <summary>
220         /// Returns a string that represents this object.
221         /// </summary>
222         /// <since_tizen>3</since_tizen>
223         /// <returns>Returns a string which presents this object.</returns>
224         public override string ToString()
225         {
226             return $"{FreeText}";
227         }
228
229         #region IDisposable Support
230         private bool _disposedValue = false;
231
232         protected virtual void Dispose(bool disposing)
233         {
234             if (!_disposedValue)
235             {
236                 handle.Dispose();
237                 _disposedValue = true;
238             }
239         }
240
241         /// <summary>
242         /// Releases all resources used by this object.
243         /// </summary>
244         /// <since_tizen>3</since_tizen>
245         public void Dispose()
246         {
247             Dispose(true);
248             GC.SuppressFinalize(this);
249         }
250         #endregion
251     }
252 }