Fixed privilege for web-history.admin
[profile/tv/apps/web/browser.git] / services / HistoryService / src / 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 {
36 }
37
38 HistoryItem::HistoryItem(const std::string & url)
39     : m_url(url)
40     , m_title()
41     , m_lastVisit()
42     , m_favIcon(std::make_shared<tizen_browser::tools::BrowserImage>())
43 {
44
45 }
46
47 HistoryItem::HistoryItem(const HistoryItem& source)
48     : m_url(source.m_url)
49     , m_title(source.m_title)
50     , m_lastVisit(source.m_lastVisit)
51     , m_favIcon(source.m_favIcon)
52     , m_visitCounter(source.m_visitCounter)
53 {
54
55 }
56
57 HistoryItem::~HistoryItem()
58 {
59
60 }
61
62 HistoryItem & HistoryItem::operator=(HistoryItem && other) throw()
63 {
64     if (this != &other) {
65         m_url = std::move(other.m_url);
66         m_title = std::move(other.m_title);
67         m_visitDate = std::move(other.m_visitDate);
68         m_visitCounter = std::move(other.m_visitCounter);
69         m_favIcon = std::move(other.m_favIcon);
70     }
71     return *this;
72 }
73
74 bool HistoryItem::operator==(const HistoryItem& other)
75 {
76     return (m_url == other.m_url);
77 }
78
79 bool HistoryItem::operator!=(const HistoryItem& other)
80 {
81     return (m_url != other.m_url);
82 }
83
84 void HistoryItem::setUrl(const std::string & url)
85 {
86     m_url = url;
87 }
88
89 std::string HistoryItem::getUrl()
90 {
91     return m_url;
92 }
93
94 void HistoryItem::setTitle(const std::string & title)
95 {
96     m_title = title;
97 }
98
99 std::string HistoryItem::getTitle() const
100 {
101     return m_title;
102 }
103
104 // void HistoryItem::setVisitDate(boost::gregorian::date visitDate)
105 // {
106 //     m_visitDate = visitDate;
107 // }
108 //
109 // boost::gregorian::date HistoryItem::getVisitDate()
110 // {
111 //     return m_visitDate;
112 // }
113
114 void HistoryItem::setLastVisit(boost::posix_time::ptime visitDate)
115 {
116     m_lastVisit = visitDate;
117 }
118
119 boost::posix_time::ptime HistoryItem::getLastVisit() const
120 {
121     return m_lastVisit;
122 }
123
124 void HistoryItem::setVisitCounter(int visitCounter)
125 {
126     m_visitCounter = visitCounter;
127 }
128
129 int HistoryItem::getVisitCounter()
130 {
131     return m_visitCounter;
132 }
133
134 void HistoryItem::setFavIcon(std::shared_ptr<tizen_browser::tools::BrowserImage> favIcon)
135 {
136     m_favIcon = favIcon;
137 }
138
139 std::shared_ptr<tizen_browser::tools::BrowserImage> HistoryItem::getFavIcon()
140 {
141     return m_favIcon;
142 }
143
144 void HistoryItem::setUriFavicon(const std::string & uri) {
145     m_urifavicon = uri;
146 }
147
148 std::string HistoryItem::getUriFavicon() {
149     return m_urifavicon;
150 }
151
152
153 }
154 }