2 * Copyright (c) 2014 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.
17 #ifndef __HISTORY_ITEM_H
18 #define __HISTORY_ITEM_H
20 #include <boost/date_time/gregorian/gregorian.hpp>
21 #include <boost/date_time/posix_time/posix_time.hpp>
25 #include "BrowserImage.h"
27 namespace tizen_browser {
32 HistoryItem(const std::string & url,
33 const std::string & title,
34 std::shared_ptr<tizen_browser::tools::BrowserImage> image);
36 HistoryItem(HistoryItem && other) throw();
37 HistoryItem(const std::string& url);
38 HistoryItem(const HistoryItem& source);
39 virtual ~HistoryItem();
41 HistoryItem & operator=(HistoryItem && other) throw();
44 * @brief compares two HisoryItems, only "url" are checked no other elements are checked.
48 bool operator==(const HistoryItem& other);
49 bool operator!=(const HistoryItem& other);
51 void setUrl(const std::string & url);
54 void setTitle(const std::string & title);
55 std::string getTitle() const;
57 ///\todo Below functions is different because two different services uses different types. To fix.
58 // void setVisitDate(boost::gregorian::date visitDate);
59 // boost::gregorian::date getVisitDate();
61 void setLastVisit(boost::posix_time::ptime visitDate);
62 boost::posix_time::ptime getLastVisit() const;
64 void setVisitCounter(int visitCounter);
65 int getVisitCounter();
67 void setFavIcon(std::shared_ptr<tizen_browser::tools::BrowserImage> favIcon);
68 std::shared_ptr<tizen_browser::tools::BrowserImage> getFavIcon();
70 void setUriFavicon(const std::string & uri);
71 std::string getUriFavicon();
75 std::string m_primaryKey;
78 boost::gregorian::date m_visitDate;
79 boost::posix_time::ptime m_lastVisit;
80 std::shared_ptr<tizen_browser::tools::BrowserImage> m_favIcon;
81 std::string m_urifavicon;
84 ///\todo consider this
85 typedef std::vector<std::shared_ptr<HistoryItem>> HistoryItemVector;
86 typedef std::vector<std::shared_ptr<HistoryItem>>::iterator HistoryItemVectorIter;
87 typedef std::vector<std::shared_ptr<HistoryItem>>::const_iterator HistoryItemVectorConstIter;