2 * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
4 * All rights reserved. Distributed under the terms of the MIT License.
6 #ifndef BROWSING_HISTORY_H
7 #define BROWSING_HISTORY_H
17 class BrowsingHistoryItem
{
19 BrowsingHistoryItem(const BString
& url
);
21 const BrowsingHistoryItem
& other
);
22 BrowsingHistoryItem(const BMessage
* archive
);
23 ~BrowsingHistoryItem();
25 status_t
Archive(BMessage
* archive
) const;
27 BrowsingHistoryItem
& operator=(const BrowsingHistoryItem
& other
);
30 const BrowsingHistoryItem
& other
) const;
32 const BrowsingHistoryItem
& other
) const;
34 const BrowsingHistoryItem
& other
) const;
36 const BrowsingHistoryItem
& other
) const;
38 const BrowsingHistoryItem
& other
) const;
40 const BrowsingHistoryItem
& other
) const;
42 const BString
& URL() const { return fURL
; }
43 const BDateTime
& DateTime() const { return fDateTime
; }
44 uint32
InvokationCount() const {
45 return fInvokationCount
; }
51 uint32 fInvokationCount
;
55 class BrowsingHistory
: public BLocker
{
57 static BrowsingHistory
* DefaultInstance();
59 bool AddItem(const BrowsingHistoryItem
& item
);
61 // Should Lock() the object when using these in some loop or so:
62 int32
CountItems() const;
63 BrowsingHistoryItem
HistoryItemAt(int32 index
) const;
66 void SetMaxHistoryItemAge(int32 days
);
67 int32
MaxHistoryItemAge() const;
71 virtual ~BrowsingHistory();
74 bool _AddItem(const BrowsingHistoryItem
& item
,
79 bool _OpenSettingsFile(BFile
& file
, uint32 mode
);
83 int32 fMaxHistoryItemAge
;
85 static BrowsingHistory sDefaultInstance
;
90 #endif // BROWSING_HISTORY_H