try to limit the places which use Rcl:: stuff

This commit is contained in:
dockes
2007-01-19 15:22:50 +00:00
parent 6b394537b2
commit ddb1bdca07
13 changed files with 94 additions and 96 deletions
+9 -2
View File
@@ -16,7 +16,7 @@
*/
#ifndef _DOCSEQ_H_INCLUDED_
#define _DOCSEQ_H_INCLUDED_
/* @(#$Id: docseq.h,v 1.10 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: docseq.h,v 1.11 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
#include <vector>
@@ -79,9 +79,16 @@ class DocSequence {
/** Get title for result list */
virtual string title() {return m_title;}
/** Get description for underlying query */
virtual string getDescription() = 0;
/** Get search terms (for highlighting abstracts). Some sequences
* may have no associated search terms. Implement this for them. */
virtual void getTerms(list<string>& t) {t.clear();}
virtual bool getTerms(vector<string>& terms,
vector<vector<string> >& groups,
vector<int>& gslks) const {
terms.clear(); groups.clear(); gslks.clear(); return true;
}
private:
string m_title;
+1 -8
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: docseqdb.cpp,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -39,13 +39,6 @@ int DocSequenceDb::getResCnt()
return m_rescnt;
}
void DocSequenceDb::getTerms(list<string> &terms)
{
if (!m_db)
return;
m_db->getQueryTerms(terms);
}
string DocSequenceDb::getAbstract(Rcl::Doc &doc)
{
if (!m_db)
+17 -17
View File
@@ -16,35 +16,35 @@
*/
#ifndef _DOCSEQDB_H_INCLUDED_
#define _DOCSEQDB_H_INCLUDED_
/* @(#$Id: docseqdb.h,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
#ifndef NO_NAMESPACES
using std::string;
using std::list;
#endif
/* @(#$Id: docseqdb.h,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
#include "docseq.h"
namespace Rcl {
class Db;
}
#include "refcntr.h"
#include "searchdata.h"
/** A DocSequence from a Db query (there should be one active for this
to make sense */
to make sense) */
class DocSequenceDb : public DocSequence {
public:
DocSequenceDb(Rcl::Db *d, const string &t) :
DocSequence(t), m_db(d), m_rescnt(-1)
DocSequenceDb(Rcl::Db *d, const string &t, RefCntr<Rcl::SearchData> sdata)
: DocSequence(t), m_db(d), m_sdata(sdata), m_rescnt(-1)
{}
virtual ~DocSequenceDb() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string * = 0);
virtual int getResCnt();
virtual void getTerms(list<string>&);
virtual bool getTerms(vector<string>& terms,
vector<vector<string> >& groups,
vector<int>& gslks) const {
return m_sdata.getptr()->getTerms(terms, groups, gslks);
}
virtual string getAbstract(Rcl::Doc &doc);
virtual string getDescription() {return m_sdata->getDescription();}
private:
Rcl::Db *m_db;
int m_rescnt;
Rcl::Db *m_db;
RefCntr<Rcl::SearchData> m_sdata;
int m_rescnt;
};
#endif /* _DOCSEQDB_H_INCLUDED_ */
+6 -10
View File
@@ -16,20 +16,14 @@
*/
#ifndef _DOCSEQHIST_H_INCLUDED_
#define _DOCSEQHIST_H_INCLUDED_
/* @(#$Id: docseqhist.h,v 1.1 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#include <list>
#ifndef NO_NAMESPACES
using std::string;
using std::list;
#endif
/* @(#$Id: docseqhist.h,v 1.2 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
#include "docseq.h"
#include "history.h"
namespace Rcl {
class Db;
class Db;
}
class RclHistory;
/** A DocSequence coming from the history file.
* History is kept as a list of urls. This queries the db to fetch
@@ -42,12 +36,14 @@ class DocSequenceHistory : public DocSequence {
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
virtual int getResCnt();
virtual string getDescription() {return m_description;}
void setDescription(const string& desc) {m_description = desc;}
private:
Rcl::Db *m_db;
RclHistory *m_hist;
int m_prevnum;
long m_prevtime;
string m_description; // This is just an nls translated 'doc history'
list<RclDHistoryEntry> m_hlist;
list<RclDHistoryEntry>::const_iterator m_it;
};
+1 -6
View File
@@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.10 2007-01-19 10:32:39 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.11 2007-01-19 15:22:50 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@@ -120,8 +120,3 @@ bool DocSeqSorted::getDoc(int num, Rcl::Doc &doc, int *percent, string *)
doc = *m_docsp[num];
return true;
}
string DocSeqSorted::getAbstract(Rcl::Doc& doc)
{
return m_seq->getAbstract(doc);
}
+5 -2
View File
@@ -16,7 +16,7 @@
*/
#ifndef _SORTSEQ_H_INCLUDED_
#define _SORTSEQ_H_INCLUDED_
/* @(#$Id: sortseq.h,v 1.9 2007-01-19 10:32:39 dockes Exp $ (C) 2004 J.F.Dockes */
/* @(#$Id: sortseq.h,v 1.10 2007-01-19 15:22:50 dockes Exp $ (C) 2004 J.F.Dockes */
#include <vector>
#include <string>
@@ -48,7 +48,10 @@ class DocSeqSorted : public DocSequence {
virtual ~DocSeqSorted() {}
virtual bool getDoc(int num, Rcl::Doc &doc, int *percent, string *sh = 0);
virtual int getResCnt() {return m_spec.sortwidth;}
virtual string getAbstract(Rcl::Doc& doc);
virtual string getAbstract(Rcl::Doc& doc) {
return m_seq->getAbstract(doc);
}
virtual string getDescription() {return m_seq->getDescription();}
private:
RefCntr<DocSequence> m_seq;