Revert "Fix prevent defect for locales"
[platform/framework/native/appfw.git] / src / security / FSecPrivilegeInfo.cpp
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        FSecPrivilegeInfo.cpp
19  * @brief       This is the implementation for the PrivilegeInfo class.
20  */
21
22 #include <new>
23
24 #include <FSecPrivilegeInfo.h>
25
26 #include <FBaseSysLog.h>
27 #include <FSec_AccessController.h>
28 #include "FSec_PrivilegeInfoImpl.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Security;
33
34 namespace Tizen { namespace Security
35 {
36
37
38 PrivilegeInfo::PrivilegeInfo(void)
39         : __pImpl(null)
40 {
41
42 }
43
44 PrivilegeInfo::~PrivilegeInfo(void)
45 {
46
47 }
48
49 result
50 PrivilegeInfo::Construct(const Tizen::Base::String& privilegeId)
51 {
52         result r = E_SUCCESS;
53
54         SysAssertf(__pImpl == null,
55                     "Already constructed. Calling Construct() twice or more on a same in stance is not allowed for this class.");
56
57         __pImpl = new (std::nothrow) _PrivilegeInfoImpl;
58     SysTryReturnResult(NID_SEC, __pImpl != null, E_OUT_OF_MEMORY, "");
59
60     r = __pImpl->Construct(privilegeId);
61     SysTryCatch(NID_SEC, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
62
63     return r;
64
65 CATCH:
66     delete __pImpl;
67     __pImpl = null;
68
69     return r;
70
71 }
72
73 String
74 PrivilegeInfo::GetId(void) const
75 {
76         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
77
78         return __pImpl->GetId();
79 }
80
81
82 String
83 PrivilegeInfo::GetDisplayName(void) const
84 {
85         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
86
87         return __pImpl->GetDisplayName();
88 }
89
90 String
91 PrivilegeInfo::GetDescription(void) const
92 {
93         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
94
95         return __pImpl->GetDescription();
96 }
97
98 }} // Tizen::Security