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>
24 #include <FSecPrivacyInfo.h>
25 #include <FBaseSysLog.h>
26 #include "FSec_PrivacyInfoImpl.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Collection;
30 using namespace Tizen::Security;
32 namespace Tizen { namespace Security
35 PrivacyInfo::PrivacyInfo(void)
41 PrivacyInfo::~PrivacyInfo(void)
47 PrivacyInfo::Construct(const Tizen::Base::String& privacyId, bool enable)
49 SysAssertf(__pImpl == null,
50 "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class");
52 std::unique_ptr< _PrivacyInfoImpl > pImpl(new (std::nothrow) _PrivacyInfoImpl);
53 SysTryReturnResult(NID_SEC, pImpl != null, E_OUT_OF_MEMORY, "Memory allocation failed");
55 result r = pImpl->Construct(privacyId, enable);
58 __pImpl = pImpl.release();
67 PrivacyInfo::GetId(void) const
69 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
70 return __pImpl->GetId();
74 PrivacyInfo::IsEnabled(void) const
76 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
77 return __pImpl->IsEnabled();
81 PrivacyInfo::SetEnabled(bool enable)
83 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
84 __pImpl->SetEnabled(enable);
88 PrivacyInfo::GetDisplayName(void) const
90 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
91 return __pImpl->GetDisplayName();
95 PrivacyInfo::GetDescription(void) const
97 SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
98 return __pImpl->GetDescription();
101 }} // Tizen::Security