Release 9.0.0.16887
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.PackageManager / Tizen.Applications / PackageFilter.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.Collections.Generic;
18
19 namespace Tizen.Applications
20 {
21     /// <summary>
22     /// This class is a parameter of the PackageManager::GetPackages method.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class PackageFilter
26     {
27         private IDictionary<string, bool> _filter;
28         private IDictionary<string, string> _stringFilter;
29
30         /// <summary>
31         /// The default constructor with an empty filter list. All the installed applications will satisfy this filter unless updated with more specific filters.
32         /// </summary>
33         /// <since_tizen> 3 </since_tizen>
34         public PackageFilter()
35         {
36             _filter = new Dictionary<string, bool>();
37             _stringFilter = new Dictionary<string, string>();
38         }
39
40         /// <summary>
41         /// The constructor with specific filters. Using this will filter out the installed packages which do not meet the filter criteria.
42         /// </summary>
43         /// <param name="filter">Package filters.</param>
44         /// <since_tizen> 3 </since_tizen>
45         public PackageFilter(IDictionary<string, bool> filter)
46         {
47             _filter = filter;
48         }
49
50         /// <summary>
51         /// The constructor with specific filters. Using this will filter out the installed packages which do not meet the filter criteria.
52         /// </summary>
53         /// <remarks>The dictionary contains filter keys as the keys, and filter values as the value.</remarks>
54         /// <param name="stringFilter">Package filters using string values.</param>
55         /// <since_tizen> 9 </since_tizen>
56         public PackageFilter(IDictionary<string, string> stringFilter)
57         {
58             _stringFilter = stringFilter;
59         }
60
61         /// <summary>
62         /// The constructor with specific filters. Using this will filter out the installed packages which do not meet the filter criteria.
63         /// </summary>
64         /// <param name="filter">Package filters.</param>
65         /// <param name="stringFilter">Package filters using string values.</param>
66         /// <since_tizen> 9 </since_tizen>
67         public PackageFilter(IDictionary<string, bool> filter, IDictionary<string, string> stringFilter)
68         {
69             _filter = filter;
70             _stringFilter = stringFilter;
71         }
72
73         /// <summary>
74         /// Filters to be used in the GetPackages method.
75         /// </summary>
76         /// <since_tizen> 3 </since_tizen>
77         public IDictionary<string, bool> Filters
78         {
79             get
80             {
81                 return _filter;
82             }
83         }
84
85         /// <summary>
86         /// String filters to be used in the GetPackages method.
87         /// </summary>
88         /// <since_tizen> 9 </since_tizen>
89         public IDictionary<string, string> StringFilters
90         {
91             get
92             {
93                 return _stringFilter;
94             }
95         }
96
97         /// <summary>
98         /// This class contains possible keys for the filter to be used in the GetPackages method.
99         /// </summary>
100         /// <since_tizen> 3 </since_tizen>
101         public static class Keys
102         {
103             /// <summary>
104             /// Key of the boolean property for filtering if the package is removable.
105             /// </summary>
106             /// <since_tizen> 3 </since_tizen>
107             public const string Removable = "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE";
108             /// <summary>
109             /// Key of the boolean property for filtering if the package is read-only.
110             /// </summary>
111             /// <since_tizen> 3 </since_tizen>
112             public const string ReadOnly = "PMINFO_PKGINFO_PROP_PACKAGE_READONLY";
113             /// <summary>
114             /// Key of the boolean property for filtering if the package supports disabling.
115             /// </summary>
116             /// <since_tizen> 3 </since_tizen>
117             public const string SupportsDisable = "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE";
118             /// <summary>
119             /// Key of the boolean property for filtering if the package is disabled.
120             /// </summary>
121             /// <since_tizen> 3 </since_tizen>
122             public const string Disable = "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE";
123             /// <summary>
124             /// Key of the boolean property for filtering if the package is preloaded.
125             /// </summary>
126             /// <since_tizen> 3 </since_tizen>
127             public const string Preload = "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD";
128
129             /// <summary>
130             /// Key of the string property for filtering the resource type of the package.
131             /// </summary>
132             /// <since_tizen> 9 </since_tizen>
133             public const string ResourceType = "PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE";
134         }
135     }
136 }