Tizen.Maps Setup
[platform/core/csapi/tizenfx.git] / src / Tizen.Maps / Interop / Interop.Place.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     internal static partial class Place
23     {
24         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
25         internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
26
27         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
28         internal delegate bool CategoriesCallback(int index, int total, IntPtr /* maps_place_category_h */ category, IntPtr /* void */ userData);
29
30         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
31         internal delegate bool AttributesCallback(int index, int total, IntPtr /* maps_place_attribute_h */ attribute, IntPtr /* void */ userData);
32
33         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
34         internal delegate bool ContactsCallback(int index, int total, IntPtr /* maps_place_contact_h */ contact, IntPtr /* void */ userData);
35
36         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
37         internal delegate bool EditorialsCallback(int index, int total, IntPtr /* maps_place_editorial_h */ editorial, IntPtr /* void */ userData);
38
39         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
40         internal delegate bool ImagesCallback(int index, int total, IntPtr /* maps_place_image_h */ image, IntPtr /* void */ userData);
41
42         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
43         internal delegate bool ReviewsCallback(int index, int total, IntPtr /* maps_place_review_h */ review, IntPtr /* void */ userData);
44
45         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
46         internal delegate bool PlaceCallback(int index, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData);
47
48         [DllImport(Libraries.MapService, EntryPoint = "maps_place_destroy")]
49         internal static extern ErrorCode Destroy(IntPtr /* maps_place_h */ place);
50
51         [DllImport(Libraries.MapService, EntryPoint = "maps_place_clone")]
52         internal static extern ErrorCode Clone(PlaceHandle /* maps_place_h */ origin, out IntPtr /* maps_place_h */ cloned);
53
54         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_id")]
55         internal static extern ErrorCode GetId(PlaceHandle /* maps_place_h */ place, out string id);
56
57         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_name")]
58         internal static extern ErrorCode GetName(PlaceHandle /* maps_place_h */ place, out string name);
59
60         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_uri")]
61         internal static extern ErrorCode GetUri(PlaceHandle /* maps_place_h */ place, out string uri);
62
63         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_location")]
64         internal static extern ErrorCode GetLocation(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_coordinates_h */ location);
65
66         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_distance")]
67         internal static extern ErrorCode GetDistance(PlaceHandle /* maps_place_h */ place, out int distance);
68
69         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_address")]
70         internal static extern ErrorCode GetAddress(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_address_h */ address);
71
72         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_rating")]
73         internal static extern ErrorCode GetRating(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_rating_h */ rating);
74
75         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_property")]
76         internal static extern ErrorCode ForeachProperty(PlaceHandle /* maps_place_h */ place, PropertiesCallback callback, IntPtr /* void */ userData);
77
78         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_category")]
79         internal static extern ErrorCode ForeachCategory(PlaceHandle /* maps_place_h */ place, CategoriesCallback callback, IntPtr /* void */ userData);
80
81         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_attribute")]
82         internal static extern ErrorCode ForeachAttribute(PlaceHandle /* maps_place_h */ place, AttributesCallback callback, IntPtr /* void */ userData);
83
84         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_contact")]
85         internal static extern ErrorCode ForeachContact(PlaceHandle /* maps_place_h */ place, ContactsCallback callback, IntPtr /* void */ userData);
86
87         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_editorial")]
88         internal static extern ErrorCode ForeachEditorial(PlaceHandle /* maps_place_h */ place, EditorialsCallback callback, IntPtr /* void */ userData);
89
90         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_image")]
91         internal static extern ErrorCode ForeachImage(PlaceHandle /* maps_place_h */ place, ImagesCallback callback, IntPtr /* void */ userData);
92
93         [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_review")]
94         internal static extern ErrorCode ForeachReview(PlaceHandle /* maps_place_h */ place, ReviewsCallback callback, IntPtr /* void */ userData);
95
96         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_supplier_link")]
97         internal static extern ErrorCode GetSupplierLink(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ supplier);
98
99         [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_related_link")]
100         internal static extern ErrorCode GetRelatedLink(PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ related);
101
102         [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_foreach")]
103         internal static extern ErrorCode ListForeach(PlaceListHandle /* maps_place_list_h */ placeList, PlaceCallback callback, IntPtr /* void */ userData);
104
105         [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_destroy")]
106         internal static extern ErrorCode ListDestroy(IntPtr /* maps_place_list_h */ placeList);
107     }
108
109     internal class PlaceHandle : SafeMapsHandle
110     {
111         public PlaceHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.Destroy; }
112     }
113
114     internal class PlaceListHandle : SafeMapsHandle
115     {
116         public PlaceListHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.ListDestroy; }
117     }
118 }