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 FWebHistoryItem.cpp
20 * @brief The file contains the definition of HistoryItem class.
22 * This file contains the definition of HistoryItem class.
25 #include <FBaseResult.h>
26 #include <FBaseSysLog.h>
27 #include <FGrpBitmap.h>
28 #include <FWebBookmarkItem.h>
29 #include "FWeb_BookmarkItemImpl.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Graphics;
36 namespace Tizen { namespace Web
40 BookmarkItem::BookmarkItem(void)
41 : __pBookmarkItemImpl(new (std::nothrow) _BookmarkItemImpl())
43 SysTryReturnVoidResult(NID_WEB, __pBookmarkItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
47 BookmarkItem::BookmarkItem(const BookmarkItem& rhs)
48 : __pBookmarkItemImpl(new (std::nothrow) _BookmarkItemImpl(*_BookmarkItemImpl::GetInstance(&rhs)))
50 SysTryReturnVoidResult(NID_WEB, __pBookmarkItemImpl, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
54 BookmarkItem::~BookmarkItem(void)
56 delete __pBookmarkItemImpl;
57 __pBookmarkItemImpl = null;
62 BookmarkItem::GetTitle(void) const
64 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
66 return __pBookmarkItemImpl->GetTitle();
71 BookmarkItem::GetUrl(void) const
73 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
75 return __pBookmarkItemImpl->GetUrl();
80 BookmarkItem::GetFaviconN(void) const
82 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
86 Bitmap* pFavicon = __pBookmarkItemImpl->GetFaviconN();
87 SysTryReturn(NID_WEB, GetLastResult() == E_SUCCESS, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
94 BookmarkItem::GetParentFolderId(void) const
96 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
98 return __pBookmarkItemImpl->GetParentFolderId();
103 BookmarkItem::IsFolder(void) const
105 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
107 return __pBookmarkItemImpl->IsFolder();
112 BookmarkItem::GetHashCode(void) const
114 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
116 return __pBookmarkItemImpl->GetHashCode();
121 BookmarkItem::Equals(const Object& obj) const
123 SysAssertf(__pBookmarkItemImpl != null, "Not yet constructed. Construct() should be called before use.");
125 const BookmarkItem* pRhs = dynamic_cast< const BookmarkItem* >(&obj);
131 return __pBookmarkItemImpl->Equals(*pRhs->__pBookmarkItemImpl);
136 BookmarkItem::operator =(const BookmarkItem& rhs)
143 Object::operator =(rhs);
144 _BookmarkItemImpl* pImpl = _BookmarkItemImpl::GetInstance(this);
147 *pImpl = *_BookmarkItemImpl::GetInstance(&rhs);