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();
38 HistoryItem(const std::string& url);
39 HistoryItem(const std::string& url, int& date_created);
40 HistoryItem(const HistoryItem& source);
41 virtual ~HistoryItem();
43 HistoryItem & operator=(HistoryItem && other) throw();
46 * @brief compares two HisoryItems, only "url" are checked no other elements are checked.
50 bool operator==(const HistoryItem& other);
51 bool operator!=(const HistoryItem& other);
53 void setUrl(const std::string & url);
56 void setTitle(const std::string & title);
57 std::string getTitle() const;
59 ///\todo Below functions is different because two different services uses different types. To fix.
60 // void setVisitDate(boost::gregorian::date visitDate);
61 // boost::gregorian::date getVisitDate();
63 void setLastVisit(boost::posix_time::ptime visitDate);
64 boost::posix_time::ptime getLastVisit() const;
66 void setVisitCounter(int visitCounter);
67 int getVisitCounter();
69 void setThumbnail(std::shared_ptr<tizen_browser::tools::BrowserImage> thumbnail);
70 std::shared_ptr<tizen_browser::tools::BrowserImage> getThumbnail() const ;
72 void setFavIcon(std::shared_ptr<tizen_browser::tools::BrowserImage> favIcon);
73 std::shared_ptr<tizen_browser::tools::BrowserImage> getFavIcon();
75 void setUriFavicon(const std::string & uri);
76 std::string getUriFavicon();
80 std::string m_primaryKey;
83 boost::gregorian::date m_visitDate;
84 boost::posix_time::ptime m_lastVisit;
85 std::shared_ptr<tizen_browser::tools::BrowserImage> m_thumbnail;
86 std::shared_ptr<tizen_browser::tools::BrowserImage> m_favIcon;
87 std::string m_urifavicon;
90 ///\todo consider this
91 typedef std::vector<std::shared_ptr<HistoryItem>> HistoryItemVector;
92 typedef std::vector<std::shared_ptr<HistoryItem>>::iterator HistoryItemVectorIter;
93 typedef std::vector<std::shared_ptr<HistoryItem>>::const_iterator HistoryItemVectorConstIter;