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;
19 using Tizen.Applications;
22 /// Contains Interop declarations of Preference classes.
24 internal static partial class Interop
27 /// Contains Interop declarations of Preference device API.
29 internal static partial class Preference
31 internal delegate void ChangedCallback(string key, IntPtr userData);
33 internal delegate bool ItemCallback(string key, IntPtr userData);
35 [DllImport(Libraries.Preference, EntryPoint = "preference_set_int")]
36 internal static extern int SetInt(string key, int value);
38 [DllImport(Libraries.Preference, EntryPoint = "preference_get_int")]
39 internal static extern int GetInt(string key, out int value);
41 [DllImport(Libraries.Preference, EntryPoint = "preference_set_double")]
42 internal static extern int SetDouble(string key, double value);
44 [DllImport(Libraries.Preference, EntryPoint = "preference_get_double")]
45 internal static extern int GetDouble(string key, out double value);
47 [DllImport(Libraries.Preference, EntryPoint = "preference_set_string")]
48 internal static extern int SetString(string key, string value);
50 [DllImport(Libraries.Preference, EntryPoint = "preference_get_string")]
51 internal static extern int GetString(string key, out string value);
53 [DllImport(Libraries.Preference, EntryPoint = "preference_set_boolean")]
54 internal static extern int SetBoolean(string key, bool value);
56 [DllImport(Libraries.Preference, EntryPoint = "preference_get_boolean")]
57 internal static extern int GetBoolean(string key, out bool value);
59 [DllImport(Libraries.Preference, EntryPoint = "preference_remove")]
60 internal static extern int Remove(string key);
62 [DllImport(Libraries.Preference, EntryPoint = "preference_is_existing")]
63 internal static extern int IsExisting(string key, out bool existing);
65 [DllImport(Libraries.Preference, EntryPoint = "preference_remove_all")]
66 internal static extern int RemoveAll();
68 [DllImport(Libraries.Preference, EntryPoint = "preference_set_changed_cb")]
69 internal static extern int SetChangedCb(string key, ChangedCallback callback, IntPtr userData);
71 [DllImport(Libraries.Preference, EntryPoint = "preference_unset_changed_cb")]
72 internal static extern int UnsetChangedCb(string key);
74 [DllImport(Libraries.Preference, EntryPoint = "preference_foreach_item")]
75 internal static extern int ForeachItem(ItemCallback callback, IntPtr userData);