Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / security / FSec_PrivilegeCache.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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 /**
18  * @file        FSecurity_PrivilegeCache.h
19  * @brief       This is the header file for the _PrivilegeCache.
20  *
21  * This header file contains the declarations of the _PrivilegeCache.
22  */
23
24 #ifndef _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
25 #define _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
26
27 #include <unique_ptr.h>
28 #include <FOspConfig.h>
29 #include "FSec_AccessControlTypes.h"
30
31 namespace Tizen { namespace Base { namespace Runtime
32 {
33 class Mutex;
34 }}}
35
36 namespace Tizen { namespace Security
37 {
38
39 class _PrivilegeInfo;
40
41 /**
42  * @class       _PrivilegeCache
43  * @brief       This class provides a way to access the privilege cache.
44  * @since       2.0
45  *
46  * This class provides a way to access the privilege cache.
47  *
48  */
49 class _PrivilegeCache
50         : public Tizen::Base::Object
51 {
52
53 public:
54
55         _PrivilegeCache(void);
56         virtual ~_PrivilegeCache(void);
57
58         result Construct(void);
59
60         /**
61          * Adds the specified privilege information to the privilege cache.
62          *
63          * @since               2.0
64          * @return              An error code
65          * @param[in]   privilegeInfo           An instance of _PrivilegeInfo.
66          * @exception   E_SUCCESS                       The method is successful.
67          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
68          * @exception   E_SYSTEM                        An unexpected system error occurred.
69          */
70         result AddPrivilegeInfo(const _PrivilegeInfo& privilegeInfo);
71
72         /**
73          * Removes the specified information in the privilege cache.
74          *
75          * @since               2.0
76          * @return              An error code
77          * @param[in]   appId                           The application ID.
78          * @exception   E_SUCCESS                       The method is successful.
79          * @exception   E_SYSTEM                        An unexpected system error occurred.
80          */
81         result RemovePrivilegeInfo(const Tizen::App::AppId& appId);
82
83         /**
84          * Gets the privilege information of the specified application.
85          *
86          * @since               2.0
87          * @return              A _PrivilegeInfo instance
88          * @param[in]   appId                           The application ID.
89          * @param[out]  privilegeInfo           An instance of _PrivilegeInfo.
90          * @exception   E_SUCCESS                       The method is successful.
91          * @exception   E_DATA_NOT_FOUND        The privilege information does not exist.
92          * @exception   E_SYSTEM                        An unexpected system error occurred.
93          */
94         _PrivilegeInfo* GetPrivilegeInfoN(const Tizen::App::AppId& appId) const;
95 private:
96
97         _PrivilegeCache(const _PrivilegeCache& rhs);
98         _PrivilegeCache& operator =(const _PrivilegeCache& rhs);
99
100 private:
101         std::unique_ptr<Tizen::Base::Collection::HashMap> __pPrivilegeList;
102         static std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
103
104 };  // _PrivilegeCache
105
106 }} // Tizen::Security
107
108 #endif // _FSEC_INTERNAL_PRIVILEGE_CACHE_H_