Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Preference / Interop / Interop.Preference.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 using Tizen.Applications;
20
21 /// <summary>
22 /// Contains Interop declarations of Preference classes.
23 /// </summary>
24 internal static partial class Interop
25 {
26     /// <summary>
27     /// Contains Interop declarations of Preference device API.
28     /// </summary>
29     internal static partial class Preference
30     {
31         internal delegate void ChangedCallback(string key, IntPtr userData);
32
33         internal delegate bool ItemCallback(string key, IntPtr userData);
34
35         [DllImport(Libraries.Preference, EntryPoint = "preference_set_int")]
36         internal static extern int SetInt(string key, int value);
37
38         [DllImport(Libraries.Preference, EntryPoint = "preference_get_int")]
39         internal static extern int GetInt(string key, out int value);
40
41         [DllImport(Libraries.Preference, EntryPoint = "preference_set_double")]
42         internal static extern int SetDouble(string key, double value);
43
44         [DllImport(Libraries.Preference, EntryPoint = "preference_get_double")]
45         internal static extern int GetDouble(string key, out double value);
46
47         [DllImport(Libraries.Preference, EntryPoint = "preference_set_string")]
48         internal static extern int SetString(string key, string value);
49
50         [DllImport(Libraries.Preference, EntryPoint = "preference_get_string")]
51         internal static extern int GetString(string key, out string value);
52
53         [DllImport(Libraries.Preference, EntryPoint = "preference_set_boolean")]
54         internal static extern int SetBoolean(string key, bool value);
55
56         [DllImport(Libraries.Preference, EntryPoint = "preference_get_boolean")]
57         internal static extern int GetBoolean(string key, out bool value);
58
59         [DllImport(Libraries.Preference, EntryPoint = "preference_remove")]
60         internal static extern int Remove(string key);
61
62         [DllImport(Libraries.Preference, EntryPoint = "preference_is_existing")]
63         internal static extern int IsExisting(string key, out bool existing);
64
65         [DllImport(Libraries.Preference, EntryPoint = "preference_remove_all")]
66         internal static extern int RemoveAll();
67
68         [DllImport(Libraries.Preference, EntryPoint = "preference_set_changed_cb")]
69         internal static extern int SetChangedCb(string key, ChangedCallback callback, IntPtr userData);
70
71         [DllImport(Libraries.Preference, EntryPoint = "preference_unset_changed_cb")]
72         internal static extern int UnsetChangedCb(string key);
73
74         [DllImport(Libraries.Preference, EntryPoint = "preference_foreach_item")]
75         internal static extern int ForeachItem(ItemCallback callback, IntPtr userData);
76     }
77 }