-
Notifications
You must be signed in to change notification settings - Fork 0
/
XTBHistory.h
62 lines (43 loc) · 1.13 KB
/
XTBHistory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// XTBHistory.h
// XTBook
//
// Created by 河田 智明 on 8/3/11.
// Copyright 2011 Nexhawks. All rights reserved.
//
#pragma once
#include <tcw/twObject.h>
#include "XTBStream.h"
#include "platform.h"
#include <tcw/twSemaphore.h>
struct XTBHistoryDBItem{
std::wstring date;
std::wstring url;
time_t time() const;
};
class XTBHistoryDB: public twObject{
struct IndexItem{
uint64_t offset;
uint16_t length;
};
XTBSysString m_path;
XTBStream *m_dbHandle;
XTBStream *m_indexHandle;
uint64_t m_historyCount;
twSemaphore *m_dbSemaphore;
twSemaphore *m_indexSemaphore;
std::wstring m_lastUrl;
IndexItem indexItemAtIndex(uint64_t);
void writeIndexItemAtEnd(const IndexItem&);
std::string entryForItem(const XTBHistoryDBItem&);
XTBHistoryDBItem itemForEntry(const std::string&);
public:
XTBHistoryDB(const XTBSysString&);
virtual ~XTBHistoryDB();
void writeEntry(const XTBHistoryDBItem&);
XTBHistoryDBItem entryAtIndex(uint64_t);
uint64_t entryCount() const{return m_historyCount;}
static XTBHistoryDB *standardHistory();
static void visitPage(const std::wstring& url);
void clearHistory();
};