Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Interop / Interop.Place.Category.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.Runtime.InteropServices;
19
20 internal static partial class Interop
21 {
22     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_id")]
23     internal static extern ErrorCode GetId(this PlaceCategoryHandle /* maps_place_category_h */ category, out string id);
24
25     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_id")]
26     internal static extern ErrorCode SetId(this PlaceCategoryHandle /* maps_place_category_h */ category, string id);
27
28     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_name")]
29     internal static extern ErrorCode GetName(this PlaceCategoryHandle /* maps_place_category_h */ category, out string name);
30
31     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_name")]
32     internal static extern ErrorCode SetName(this PlaceCategoryHandle /* maps_place_category_h */ category, string name);
33
34     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_url")]
35     internal static extern ErrorCode GetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, out string url);
36
37     [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_url")]
38     internal static extern ErrorCode SetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, string url);
39
40     internal class PlaceCategoryHandle : SafeMapsHandle
41     {
42         [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_create")]
43         internal static extern ErrorCode Create(out IntPtr /* maps_place_category_h */ category);
44
45         [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_destroy")]
46         internal static extern ErrorCode Destroy(IntPtr /* maps_place_category_h */ category);
47
48         internal string Id
49         {
50             get { return NativeGet(this.GetId); }
51             set { NativeSet(this.SetId, value); }
52         }
53
54         internal string Name
55         {
56             get { return NativeGet(this.GetName); }
57             set { NativeSet(this.SetName, value); }
58         }
59
60         internal string Url
61         {
62             get { return NativeGet(this.GetUrl); }
63             set { NativeSet(this.SetUrl, value); }
64         }
65
66         public PlaceCategoryHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy)
67         {
68         }
69
70         internal PlaceCategoryHandle() : this(IntPtr.Zero, true)
71         {
72             Create(out handle).ThrowIfFailed("Failed to create native handle");
73         }
74
75         internal static PlaceCategoryHandle Create(IntPtr nativeHandle)
76         {
77             return new PlaceCategoryHandle(nativeHandle, true);
78         }
79     }
80 }