Switch to unified view

a/src/query/docseqhist.h b/src/query/docseqhist.h
...
...
16
 */
16
 */
17
#ifndef _DOCSEQHIST_H_INCLUDED_
17
#ifndef _DOCSEQHIST_H_INCLUDED_
18
#define _DOCSEQHIST_H_INCLUDED_
18
#define _DOCSEQHIST_H_INCLUDED_
19
#include <time.h>
19
#include <time.h>
20
20
21
#include <vector>
22
21
#include "docseq.h"
23
#include "docseq.h"
22
#include "dynconf.h"
24
#include "dynconf.h"
23
25
24
namespace Rcl {
26
namespace Rcl {
25
    class Db;
27
    class Db;
...
...
27
29
28
/** DynConf Document history entry */
30
/** DynConf Document history entry */
29
class RclDHistoryEntry : public DynConfEntry {
31
class RclDHistoryEntry : public DynConfEntry {
30
 public:
32
 public:
31
    RclDHistoryEntry() : unixtime(0) {}
33
    RclDHistoryEntry() : unixtime(0) {}
32
    RclDHistoryEntry(time_t t, const string& u) 
34
    RclDHistoryEntry(time_t t, const std::string& u, const std::string& d) 
33
    : unixtime(t), udi(u) {}
35
    : unixtime(t), udi(u), dbdir(d) {}
34
    virtual ~RclDHistoryEntry() {}
36
    virtual ~RclDHistoryEntry() {}
35
    virtual bool decode(const string &value);
37
    virtual bool decode(const std::string &value);
36
    virtual bool encode(string& value);
38
    virtual bool encode(std::string& value);
37
    virtual bool equal(const DynConfEntry& other);
39
    virtual bool equal(const DynConfEntry& other);
38
    time_t unixtime;
40
    time_t unixtime;
39
    string udi;
41
    std::string udi;
42
    std::string dbdir;
40
};
43
};
41
44
42
/** A DocSequence coming from the history file. 
45
/** A DocSequence coming from the history file. 
43
 *  History is kept as a list of urls. This queries the db to fetch
46
 *  History is kept as a list of urls. This queries the db to fetch
44
 *  metadata for an url key */
47
 *  metadata for an url key */
45
class DocSequenceHistory : public DocSequence {
48
class DocSequenceHistory : public DocSequence {
46
 public:
49
 public:
47
    DocSequenceHistory(Rcl::Db *d, RclDynConf *h, const string &t) 
50
    DocSequenceHistory(Rcl::Db *d, RclDynConf *h, const std::string &t) 
48
  : DocSequence(t), m_db(d), m_hist(h), m_prevnum(-1), m_prevtime(-1) {}
51
  : DocSequence(t), m_db(d), m_hist(h) {}
49
    virtual ~DocSequenceHistory() {}
52
    virtual ~DocSequenceHistory() {}
50
53
51
    virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0);
54
    virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0);
52
    virtual int getResCnt();
55
    virtual int getResCnt();
53
    virtual string getDescription() {return m_description;}
56
    virtual std::string getDescription() {return m_description;}
54
    void setDescription(const string& desc) {m_description = desc;}
57
    void setDescription(const std::string& desc) {m_description = desc;}
55
protected:
58
protected:
56
    virtual Rcl::Db *getDb();
59
    virtual Rcl::Db *getDb();
57
private:
60
private:
58
    Rcl::Db    *m_db;
61
    Rcl::Db    *m_db;
59
    RclDynConf *m_hist;
62
    RclDynConf *m_hist;
60
    int         m_prevnum;
61
    time_t      m_prevtime;
63
    time_t      m_prevtime{-1};
62
    std::string m_description; // This is just an nls translated 'doc history'
64
    std::string m_description; // This is just an nls translated 'doc history'
63
    std::list<RclDHistoryEntry> m_hlist;
65
    std::vector<RclDHistoryEntry> m_history;
64
    std::list<RclDHistoryEntry>::const_iterator m_it;
65
};
66
};
66
67
67
extern bool historyEnterDoc(RclDynConf *dncf, const string& udi);
68
extern bool historyEnterDoc(Rcl::Db *db, RclDynConf *dncf, const Rcl::Doc& doc);
68
69
69
#endif /* _DOCSEQ_H_INCLUDED_ */
70
#endif /* _DOCSEQ_H_INCLUDED_ */