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 internal static partial class Place
24 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
25 internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData);
27 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
28 internal delegate bool CategoriesCallback(int index, int total, IntPtr /* maps_place_category_h */ category, IntPtr /* void */ userData);
30 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
31 internal delegate bool AttributesCallback(int index, int total, IntPtr /* maps_place_attribute_h */ attribute, IntPtr /* void */ userData);
33 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
34 internal delegate bool ContactsCallback(int index, int total, IntPtr /* maps_place_contact_h */ contact, IntPtr /* void */ userData);
36 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
37 internal delegate bool EditorialsCallback(int index, int total, IntPtr /* maps_place_editorial_h */ editorial, IntPtr /* void */ userData);
39 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
40 internal delegate bool ImagesCallback(int index, int total, IntPtr /* maps_place_image_h */ image, IntPtr /* void */ userData);
42 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
43 internal delegate bool ReviewsCallback(int index, int total, IntPtr /* maps_place_review_h */ review, IntPtr /* void */ userData);
45 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
46 internal delegate bool PlaceCallback(int index, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData);
48 [DllImport(Libraries.MapService, EntryPoint = "maps_place_destroy")]
49 internal static extern ErrorCode Destroy(IntPtr /* maps_place_h */ place);
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);
54 [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_id")]
55 internal static extern ErrorCode GetId(PlaceHandle /* maps_place_h */ place, out string id);
57 [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_name")]
58 internal static extern ErrorCode GetName(PlaceHandle /* maps_place_h */ place, out string name);
60 [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_uri")]
61 internal static extern ErrorCode GetUri(PlaceHandle /* maps_place_h */ place, out string uri);
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);
66 [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_distance")]
67 internal static extern ErrorCode GetDistance(PlaceHandle /* maps_place_h */ place, out int distance);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
105 [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_destroy")]
106 internal static extern ErrorCode ListDestroy(IntPtr /* maps_place_list_h */ placeList);
109 internal class PlaceHandle : SafeMapsHandle
111 public PlaceHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.Destroy; }
114 internal class PlaceListHandle : SafeMapsHandle
116 public PlaceListHandle(IntPtr handle, bool ownsHandle = true) : base(handle, ownsHandle) { Destroy = Place.ListDestroy; }