Use std[::tr1]::shared_ptr instead of local RefCntr by default
This commit is contained in:
@@ -56,9 +56,9 @@ bool DocSequence::getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
|
||||
// Remove stacked modifying sources (sort, filter) until we get to a real one
|
||||
void DocSource::stripStack()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return;
|
||||
while (m_seq->getSourceSeq().isNotNull()) {
|
||||
while (m_seq->getSourceSeq()) {
|
||||
m_seq = m_seq->getSourceSeq();
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ bool DocSource::buildStack()
|
||||
LOGDEB2(("DocSource::buildStack()\n"));
|
||||
stripStack();
|
||||
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
|
||||
// Filtering must be done before sorting, (which may
|
||||
@@ -80,7 +80,7 @@ bool DocSource::buildStack()
|
||||
} else {
|
||||
if (m_fspec.isNotNull()) {
|
||||
m_seq =
|
||||
RefCntr<DocSequence>(new DocSeqFiltered(m_config, m_seq, m_fspec));
|
||||
STD_SHARED_PTR<DocSequence>(new DocSeqFiltered(m_config, m_seq, m_fspec));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool DocSource::buildStack()
|
||||
}
|
||||
} else {
|
||||
if (m_sspec.isNotNull()) {
|
||||
m_seq = RefCntr<DocSequence>(new DocSeqSorted(m_seq, m_sspec));
|
||||
m_seq = STD_SHARED_PTR<DocSequence>(new DocSeqSorted(m_seq, m_sspec));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -98,7 +98,7 @@ bool DocSource::buildStack()
|
||||
|
||||
string DocSource::title()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return string();
|
||||
string qual;
|
||||
if (m_fspec.isNotNull() && !m_sspec.isNotNull())
|
||||
|
||||
+20
-18
@@ -16,13 +16,15 @@
|
||||
*/
|
||||
#ifndef _DOCSEQ_H_INCLUDED_
|
||||
#define _DOCSEQ_H_INCLUDED_
|
||||
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include MEMORY_INCLUDE
|
||||
|
||||
#include "rcldoc.h"
|
||||
#include "refcntr.h"
|
||||
#include "hldata.h"
|
||||
#include "ptmutex.h"
|
||||
|
||||
@@ -153,7 +155,7 @@ class DocSequence {
|
||||
virtual bool canSort() {return false;}
|
||||
virtual bool setFiltSpec(const DocSeqFiltSpec &) {return false;}
|
||||
virtual bool setSortSpec(const DocSeqSortSpec &) {return false;}
|
||||
virtual RefCntr<DocSequence> getSourceSeq() {return RefCntr<DocSequence>();}
|
||||
virtual STD_SHARED_PTR<DocSequence> getSourceSeq() {return STD_SHARED_PTR<DocSequence>();}
|
||||
|
||||
static void set_translations(const std::string& sort, const std::string& filt)
|
||||
{
|
||||
@@ -179,59 +181,59 @@ protected:
|
||||
*/
|
||||
class DocSeqModifier : public DocSequence {
|
||||
public:
|
||||
DocSeqModifier(RefCntr<DocSequence> iseq)
|
||||
DocSeqModifier(STD_SHARED_PTR<DocSequence> iseq)
|
||||
: DocSequence(""), m_seq(iseq)
|
||||
{}
|
||||
virtual ~DocSeqModifier() {}
|
||||
|
||||
virtual bool getAbstract(Rcl::Doc& doc, std::vector<std::string>& abs)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->getAbstract(doc, abs);
|
||||
}
|
||||
virtual bool getAbstract(Rcl::Doc& doc,
|
||||
std::vector<Rcl::Snippet>& abs)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->getAbstract(doc, abs);
|
||||
}
|
||||
/** Get duplicates. */
|
||||
virtual bool docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->docDups(doc, dups);
|
||||
}
|
||||
|
||||
virtual bool snippetsCapable()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->snippetsCapable();
|
||||
}
|
||||
virtual std::string getDescription()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return "";
|
||||
return m_seq->getDescription();
|
||||
}
|
||||
virtual void getTerms(HighlightData& hld)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return;
|
||||
m_seq->getTerms(hld);
|
||||
}
|
||||
virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->getEnclosing(doc, pdoc);
|
||||
}
|
||||
virtual std::string getReason()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return string();
|
||||
return m_seq->getReason();
|
||||
}
|
||||
@@ -239,7 +241,7 @@ public:
|
||||
{
|
||||
return m_seq->title();
|
||||
}
|
||||
virtual RefCntr<DocSequence> getSourceSeq()
|
||||
virtual STD_SHARED_PTR<DocSequence> getSourceSeq()
|
||||
{
|
||||
return m_seq;
|
||||
}
|
||||
@@ -247,12 +249,12 @@ public:
|
||||
protected:
|
||||
virtual Rcl::Db *getDb()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return 0;
|
||||
return m_seq->getDb();
|
||||
}
|
||||
|
||||
RefCntr<DocSequence> m_seq;
|
||||
STD_SHARED_PTR<DocSequence> m_seq;
|
||||
};
|
||||
|
||||
class RclConfig;
|
||||
@@ -261,7 +263,7 @@ class RclConfig;
|
||||
// sorting and filtering in ways depending on the base seqs capabilities
|
||||
class DocSource : public DocSeqModifier {
|
||||
public:
|
||||
DocSource(RclConfig *config, RefCntr<DocSequence> iseq)
|
||||
DocSource(RclConfig *config, STD_SHARED_PTR<DocSequence> iseq)
|
||||
: DocSeqModifier(iseq), m_config(config)
|
||||
{}
|
||||
virtual bool canFilter() {return true;}
|
||||
@@ -270,13 +272,13 @@ public:
|
||||
virtual bool setSortSpec(const DocSeqSortSpec &);
|
||||
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0)
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return false;
|
||||
return m_seq->getDoc(num, doc, sh);
|
||||
}
|
||||
virtual int getResCnt()
|
||||
{
|
||||
if (m_seq.isNull())
|
||||
if (!m_seq)
|
||||
return 0;
|
||||
return m_seq->getResCnt();
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ using std::list;
|
||||
#include "debuglog.h"
|
||||
#include "wasatorcl.h"
|
||||
|
||||
DocSequenceDb::DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
|
||||
RefCntr<Rcl::SearchData> sdata)
|
||||
DocSequenceDb::DocSequenceDb(STD_SHARED_PTR<Rcl::Query> q, const string &t,
|
||||
STD_SHARED_PTR<Rcl::SearchData> sdata)
|
||||
: DocSequence(t), m_q(q), m_sdata(sdata), m_fsdata(sdata),
|
||||
m_rescnt(-1),
|
||||
m_queryBuildAbstract(true),
|
||||
@@ -131,7 +131,7 @@ int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
|
||||
|
||||
Rcl::Db *DocSequenceDb::getDb()
|
||||
{
|
||||
return m_q.isNotNull() ? m_q->whatDb() : 0;
|
||||
return m_q ? m_q->whatDb() : 0;
|
||||
}
|
||||
|
||||
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
|
||||
@@ -162,7 +162,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||
PTMutexLocker locker(o_dblock);
|
||||
if (fs.isNotNull()) {
|
||||
// We build a search spec by adding a filtering layer to the base one.
|
||||
m_fsdata = RefCntr<Rcl::SearchData>(
|
||||
m_fsdata = STD_SHARED_PTR<Rcl::SearchData>(
|
||||
new Rcl::SearchData(Rcl::SCLT_AND, m_sdata->getStemLang()));
|
||||
Rcl::SearchDataClauseSub *cl =
|
||||
new Rcl::SearchDataClauseSub(m_sdata);
|
||||
@@ -175,7 +175,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||
break;
|
||||
case DocSeqFiltSpec::DSFS_QLANG:
|
||||
{
|
||||
if (m_q.isNull())
|
||||
if (!m_q)
|
||||
break;
|
||||
|
||||
string reason;
|
||||
@@ -186,7 +186,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||
if (sd) {
|
||||
Rcl::SearchDataClauseSub *cl1 =
|
||||
new Rcl::SearchDataClauseSub(
|
||||
RefCntr<Rcl::SearchData>(sd));
|
||||
STD_SHARED_PTR<Rcl::SearchData>(sd));
|
||||
m_fsdata->addClause(cl1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef _DOCSEQDB_H_INCLUDED_
|
||||
#define _DOCSEQDB_H_INCLUDED_
|
||||
#include "docseq.h"
|
||||
#include "refcntr.h"
|
||||
#include MEMORY_INCLUDE
|
||||
|
||||
#include "searchdata.h"
|
||||
#include "rclquery.h"
|
||||
@@ -25,8 +25,8 @@
|
||||
/** A DocSequence from a Db query */
|
||||
class DocSequenceDb : public DocSequence {
|
||||
public:
|
||||
DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
|
||||
RefCntr<Rcl::SearchData> sdata);
|
||||
DocSequenceDb(STD_SHARED_PTR<Rcl::Query> q, const string &t,
|
||||
STD_SHARED_PTR<Rcl::SearchData> sdata);
|
||||
virtual ~DocSequenceDb() {}
|
||||
virtual bool getDoc(int num, Rcl::Doc &doc, string * = 0);
|
||||
virtual int getResCnt();
|
||||
@@ -60,9 +60,9 @@ class DocSequenceDb : public DocSequence {
|
||||
protected:
|
||||
virtual Rcl::Db *getDb();
|
||||
private:
|
||||
RefCntr<Rcl::Query> m_q;
|
||||
RefCntr<Rcl::SearchData> m_sdata;
|
||||
RefCntr<Rcl::SearchData> m_fsdata; // Filtered
|
||||
STD_SHARED_PTR<Rcl::Query> m_q;
|
||||
STD_SHARED_PTR<Rcl::SearchData> m_sdata;
|
||||
STD_SHARED_PTR<Rcl::SearchData> m_fsdata; // Filtered
|
||||
int m_rescnt;
|
||||
bool m_queryBuildAbstract;
|
||||
bool m_queryReplaceAbstract;
|
||||
|
||||
@@ -47,7 +47,7 @@ static bool filter(const DocSeqFiltSpec& fs, const Rcl::Doc *x)
|
||||
return false;
|
||||
}
|
||||
|
||||
DocSeqFiltered::DocSeqFiltered(RclConfig *conf, RefCntr<DocSequence> iseq,
|
||||
DocSeqFiltered::DocSeqFiltered(RclConfig *conf, STD_SHARED_PTR<DocSequence> iseq,
|
||||
DocSeqFiltSpec &filtspec)
|
||||
: DocSeqModifier(iseq), m_config(conf)
|
||||
{
|
||||
|
||||
+5
-6
@@ -16,13 +16,12 @@
|
||||
*/
|
||||
#ifndef _FILTSEQ_H_INCLUDED_
|
||||
#define _FILTSEQ_H_INCLUDED_
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using std::string;
|
||||
using std::vector;
|
||||
#include MEMORY_INCLUDE
|
||||
|
||||
#include "refcntr.h"
|
||||
#include "docseq.h"
|
||||
|
||||
class RclConfig;
|
||||
@@ -33,17 +32,17 @@ class RclConfig;
|
||||
*/
|
||||
class DocSeqFiltered : public DocSeqModifier {
|
||||
public:
|
||||
DocSeqFiltered(RclConfig *conf, RefCntr<DocSequence> iseq,
|
||||
DocSeqFiltered(RclConfig *conf, STD_SHARED_PTR<DocSequence> iseq,
|
||||
DocSeqFiltSpec &filtspec);
|
||||
virtual ~DocSeqFiltered() {}
|
||||
virtual bool canFilter() {return true;}
|
||||
virtual bool setFiltSpec(const DocSeqFiltSpec &filtspec);
|
||||
virtual bool getDoc(int num, Rcl::Doc &doc, string *sh = 0);
|
||||
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0);
|
||||
virtual int getResCnt() {return m_seq->getResCnt();}
|
||||
private:
|
||||
RclConfig *m_config;
|
||||
DocSeqFiltSpec m_spec;
|
||||
vector<int> m_dbindices;
|
||||
std::vector<int> m_dbindices;
|
||||
};
|
||||
|
||||
#endif /* _FILTSEQ_H_INCLUDED_ */
|
||||
|
||||
@@ -330,7 +330,7 @@ endopts:
|
||||
return 1;
|
||||
}
|
||||
|
||||
RefCntr<Rcl::SearchData> rq(sd);
|
||||
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||
Rcl::Query query(&rcldb);
|
||||
if (op_flags & OPT_S) {
|
||||
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
|
||||
|
||||
@@ -65,7 +65,7 @@ ResListPager::ResListPager(int pagesize)
|
||||
|
||||
void ResListPager::resultPageNext()
|
||||
{
|
||||
if (m_docSource.isNull()) {
|
||||
if (!m_docSource) {
|
||||
LOGDEB(("ResListPager::resultPageNext: null source\n"));
|
||||
return;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ static string maybeEscapeHtml(const string& fld)
|
||||
|
||||
void ResListPager::resultPageFor(int docnum)
|
||||
{
|
||||
if (m_docSource.isNull()) {
|
||||
if (!m_docSource) {
|
||||
LOGDEB(("ResListPager::resultPageFor: null source\n"));
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
|
||||
|
||||
string richabst;
|
||||
bool needabstract = parFormat().find("%A") != string::npos;
|
||||
if (needabstract && m_docSource.isNotNull()) {
|
||||
if (needabstract && m_docSource) {
|
||||
vector<string> vabs;
|
||||
m_docSource->getAbstract(doc, vabs);
|
||||
m_hiliter->set_inputhtml(false);
|
||||
@@ -344,7 +344,7 @@ bool ResListPager::getDoc(int num, Rcl::Doc& doc)
|
||||
void ResListPager::displayPage(RclConfig *config)
|
||||
{
|
||||
LOGDEB(("ResListPager::displayPage\n"));
|
||||
if (m_docSource.isNull()) {
|
||||
if (!m_docSource) {
|
||||
LOGDEB(("ResListPager::displayPage: null source\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
|
||||
#ifndef _reslistpager_h_included_
|
||||
#define _reslistpager_h_included_
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <vector>
|
||||
#include MEMORY_INCLUDE
|
||||
|
||||
#include "refcntr.h"
|
||||
#include "docseq.h"
|
||||
#include "hldata.h"
|
||||
|
||||
@@ -39,7 +40,7 @@ public:
|
||||
{
|
||||
m_hiliter = ptr;
|
||||
}
|
||||
void setDocSource(RefCntr<DocSequence> src, int winfirst = -1)
|
||||
void setDocSource(STD_SHARED_PTR<DocSequence> src, int winfirst = -1)
|
||||
{
|
||||
m_pagesize = m_newpagesize;
|
||||
m_winfirst = winfirst;
|
||||
@@ -87,8 +88,9 @@ public:
|
||||
const HighlightData& hdata, const string& sh = "");
|
||||
bool pageEmpty() {return m_respage.size() == 0;}
|
||||
|
||||
string queryDescription() {return m_docSource.isNull() ? "" :
|
||||
m_docSource->getDescription();}
|
||||
string queryDescription() {
|
||||
return m_docSource ? m_docSource->getDescription() : "";
|
||||
}
|
||||
|
||||
bool getDoc(int num, Rcl::Doc &doc);
|
||||
|
||||
@@ -127,7 +129,7 @@ private:
|
||||
int m_winfirst;
|
||||
bool m_hasNext;
|
||||
PlainToRich *m_hiliter;
|
||||
RefCntr<DocSequence> m_docSource;
|
||||
STD_SHARED_PTR<DocSequence> m_docSource;
|
||||
std::vector<ResListEntry> m_respage;
|
||||
};
|
||||
|
||||
|
||||
+3
-2
@@ -16,11 +16,12 @@
|
||||
*/
|
||||
#ifndef _SORTSEQ_H_INCLUDED_
|
||||
#define _SORTSEQ_H_INCLUDED_
|
||||
#include "autoconfig.h"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include MEMORY_INCLUDE
|
||||
|
||||
#include "refcntr.h"
|
||||
#include "docseq.h"
|
||||
|
||||
/**
|
||||
@@ -29,7 +30,7 @@
|
||||
*/
|
||||
class DocSeqSorted : public DocSeqModifier {
|
||||
public:
|
||||
DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec)
|
||||
DocSeqSorted(STD_SHARED_PTR<DocSequence> iseq, DocSeqSortSpec &sortspec)
|
||||
: DocSeqModifier(iseq)
|
||||
{
|
||||
setSortSpec(sortspec);
|
||||
|
||||
Reference in New Issue
Block a user