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.
22 /// Place Category information, used in Place Discovery and Search requests
24 public class PlaceCategory
26 internal Interop.PlaceCategoryHandle handle;
28 protected string _name;
29 protected string _url;
32 /// Constructs search category object
34 /// <exception cref="System.InvalidOperationException">Throws if native operation failed to allocate memory</exception>
35 public PlaceCategory()
38 var err = Interop.PlaceCategory.Create(out nativeHandle);
39 err.ThrowIfFailed("Failed to create native handle for Place Category");
41 handle = new Interop.PlaceCategoryHandle(nativeHandle);
44 internal PlaceCategory(IntPtr nativeHandle)
46 handle = new Interop.PlaceCategoryHandle(nativeHandle);
51 /// ID for this category
61 var err = Interop.PlaceCategory.SetId(handle, value);
62 if (err.WarnIfFailed("Failed to set id for place category"))
70 /// Name for this category
80 var err = Interop.PlaceCategory.SetName(handle, value);
81 if (err.WarnIfFailed("Failed to set name for place category"))
89 /// URL for this category
99 var err = Interop.PlaceCategory.SetUrl(handle, value);
100 if (err.WarnIfFailed("Failed to set URL for place category"))
107 internal void Initialize()
109 var err = Interop.PlaceCategory.GetId(handle, out _id);
110 err.WarnIfFailed("Failed to get id for place category");
112 err = Interop.PlaceCategory.GetName(handle, out _name);
113 err.WarnIfFailed("Failed to get name for place category");
115 err = Interop.PlaceCategory.GetUrl(handle, out _url);
116 err.WarnIfFailed("Failed to get URL for place category");