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