2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSecPrivacyInfo.cpp
19 * @brief This is the implementation for the PrivacyInfo class.
23 #include <unique_ptr.h>
25 #include <FBaseSysLog.h>
26 #include <FBaseString.h>
27 #include <FSecPrivacyInfo.h>
29 #include "FSec_PrivacyInfoImpl.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Security;
34 namespace Tizen { namespace Security
37 PrivacyInfo::PrivacyInfo(void)
43 PrivacyInfo::~PrivacyInfo(void)
49 PrivacyInfo::Construct(const Tizen::Base::String& privacyId, bool enable)
51 SysAssertf(__pImpl == null,
52 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
54 std::unique_ptr< _PrivacyInfoImpl > pImpl(new (std::nothrow) _PrivacyInfoImpl);
55 SysTryReturnResult(NID_SEC, pImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
57 result r = pImpl->Construct(privacyId, enable);
60 __pImpl = pImpl.release();
69 PrivacyInfo::GetId(void) const
71 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
72 return __pImpl->GetId();
76 PrivacyInfo::IsEnabled(void) const
78 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
79 return __pImpl->IsEnabled();
83 PrivacyInfo::SetEnabled(bool enable)
85 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
86 __pImpl->SetEnabled(enable);
90 PrivacyInfo::GetDisplayName(void) const
92 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
93 return __pImpl->GetDisplayName();
97 PrivacyInfo::GetDescription(void) const
99 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
100 return __pImpl->GetDescription();
103 }} // Tizen::Security