2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FSecPrivilegeInfo.cpp
20 * @brief This is the implementation for the PrivilegeInfo class.
25 #include <FSecPrivilegeInfo.h>
27 #include <FBaseSysLog.h>
28 #include <FSec_AccessController.h>
29 #include "FSec_PrivilegeInfoImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Collection;
33 using namespace Tizen::Security;
35 namespace Tizen { namespace Security
38 _PrivilegeInfoImpl* PrivilegeInfo::__pPrivilegeInfoImpl = null;
40 PrivilegeInfo::PrivilegeInfo(void)
46 PrivilegeInfo::~PrivilegeInfo(void)
52 PrivilegeInfo::Construct(const Tizen::Base::String& privilegeId)
56 SysAssertf(__pImpl == null,
57 "Already constructed. Calling Construct() twice or more on a same in stance is not allowed for this class.");
59 __pImpl = new (std::nothrow) _PrivilegeInfoImpl;
60 SysTryReturnResult(NID_SEC, __pImpl != null, E_OUT_OF_MEMORY, "");
62 r = __pImpl->Construct(privilegeId);
63 SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
76 PrivilegeInfo::GetId(void) const
78 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
80 return __pImpl->GetId();
85 PrivilegeInfo::GetDisplayName(void) const
87 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
89 return __pImpl->GetDisplayName();
93 PrivilegeInfo::GetDescription(void) const
95 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
97 return __pImpl->GetDescription();
103 PrivilegeInfo::GetName(const String& privilege)
107 if (__pPrivilegeInfoImpl == null)
109 __pPrivilegeInfoImpl = _PrivilegeInfoImpl::GetInstance();
111 SysTryReturn(NID_SEC, __pPrivilegeInfoImpl != null, name, E_SYSTEM, "An unexpected system error occurred.");
113 name = __pPrivilegeInfoImpl->GetName(privilege);
119 PrivilegeInfo::GetDescription(const String& privilege)
123 if (__pPrivilegeInfoImpl == null)
125 __pPrivilegeInfoImpl = _PrivilegeInfoImpl::GetInstance();
127 SysTryReturn(NID_SEC, __pPrivilegeInfoImpl != null, description, E_SYSTEM, "An unexpected system error occurred.");
129 description = __pPrivilegeInfoImpl->GetDescription(privilege);
134 }} // Tizen::Security