Task TT-75 Implement "Main page loading UI" view
[profile/tv/apps/web/browser.git] / services / HistoryService / HistoryItem.cpp
1 /*
2  * Copyright (c) 2014 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 #include "HistoryItem.h"
18
19 namespace tizen_browser
20 {
21 namespace services
22 {
23
24 HistoryItem::HistoryItem(HistoryItem && other) throw()
25 {
26     *this = std::move(other);
27 }
28
29 HistoryItem::HistoryItem(const std::string & url,
30                          const std::string & title,
31                          std::shared_ptr<tizen_browser::tools::BrowserImage> image)
32     : m_url(url)
33     , m_title(title)
34     , m_favIcon(image)
35     , m_lastVisit()
36 {
37 }
38
39 HistoryItem::HistoryItem(const std::string & url)
40     : m_url(url)
41     , m_title()
42     , m_lastVisit()
43     , m_favIcon(std::make_shared<tizen_browser::tools::BrowserImage>())
44 {
45
46 }
47
48 HistoryItem::HistoryItem(const HistoryItem& source)
49     : m_url(source.m_url)
50     , m_title(source.m_title)
51     , m_lastVisit(source.m_lastVisit)
52     , m_favIcon(source.m_favIcon)
53     , m_visitCounter(source.m_visitCounter)
54 {
55
56 }
57
58 HistoryItem::~HistoryItem()
59 {
60
61 }
62
63 HistoryItem & HistoryItem::operator=(HistoryItem && other) throw()
64 {
65     if (this != &other) {
66         m_url = std::move(other.m_url);
67         m_title = std::move(other.m_title);
68         m_visitDate = std::move(other.m_visitDate);
69         m_visitCounter = std::move(other.m_visitCounter);
70         m_favIcon = std::move(other.m_favIcon);
71     }
72     return *this;
73 }
74
75 bool HistoryItem::operator==(const HistoryItem& other)
76 {
77     return (m_url == other.m_url);
78 }
79
80 bool HistoryItem::operator!=(const HistoryItem& other)
81 {
82     return (m_url != other.m_url);
83 }
84
85 void HistoryItem::setUrl(const std::string & url)
86 {
87     m_url = url;
88 }
89
90 std::string HistoryItem::getUrl()
91 {
92     return m_url;
93 }
94
95 void HistoryItem::setTitle(const std::string & title)
96 {
97     m_title = title;
98 }
99
100 std::string HistoryItem::getTitle() const
101 {
102     return m_title;
103 }
104
105 // void HistoryItem::setVisitDate(boost::gregorian::date visitDate)
106 // {
107 //     m_visitDate = visitDate;
108 // }
109 //
110 // boost::gregorian::date HistoryItem::getVisitDate()
111 // {
112 //     return m_visitDate;
113 // }
114
115 void HistoryItem::setLastVisit(boost::posix_time::ptime visitDate)
116 {
117     m_lastVisit = visitDate;
118 }
119
120 boost::posix_time::ptime HistoryItem::getLastVisit() const
121 {
122     return m_lastVisit;
123 }
124
125 void HistoryItem::setVisitCounter(int visitCounter)
126 {
127     m_visitCounter = visitCounter;
128 }
129
130 int HistoryItem::getVisitCounter()
131 {
132     return m_visitCounter;
133 }
134
135 void HistoryItem::setFavIcon(std::shared_ptr<tizen_browser::tools::BrowserImage> favIcon)
136 {
137     m_favIcon = favIcon;
138 }
139
140 std::shared_ptr<tizen_browser::tools::BrowserImage> HistoryItem::getFavIcon()
141 {
142     return m_favIcon;
143 }
144
145 void HistoryItem::setThumbnail(std::shared_ptr<tizen_browser::tools::BrowserImage> thumbnail)
146 {
147     m_thumbnail = thumbnail;
148 };
149
150 std::shared_ptr<tizen_browser::tools::BrowserImage> HistoryItem::getThumbnail() const
151 {
152
153     return m_thumbnail;
154 };
155
156 void HistoryItem::setUriFavicon(const std::string & uri) {
157     m_urifavicon = uri;
158 }
159
160 std::string HistoryItem::getUriFavicon() {
161     return m_urifavicon;
162 }
163
164
165 }
166 }