Release 4.0.0-preview1-00051
[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 PackageManager::GetPackages method.
23     /// </summary>
24     public class PackageFilter
25     {
26         private IDictionary<string, bool> _filter;
27
28         /// <summary>
29         /// Default constructor with empty filter list. All installed applications will satisfy this filter unless updated with more specific filters.
30         /// </summary>
31         public PackageFilter()
32         {
33             _filter = new Dictionary<string, bool>();
34         }
35
36         /// <summary>
37         /// Constructor with specific filters. Using this will filter out installed packages which do not meet the criteria of the filters.
38         /// </summary>
39         public PackageFilter(IDictionary<string, bool> filter)
40         {
41             _filter = filter;
42         }
43
44         /// <summary>
45         /// Filters to be used in the GetPackages method.
46         /// </summary>
47         public IDictionary<string, bool> Filters
48         {
49             get
50             {
51                 return _filter;
52             }
53         }
54
55         /// <summary>
56         /// This class contains possible keys for filter to be used in the GetPackages method.
57         /// </summary>
58         public static class Keys
59         {
60             /// <summary>
61             /// Key of the boolean property for filtering whether the package is removable
62             /// </summary>
63             public const string Removable = "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE";
64             /// <summary>
65             /// Key of the boolean property for filtering whether the package is readonly.
66             /// </summary>
67             public const string ReadOnly = "PMINFO_PKGINFO_PROP_PACKAGE_READONLY";
68             /// <summary>
69             /// Key of the boolean property for filtering whether the package supports disabling.
70             /// </summary>
71             public const string SupportsDisable = "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE";
72             /// <summary>
73             /// Key of the boolean property for filtering whether the package is disabled.
74             /// </summary>
75             public const string Disable = "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE";
76             /// <summary>
77             /// Key of the boolean property for filtering whether the package is preloaded.
78             /// </summary>
79             public const string Preload = "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD";
80         }
81     }
82 }