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 FSecPrivacyInfo.cpp
20 * @brief This is the implementation for the PrivacyInfo class.
24 #include <unique_ptr.h>
25 #include <FSecPrivacyInfo.h>
26 #include <FBaseSysLog.h>
27 #include "FSec_PrivacyInfoImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Security;
33 namespace Tizen { namespace Security
36 PrivacyInfo::PrivacyInfo(void)
42 PrivacyInfo::~PrivacyInfo(void)
48 PrivacyInfo::Construct(const Tizen::Base::String& privacyId, bool enable)
50 SysAssertf(__pImpl == null,
51 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
53 std::unique_ptr< _PrivacyInfoImpl > pImpl(new (std::nothrow) _PrivacyInfoImpl);
54 SysTryReturnResult(NID_SEC, pImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
56 result r = pImpl->Construct(privacyId, enable);
59 __pImpl = pImpl.release();
68 PrivacyInfo::GetId(void) const
70 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
71 return __pImpl->GetId();
75 PrivacyInfo::IsEnabled(void) const
77 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
78 return __pImpl->IsEnabled();
82 PrivacyInfo::SetEnabled(bool enable)
84 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
85 __pImpl->SetEnabled(enable);
89 PrivacyInfo::GetDisplayName(void) const
91 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
92 return __pImpl->GetDisplayName();
96 PrivacyInfo::GetDescription(void) const
98 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
99 return __pImpl->GetDescription();
102 }} // Tizen::Security