dae19e571ed37518b7156c78fe16db6e3992b040
[platform/core/csapi/maps.git] / Tizen.Maps / Tizen.Maps / PlaceCategory.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
19 namespace Tizen.Maps
20 {
21     /// <summary>
22     /// Place Category information, used in Place Discovery and Search requests
23     /// </summary>
24     public class PlaceCategory : IDisposable
25     {
26         internal Interop.PlaceCategoryHandle handle;
27
28         /// <summary>
29         /// Constructs search category object.
30         /// </summary>
31         /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory.</exception>
32         public PlaceCategory()
33         {
34             handle = new Interop.PlaceCategoryHandle();
35         }
36
37         internal PlaceCategory(Interop.PlaceCategoryHandle nativeHandle)
38         {
39             handle = nativeHandle;
40         }
41
42
43         /// <summary>
44         /// Gets or sets an ID for this category.
45         /// </summary>
46         public string Id
47         {
48             get { return handle.Id; }
49             set { handle.Id = value; }
50         }
51
52         /// <summary>
53         /// Gets or sets a name for this category.
54         /// </summary>
55         public string Name
56         {
57             get { return handle.Name; }
58             set { handle.Name = value; }
59         }
60
61         /// <summary>
62         /// Gets or sets an URL for this category.
63         /// </summary>
64         public string Url
65         {
66             get { return handle.Url; }
67             set { handle.Url = value; }
68         }
69
70         /// <summary>
71         /// Returns a string that represents this object.
72         /// </summary>
73         /// <returns>Returns a string which presents this object.</returns>
74         public override string ToString()
75         {
76             return $"{Name}";
77         }
78
79         #region IDisposable Support
80         private bool _disposedValue = false;
81
82         protected virtual void Dispose(bool disposing)
83         {
84             if (!_disposedValue)
85             {
86                 handle.Dispose();
87                 _disposedValue = true;
88             }
89         }
90
91         /// <summary>
92         /// Releases all resources used by this object.
93         /// </summary>
94         public void Dispose()
95         {
96             Dispose(true);
97             GC.SuppressFinalize(this);
98         }
99         #endregion
100     }
101 }