1 |
|
---|
2 |
|
---|
3 | #ifndef HISTORY_H
|
---|
4 | #define HISTORY_H
|
---|
5 |
|
---|
6 | #include "infodbclass.h"
|
---|
7 | #include "text_t.h"
|
---|
8 | #include "recptproto.h"
|
---|
9 | //#include <vector.h>
|
---|
10 | #include <map.h>
|
---|
11 |
|
---|
12 | struct HistRecord {
|
---|
13 | text_t entry;
|
---|
14 | bool save;
|
---|
15 | };
|
---|
16 |
|
---|
17 | struct ltinttext_t
|
---|
18 | {
|
---|
19 | bool operator()(const text_t &t1, const text_t &t2) const
|
---|
20 | { return t1.getint() < t2.getint(); }
|
---|
21 | };
|
---|
22 |
|
---|
23 |
|
---|
24 | typedef map<text_t, HistRecord, ltinttext_t> HistRecordmap;
|
---|
25 |
|
---|
26 | // returns true on success (in which case historyinfo will contain
|
---|
27 | // the information for this history)
|
---|
28 | bool get_history_info ( const text_t &userid, text_tarray &historyinfo);
|
---|
29 |
|
---|
30 | // returns true on success
|
---|
31 | bool set_history_info (const text_t &userid, const text_t &historyinfo);
|
---|
32 |
|
---|
33 | bool delete_all_history_info (const text_t &userid);
|
---|
34 |
|
---|
35 | // deletes only the entries specified
|
---|
36 | bool delete_history_info(const text_t &userid, const text_t &deletemode,
|
---|
37 | const text_t &selection);
|
---|
38 |
|
---|
39 | // takes a text_t with x-y, and retrieves the x and y params
|
---|
40 | bool get_selection_params (text_t &data, int &start, int &stop);
|
---|
41 |
|
---|
42 | bool expand_query(HistRecord &query, HistRecordmap &records);
|
---|
43 |
|
---|
44 | // combine query looks for #x and replaces it with the query
|
---|
45 | // string from the xth entry. THe first one looks up the xth
|
---|
46 | // query in the database (used before running a query), the
|
---|
47 | // second version looks it up inthe records map (used in
|
---|
48 | // delete history -are doing a lotof #x replacing at once.
|
---|
49 | bool combine_query(text_t &userid, text_t &query);
|
---|
50 | bool combine_query(text_t &userid, HistRecordmap &records);
|
---|
51 |
|
---|
52 | // retrieves the value of an arg (key) from a list of cgi args
|
---|
53 | // in the form a=q&b=1&...
|
---|
54 | void parse_saved_args(text_t &args, text_t &key, text_t &value);
|
---|
55 |
|
---|
56 | // extracts out the components of an entry in the database
|
---|
57 | // currently:
|
---|
58 | // querynum:numdocs cgiargs
|
---|
59 | void split_saved_query(text_t &query, text_t &querynum, text_t &numdocs, text_t &cgiargs);
|
---|
60 |
|
---|
61 | // just extracts the query number out of the entry
|
---|
62 | void get_query_num(text_t &query, text_t &querynum);
|
---|
63 |
|
---|
64 | // takes the cgiarg string, and outputs it in some form useful
|
---|
65 | // to the user
|
---|
66 | void format_user_info (text_t &cgiargs, text_t &info,
|
---|
67 | recptprotolistclass *protos, ostream &logout);
|
---|
68 |
|
---|
69 | #endif
|
---|
70 |
|
---|
71 |
|
---|