Use std[::tr1]::shared_ptr instead of local RefCntr by default
This commit is contained in:
parent
143b3e92b6
commit
b71c399fe7
61 changed files with 313 additions and 288 deletions
|
@ -16,9 +16,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TEST_SUBTREELIST
|
#ifndef TEST_SUBTREELIST
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "cstr.h"
|
#include "cstr.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "rclquery.h"
|
#include "rclquery.h"
|
||||||
|
@ -37,7 +39,7 @@ bool subtreelist(RclConfig *config, const string& top,
|
||||||
}
|
}
|
||||||
|
|
||||||
Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_OR, cstr_null);
|
Rcl::SearchData *sd = new Rcl::SearchData(Rcl::SCLT_OR, cstr_null);
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||||
|
|
||||||
sd->addClause(new Rcl::SearchDataClausePath(top, false));
|
sd->addClause(new Rcl::SearchDataClausePath(top, false));
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
|
||||||
result = df->set_document_data(m_mimetype, data.c_str(), data.length());
|
result = df->set_document_data(m_mimetype, data.c_str(), data.length());
|
||||||
} else if (df->is_data_input_ok(Dijon::Filter::DOCUMENT_FILE_NAME)) {
|
} else if (df->is_data_input_ok(Dijon::Filter::DOCUMENT_FILE_NAME)) {
|
||||||
TempFile temp = dataToTempFile(data, m_mimetype);
|
TempFile temp = dataToTempFile(data, m_mimetype);
|
||||||
if (temp.isNotNull() &&
|
if (temp &&
|
||||||
(result = df->set_document_file(m_mimetype, temp->filename()))) {
|
(result = df->set_document_file(m_mimetype, temp->filename()))) {
|
||||||
m_tmpflgs[m_handlers.size()] = true;
|
m_tmpflgs[m_handlers.size()] = true;
|
||||||
m_tempfiles.push_back(temp);
|
m_tempfiles.push_back(temp);
|
||||||
|
@ -701,7 +701,7 @@ int FileInterner::addHandler()
|
||||||
setres = newflt->set_document_data(mimetype,txt->c_str(),txt->length());
|
setres = newflt->set_document_data(mimetype,txt->c_str(),txt->length());
|
||||||
} else if (newflt->is_data_input_ok(Dijon::Filter::DOCUMENT_FILE_NAME)) {
|
} else if (newflt->is_data_input_ok(Dijon::Filter::DOCUMENT_FILE_NAME)) {
|
||||||
TempFile temp = dataToTempFile(*txt, mimetype);
|
TempFile temp = dataToTempFile(*txt, mimetype);
|
||||||
if (temp.isNotNull() &&
|
if (temp &&
|
||||||
(setres = newflt->set_document_file(mimetype, temp->filename()))) {
|
(setres = newflt->set_document_file(mimetype, temp->filename()))) {
|
||||||
m_tmpflgs[m_handlers.size()] = true;
|
m_tmpflgs[m_handlers.size()] = true;
|
||||||
m_tempfiles.push_back(temp);
|
m_tempfiles.push_back(temp);
|
||||||
|
@ -743,7 +743,7 @@ FileInterner::Status FileInterner::internfile(Rcl::Doc& doc, const string& ipath
|
||||||
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
LOGDEB(("FileInterner::internfile. ipath [%s]\n", ipath.c_str()));
|
||||||
|
|
||||||
// Get rid of possible image tempfile from older call
|
// Get rid of possible image tempfile from older call
|
||||||
m_imgtmp.release();
|
m_imgtmp.reset();
|
||||||
|
|
||||||
if (m_handlers.size() < 1) {
|
if (m_handlers.size() < 1) {
|
||||||
// Just means the constructor failed
|
// Just means the constructor failed
|
||||||
|
|
|
@ -332,8 +332,8 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> sdata(sd);
|
STD_SHARED_PTR<Rcl::SearchData> sdata(sd);
|
||||||
RefCntr<Rcl::Query>query(new Rcl::Query(m_rcldb));
|
STD_SHARED_PTR<Rcl::Query>query(new Rcl::Query(m_rcldb));
|
||||||
query->setCollapseDuplicates(prefs.collapseDuplicates);
|
query->setCollapseDuplicates(prefs.collapseDuplicates);
|
||||||
if (!query->setQuery(sdata)) {
|
if (!query->setQuery(sdata)) {
|
||||||
m_reason = "Query execute failed. Invalid query or syntax error?";
|
m_reason = "Query execute failed. Invalid query or syntax error?";
|
||||||
|
@ -342,12 +342,12 @@ bool RecollProtocol::doSearch(const QueryDesc& qd)
|
||||||
}
|
}
|
||||||
|
|
||||||
DocSequenceDb *src =
|
DocSequenceDb *src =
|
||||||
new DocSequenceDb(RefCntr<Rcl::Query>(query), "Query results", sdata);
|
new DocSequenceDb(STD_SHARED_PTR<Rcl::Query>(query), "Query results", sdata);
|
||||||
if (src == 0) {
|
if (src == 0) {
|
||||||
error(KIO::ERR_SLAVE_DEFINED, "Can't build result sequence");
|
error(KIO::ERR_SLAVE_DEFINED, "Can't build result sequence");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_source = RefCntr<DocSequence>(src);
|
m_source = STD_SHARED_PTR<DocSequence>(src);
|
||||||
// Reset pager in all cases. Costs nothing, stays at page -1 initially
|
// Reset pager in all cases. Costs nothing, stays at page -1 initially
|
||||||
// htmldosearch will fetch the first page if needed.
|
// htmldosearch will fetch the first page if needed.
|
||||||
m_pager.setDocSource(m_source);
|
m_pager.setDocSource(m_source);
|
||||||
|
|
|
@ -32,7 +32,7 @@ using std::string;
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "reslistpager.h"
|
#include "reslistpager.h"
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
class RecollProtocol;
|
class RecollProtocol;
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ class RecollProtocol : public KIO::SlaveBase {
|
||||||
// (one slave several konqueror windows) would be to have a small
|
// (one slave several konqueror windows) would be to have a small
|
||||||
// cache of recent searches kept open.
|
// cache of recent searches kept open.
|
||||||
RecollKioPager m_pager;
|
RecollKioPager m_pager;
|
||||||
RefCntr<DocSequence> m_source;
|
STD_SHARED_PTR<DocSequence> m_source;
|
||||||
// Note: page here is not used, current page always comes from m_pager.
|
// Note: page here is not used, current page always comes from m_pager.
|
||||||
QueryDesc m_query;
|
QueryDesc m_query;
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,7 +131,7 @@ PHP_METHOD(Query, query)
|
||||||
RETURN_BOOL(false);
|
RETURN_BOOL(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||||
Rcl::Query *pRclQuery = new Rcl::Query(pRclDb);
|
Rcl::Query *pRclQuery = new Rcl::Query(pRclDb);
|
||||||
pRclQuery->setQuery(rq);
|
pRclQuery->setQuery(rq);
|
||||||
|
|
||||||
|
|
|
@ -55,15 +55,15 @@ static RclConfig *rclconfig;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
/* Type-specific fields go here. */
|
/* Type-specific fields go here. */
|
||||||
RefCntr<Rcl::SearchData> sd;
|
STD_SHARED_PTR<Rcl::SearchData> sd;
|
||||||
} recoll_SearchDataObject;
|
} recoll_SearchDataObject;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SearchData_dealloc(recoll_SearchDataObject *self)
|
SearchData_dealloc(recoll_SearchDataObject *self)
|
||||||
{
|
{
|
||||||
LOGDEB(("SearchData_dealloc. Releasing. Count before: %d\n",
|
LOGDEB(("SearchData_dealloc. Releasing. Count before: %d\n",
|
||||||
self->sd.getcnt()));
|
self->sd.use_count()));
|
||||||
self->sd.release();
|
self->sd.reset();
|
||||||
Py_TYPE(self)->tp_free((PyObject*)self);
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ SearchData_init(recoll_SearchDataObject *self, PyObject *args, PyObject *kwargs)
|
||||||
} else {
|
} else {
|
||||||
stemlang = "english";
|
stemlang = "english";
|
||||||
}
|
}
|
||||||
self->sd = RefCntr<Rcl::SearchData>(new Rcl::SearchData(tp, stemlang));
|
self->sd = STD_SHARED_PTR<Rcl::SearchData>(new Rcl::SearchData(tp, stemlang));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ SearchData_addclause(recoll_SearchDataObject* self, PyObject *args,
|
||||||
PyObject *kwargs)
|
PyObject *kwargs)
|
||||||
{
|
{
|
||||||
LOGDEB0(("SearchData_addclause\n"));
|
LOGDEB0(("SearchData_addclause\n"));
|
||||||
if (self->sd.isNull()) {
|
if (!self->sd) {
|
||||||
LOGERR(("SearchData_addclause: not init??\n"));
|
LOGERR(("SearchData_addclause: not init??\n"));
|
||||||
PyErr_SetString(PyExc_AttributeError, "sd");
|
PyErr_SetString(PyExc_AttributeError, "sd");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -951,7 +951,7 @@ Query_execute(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||||
self->query->setSortBy(*self->sortfield, self->ascending);
|
self->query->setSortBy(*self->sortfield, self->ascending);
|
||||||
self->query->setQuery(rq);
|
self->query->setQuery(rq);
|
||||||
int cnt = self->query->getResCnt();
|
int cnt = self->query->getResCnt();
|
||||||
|
@ -1222,8 +1222,8 @@ Query_highlight(recoll_QueryObject* self, PyObject *args, PyObject *kwargs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> sd = self->query->getSD();
|
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
||||||
if (sd.isNull()) {
|
if (!sd) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1273,8 +1273,8 @@ Query_makedocabstract(recoll_QueryObject* self, PyObject *args,PyObject *kwargs)
|
||||||
PyErr_SetString(PyExc_AttributeError, "query");
|
PyErr_SetString(PyExc_AttributeError, "query");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RefCntr<Rcl::SearchData> sd = self->query->getSD();
|
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
||||||
if (sd.isNull()) {
|
if (!sd) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1329,8 +1329,8 @@ Query_getxquery(recoll_QueryObject* self, PyObject *, PyObject *)
|
||||||
PyErr_SetString(PyExc_AttributeError, "query");
|
PyErr_SetString(PyExc_AttributeError, "query");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RefCntr<Rcl::SearchData> sd = self->query->getSD();
|
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
||||||
if (sd.isNull()) {
|
if (!sd) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1357,8 +1357,8 @@ Query_getgroups(recoll_QueryObject* self, PyObject *, PyObject *)
|
||||||
PyErr_SetString(PyExc_AttributeError, "query");
|
PyErr_SetString(PyExc_AttributeError, "query");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
RefCntr<Rcl::SearchData> sd = self->query->getSD();
|
STD_SHARED_PTR<Rcl::SearchData> sd = self->query->getSD();
|
||||||
if (sd.isNull()) {
|
if (!sd) {
|
||||||
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
PyErr_SetString(PyExc_ValueError, "Query not initialized");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ using namespace Rcl;
|
||||||
void AdvSearch::runSearch()
|
void AdvSearch::runSearch()
|
||||||
{
|
{
|
||||||
string stemLang = prefs.stemlang();
|
string stemLang = prefs.stemlang();
|
||||||
RefCntr<SearchData> sdata(new SearchData(conjunctCMB->currentIndex() == 0 ?
|
STD_SHARED_PTR<SearchData> sdata(new SearchData(conjunctCMB->currentIndex() == 0 ?
|
||||||
SCLT_AND : SCLT_OR, stemLang));
|
SCLT_AND : SCLT_OR, stemLang));
|
||||||
bool hasclause = false;
|
bool hasclause = false;
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ void AdvSearch::runSearch()
|
||||||
|
|
||||||
// Set up fields from existing search data, which must be compatible
|
// Set up fields from existing search data, which must be compatible
|
||||||
// with what we can do...
|
// with what we can do...
|
||||||
void AdvSearch::fromSearch(RefCntr<SearchData> sdata)
|
void AdvSearch::fromSearch(STD_SHARED_PTR<SearchData> sdata)
|
||||||
{
|
{
|
||||||
if (sdata->m_tp == SCLT_OR)
|
if (sdata->m_tp == SCLT_OR)
|
||||||
conjunctCMB->setCurrentIndex(1);
|
conjunctCMB->setCurrentIndex(1);
|
||||||
|
@ -553,8 +553,8 @@ void AdvSearch::slotHistoryNext()
|
||||||
{
|
{
|
||||||
if (g_advshistory == 0)
|
if (g_advshistory == 0)
|
||||||
return;
|
return;
|
||||||
RefCntr<Rcl::SearchData> sd = g_advshistory->getnewer();
|
STD_SHARED_PTR<Rcl::SearchData> sd = g_advshistory->getnewer();
|
||||||
if (sd.isNull())
|
if (!sd)
|
||||||
return;
|
return;
|
||||||
fromSearch(sd);
|
fromSearch(sd);
|
||||||
}
|
}
|
||||||
|
@ -563,8 +563,8 @@ void AdvSearch::slotHistoryPrev()
|
||||||
{
|
{
|
||||||
if (g_advshistory == 0)
|
if (g_advshistory == 0)
|
||||||
return;
|
return;
|
||||||
RefCntr<Rcl::SearchData> sd = g_advshistory->getolder();
|
STD_SHARED_PTR<Rcl::SearchData> sd = g_advshistory->getolder();
|
||||||
if (sd.isNull())
|
if (!sd)
|
||||||
return;
|
return;
|
||||||
fromSearch(sd);
|
fromSearch(sd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "searchclause_w.h"
|
#include "searchclause_w.h"
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "advshist.h"
|
#include "advshist.h"
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public slots:
|
||||||
virtual void restrictFtCB_toggled(bool);
|
virtual void restrictFtCB_toggled(bool);
|
||||||
virtual void restrictCtCB_toggled(bool);
|
virtual void restrictCtCB_toggled(bool);
|
||||||
virtual void runSearch();
|
virtual void runSearch();
|
||||||
virtual void fromSearch(RefCntr<Rcl::SearchData> sdata);
|
virtual void fromSearch(STD_SHARED_PTR<Rcl::SearchData> sdata);
|
||||||
virtual void browsePB_clicked();
|
virtual void browsePB_clicked();
|
||||||
virtual void saveFileTypes();
|
virtual void saveFileTypes();
|
||||||
virtual void delClause();
|
virtual void delClause();
|
||||||
|
@ -67,7 +67,7 @@ public slots:
|
||||||
virtual void slotHistoryPrev();
|
virtual void slotHistoryPrev();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startSearch(RefCntr<Rcl::SearchData>, bool);
|
void startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
|
@ -33,38 +33,38 @@ AdvSearchHist::AdvSearchHist()
|
||||||
|
|
||||||
AdvSearchHist::~AdvSearchHist()
|
AdvSearchHist::~AdvSearchHist()
|
||||||
{
|
{
|
||||||
for (vector<RefCntr<SearchData> >::iterator it = m_entries.begin();
|
for (vector<STD_SHARED_PTR<SearchData> >::iterator it = m_entries.begin();
|
||||||
it != m_entries.end(); it++) {
|
it != m_entries.end(); it++) {
|
||||||
it->release();
|
it->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> AdvSearchHist::getnewest()
|
STD_SHARED_PTR<Rcl::SearchData> AdvSearchHist::getnewest()
|
||||||
{
|
{
|
||||||
if (m_entries.empty())
|
if (m_entries.empty())
|
||||||
return RefCntr<Rcl::SearchData>();
|
return STD_SHARED_PTR<Rcl::SearchData>();
|
||||||
|
|
||||||
return m_entries[0];
|
return m_entries[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> AdvSearchHist::getolder()
|
STD_SHARED_PTR<Rcl::SearchData> AdvSearchHist::getolder()
|
||||||
{
|
{
|
||||||
m_current++;
|
m_current++;
|
||||||
if (m_current >= int(m_entries.size())) {
|
if (m_current >= int(m_entries.size())) {
|
||||||
m_current--;
|
m_current--;
|
||||||
return RefCntr<Rcl::SearchData>();
|
return STD_SHARED_PTR<Rcl::SearchData>();
|
||||||
}
|
}
|
||||||
return m_entries[m_current];
|
return m_entries[m_current];
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> AdvSearchHist::getnewer()
|
STD_SHARED_PTR<Rcl::SearchData> AdvSearchHist::getnewer()
|
||||||
{
|
{
|
||||||
if (m_current == -1 || m_current == 0 || m_entries.empty())
|
if (m_current == -1 || m_current == 0 || m_entries.empty())
|
||||||
return RefCntr<Rcl::SearchData>();
|
return STD_SHARED_PTR<Rcl::SearchData>();
|
||||||
return m_entries[--m_current];
|
return m_entries[--m_current];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdvSearchHist::push(RefCntr<SearchData> sd)
|
bool AdvSearchHist::push(STD_SHARED_PTR<SearchData> sd)
|
||||||
{
|
{
|
||||||
m_entries.insert(m_entries.begin(), sd);
|
m_entries.insert(m_entries.begin(), sd);
|
||||||
if (m_current != -1)
|
if (m_current != -1)
|
||||||
|
@ -83,7 +83,7 @@ bool AdvSearchHist::read()
|
||||||
|
|
||||||
for (list<string>::const_iterator it = lxml.begin(); it != lxml.end();
|
for (list<string>::const_iterator it = lxml.begin(); it != lxml.end();
|
||||||
it++) {
|
it++) {
|
||||||
RefCntr<SearchData> sd = xmlToSearchData(*it);
|
STD_SHARED_PTR<SearchData> sd = xmlToSearchData(*it);
|
||||||
if (sd)
|
if (sd)
|
||||||
m_entries.push_back(sd);
|
m_entries.push_back(sd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
|
|
||||||
/** Advanced search history.
|
/** Advanced search history.
|
||||||
|
@ -43,14 +43,14 @@ public:
|
||||||
~AdvSearchHist();
|
~AdvSearchHist();
|
||||||
|
|
||||||
// Add entry
|
// Add entry
|
||||||
bool push(RefCntr<Rcl::SearchData>);
|
bool push(STD_SHARED_PTR<Rcl::SearchData>);
|
||||||
|
|
||||||
// Get latest. does not change state
|
// Get latest. does not change state
|
||||||
RefCntr<Rcl::SearchData> getnewest();
|
STD_SHARED_PTR<Rcl::SearchData> getnewest();
|
||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
RefCntr<Rcl::SearchData> getolder();
|
STD_SHARED_PTR<Rcl::SearchData> getolder();
|
||||||
RefCntr<Rcl::SearchData> getnewer();
|
STD_SHARED_PTR<Rcl::SearchData> getnewer();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ private:
|
||||||
bool read();
|
bool read();
|
||||||
|
|
||||||
int m_current;
|
int m_current;
|
||||||
std::vector<RefCntr<Rcl::SearchData> > m_entries;
|
std::vector<STD_SHARED_PTR<Rcl::SearchData> > m_entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ADVSHIST_H_INCLUDED_
|
#endif // _ADVSHIST_H_INCLUDED_
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
* destroyed and recreated as a copy if Cancel is pressed (you have to
|
* destroyed and recreated as a copy if Cancel is pressed (you have to
|
||||||
* delete/recreate the widgets in this case as the links are no longer valid).
|
* delete/recreate the widgets in this case as the links are no longer valid).
|
||||||
*/
|
*/
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
@ -43,9 +45,7 @@
|
||||||
#include <qstring.h>
|
#include <qstring.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
|
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
using std::string;
|
|
||||||
|
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
@ -61,21 +61,21 @@ namespace confgui {
|
||||||
class ConfLinkRep {
|
class ConfLinkRep {
|
||||||
public:
|
public:
|
||||||
virtual ~ConfLinkRep() {}
|
virtual ~ConfLinkRep() {}
|
||||||
virtual bool set(const string& val) = 0;
|
virtual bool set(const std::string& val) = 0;
|
||||||
virtual bool get(string& val) = 0;
|
virtual bool get(std::string& val) = 0;
|
||||||
};
|
};
|
||||||
typedef RefCntr<ConfLinkRep> ConfLink;
|
typedef STD_SHARED_PTR<ConfLinkRep> ConfLink;
|
||||||
|
|
||||||
// Useful to store/manage data which has no direct representation in
|
// Useful to store/manage data which has no direct representation in
|
||||||
// the config, ie list of subkey directories
|
// the config, ie list of subkey directories
|
||||||
class ConfLinkNullRep : public ConfLinkRep {
|
class ConfLinkNullRep : public ConfLinkRep {
|
||||||
public:
|
public:
|
||||||
virtual ~ConfLinkNullRep() {}
|
virtual ~ConfLinkNullRep() {}
|
||||||
virtual bool set(const string&)
|
virtual bool set(const std::string&)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool get(string& val) {val = ""; return true;}
|
virtual bool get(std::string& val) {val = ""; return true;}
|
||||||
};
|
};
|
||||||
|
|
||||||
// A widget to let the user change one configuration
|
// A widget to let the user change one configuration
|
||||||
|
|
|
@ -70,8 +70,8 @@ void forgetTempFile(string &fn)
|
||||||
PTMutexLocker locker(thetempfileslock);
|
PTMutexLocker locker(thetempfileslock);
|
||||||
for (vector<TempFile>::iterator it = o_tempfiles.begin();
|
for (vector<TempFile>::iterator it = o_tempfiles.begin();
|
||||||
it != o_tempfiles.end(); it++) {
|
it != o_tempfiles.end(); it++) {
|
||||||
if ((*it).isNotNull() && !fn.compare((*it)->filename())) {
|
if ((*it) && !fn.compare((*it)->filename())) {
|
||||||
it->release();
|
it->reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn.erase();
|
fn.erase();
|
||||||
|
|
|
@ -1028,13 +1028,13 @@ bool Preview::loadDocInCurrentTab(const Rcl::Doc &idoc, int docnum)
|
||||||
theconfig->setKeyDir(path_getfather(fn));
|
theconfig->setKeyDir(path_getfather(fn));
|
||||||
if (fn.empty() || !idoc.ipath.empty()) {
|
if (fn.empty() || !idoc.ipath.empty()) {
|
||||||
TempFile temp = lthr.imgtmp;
|
TempFile temp = lthr.imgtmp;
|
||||||
if (temp.isNotNull()) {
|
if (temp) {
|
||||||
LOGDEB1(("Preview: load: got temp file from internfile\n"));
|
LOGDEB1(("Preview: load: got temp file from internfile\n"));
|
||||||
} else if (!FileInterner::idocToFile(temp, string(),
|
} else if (!FileInterner::idocToFile(temp, string(),
|
||||||
theconfig, idoc)) {
|
theconfig, idoc)) {
|
||||||
temp.release(); // just in case.
|
temp.reset(); // just in case.
|
||||||
}
|
}
|
||||||
if (temp.isNotNull()) {
|
if (temp) {
|
||||||
rememberTempFile(temp);
|
rememberTempFile(temp);
|
||||||
fn = temp->filename();
|
fn = temp->filename();
|
||||||
editor->m_tmpfilename = fn;
|
editor->m_tmpfilename = fn;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _PREVIEW_W_H_INCLUDED_
|
#ifndef _PREVIEW_W_H_INCLUDED_
|
||||||
#define _PREVIEW_W_H_INCLUDED_
|
#define _PREVIEW_W_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
// Always use a qtextbrowser for now, there is no compelling reason to
|
// Always use a qtextbrowser for now, there is no compelling reason to
|
||||||
// switch to webkit here
|
// switch to webkit here
|
||||||
|
@ -25,6 +26,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
|
@ -39,7 +42,6 @@
|
||||||
#include <qimage.h>
|
#include <qimage.h>
|
||||||
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "plaintorich.h"
|
#include "plaintorich.h"
|
||||||
#include "rclmain_w.h"
|
#include "rclmain_w.h"
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ void RclMain::previewPrevOrNextInTab(Preview * w, int sid, int docnum, bool nxt)
|
||||||
docnum++;
|
docnum++;
|
||||||
else
|
else
|
||||||
docnum--;
|
docnum--;
|
||||||
if (docnum < 0 || m_source.isNull() || docnum >= m_source->getResCnt()) {
|
if (docnum < 0 || !m_source || docnum >= m_source->getResCnt()) {
|
||||||
QApplication::beep();
|
QApplication::beep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ void RclMain::saveLastQuery()
|
||||||
xml = sSearch->asXML();
|
xml = sSearch->asXML();
|
||||||
} else {
|
} else {
|
||||||
if (g_advshistory) {
|
if (g_advshistory) {
|
||||||
RefCntr<Rcl::SearchData> sd;
|
STD_SHARED_PTR<Rcl::SearchData> sd;
|
||||||
sd = g_advshistory->getnewest();
|
sd = g_advshistory->getnewest();
|
||||||
if (sd) {
|
if (sd) {
|
||||||
xml = sd->asXML();
|
xml = sd->asXML();
|
||||||
|
@ -118,7 +118,7 @@ void RclMain::loadSavedQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to parse as SearchData
|
// Try to parse as SearchData
|
||||||
RefCntr<SearchData> sd = xmlToSearchData(xml);
|
STD_SHARED_PTR<SearchData> sd = xmlToSearchData(xml);
|
||||||
if (sd) {
|
if (sd) {
|
||||||
showAdvSearchDialog();
|
showAdvSearchDialog();
|
||||||
asearchform->fromSearch(sd);
|
asearchform->fromSearch(sd);
|
||||||
|
|
|
@ -64,9 +64,9 @@ void RclMain::viewUrl()
|
||||||
// StartNativeViewer needs a db source to call getEnclosing() on.
|
// StartNativeViewer needs a db source to call getEnclosing() on.
|
||||||
Rcl::Query *query = new Rcl::Query(rcldb);
|
Rcl::Query *query = new Rcl::Query(rcldb);
|
||||||
DocSequenceDb *src =
|
DocSequenceDb *src =
|
||||||
new DocSequenceDb(RefCntr<Rcl::Query>(query), "",
|
new DocSequenceDb(STD_SHARED_PTR<Rcl::Query>(query), "",
|
||||||
RefCntr<Rcl::SearchData>(new Rcl::SearchData));
|
STD_SHARED_PTR<Rcl::SearchData>(new Rcl::SearchData));
|
||||||
m_source = RefCntr<DocSequence>(src);
|
m_source = STD_SHARED_PTR<DocSequence>(src);
|
||||||
|
|
||||||
|
|
||||||
// Start a native viewer if the mimetype has one defined, else a
|
// Start a native viewer if the mimetype has one defined, else a
|
||||||
|
@ -269,7 +269,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||||
// We want the path for the parent document. For example to
|
// We want the path for the parent document. For example to
|
||||||
// open the chm file, not the internal page. Note that we just
|
// open the chm file, not the internal page. Note that we just
|
||||||
// override the other file name in this case.
|
// override the other file name in this case.
|
||||||
if (m_source.isNull() || !m_source->getEnclosing(doc, pdoc)) {
|
if (!m_source || !m_source->getEnclosing(doc, pdoc)) {
|
||||||
QMessageBox::warning(0, "Recoll",
|
QMessageBox::warning(0, "Recoll",
|
||||||
tr("Cannot find parent document"));
|
tr("Cannot find parent document"));
|
||||||
return;
|
return;
|
||||||
|
@ -330,7 +330,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!temp.isNull()) {
|
if (temp) {
|
||||||
rememberTempFile(temp);
|
rememberTempFile(temp);
|
||||||
fn = temp->filename();
|
fn = temp->filename();
|
||||||
url = string("file://") + fn;
|
url = string("file://") + fn;
|
||||||
|
@ -342,7 +342,7 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||||
if (pagenum == -1) {
|
if (pagenum == -1) {
|
||||||
pagenum = 1;
|
pagenum = 1;
|
||||||
string lterm;
|
string lterm;
|
||||||
if (m_source.isNotNull())
|
if (m_source)
|
||||||
pagenum = m_source->getFirstMatchPage(doc, lterm);
|
pagenum = m_source->getFirstMatchPage(doc, lterm);
|
||||||
if (pagenum == -1)
|
if (pagenum == -1)
|
||||||
pagenum = 1;
|
pagenum = 1;
|
||||||
|
|
|
@ -47,8 +47,8 @@ void RclMain::showAdvSearchDialog()
|
||||||
this, SLOT (fileExit()));
|
this, SLOT (fileExit()));
|
||||||
|
|
||||||
connect(asearchform,
|
connect(asearchform,
|
||||||
SIGNAL(startSearch(RefCntr<Rcl::SearchData>, bool)),
|
SIGNAL(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)),
|
||||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>, bool)));
|
this, SLOT(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)));
|
||||||
asearchform->show();
|
asearchform->show();
|
||||||
} else {
|
} else {
|
||||||
// Close and reopen, in hope that makes us visible...
|
// Close and reopen, in hope that makes us visible...
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include "uiprefs_w.h"
|
#include "uiprefs_w.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "reslist.h"
|
#include "reslist.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "ssearch_w.h"
|
#include "ssearch_w.h"
|
||||||
#include "internfile.h"
|
#include "internfile.h"
|
||||||
#include "docseqdb.h"
|
#include "docseqdb.h"
|
||||||
|
@ -285,8 +285,8 @@ void RclMain::init()
|
||||||
|
|
||||||
connect(&m_watcher, SIGNAL(fileChanged(QString)),
|
connect(&m_watcher, SIGNAL(fileChanged(QString)),
|
||||||
this, SLOT(idxStatus()));
|
this, SLOT(idxStatus()));
|
||||||
connect(sSearch, SIGNAL(startSearch(RefCntr<Rcl::SearchData>, bool)),
|
connect(sSearch, SIGNAL(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)),
|
||||||
this, SLOT(startSearch(RefCntr<Rcl::SearchData>, bool)));
|
this, SLOT(startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool)));
|
||||||
connect(sSearch, SIGNAL(clearSearch()),
|
connect(sSearch, SIGNAL(clearSearch()),
|
||||||
this, SLOT(resetSearch()));
|
this, SLOT(resetSearch()));
|
||||||
|
|
||||||
|
@ -344,8 +344,8 @@ void RclMain::init()
|
||||||
restable->setRclMain(this, true);
|
restable->setRclMain(this, true);
|
||||||
connect(actionSaveResultsAsCSV, SIGNAL(triggered()),
|
connect(actionSaveResultsAsCSV, SIGNAL(triggered()),
|
||||||
restable, SLOT(saveAsCSV()));
|
restable, SLOT(saveAsCSV()));
|
||||||
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
|
connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
|
||||||
restable, SLOT(setDocSource(RefCntr<DocSequence>)));
|
restable, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));
|
||||||
connect(this, SIGNAL(searchReset()),
|
connect(this, SIGNAL(searchReset()),
|
||||||
restable, SLOT(resetSource()));
|
restable, SLOT(resetSource()));
|
||||||
connect(this, SIGNAL(resultsReady()),
|
connect(this, SIGNAL(resultsReady()),
|
||||||
|
@ -374,8 +374,8 @@ void RclMain::init()
|
||||||
this, SLOT(showSnippets(Rcl::Doc)));
|
this, SLOT(showSnippets(Rcl::Doc)));
|
||||||
|
|
||||||
reslist->setRclMain(this, true);
|
reslist->setRclMain(this, true);
|
||||||
connect(this, SIGNAL(docSourceChanged(RefCntr<DocSequence>)),
|
connect(this, SIGNAL(docSourceChanged(STD_SHARED_PTR<DocSequence>)),
|
||||||
reslist, SLOT(setDocSource(RefCntr<DocSequence>)));
|
reslist, SLOT(setDocSource(STD_SHARED_PTR<DocSequence>)));
|
||||||
connect(firstPageAction, SIGNAL(triggered()),
|
connect(firstPageAction, SIGNAL(triggered()),
|
||||||
reslist, SLOT(resultPageFirst()));
|
reslist, SLOT(resultPageFirst()));
|
||||||
connect(prevPageAction, SIGNAL(triggered()),
|
connect(prevPageAction, SIGNAL(triggered()),
|
||||||
|
@ -636,7 +636,7 @@ void RclMain::fileExit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a db query and set the reslist docsource
|
// Start a db query and set the reslist docsource
|
||||||
void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata, bool issimple)
|
void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::startSearch. Indexing %s Active %d\n",
|
LOGDEB(("RclMain::startSearch. Indexing %s Active %d\n",
|
||||||
m_idxproc?"on":"off", m_queryActive));
|
m_idxproc?"on":"off", m_queryActive));
|
||||||
|
@ -646,7 +646,7 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata, bool issimple)
|
||||||
}
|
}
|
||||||
m_queryActive = true;
|
m_queryActive = true;
|
||||||
restable->setEnabled(false);
|
restable->setEnabled(false);
|
||||||
m_source = RefCntr<DocSequence>();
|
m_source = STD_SHARED_PTR<DocSequence>();
|
||||||
|
|
||||||
m_searchIsSimple = issimple;
|
m_searchIsSimple = issimple;
|
||||||
|
|
||||||
|
@ -665,11 +665,11 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata, bool issimple)
|
||||||
|
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
DocSequenceDb *src =
|
DocSequenceDb *src =
|
||||||
new DocSequenceDb(RefCntr<Rcl::Query>(query),
|
new DocSequenceDb(STD_SHARED_PTR<Rcl::Query>(query),
|
||||||
string(tr("Query results").toUtf8()), sdata);
|
string(tr("Query results").toUtf8()), sdata);
|
||||||
src->setAbstractParams(prefs.queryBuildAbstract,
|
src->setAbstractParams(prefs.queryBuildAbstract,
|
||||||
prefs.queryReplaceAbstract);
|
prefs.queryReplaceAbstract);
|
||||||
m_source = RefCntr<DocSequence>(src);
|
m_source = STD_SHARED_PTR<DocSequence>(src);
|
||||||
m_source->setSortSpec(m_sortspec);
|
m_source->setSortSpec(m_sortspec);
|
||||||
m_source->setFiltSpec(m_filtspec);
|
m_source->setFiltSpec(m_filtspec);
|
||||||
|
|
||||||
|
@ -680,9 +680,9 @@ void RclMain::startSearch(RefCntr<Rcl::SearchData> sdata, bool issimple)
|
||||||
|
|
||||||
class QueryThread : public QThread {
|
class QueryThread : public QThread {
|
||||||
int loglevel;
|
int loglevel;
|
||||||
RefCntr<DocSequence> m_source;
|
STD_SHARED_PTR<DocSequence> m_source;
|
||||||
public:
|
public:
|
||||||
QueryThread(RefCntr<DocSequence> source)
|
QueryThread(STD_SHARED_PTR<DocSequence> source)
|
||||||
: m_source(source)
|
: m_source(source)
|
||||||
{
|
{
|
||||||
loglevel = DebugLog::getdbl()->getlevel();
|
loglevel = DebugLog::getdbl()->getlevel();
|
||||||
|
@ -698,7 +698,7 @@ class QueryThread : public QThread {
|
||||||
|
|
||||||
void RclMain::initiateQuery()
|
void RclMain::initiateQuery()
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
|
@ -778,7 +778,7 @@ void RclMain::onSortCtlChanged()
|
||||||
prefs.sortActive = prefs.sortDesc = false;
|
prefs.sortActive = prefs.sortDesc = false;
|
||||||
prefs.sortField = "";
|
prefs.sortField = "";
|
||||||
}
|
}
|
||||||
if (m_source.isNotNull())
|
if (m_source)
|
||||||
m_source->setSortSpec(m_sortspec);
|
m_source->setSortSpec(m_sortspec);
|
||||||
emit sortDataChanged(m_sortspec);
|
emit sortDataChanged(m_sortspec);
|
||||||
initiateQuery();
|
initiateQuery();
|
||||||
|
@ -796,7 +796,7 @@ void RclMain::onSortDataChanged(DocSeqSortSpec spec)
|
||||||
actionSortByDateAsc->setChecked(!spec.desc);
|
actionSortByDateAsc->setChecked(!spec.desc);
|
||||||
}
|
}
|
||||||
m_sortspecnochange = false;
|
m_sortspecnochange = false;
|
||||||
if (m_source.isNotNull())
|
if (m_source)
|
||||||
m_source->setSortSpec(spec);
|
m_source->setSortSpec(spec);
|
||||||
m_sortspec = spec;
|
m_sortspec = spec;
|
||||||
|
|
||||||
|
@ -896,8 +896,8 @@ void RclMain::showSubDocs(Rcl::Doc doc)
|
||||||
new DocSequenceDocs(rcldb, docs,
|
new DocSequenceDocs(rcldb, docs,
|
||||||
qs2utf8s(tr("Sub-documents and attachments")));
|
qs2utf8s(tr("Sub-documents and attachments")));
|
||||||
src->setDescription(qs2utf8s(tr("Sub-documents and attachments")));
|
src->setDescription(qs2utf8s(tr("Sub-documents and attachments")));
|
||||||
RefCntr<DocSequence>
|
STD_SHARED_PTR<DocSequence>
|
||||||
source(new DocSource(theconfig, RefCntr<DocSequence>(src)));
|
source(new DocSource(theconfig, STD_SHARED_PTR<DocSequence>(src)));
|
||||||
|
|
||||||
ResTable *res = new ResTable();
|
ResTable *res = new ResTable();
|
||||||
res->setRclMain(this, false);
|
res->setRclMain(this, false);
|
||||||
|
@ -938,7 +938,7 @@ void RclMain::showDocHistory()
|
||||||
{
|
{
|
||||||
LOGDEB(("RclMain::showDocHistory\n"));
|
LOGDEB(("RclMain::showDocHistory\n"));
|
||||||
emit searchReset();
|
emit searchReset();
|
||||||
m_source = RefCntr<DocSequence>();
|
m_source = STD_SHARED_PTR<DocSequence>();
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
|
@ -947,8 +947,8 @@ void RclMain::showDocHistory()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Construct a bogus SearchData structure
|
// Construct a bogus SearchData structure
|
||||||
RefCntr<Rcl::SearchData>searchdata =
|
STD_SHARED_PTR<Rcl::SearchData>searchdata =
|
||||||
RefCntr<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND, cstr_null));
|
STD_SHARED_PTR<Rcl::SearchData>(new Rcl::SearchData(Rcl::SCLT_AND, cstr_null));
|
||||||
searchdata->setDescription((const char *)tr("History data").toUtf8());
|
searchdata->setDescription((const char *)tr("History data").toUtf8());
|
||||||
|
|
||||||
|
|
||||||
|
@ -957,8 +957,8 @@ void RclMain::showDocHistory()
|
||||||
new DocSequenceHistory(rcldb, g_dynconf,
|
new DocSequenceHistory(rcldb, g_dynconf,
|
||||||
string(tr("Document history").toUtf8()));
|
string(tr("Document history").toUtf8()));
|
||||||
src->setDescription((const char *)tr("History data").toUtf8());
|
src->setDescription((const char *)tr("History data").toUtf8());
|
||||||
DocSource *source = new DocSource(theconfig, RefCntr<DocSequence>(src));
|
DocSource *source = new DocSource(theconfig, STD_SHARED_PTR<DocSequence>(src));
|
||||||
m_source = RefCntr<DocSequence>(source);
|
m_source = STD_SHARED_PTR<DocSequence>(source);
|
||||||
m_source->setSortSpec(m_sortspec);
|
m_source->setSortSpec(m_sortspec);
|
||||||
m_source->setFiltSpec(m_filtspec);
|
m_source->setFiltSpec(m_filtspec);
|
||||||
emit docSourceChanged(m_source);
|
emit docSourceChanged(m_source);
|
||||||
|
@ -1013,7 +1013,7 @@ void RclMain::enablePrevPage(bool yesno)
|
||||||
|
|
||||||
QString RclMain::getQueryDescription()
|
QString RclMain::getQueryDescription()
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return "";
|
return "";
|
||||||
return QString::fromUtf8(m_source->getDescription().c_str());
|
return QString::fromUtf8(m_source->getDescription().c_str());
|
||||||
}
|
}
|
||||||
|
@ -1073,7 +1073,7 @@ void RclMain::setFiltSpec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_source.isNotNull())
|
if (m_source)
|
||||||
m_source->setFiltSpec(m_filtspec);
|
m_source->setFiltSpec(m_filtspec);
|
||||||
initiateQuery();
|
initiateQuery();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "spell_w.h"
|
#include "spell_w.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public slots:
|
||||||
virtual void periodic100();
|
virtual void periodic100();
|
||||||
virtual void toggleIndexing();
|
virtual void toggleIndexing();
|
||||||
virtual void rebuildIndex();
|
virtual void rebuildIndex();
|
||||||
virtual void startSearch(RefCntr<Rcl::SearchData> sdata, bool issimple);
|
virtual void startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple);
|
||||||
virtual void previewClosed(Preview *w);
|
virtual void previewClosed(Preview *w);
|
||||||
virtual void showAdvSearchDialog();
|
virtual void showAdvSearchDialog();
|
||||||
virtual void showSpellDialog();
|
virtual void showSpellDialog();
|
||||||
|
@ -172,7 +172,7 @@ public slots:
|
||||||
virtual void showTrayMessage(const QString& text);
|
virtual void showTrayMessage(const QString& text);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void docSourceChanged(RefCntr<DocSequence>);
|
void docSourceChanged(STD_SHARED_PTR<DocSequence>);
|
||||||
void stemLangChanged(const QString& lang);
|
void stemLangChanged(const QString& lang);
|
||||||
void sortDataChanged(DocSeqSortSpec);
|
void sortDataChanged(DocSeqSortSpec);
|
||||||
void resultsReady();
|
void resultsReady();
|
||||||
|
@ -212,7 +212,7 @@ private:
|
||||||
DocSeqFiltSpec m_filtspec;
|
DocSeqFiltSpec m_filtspec;
|
||||||
bool m_sortspecnochange;
|
bool m_sortspecnochange;
|
||||||
DocSeqSortSpec m_sortspec;
|
DocSeqSortSpec m_sortspec;
|
||||||
RefCntr<DocSequence> m_source;
|
STD_SHARED_PTR<DocSequence> m_source;
|
||||||
IndexerState m_indexerState;
|
IndexerState m_indexerState;
|
||||||
bool m_queryActive;
|
bool m_queryActive;
|
||||||
bool m_firstIndexing;
|
bool m_firstIndexing;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
#include "mimehandler.h"
|
#include "mimehandler.h"
|
||||||
#include "plaintorich.h"
|
#include "plaintorich.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "internfile.h"
|
#include "internfile.h"
|
||||||
#include "indexer.h"
|
#include "indexer.h"
|
||||||
#include "snippets_w.h"
|
#include "snippets_w.h"
|
||||||
|
@ -423,10 +423,10 @@ int ResList::newListId()
|
||||||
|
|
||||||
extern "C" int XFlush(void *);
|
extern "C" int XFlush(void *);
|
||||||
|
|
||||||
void ResList::setDocSource(RefCntr<DocSequence> nsource)
|
void ResList::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
|
||||||
{
|
{
|
||||||
LOGDEB(("ResList::setDocSource()\n"));
|
LOGDEB(("ResList::setDocSource()\n"));
|
||||||
m_source = RefCntr<DocSequence>(new DocSource(theconfig, nsource));
|
m_source = STD_SHARED_PTR<DocSequence>(new DocSource(theconfig, nsource));
|
||||||
}
|
}
|
||||||
|
|
||||||
// A query was executed, or the filtering/sorting parameters changed,
|
// A query was executed, or the filtering/sorting parameters changed,
|
||||||
|
@ -435,7 +435,7 @@ void ResList::readDocSource()
|
||||||
{
|
{
|
||||||
LOGDEB(("ResList::readDocSource()\n"));
|
LOGDEB(("ResList::readDocSource()\n"));
|
||||||
resetView();
|
resetView();
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
m_listId = newListId();
|
m_listId = newListId();
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ void ResList::readDocSource()
|
||||||
void ResList::resetList()
|
void ResList::resetList()
|
||||||
{
|
{
|
||||||
LOGDEB(("ResList::resetList()\n"));
|
LOGDEB(("ResList::resetList()\n"));
|
||||||
setDocSource(RefCntr<DocSequence>());
|
setDocSource(STD_SHARED_PTR<DocSequence>());
|
||||||
resetView();
|
resetView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ bool ResList::displayingHistory()
|
||||||
// We want to reset the displayed history if it is currently
|
// We want to reset the displayed history if it is currently
|
||||||
// shown. Using the title value is an ugly hack
|
// shown. Using the title value is an ugly hack
|
||||||
string htstring = string((const char *)tr("Document history").toUtf8());
|
string htstring = string((const char *)tr("Document history").toUtf8());
|
||||||
if (m_source.isNull() || m_source->title().empty())
|
if (!m_source || m_source->title().empty())
|
||||||
return false;
|
return false;
|
||||||
return m_source->title().find(htstring) == 0;
|
return m_source->title().find(htstring) == 0;
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ void ResList::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
|
|
||||||
void ResList::showQueryDetails()
|
void ResList::showQueryDetails()
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
string oq = breakIntoLines(m_source->getDescription(), 100, 50);
|
string oq = breakIntoLines(m_source->getDescription(), 100, 50);
|
||||||
QString str;
|
QString str;
|
||||||
|
@ -871,7 +871,7 @@ void ResList::linkWasClicked(const QUrl &url)
|
||||||
// Open abstract/snippets window
|
// Open abstract/snippets window
|
||||||
case 'A':
|
case 'A':
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
int i = atoi(ascurl.c_str()+1) - 1;
|
int i = atoi(ascurl.c_str()+1) - 1;
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
|
@ -886,7 +886,7 @@ void ResList::linkWasClicked(const QUrl &url)
|
||||||
// Show duplicates
|
// Show duplicates
|
||||||
case 'D':
|
case 'D':
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
int i = atoi(ascurl.c_str()+1) - 1;
|
int i = atoi(ascurl.c_str()+1) - 1;
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
|
@ -910,7 +910,7 @@ void ResList::linkWasClicked(const QUrl &url)
|
||||||
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
|
LOGERR(("ResList::linkWasClicked: can't get doc for %d\n", i));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit editRequested(ResultPopup::getParent(RefCntr<DocSequence>(),
|
emit editRequested(ResultPopup::getParent(STD_SHARED_PTR<DocSequence>(),
|
||||||
doc));
|
doc));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1050,7 +1050,7 @@ void ResList::menuSaveToFile()
|
||||||
void ResList::menuPreviewParent()
|
void ResList::menuPreviewParent()
|
||||||
{
|
{
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (getDoc(m_popDoc, doc) && !m_source.isNull()) {
|
if (getDoc(m_popDoc, doc) && m_source) {
|
||||||
Rcl::Doc pdoc = ResultPopup::getParent(m_source, doc);
|
Rcl::Doc pdoc = ResultPopup::getParent(m_source, doc);
|
||||||
if (pdoc.mimetype == "inode/directory") {
|
if (pdoc.mimetype == "inode/directory") {
|
||||||
emit editRequested(pdoc);
|
emit editRequested(pdoc);
|
||||||
|
@ -1063,7 +1063,7 @@ void ResList::menuPreviewParent()
|
||||||
void ResList::menuOpenParent()
|
void ResList::menuOpenParent()
|
||||||
{
|
{
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (getDoc(m_popDoc, doc) && m_source.isNotNull())
|
if (getDoc(m_popDoc, doc) && m_source)
|
||||||
emit editRequested(ResultPopup::getParent(m_source, doc));
|
emit editRequested(ResultPopup::getParent(m_source, doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ using std::pair;
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "sortseq.h"
|
#include "sortseq.h"
|
||||||
#include "filtseq.h"
|
#include "filtseq.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "rcldoc.h"
|
#include "rcldoc.h"
|
||||||
#include "reslistpager.h"
|
#include "reslistpager.h"
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||||
void setRclMain(RclMain *m, bool ismain);
|
void setRclMain(RclMain *m, bool ismain);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
virtual void setDocSource(STD_SHARED_PTR<DocSequence> nsource);
|
||||||
virtual void resetList(); // Erase current list
|
virtual void resetList(); // Erase current list
|
||||||
virtual void resPageUpOrBack(); // Page up pressed
|
virtual void resPageUpOrBack(); // Page up pressed
|
||||||
virtual void resPageDownOrNext(); // Page down pressed
|
virtual void resPageDownOrNext(); // Page down pressed
|
||||||
|
@ -122,7 +122,7 @@ class ResList : public RESLIST_PARENTCLASS
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtGuiResListPager *m_pager;
|
QtGuiResListPager *m_pager;
|
||||||
RefCntr<DocSequence> m_source;
|
STD_SHARED_PTR<DocSequence> m_source;
|
||||||
int m_popDoc; // Docnum for the popup menu.
|
int m_popDoc; // Docnum for the popup menu.
|
||||||
int m_curPvDoc;// Docnum for current preview
|
int m_curPvDoc;// Docnum for current preview
|
||||||
int m_lstClckMod; // Last click modifier.
|
int m_lstClckMod; // Last click modifier.
|
||||||
|
|
|
@ -29,15 +29,14 @@
|
||||||
|
|
||||||
namespace ResultPopup {
|
namespace ResultPopup {
|
||||||
|
|
||||||
QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
QMenu *create(QWidget *me, int opts, STD_SHARED_PTR<DocSequence> source, Rcl::Doc& doc)
|
||||||
{
|
{
|
||||||
QMenu *popup = new QMenu(me);
|
QMenu *popup = new QMenu(me);
|
||||||
|
|
||||||
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
|
LOGDEB(("ResultPopup::create: opts %x haspages %d %s %s\n", opts,
|
||||||
doc.haspages, source.isNull() ?
|
doc.haspages, source ? "Source not null" : "Source is Null",
|
||||||
"Source is Null" : "Source not null",
|
source ? (source->snippetsCapable() ?
|
||||||
source.isNull() ? "" : source->snippetsCapable() ?
|
"snippetsCapable" : "not snippetsCapable") : ""));
|
||||||
"snippetsCapable" : "not snippetsCapable"));
|
|
||||||
|
|
||||||
string apptag;
|
string apptag;
|
||||||
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
doc.getmeta(Rcl::Doc::keyapptg, &apptag);
|
||||||
|
@ -112,7 +111,7 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
||||||
me, SLOT(menuSaveSelection()));
|
me, SLOT(menuSaveSelection()));
|
||||||
|
|
||||||
Rcl::Doc pdoc;
|
Rcl::Doc pdoc;
|
||||||
if (source.isNotNull() && source->getEnclosing(doc, pdoc)) {
|
if (source && source->getEnclosing(doc, pdoc)) {
|
||||||
popup->addAction(QWidget::tr("Preview P&arent document/folder"),
|
popup->addAction(QWidget::tr("Preview P&arent document/folder"),
|
||||||
me, SLOT(menuPreviewParent()));
|
me, SLOT(menuPreviewParent()));
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,7 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
||||||
popup->addAction(QWidget::tr("Find &similar documents"),
|
popup->addAction(QWidget::tr("Find &similar documents"),
|
||||||
me, SLOT(menuExpand()));
|
me, SLOT(menuExpand()));
|
||||||
|
|
||||||
if (doc.haspages && source.isNotNull() && source->snippetsCapable())
|
if (doc.haspages && source && source->snippetsCapable())
|
||||||
popup->addAction(QWidget::tr("Open &Snippets window"),
|
popup->addAction(QWidget::tr("Open &Snippets window"),
|
||||||
me, SLOT(menuShowSnippets()));
|
me, SLOT(menuShowSnippets()));
|
||||||
|
|
||||||
|
@ -137,10 +136,10 @@ QMenu *create(QWidget *me, int opts, RefCntr<DocSequence> source, Rcl::Doc& doc)
|
||||||
return popup;
|
return popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rcl::Doc getParent(RefCntr<DocSequence> source, Rcl::Doc& doc)
|
Rcl::Doc getParent(STD_SHARED_PTR<DocSequence> source, Rcl::Doc& doc)
|
||||||
{
|
{
|
||||||
Rcl::Doc pdoc;
|
Rcl::Doc pdoc;
|
||||||
if (source.isNull() || !source->getEnclosing(doc, pdoc)) {
|
if (!source || !source->getEnclosing(doc, pdoc)) {
|
||||||
// No parent doc: show enclosing folder with app configured for
|
// No parent doc: show enclosing folder with app configured for
|
||||||
// directories
|
// directories
|
||||||
pdoc.url = url_parentfolder(doc.url);
|
pdoc.url = url_parentfolder(doc.url);
|
||||||
|
|
|
@ -21,9 +21,9 @@ namespace ResultPopup {
|
||||||
enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3,
|
enum Options {showExpand = 0x1, showSubs = 0x2, isMain = 0x3,
|
||||||
showSaveOne = 0x4, showSaveSel = 0x8};
|
showSaveOne = 0x4, showSaveSel = 0x8};
|
||||||
extern QMenu *create(QWidget *me, int opts,
|
extern QMenu *create(QWidget *me, int opts,
|
||||||
RefCntr<DocSequence> source,
|
STD_SHARED_PTR<DocSequence> source,
|
||||||
Rcl::Doc& doc);
|
Rcl::Doc& doc);
|
||||||
extern Rcl::Doc getParent(RefCntr<DocSequence> source,
|
extern Rcl::Doc getParent(STD_SHARED_PTR<DocSequence> source,
|
||||||
Rcl::Doc& doc);
|
Rcl::Doc& doc);
|
||||||
extern void copyFN(const Rcl::Doc &doc);
|
extern void copyFN(const Rcl::Doc &doc);
|
||||||
extern void copyURL(const Rcl::Doc &doc);
|
extern void copyURL(const Rcl::Doc &doc);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "restable.h"
|
#include "restable.h"
|
||||||
|
@ -272,7 +272,7 @@ RecollModel::RecollModel(const QStringList fields, QObject *parent)
|
||||||
int RecollModel::rowCount(const QModelIndex&) const
|
int RecollModel::rowCount(const QModelIndex&) const
|
||||||
{
|
{
|
||||||
LOGDEB2(("RecollModel::rowCount\n"));
|
LOGDEB2(("RecollModel::rowCount\n"));
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return 0;
|
return 0;
|
||||||
return m_source->getResCnt();
|
return m_source->getResCnt();
|
||||||
}
|
}
|
||||||
|
@ -290,13 +290,13 @@ void RecollModel::readDocSource()
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecollModel::setDocSource(RefCntr<DocSequence> nsource)
|
void RecollModel::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
|
||||||
{
|
{
|
||||||
LOGDEB(("RecollModel::setDocSource\n"));
|
LOGDEB(("RecollModel::setDocSource\n"));
|
||||||
if (nsource.isNull()) {
|
if (!nsource) {
|
||||||
m_source = RefCntr<DocSequence>();
|
m_source = STD_SHARED_PTR<DocSequence>();
|
||||||
} else {
|
} else {
|
||||||
m_source = RefCntr<DocSequence>(new DocSource(theconfig, nsource));
|
m_source = STD_SHARED_PTR<DocSequence>(new DocSource(theconfig, nsource));
|
||||||
m_hdata.clear();
|
m_hdata.clear();
|
||||||
m_source->getTerms(m_hdata);
|
m_source->getTerms(m_hdata);
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ QVariant RecollModel::data(const QModelIndex& index, int role) const
|
||||||
{
|
{
|
||||||
LOGDEB2(("RecollModel::data: row %d col %d role %d\n", index.row(),
|
LOGDEB2(("RecollModel::data: row %d col %d role %d\n", index.row(),
|
||||||
index.column(), role));
|
index.column(), role));
|
||||||
if (m_source.isNull() || role != Qt::DisplayRole || !index.isValid() ||
|
if (!m_source || role != Qt::DisplayRole || !index.isValid() ||
|
||||||
index.column() >= int(m_fields.size())) {
|
index.column() >= int(m_fields.size())) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ QVariant RecollModel::data(const QModelIndex& index, int role) const
|
||||||
|
|
||||||
void RecollModel::saveAsCSV(FILE *fp)
|
void RecollModel::saveAsCSV(FILE *fp)
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int cols = columnCount();
|
int cols = columnCount();
|
||||||
|
@ -637,7 +637,7 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
|
||||||
LOGDEB2(("ResTable::onTableView_currentChanged(%d, %d)\n",
|
LOGDEB2(("ResTable::onTableView_currentChanged(%d, %d)\n",
|
||||||
index.row(), index.column()));
|
index.row(), index.column()));
|
||||||
|
|
||||||
if (!m_model || m_model->getDocSource().isNull())
|
if (!m_model || !m_model->getDocSource())
|
||||||
return;
|
return;
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
||||||
|
@ -665,7 +665,7 @@ void ResTable::takeFocus()
|
||||||
tableView->setFocus(Qt::ShortcutFocusReason);
|
tableView->setFocus(Qt::ShortcutFocusReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResTable::setDocSource(RefCntr<DocSequence> nsource)
|
void ResTable::setDocSource(STD_SHARED_PTR<DocSequence> nsource)
|
||||||
{
|
{
|
||||||
LOGDEB(("ResTable::setDocSource\n"));
|
LOGDEB(("ResTable::setDocSource\n"));
|
||||||
if (m_model)
|
if (m_model)
|
||||||
|
@ -680,7 +680,7 @@ void ResTable::setDocSource(RefCntr<DocSequence> nsource)
|
||||||
void ResTable::resetSource()
|
void ResTable::resetSource()
|
||||||
{
|
{
|
||||||
LOGDEB(("ResTable::resetSource\n"));
|
LOGDEB(("ResTable::resetSource\n"));
|
||||||
setDocSource(RefCntr<DocSequence>());
|
setDocSource(STD_SHARED_PTR<DocSequence>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResTable::saveAsCSV()
|
void ResTable::saveAsCSV()
|
||||||
|
@ -782,7 +782,7 @@ void ResTable::linkWasClicked(const QUrl &url)
|
||||||
// Open parent folder
|
// Open parent folder
|
||||||
case 'F':
|
case 'F':
|
||||||
{
|
{
|
||||||
emit editRequested(ResultPopup::getParent(RefCntr<DocSequence>(),
|
emit editRequested(ResultPopup::getParent(STD_SHARED_PTR<DocSequence>(),
|
||||||
m_detaildoc));
|
m_detaildoc));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -823,7 +823,7 @@ void ResTable::linkWasClicked(const QUrl &url)
|
||||||
|
|
||||||
void ResTable::onDoubleClick(const QModelIndex& index)
|
void ResTable::onDoubleClick(const QModelIndex& index)
|
||||||
{
|
{
|
||||||
if (!m_model || m_model->getDocSource().isNull())
|
if (!m_model || !m_model->getDocSource())
|
||||||
return;
|
return;
|
||||||
Rcl::Doc doc;
|
Rcl::Doc doc;
|
||||||
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
if (m_model->getDocSource()->getDoc(index.row(), doc)) {
|
||||||
|
@ -877,7 +877,7 @@ void ResTable::menuSaveToFile()
|
||||||
|
|
||||||
void ResTable::menuSaveSelection()
|
void ResTable::menuSaveSelection()
|
||||||
{
|
{
|
||||||
if (m_model == 0 || m_model->getDocSource().isNull())
|
if (m_model == 0 || !m_model->getDocSource())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QModelIndexList indexl = tableView->selectionModel()->selectedRows();
|
QModelIndexList indexl = tableView->selectionModel()->selectedRows();
|
||||||
|
@ -899,7 +899,7 @@ void ResTable::menuSaveSelection()
|
||||||
void ResTable::menuPreviewParent()
|
void ResTable::menuPreviewParent()
|
||||||
{
|
{
|
||||||
if (m_detaildocnum >= 0 && m_model &&
|
if (m_detaildocnum >= 0 && m_model &&
|
||||||
m_model->getDocSource().isNotNull()) {
|
m_model->getDocSource()) {
|
||||||
Rcl::Doc pdoc = ResultPopup::getParent(m_model->getDocSource(),
|
Rcl::Doc pdoc = ResultPopup::getParent(m_model->getDocSource(),
|
||||||
m_detaildoc);
|
m_detaildoc);
|
||||||
if (pdoc.mimetype == "inode/directory") {
|
if (pdoc.mimetype == "inode/directory") {
|
||||||
|
@ -912,7 +912,7 @@ void ResTable::menuPreviewParent()
|
||||||
|
|
||||||
void ResTable::menuOpenParent()
|
void ResTable::menuOpenParent()
|
||||||
{
|
{
|
||||||
if (m_detaildocnum >= 0 && m_model && m_model->getDocSource().isNotNull())
|
if (m_detaildocnum >= 0 && m_model && m_model->getDocSource())
|
||||||
emit editRequested(
|
emit editRequested(
|
||||||
ResultPopup::getParent(m_model->getDocSource(), m_detaildoc));
|
ResultPopup::getParent(m_model->getDocSource(), m_detaildoc));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,16 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _RESTABLE_H_INCLUDED_
|
#ifndef _RESTABLE_H_INCLUDED_
|
||||||
#define _RESTABLE_H_INCLUDED_
|
#define _RESTABLE_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "ui_restable.h"
|
#include "ui_restable.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "plaintorich.h"
|
#include "plaintorich.h"
|
||||||
|
|
||||||
|
@ -50,8 +51,8 @@ public:
|
||||||
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||||
// Specific methods
|
// Specific methods
|
||||||
virtual void readDocSource();
|
virtual void readDocSource();
|
||||||
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
virtual void setDocSource(STD_SHARED_PTR<DocSequence> nsource);
|
||||||
virtual RefCntr<DocSequence> getDocSource() {return m_source;}
|
virtual STD_SHARED_PTR<DocSequence> getDocSource() {return m_source;}
|
||||||
virtual void deleteColumn(int);
|
virtual void deleteColumn(int);
|
||||||
virtual const std::vector<std::string>& getFields() {return m_fields;}
|
virtual const std::vector<std::string>& getFields() {return m_fields;}
|
||||||
virtual const std::map<std::string, QString>& getAllFields()
|
virtual const std::map<std::string, QString>& getAllFields()
|
||||||
|
@ -72,7 +73,7 @@ signals:
|
||||||
void sortDataChanged(DocSeqSortSpec);
|
void sortDataChanged(DocSeqSortSpec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable RefCntr<DocSequence> m_source;
|
mutable STD_SHARED_PTR<DocSequence> m_source;
|
||||||
std::vector<std::string> m_fields;
|
std::vector<std::string> m_fields;
|
||||||
std::vector<FieldGetter*> m_getters;
|
std::vector<FieldGetter*> m_getters;
|
||||||
static std::map<std::string, QString> o_displayableFields;
|
static std::map<std::string, QString> o_displayableFields;
|
||||||
|
@ -126,7 +127,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void onTableView_currentChanged(const QModelIndex&);
|
virtual void onTableView_currentChanged(const QModelIndex&);
|
||||||
virtual void on_tableView_entered(const QModelIndex& index);
|
virtual void on_tableView_entered(const QModelIndex& index);
|
||||||
virtual void setDocSource(RefCntr<DocSequence> nsource);
|
virtual void setDocSource(STD_SHARED_PTR<DocSequence> nsource);
|
||||||
virtual void saveColState();
|
virtual void saveColState();
|
||||||
virtual void resetSource();
|
virtual void resetSource();
|
||||||
virtual void readDocSource(bool resetPos = true);
|
virtual void readDocSource(bool resetPos = true);
|
||||||
|
|
|
@ -65,7 +65,7 @@ static PlainToRichQtSnippets g_hiliter;
|
||||||
|
|
||||||
void SnippetsW::init()
|
void SnippetsW::init()
|
||||||
{
|
{
|
||||||
if (m_source.isNull())
|
if (!m_source)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPushButton *searchButton = new QPushButton(tr("Search"));
|
QPushButton *searchButton = new QPushButton(tr("Search"));
|
||||||
|
|
|
@ -16,10 +16,14 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _SNIPPETS_W_H_INCLUDED_
|
#ifndef _SNIPPETS_W_H_INCLUDED_
|
||||||
#define _SNIPPETS_W_H_INCLUDED_
|
#define _SNIPPETS_W_H_INCLUDED_
|
||||||
|
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "rcldoc.h"
|
#include "rcldoc.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "rclmain_w.h"
|
#include "rclmain_w.h"
|
||||||
|
|
||||||
|
@ -29,7 +33,7 @@ class SnippetsW : public QWidget, public Ui::Snippets
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SnippetsW(Rcl::Doc doc, RefCntr<DocSequence> source, QWidget* parent = 0)
|
SnippetsW(Rcl::Doc doc, STD_SHARED_PTR<DocSequence> source, QWidget* parent = 0)
|
||||||
: QWidget(parent), m_doc(doc), m_source(source)
|
: QWidget(parent), m_doc(doc), m_source(source)
|
||||||
{
|
{
|
||||||
setupUi((QDialog*)this);
|
setupUi((QDialog*)this);
|
||||||
|
@ -48,7 +52,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
Rcl::Doc m_doc;
|
Rcl::Doc m_doc;
|
||||||
RefCntr<DocSequence> m_source;
|
STD_SHARED_PTR<DocSequence> m_source;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _SNIPPETS_W_H_INCLUDED_ */
|
#endif /* _SNIPPETS_W_H_INCLUDED_ */
|
||||||
|
|
|
@ -332,7 +332,7 @@ void SpellW::showStats()
|
||||||
string reason;
|
string reason;
|
||||||
string q = string("mime:") + *it;
|
string q = string("mime:") + *it;
|
||||||
Rcl::SearchData *sd = wasaStringToRcl(theconfig, "", q, reason);
|
Rcl::SearchData *sd = wasaStringToRcl(theconfig, "", q, reason);
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||||
Rcl::Query query(rcldb);
|
Rcl::Query query(rcldb);
|
||||||
if (!query.setQuery(rq)) {
|
if (!query.setQuery(rq)) {
|
||||||
LOGERR(("Query setup failed: %s",query.getReason().c_str()));
|
LOGERR(("Query setup failed: %s",query.getReason().c_str()));
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "ssearch_w.h"
|
#include "ssearch_w.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "textsplit.h"
|
#include "textsplit.h"
|
||||||
#include "wasatorcl.h"
|
#include "wasatorcl.h"
|
||||||
#include "rclhelp.h"
|
#include "rclhelp.h"
|
||||||
|
@ -309,7 +309,7 @@ bool SSearch::startSimpleSearch(const string& u8, int maxexp)
|
||||||
m_xml = xml.str();
|
m_xml = xml.str();
|
||||||
LOGDEB(("SSearch::startSimpleSearch:xml:[%s]\n", m_xml.c_str()));
|
LOGDEB(("SSearch::startSimpleSearch:xml:[%s]\n", m_xml.c_str()));
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> rsdata(sdata);
|
STD_SHARED_PTR<Rcl::SearchData> rsdata(sdata);
|
||||||
emit startSearch(rsdata, true);
|
emit startSearch(rsdata, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class QTimer;
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "ui_ssearchb.h"
|
#include "ui_ssearchb.h"
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public slots:
|
||||||
virtual void takeFocus();
|
virtual void takeFocus();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void startSearch(RefCntr<Rcl::SearchData>, bool);
|
void startSearch(STD_SHARED_PTR<Rcl::SearchData>, bool);
|
||||||
void clearSearch();
|
void clearSearch();
|
||||||
private:
|
private:
|
||||||
bool m_escape;
|
bool m_escape;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// The object we set up
|
// The object we set up
|
||||||
RefCntr<SearchData> sd;
|
STD_SHARED_PTR<SearchData> sd;
|
||||||
bool isvalid;
|
bool isvalid;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -94,8 +94,8 @@ bool SDHXMLHandler::startElement(const QString & /* namespaceURI */,
|
||||||
}
|
}
|
||||||
resetTemps();
|
resetTemps();
|
||||||
// A new search descriptor. Allocate data structure
|
// A new search descriptor. Allocate data structure
|
||||||
sd = RefCntr<SearchData>(new SearchData);
|
sd = STD_SHARED_PTR<SearchData>(new SearchData);
|
||||||
if (sd.isNull()) {
|
if (!sd) {
|
||||||
LOGERR(("SDHXMLHandler::startElement: out of memory\n"));
|
LOGERR(("SDHXMLHandler::startElement: out of memory\n"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ bool SDHXMLHandler::endElement(const QString & /* namespaceURI */,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> xmlToSearchData(const string& xml)
|
STD_SHARED_PTR<Rcl::SearchData> xmlToSearchData(const string& xml)
|
||||||
{
|
{
|
||||||
SDHXMLHandler handler;
|
SDHXMLHandler handler;
|
||||||
QXmlSimpleReader reader;
|
QXmlSimpleReader reader;
|
||||||
|
@ -221,7 +221,7 @@ RefCntr<Rcl::SearchData> xmlToSearchData(const string& xml)
|
||||||
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
|
if (!reader.parse(xmlInputSource) || !handler.isvalid) {
|
||||||
LOGERR(("xmlToSearchData: parse failed for [%s]\n",
|
LOGERR(("xmlToSearchData: parse failed for [%s]\n",
|
||||||
xml.c_str()));
|
xml.c_str()));
|
||||||
return RefCntr<SearchData>();
|
return STD_SHARED_PTR<SearchData>();
|
||||||
}
|
}
|
||||||
return handler.sd;
|
return handler.sd;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,12 +57,12 @@
|
||||||
* </SD>
|
* </SD>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
|
|
||||||
// Parsing XML from advanced search history or saved advanced search to to
|
// Parsing XML from advanced search history or saved advanced search to to
|
||||||
// SearchData structure:
|
// SearchData structure:
|
||||||
RefCntr<Rcl::SearchData> xmlToSearchData(const string& xml);
|
STD_SHARED_PTR<Rcl::SearchData> xmlToSearchData(const string& xml);
|
||||||
|
|
||||||
// Parsing XML from saved simple search to ssearch parameters
|
// Parsing XML from saved simple search to ssearch parameters
|
||||||
struct SSearchDef {
|
struct SSearchDef {
|
||||||
|
|
|
@ -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
|
// Remove stacked modifying sources (sort, filter) until we get to a real one
|
||||||
void DocSource::stripStack()
|
void DocSource::stripStack()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return;
|
return;
|
||||||
while (m_seq->getSourceSeq().isNotNull()) {
|
while (m_seq->getSourceSeq()) {
|
||||||
m_seq = m_seq->getSourceSeq();
|
m_seq = m_seq->getSourceSeq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ bool DocSource::buildStack()
|
||||||
LOGDEB2(("DocSource::buildStack()\n"));
|
LOGDEB2(("DocSource::buildStack()\n"));
|
||||||
stripStack();
|
stripStack();
|
||||||
|
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filtering must be done before sorting, (which may
|
// Filtering must be done before sorting, (which may
|
||||||
|
@ -80,7 +80,7 @@ bool DocSource::buildStack()
|
||||||
} else {
|
} else {
|
||||||
if (m_fspec.isNotNull()) {
|
if (m_fspec.isNotNull()) {
|
||||||
m_seq =
|
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 {
|
} else {
|
||||||
if (m_sspec.isNotNull()) {
|
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;
|
return true;
|
||||||
|
@ -98,7 +98,7 @@ bool DocSource::buildStack()
|
||||||
|
|
||||||
string DocSource::title()
|
string DocSource::title()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return string();
|
return string();
|
||||||
string qual;
|
string qual;
|
||||||
if (m_fspec.isNotNull() && !m_sspec.isNotNull())
|
if (m_fspec.isNotNull() && !m_sspec.isNotNull())
|
||||||
|
|
|
@ -16,13 +16,15 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _DOCSEQ_H_INCLUDED_
|
#ifndef _DOCSEQ_H_INCLUDED_
|
||||||
#define _DOCSEQ_H_INCLUDED_
|
#define _DOCSEQ_H_INCLUDED_
|
||||||
|
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "rcldoc.h"
|
#include "rcldoc.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "hldata.h"
|
#include "hldata.h"
|
||||||
#include "ptmutex.h"
|
#include "ptmutex.h"
|
||||||
|
|
||||||
|
@ -153,7 +155,7 @@ class DocSequence {
|
||||||
virtual bool canSort() {return false;}
|
virtual bool canSort() {return false;}
|
||||||
virtual bool setFiltSpec(const DocSeqFiltSpec &) {return false;}
|
virtual bool setFiltSpec(const DocSeqFiltSpec &) {return false;}
|
||||||
virtual bool setSortSpec(const DocSeqSortSpec &) {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)
|
static void set_translations(const std::string& sort, const std::string& filt)
|
||||||
{
|
{
|
||||||
|
@ -179,59 +181,59 @@ protected:
|
||||||
*/
|
*/
|
||||||
class DocSeqModifier : public DocSequence {
|
class DocSeqModifier : public DocSequence {
|
||||||
public:
|
public:
|
||||||
DocSeqModifier(RefCntr<DocSequence> iseq)
|
DocSeqModifier(STD_SHARED_PTR<DocSequence> iseq)
|
||||||
: DocSequence(""), m_seq(iseq)
|
: DocSequence(""), m_seq(iseq)
|
||||||
{}
|
{}
|
||||||
virtual ~DocSeqModifier() {}
|
virtual ~DocSeqModifier() {}
|
||||||
|
|
||||||
virtual bool getAbstract(Rcl::Doc& doc, std::vector<std::string>& abs)
|
virtual bool getAbstract(Rcl::Doc& doc, std::vector<std::string>& abs)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->getAbstract(doc, abs);
|
return m_seq->getAbstract(doc, abs);
|
||||||
}
|
}
|
||||||
virtual bool getAbstract(Rcl::Doc& doc,
|
virtual bool getAbstract(Rcl::Doc& doc,
|
||||||
std::vector<Rcl::Snippet>& abs)
|
std::vector<Rcl::Snippet>& abs)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->getAbstract(doc, abs);
|
return m_seq->getAbstract(doc, abs);
|
||||||
}
|
}
|
||||||
/** Get duplicates. */
|
/** Get duplicates. */
|
||||||
virtual bool docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
virtual bool docDups(const Rcl::Doc& doc, std::vector<Rcl::Doc>& dups)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->docDups(doc, dups);
|
return m_seq->docDups(doc, dups);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool snippetsCapable()
|
virtual bool snippetsCapable()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->snippetsCapable();
|
return m_seq->snippetsCapable();
|
||||||
}
|
}
|
||||||
virtual std::string getDescription()
|
virtual std::string getDescription()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return "";
|
return "";
|
||||||
return m_seq->getDescription();
|
return m_seq->getDescription();
|
||||||
}
|
}
|
||||||
virtual void getTerms(HighlightData& hld)
|
virtual void getTerms(HighlightData& hld)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return;
|
return;
|
||||||
m_seq->getTerms(hld);
|
m_seq->getTerms(hld);
|
||||||
}
|
}
|
||||||
virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
|
virtual bool getEnclosing(Rcl::Doc& doc, Rcl::Doc& pdoc)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->getEnclosing(doc, pdoc);
|
return m_seq->getEnclosing(doc, pdoc);
|
||||||
}
|
}
|
||||||
virtual std::string getReason()
|
virtual std::string getReason()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return string();
|
return string();
|
||||||
return m_seq->getReason();
|
return m_seq->getReason();
|
||||||
}
|
}
|
||||||
|
@ -239,7 +241,7 @@ public:
|
||||||
{
|
{
|
||||||
return m_seq->title();
|
return m_seq->title();
|
||||||
}
|
}
|
||||||
virtual RefCntr<DocSequence> getSourceSeq()
|
virtual STD_SHARED_PTR<DocSequence> getSourceSeq()
|
||||||
{
|
{
|
||||||
return m_seq;
|
return m_seq;
|
||||||
}
|
}
|
||||||
|
@ -247,12 +249,12 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual Rcl::Db *getDb()
|
virtual Rcl::Db *getDb()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return 0;
|
return 0;
|
||||||
return m_seq->getDb();
|
return m_seq->getDb();
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<DocSequence> m_seq;
|
STD_SHARED_PTR<DocSequence> m_seq;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RclConfig;
|
class RclConfig;
|
||||||
|
@ -261,7 +263,7 @@ class RclConfig;
|
||||||
// sorting and filtering in ways depending on the base seqs capabilities
|
// sorting and filtering in ways depending on the base seqs capabilities
|
||||||
class DocSource : public DocSeqModifier {
|
class DocSource : public DocSeqModifier {
|
||||||
public:
|
public:
|
||||||
DocSource(RclConfig *config, RefCntr<DocSequence> iseq)
|
DocSource(RclConfig *config, STD_SHARED_PTR<DocSequence> iseq)
|
||||||
: DocSeqModifier(iseq), m_config(config)
|
: DocSeqModifier(iseq), m_config(config)
|
||||||
{}
|
{}
|
||||||
virtual bool canFilter() {return true;}
|
virtual bool canFilter() {return true;}
|
||||||
|
@ -270,13 +272,13 @@ public:
|
||||||
virtual bool setSortSpec(const DocSeqSortSpec &);
|
virtual bool setSortSpec(const DocSeqSortSpec &);
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0)
|
virtual bool getDoc(int num, Rcl::Doc &doc, std::string *sh = 0)
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return false;
|
return false;
|
||||||
return m_seq->getDoc(num, doc, sh);
|
return m_seq->getDoc(num, doc, sh);
|
||||||
}
|
}
|
||||||
virtual int getResCnt()
|
virtual int getResCnt()
|
||||||
{
|
{
|
||||||
if (m_seq.isNull())
|
if (!m_seq)
|
||||||
return 0;
|
return 0;
|
||||||
return m_seq->getResCnt();
|
return m_seq->getResCnt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ using std::list;
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "wasatorcl.h"
|
#include "wasatorcl.h"
|
||||||
|
|
||||||
DocSequenceDb::DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
|
DocSequenceDb::DocSequenceDb(STD_SHARED_PTR<Rcl::Query> q, const string &t,
|
||||||
RefCntr<Rcl::SearchData> sdata)
|
STD_SHARED_PTR<Rcl::SearchData> sdata)
|
||||||
: DocSequence(t), m_q(q), m_sdata(sdata), m_fsdata(sdata),
|
: DocSequence(t), m_q(q), m_sdata(sdata), m_fsdata(sdata),
|
||||||
m_rescnt(-1),
|
m_rescnt(-1),
|
||||||
m_queryBuildAbstract(true),
|
m_queryBuildAbstract(true),
|
||||||
|
@ -131,7 +131,7 @@ int DocSequenceDb::getFirstMatchPage(Rcl::Doc &doc, string& term)
|
||||||
|
|
||||||
Rcl::Db *DocSequenceDb::getDb()
|
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)
|
list<string> DocSequenceDb::expand(Rcl::Doc &doc)
|
||||||
|
@ -162,7 +162,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||||
PTMutexLocker locker(o_dblock);
|
PTMutexLocker locker(o_dblock);
|
||||||
if (fs.isNotNull()) {
|
if (fs.isNotNull()) {
|
||||||
// We build a search spec by adding a filtering layer to the base one.
|
// 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()));
|
new Rcl::SearchData(Rcl::SCLT_AND, m_sdata->getStemLang()));
|
||||||
Rcl::SearchDataClauseSub *cl =
|
Rcl::SearchDataClauseSub *cl =
|
||||||
new Rcl::SearchDataClauseSub(m_sdata);
|
new Rcl::SearchDataClauseSub(m_sdata);
|
||||||
|
@ -175,7 +175,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||||
break;
|
break;
|
||||||
case DocSeqFiltSpec::DSFS_QLANG:
|
case DocSeqFiltSpec::DSFS_QLANG:
|
||||||
{
|
{
|
||||||
if (m_q.isNull())
|
if (!m_q)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
string reason;
|
string reason;
|
||||||
|
@ -186,7 +186,7 @@ bool DocSequenceDb::setFiltSpec(const DocSeqFiltSpec &fs)
|
||||||
if (sd) {
|
if (sd) {
|
||||||
Rcl::SearchDataClauseSub *cl1 =
|
Rcl::SearchDataClauseSub *cl1 =
|
||||||
new Rcl::SearchDataClauseSub(
|
new Rcl::SearchDataClauseSub(
|
||||||
RefCntr<Rcl::SearchData>(sd));
|
STD_SHARED_PTR<Rcl::SearchData>(sd));
|
||||||
m_fsdata->addClause(cl1);
|
m_fsdata->addClause(cl1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef _DOCSEQDB_H_INCLUDED_
|
#ifndef _DOCSEQDB_H_INCLUDED_
|
||||||
#define _DOCSEQDB_H_INCLUDED_
|
#define _DOCSEQDB_H_INCLUDED_
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
#include "rclquery.h"
|
#include "rclquery.h"
|
||||||
|
@ -25,8 +25,8 @@
|
||||||
/** A DocSequence from a Db query */
|
/** A DocSequence from a Db query */
|
||||||
class DocSequenceDb : public DocSequence {
|
class DocSequenceDb : public DocSequence {
|
||||||
public:
|
public:
|
||||||
DocSequenceDb(RefCntr<Rcl::Query> q, const string &t,
|
DocSequenceDb(STD_SHARED_PTR<Rcl::Query> q, const string &t,
|
||||||
RefCntr<Rcl::SearchData> sdata);
|
STD_SHARED_PTR<Rcl::SearchData> sdata);
|
||||||
virtual ~DocSequenceDb() {}
|
virtual ~DocSequenceDb() {}
|
||||||
virtual bool getDoc(int num, Rcl::Doc &doc, string * = 0);
|
virtual bool getDoc(int num, Rcl::Doc &doc, string * = 0);
|
||||||
virtual int getResCnt();
|
virtual int getResCnt();
|
||||||
|
@ -60,9 +60,9 @@ class DocSequenceDb : public DocSequence {
|
||||||
protected:
|
protected:
|
||||||
virtual Rcl::Db *getDb();
|
virtual Rcl::Db *getDb();
|
||||||
private:
|
private:
|
||||||
RefCntr<Rcl::Query> m_q;
|
STD_SHARED_PTR<Rcl::Query> m_q;
|
||||||
RefCntr<Rcl::SearchData> m_sdata;
|
STD_SHARED_PTR<Rcl::SearchData> m_sdata;
|
||||||
RefCntr<Rcl::SearchData> m_fsdata; // Filtered
|
STD_SHARED_PTR<Rcl::SearchData> m_fsdata; // Filtered
|
||||||
int m_rescnt;
|
int m_rescnt;
|
||||||
bool m_queryBuildAbstract;
|
bool m_queryBuildAbstract;
|
||||||
bool m_queryReplaceAbstract;
|
bool m_queryReplaceAbstract;
|
||||||
|
|
|
@ -47,7 +47,7 @@ static bool filter(const DocSeqFiltSpec& fs, const Rcl::Doc *x)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DocSeqFiltered::DocSeqFiltered(RclConfig *conf, RefCntr<DocSequence> iseq,
|
DocSeqFiltered::DocSeqFiltered(RclConfig *conf, STD_SHARED_PTR<DocSequence> iseq,
|
||||||
DocSeqFiltSpec &filtspec)
|
DocSeqFiltSpec &filtspec)
|
||||||
: DocSeqModifier(iseq), m_config(conf)
|
: DocSeqModifier(iseq), m_config(conf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,13 +16,12 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _FILTSEQ_H_INCLUDED_
|
#ifndef _FILTSEQ_H_INCLUDED_
|
||||||
#define _FILTSEQ_H_INCLUDED_
|
#define _FILTSEQ_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
using std::string;
|
#include MEMORY_INCLUDE
|
||||||
using std::vector;
|
|
||||||
|
|
||||||
#include "refcntr.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
|
|
||||||
class RclConfig;
|
class RclConfig;
|
||||||
|
@ -33,17 +32,17 @@ class RclConfig;
|
||||||
*/
|
*/
|
||||||
class DocSeqFiltered : public DocSeqModifier {
|
class DocSeqFiltered : public DocSeqModifier {
|
||||||
public:
|
public:
|
||||||
DocSeqFiltered(RclConfig *conf, RefCntr<DocSequence> iseq,
|
DocSeqFiltered(RclConfig *conf, STD_SHARED_PTR<DocSequence> iseq,
|
||||||
DocSeqFiltSpec &filtspec);
|
DocSeqFiltSpec &filtspec);
|
||||||
virtual ~DocSeqFiltered() {}
|
virtual ~DocSeqFiltered() {}
|
||||||
virtual bool canFilter() {return true;}
|
virtual bool canFilter() {return true;}
|
||||||
virtual bool setFiltSpec(const DocSeqFiltSpec &filtspec);
|
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();}
|
virtual int getResCnt() {return m_seq->getResCnt();}
|
||||||
private:
|
private:
|
||||||
RclConfig *m_config;
|
RclConfig *m_config;
|
||||||
DocSeqFiltSpec m_spec;
|
DocSeqFiltSpec m_spec;
|
||||||
vector<int> m_dbindices;
|
std::vector<int> m_dbindices;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _FILTSEQ_H_INCLUDED_ */
|
#endif /* _FILTSEQ_H_INCLUDED_ */
|
||||||
|
|
|
@ -330,7 +330,7 @@ endopts:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<Rcl::SearchData> rq(sd);
|
STD_SHARED_PTR<Rcl::SearchData> rq(sd);
|
||||||
Rcl::Query query(&rcldb);
|
Rcl::Query query(&rcldb);
|
||||||
if (op_flags & OPT_S) {
|
if (op_flags & OPT_S) {
|
||||||
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
|
query.setSortBy(sortfield, (op_flags & OPT_D) ? false : true);
|
||||||
|
|
|
@ -65,7 +65,7 @@ ResListPager::ResListPager(int pagesize)
|
||||||
|
|
||||||
void ResListPager::resultPageNext()
|
void ResListPager::resultPageNext()
|
||||||
{
|
{
|
||||||
if (m_docSource.isNull()) {
|
if (!m_docSource) {
|
||||||
LOGDEB(("ResListPager::resultPageNext: null source\n"));
|
LOGDEB(("ResListPager::resultPageNext: null source\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ static string maybeEscapeHtml(const string& fld)
|
||||||
|
|
||||||
void ResListPager::resultPageFor(int docnum)
|
void ResListPager::resultPageFor(int docnum)
|
||||||
{
|
{
|
||||||
if (m_docSource.isNull()) {
|
if (!m_docSource) {
|
||||||
LOGDEB(("ResListPager::resultPageFor: null source\n"));
|
LOGDEB(("ResListPager::resultPageFor: null source\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ void ResListPager::displayDoc(RclConfig *config, int i, Rcl::Doc& doc,
|
||||||
|
|
||||||
string richabst;
|
string richabst;
|
||||||
bool needabstract = parFormat().find("%A") != string::npos;
|
bool needabstract = parFormat().find("%A") != string::npos;
|
||||||
if (needabstract && m_docSource.isNotNull()) {
|
if (needabstract && m_docSource) {
|
||||||
vector<string> vabs;
|
vector<string> vabs;
|
||||||
m_docSource->getAbstract(doc, vabs);
|
m_docSource->getAbstract(doc, vabs);
|
||||||
m_hiliter->set_inputhtml(false);
|
m_hiliter->set_inputhtml(false);
|
||||||
|
@ -344,7 +344,7 @@ bool ResListPager::getDoc(int num, Rcl::Doc& doc)
|
||||||
void ResListPager::displayPage(RclConfig *config)
|
void ResListPager::displayPage(RclConfig *config)
|
||||||
{
|
{
|
||||||
LOGDEB(("ResListPager::displayPage\n"));
|
LOGDEB(("ResListPager::displayPage\n"));
|
||||||
if (m_docSource.isNull()) {
|
if (!m_docSource) {
|
||||||
LOGDEB(("ResListPager::displayPage: null source\n"));
|
LOGDEB(("ResListPager::displayPage: null source\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@
|
||||||
|
|
||||||
#ifndef _reslistpager_h_included_
|
#ifndef _reslistpager_h_included_
|
||||||
#define _reslistpager_h_included_
|
#define _reslistpager_h_included_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "refcntr.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
#include "hldata.h"
|
#include "hldata.h"
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ public:
|
||||||
{
|
{
|
||||||
m_hiliter = ptr;
|
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_pagesize = m_newpagesize;
|
||||||
m_winfirst = winfirst;
|
m_winfirst = winfirst;
|
||||||
|
@ -87,8 +88,9 @@ public:
|
||||||
const HighlightData& hdata, const string& sh = "");
|
const HighlightData& hdata, const string& sh = "");
|
||||||
bool pageEmpty() {return m_respage.size() == 0;}
|
bool pageEmpty() {return m_respage.size() == 0;}
|
||||||
|
|
||||||
string queryDescription() {return m_docSource.isNull() ? "" :
|
string queryDescription() {
|
||||||
m_docSource->getDescription();}
|
return m_docSource ? m_docSource->getDescription() : "";
|
||||||
|
}
|
||||||
|
|
||||||
bool getDoc(int num, Rcl::Doc &doc);
|
bool getDoc(int num, Rcl::Doc &doc);
|
||||||
|
|
||||||
|
@ -127,7 +129,7 @@ private:
|
||||||
int m_winfirst;
|
int m_winfirst;
|
||||||
bool m_hasNext;
|
bool m_hasNext;
|
||||||
PlainToRich *m_hiliter;
|
PlainToRich *m_hiliter;
|
||||||
RefCntr<DocSequence> m_docSource;
|
STD_SHARED_PTR<DocSequence> m_docSource;
|
||||||
std::vector<ResListEntry> m_respage;
|
std::vector<ResListEntry> m_respage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _SORTSEQ_H_INCLUDED_
|
#ifndef _SORTSEQ_H_INCLUDED_
|
||||||
#define _SORTSEQ_H_INCLUDED_
|
#define _SORTSEQ_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "refcntr.h"
|
|
||||||
#include "docseq.h"
|
#include "docseq.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
class DocSeqSorted : public DocSeqModifier {
|
class DocSeqSorted : public DocSeqModifier {
|
||||||
public:
|
public:
|
||||||
DocSeqSorted(RefCntr<DocSequence> iseq, DocSeqSortSpec &sortspec)
|
DocSeqSorted(STD_SHARED_PTR<DocSequence> iseq, DocSeqSortSpec &sortspec)
|
||||||
: DocSeqModifier(iseq)
|
: DocSeqModifier(iseq)
|
||||||
{
|
{
|
||||||
setSortSpec(sortspec);
|
setSortSpec(sortspec);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "utf8iter.h"
|
#include "utf8iter.h"
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "textsplit.h"
|
#include "textsplit.h"
|
||||||
#include "xmacros.h"
|
#include "xmacros.h"
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
|
@ -56,13 +56,13 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
|
||||||
vector<XapWritableComputableSynFamMember> stemdbs;
|
vector<XapWritableComputableSynFamMember> stemdbs;
|
||||||
// Note: tried to make this to work with stack-allocated objects, couldn't.
|
// Note: tried to make this to work with stack-allocated objects, couldn't.
|
||||||
// Looks like a bug in copy constructors somewhere, can't guess where
|
// Looks like a bug in copy constructors somewhere, can't guess where
|
||||||
vector<RefCntr<SynTermTransStem> > stemmers;
|
vector<STD_SHARED_PTR<SynTermTransStem> > stemmers;
|
||||||
for (unsigned int i = 0; i < langs.size(); i++) {
|
for (unsigned int i = 0; i < langs.size(); i++) {
|
||||||
stemmers.push_back(RefCntr<SynTermTransStem>
|
stemmers.push_back(STD_SHARED_PTR<SynTermTransStem>
|
||||||
(new SynTermTransStem(langs[i])));
|
(new SynTermTransStem(langs[i])));
|
||||||
stemdbs.push_back(
|
stemdbs.push_back(
|
||||||
XapWritableComputableSynFamMember(wdb, synFamStem, langs[i],
|
XapWritableComputableSynFamMember(wdb, synFamStem, langs[i],
|
||||||
stemmers.back().getptr()));
|
stemmers.back().get()));
|
||||||
stemdbs.back().recreate();
|
stemdbs.back().recreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ bool createExpansionDbs(Xapian::WritableDatabase& wdb,
|
||||||
for (unsigned int i = 0; i < langs.size(); i++) {
|
for (unsigned int i = 0; i < langs.size(); i++) {
|
||||||
unacstemdbs.push_back(
|
unacstemdbs.push_back(
|
||||||
XapWritableComputableSynFamMember(wdb, synFamStemUnac, langs[i],
|
XapWritableComputableSynFamMember(wdb, synFamStemUnac, langs[i],
|
||||||
stemmers.back().getptr()));
|
stemmers.back().get()));
|
||||||
unacstemdbs.back().recreate();
|
unacstemdbs.back().recreate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ double Query::Native::qualityTerms(Xapian::docid docid,
|
||||||
if (doclen == 0)
|
if (doclen == 0)
|
||||||
doclen = 1;
|
doclen = 1;
|
||||||
HighlightData hld;
|
HighlightData hld;
|
||||||
if (!m_q->m_sd.isNull()) {
|
if (m_q->m_sd) {
|
||||||
m_q->m_sd->getTerms(hld);
|
m_q->m_sd->getTerms(hld);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -570,7 +570,7 @@ bool Db::Native::addOrUpdateWrite(const string& udi, const string& uniterm,
|
||||||
Chrono chron;
|
Chrono chron;
|
||||||
PTMutexLocker lock(m_mutex);
|
PTMutexLocker lock(m_mutex);
|
||||||
#endif
|
#endif
|
||||||
RefCntr<Xapian::Document> doc_cleaner(newdocument_ptr);
|
STD_SHARED_PTR<Xapian::Document> doc_cleaner(newdocument_ptr);
|
||||||
|
|
||||||
// Check file system full every mbyte of indexed text. It's a bit wasteful
|
// Check file system full every mbyte of indexed text. It's a bit wasteful
|
||||||
// to do this after having prepared the document, but it needs to be in
|
// to do this after having prepared the document, but it needs to be in
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "cstr.h"
|
#include "cstr.h"
|
||||||
#include "refcntr.h"
|
|
||||||
#include "rcldoc.h"
|
#include "rcldoc.h"
|
||||||
#include "stoplist.h"
|
#include "stoplist.h"
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool Db::docDups(const Doc& idoc, vector<Doc>& odocs)
|
||||||
MD5HexPrint(digest, md5);
|
MD5HexPrint(digest, md5);
|
||||||
|
|
||||||
SearchData *sdp = new SearchData();
|
SearchData *sdp = new SearchData();
|
||||||
RefCntr<SearchData> sd(sdp);
|
STD_SHARED_PTR<SearchData> sd(sdp);
|
||||||
SearchDataClauseSimple *sdc =
|
SearchDataClauseSimple *sdc =
|
||||||
new SearchDataClauseSimple(SCLT_AND, md5, "rclmd5");
|
new SearchDataClauseSimple(SCLT_AND, md5, "rclmd5");
|
||||||
sdc->addModifier(SearchDataClause::SDCM_CASESENS);
|
sdc->addModifier(SearchDataClause::SDCM_CASESENS);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void Query::setSortBy(const string& fld, bool ascending) {
|
||||||
#define ISNULL(X) !(X)
|
#define ISNULL(X) !(X)
|
||||||
|
|
||||||
// Prepare query out of user search data
|
// Prepare query out of user search data
|
||||||
bool Query::setQuery(RefCntr<SearchData> sdata)
|
bool Query::setQuery(STD_SHARED_PTR<SearchData> sdata)
|
||||||
{
|
{
|
||||||
LOGDEB(("Query::setQuery:\n"));
|
LOGDEB(("Query::setQuery:\n"));
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "searchdata.h"
|
#include "searchdata.h"
|
||||||
|
|
||||||
#ifndef NO_NAMESPACES
|
#ifndef NO_NAMESPACES
|
||||||
|
@ -92,7 +92,7 @@ class Query {
|
||||||
* be called repeatedly on the same object which gets reinitialized each
|
* be called repeatedly on the same object which gets reinitialized each
|
||||||
* time.
|
* time.
|
||||||
*/
|
*/
|
||||||
bool setQuery(RefCntr<SearchData> q);
|
bool setQuery(STD_SHARED_PTR<SearchData> q);
|
||||||
|
|
||||||
/** Get results count for current query */
|
/** Get results count for current query */
|
||||||
int getResCnt();
|
int getResCnt();
|
||||||
|
@ -117,7 +117,7 @@ class Query {
|
||||||
int getFirstMatchPage(const Doc &doc, std::string& term);
|
int getFirstMatchPage(const Doc &doc, std::string& term);
|
||||||
|
|
||||||
/** Retrieve a reference to the searchData we are using */
|
/** Retrieve a reference to the searchData we are using */
|
||||||
RefCntr<SearchData> getSD()
|
STD_SHARED_PTR<SearchData> getSD()
|
||||||
{
|
{
|
||||||
return m_sd;
|
return m_sd;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ private:
|
||||||
bool m_sortAscending;
|
bool m_sortAscending;
|
||||||
bool m_collapseDuplicates;
|
bool m_collapseDuplicates;
|
||||||
int m_resCnt;
|
int m_resCnt;
|
||||||
RefCntr<SearchData> m_sd;
|
STD_SHARED_PTR<SearchData> m_sd;
|
||||||
int m_snipMaxPosWalk;
|
int m_snipMaxPosWalk;
|
||||||
|
|
||||||
/* Copyconst and assignement private and forbidden */
|
/* Copyconst and assignement private and forbidden */
|
||||||
|
|
|
@ -198,11 +198,11 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
|
||||||
XapComputableSynFamMember synac(xrdb, synFamDiCa, "all", &unacfoldtrans);
|
XapComputableSynFamMember synac(xrdb, synFamDiCa, "all", &unacfoldtrans);
|
||||||
|
|
||||||
if (matchtyp == ET_WILD || matchtyp == ET_REGEXP) {
|
if (matchtyp == ET_WILD || matchtyp == ET_REGEXP) {
|
||||||
RefCntr<StrMatcher> matcher;
|
STD_SHARED_PTR<StrMatcher> matcher;
|
||||||
if (matchtyp == ET_WILD) {
|
if (matchtyp == ET_WILD) {
|
||||||
matcher = RefCntr<StrMatcher>(new StrWildMatcher(term));
|
matcher = STD_SHARED_PTR<StrMatcher>(new StrWildMatcher(term));
|
||||||
} else {
|
} else {
|
||||||
matcher = RefCntr<StrMatcher>(new StrRegexpMatcher(term));
|
matcher = STD_SHARED_PTR<StrMatcher>(new StrRegexpMatcher(term));
|
||||||
}
|
}
|
||||||
if (!diac_sensitive || !case_sensitive) {
|
if (!diac_sensitive || !case_sensitive) {
|
||||||
// Perform case/diac expansion on the exp as appropriate and
|
// Perform case/diac expansion on the exp as appropriate and
|
||||||
|
@ -211,14 +211,14 @@ bool Db::termMatch(int typ_sens, const string &lang, const string &_term,
|
||||||
if (diac_sensitive) {
|
if (diac_sensitive) {
|
||||||
// Expand for diacritics and case, filtering for same diacritics
|
// Expand for diacritics and case, filtering for same diacritics
|
||||||
SynTermTransUnac foldtrans(UNACOP_FOLD);
|
SynTermTransUnac foldtrans(UNACOP_FOLD);
|
||||||
synac.synKeyExpand(matcher.getptr(), exp, &foldtrans);
|
synac.synKeyExpand(matcher.get(), exp, &foldtrans);
|
||||||
} else if (case_sensitive) {
|
} else if (case_sensitive) {
|
||||||
// Expand for diacritics and case, filtering for same case
|
// Expand for diacritics and case, filtering for same case
|
||||||
SynTermTransUnac unactrans(UNACOP_UNAC);
|
SynTermTransUnac unactrans(UNACOP_UNAC);
|
||||||
synac.synKeyExpand(matcher.getptr(), exp, &unactrans);
|
synac.synKeyExpand(matcher.get(), exp, &unactrans);
|
||||||
} else {
|
} else {
|
||||||
// Expand for diacritics and case, no filtering
|
// Expand for diacritics and case, no filtering
|
||||||
synac.synKeyExpand(matcher.getptr(), exp);
|
synac.synKeyExpand(matcher.get(), exp);
|
||||||
}
|
}
|
||||||
// Retrieve additional info and filter against the index itself
|
// Retrieve additional info and filter against the index itself
|
||||||
for (vector<string>::const_iterator it = exp.begin();
|
for (vector<string>::const_iterator it = exp.begin();
|
||||||
|
@ -337,21 +337,21 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
|
||||||
}
|
}
|
||||||
res.prefix = prefix;
|
res.prefix = prefix;
|
||||||
|
|
||||||
RefCntr<StrMatcher> matcher;
|
STD_SHARED_PTR<StrMatcher> matcher;
|
||||||
if (typ == ET_REGEXP) {
|
if (typ == ET_REGEXP) {
|
||||||
matcher = RefCntr<StrMatcher>(new StrRegexpMatcher(root));
|
matcher = STD_SHARED_PTR<StrMatcher>(new StrRegexpMatcher(root));
|
||||||
if (!matcher->ok()) {
|
if (!matcher->ok()) {
|
||||||
LOGERR(("termMatch: regcomp failed: %s\n",
|
LOGERR(("termMatch: regcomp failed: %s\n",
|
||||||
matcher->getreason().c_str()))
|
matcher->getreason().c_str()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (typ == ET_WILD) {
|
} else if (typ == ET_WILD) {
|
||||||
matcher = RefCntr<StrMatcher>(new StrWildMatcher(root));
|
matcher = STD_SHARED_PTR<StrMatcher>(new StrWildMatcher(root));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the initial section before any special char
|
// Find the initial section before any special char
|
||||||
string::size_type es = string::npos;
|
string::size_type es = string::npos;
|
||||||
if (matcher.isNotNull()) {
|
if (matcher) {
|
||||||
es = matcher->baseprefixlen();
|
es = matcher->baseprefixlen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ bool Db::idxTermMatch(int typ_sens, const string &lang, const string &root,
|
||||||
term = *it;
|
term = *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matcher.isNotNull() && !matcher->match(term))
|
if (matcher && !matcher->match(term))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
res.entries.push_back(
|
res.entries.push_back(
|
||||||
|
|
|
@ -162,7 +162,7 @@ bool SearchData::maybeAddAutoPhrase(Rcl::Db& db, double freqThreshold)
|
||||||
// an actual user-entered phrase
|
// an actual user-entered phrase
|
||||||
slack += 1 + nwords / 3;
|
slack += 1 + nwords / 3;
|
||||||
|
|
||||||
m_autophrase = RefCntr<SearchDataClauseDist>(
|
m_autophrase = STD_SHARED_PTR<SearchDataClauseDist>(
|
||||||
new SearchDataClauseDist(SCLT_PHRASE, swords, slack, field));
|
new SearchDataClauseDist(SCLT_PHRASE, swords, slack, field));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ void SearchDataClauseDist::dump(ostream& o) const
|
||||||
void SearchDataClauseSub::dump(ostream& o) const
|
void SearchDataClauseSub::dump(ostream& o) const
|
||||||
{
|
{
|
||||||
o << "ClauseSub {\n";
|
o << "ClauseSub {\n";
|
||||||
m_sub.getconstptr()->dump(o);
|
m_sub->dump(o);
|
||||||
o << "}";
|
o << "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include "rcldb.h"
|
#include "rcldb.h"
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "cstr.h"
|
#include "cstr.h"
|
||||||
#include "hldata.h"
|
#include "hldata.h"
|
||||||
|
@ -174,7 +174,7 @@ private:
|
||||||
std::vector<std::string> m_nfiletypes;
|
std::vector<std::string> m_nfiletypes;
|
||||||
// Autophrase if set. Can't be part of the normal chain because
|
// Autophrase if set. Can't be part of the normal chain because
|
||||||
// it uses OP_AND_MAYBE
|
// it uses OP_AND_MAYBE
|
||||||
RefCntr<SearchDataClauseDist> m_autophrase;
|
STD_SHARED_PTR<SearchDataClauseDist> m_autophrase;
|
||||||
|
|
||||||
// Special stuff produced by input which looks like a clause but means
|
// Special stuff produced by input which looks like a clause but means
|
||||||
// something else (date and size specs)
|
// something else (date and size specs)
|
||||||
|
@ -487,7 +487,7 @@ private:
|
||||||
/** Subquery */
|
/** Subquery */
|
||||||
class SearchDataClauseSub : public SearchDataClause {
|
class SearchDataClauseSub : public SearchDataClause {
|
||||||
public:
|
public:
|
||||||
SearchDataClauseSub(RefCntr<SearchData> sub)
|
SearchDataClauseSub(STD_SHARED_PTR<SearchData> sub)
|
||||||
: SearchDataClause(SCLT_SUB), m_sub(sub)
|
: SearchDataClause(SCLT_SUB), m_sub(sub)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -501,15 +501,15 @@ public:
|
||||||
|
|
||||||
virtual void getTerms(HighlightData& hldata) const
|
virtual void getTerms(HighlightData& hldata) const
|
||||||
{
|
{
|
||||||
m_sub.getconstptr()->getTerms(hldata);
|
m_sub.get()->getTerms(hldata);
|
||||||
}
|
}
|
||||||
virtual RefCntr<SearchData> getSub() {
|
virtual STD_SHARED_PTR<SearchData> getSub() {
|
||||||
return m_sub;
|
return m_sub;
|
||||||
}
|
}
|
||||||
virtual void dump(ostream& o) const;
|
virtual void dump(ostream& o) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RefCntr<SearchData> m_sub;
|
STD_SHARED_PTR<SearchData> m_sub;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Namespace Rcl
|
} // Namespace Rcl
|
||||||
|
|
|
@ -250,7 +250,7 @@ bool SearchData::toNativeQuery(Rcl::Db &db, void *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the autophrase if any
|
// Add the autophrase if any
|
||||||
if (m_autophrase.isNotNull()) {
|
if (m_autophrase) {
|
||||||
Xapian::Query apq;
|
Xapian::Query apq;
|
||||||
if (m_autophrase->toNativeQuery(db, &apq)) {
|
if (m_autophrase->toNativeQuery(db, &apq)) {
|
||||||
xq = xq.empty() ? apq :
|
xq = xq.empty() ? apq :
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
#include "cstr.h"
|
#include "cstr.h"
|
||||||
#include "xmacros.h"
|
#include "xmacros.h"
|
||||||
#include "synfamily.h"
|
#include "synfamily.h"
|
||||||
#include "smallut.h"
|
#include "smallut.h"
|
||||||
#include "refcntr.h"
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -188,9 +188,9 @@ bool XapComputableSynFamMember::synKeyExpand(StrMatcher* inexp,
|
||||||
LOGDEB(("XapCompSynFam::synKeyExpand: [%s]\n", inexp->exp().c_str()));
|
LOGDEB(("XapCompSynFam::synKeyExpand: [%s]\n", inexp->exp().c_str()));
|
||||||
|
|
||||||
// If set, compute filtering term (e.g.: only case-folded)
|
// If set, compute filtering term (e.g.: only case-folded)
|
||||||
RefCntr<StrMatcher> filter_exp;
|
STD_SHARED_PTR<StrMatcher> filter_exp;
|
||||||
if (filtertrans) {
|
if (filtertrans) {
|
||||||
filter_exp = RefCntr<StrMatcher>(inexp->clone());
|
filter_exp = STD_SHARED_PTR<StrMatcher>(inexp->clone());
|
||||||
filter_exp->setExp((*filtertrans)(inexp->exp()));
|
filter_exp->setExp((*filtertrans)(inexp->exp()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ bool XapComputableSynFamMember::synKeyExpand(StrMatcher* inexp,
|
||||||
m_family.getdb().synonyms_begin(*xit);
|
m_family.getdb().synonyms_begin(*xit);
|
||||||
xit1 != m_family.getdb().synonyms_end(*xit); xit1++) {
|
xit1 != m_family.getdb().synonyms_end(*xit); xit1++) {
|
||||||
string term = *xit1;
|
string term = *xit1;
|
||||||
if (filter_exp.isNotNull()) {
|
if (filter_exp) {
|
||||||
string term1 = (*filtertrans)(term);
|
string term1 = (*filtertrans)(term);
|
||||||
LOGDEB2((" Testing [%s] against [%s]\n",
|
LOGDEB2((" Testing [%s] against [%s]\n",
|
||||||
term1.c_str(), filter_exp->exp().c_str()));
|
term1.c_str(), filter_exp->exp().c_str()));
|
||||||
|
@ -231,7 +231,7 @@ bool XapComputableSynFamMember::synKeyExpand(StrMatcher* inexp,
|
||||||
}
|
}
|
||||||
// Same with key itself
|
// Same with key itself
|
||||||
string term = (*xit).substr(preflen);
|
string term = (*xit).substr(preflen);
|
||||||
if (filter_exp.isNotNull()) {
|
if (filter_exp) {
|
||||||
string term1 = (*filtertrans)(term);
|
string term1 = (*filtertrans)(term);
|
||||||
LOGDEB2((" Testing [%s] against [%s]\n",
|
LOGDEB2((" Testing [%s] against [%s]\n",
|
||||||
term1.c_str(), filter_exp->exp().c_str()));
|
term1.c_str(), filter_exp->exp().c_str()));
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ using namespace std;
|
||||||
|
|
||||||
bool resizecc(const string& dir, int newmbs)
|
bool resizecc(const string& dir, int newmbs)
|
||||||
{
|
{
|
||||||
RefCntr<CirCache> occ(new CirCache(dir));
|
STD_SHARED_PTR<CirCache> occ(new CirCache(dir));
|
||||||
string ofn = occ->getpath();
|
string ofn = occ->getpath();
|
||||||
|
|
||||||
string backupfn = ofn + ".orig";
|
string backupfn = ofn + ".orig";
|
||||||
|
@ -1353,7 +1353,7 @@ bool resizecc(const string& dir, int newmbs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RefCntr<CirCache> ncc(new CirCache(tmpdir));
|
STD_SHARED_PTR<CirCache> ncc(new CirCache(tmpdir));
|
||||||
string nfn = ncc->getpath();
|
string nfn = ncc->getpath();
|
||||||
if (!ncc->create(off_t(newmbs) * 1000 * 1024,
|
if (!ncc->create(off_t(newmbs) * 1000 * 1024,
|
||||||
CirCache::CC_CRUNIQUE | CirCache::CC_CRTRUNCATE)) {
|
CirCache::CC_CRUNIQUE | CirCache::CC_CRTRUNCATE)) {
|
||||||
|
|
|
@ -690,7 +690,7 @@ int ExecCmd::doexec(const string &cmd, const vector<string>& args,
|
||||||
LOGERR(("ExecCmd::doexec: no connection from command\n"));
|
LOGERR(("ExecCmd::doexec: no connection from command\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
oclicon->setcallback(RefCntr<NetconWorker>
|
oclicon->setcallback(STD_SHARED_PTR<NetconWorker>
|
||||||
(new ExecReader(output, m_advise)));
|
(new ExecReader(output, m_advise)));
|
||||||
myloop.addselcon(m_fromcmd, Netcon::NETCONPOLL_READ);
|
myloop.addselcon(m_fromcmd, Netcon::NETCONPOLL_READ);
|
||||||
// Give up ownership
|
// Give up ownership
|
||||||
|
@ -703,7 +703,7 @@ int ExecCmd::doexec(const string &cmd, const vector<string>& args,
|
||||||
LOGERR(("ExecCmd::doexec: no connection from command\n"));
|
LOGERR(("ExecCmd::doexec: no connection from command\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
iclicon->setcallback(RefCntr<NetconWorker>
|
iclicon->setcallback(STD_SHARED_PTR<NetconWorker>
|
||||||
(new ExecWriter(input, m_provide)));
|
(new ExecWriter(input, m_provide)));
|
||||||
myloop.addselcon(m_tocmd, Netcon::NETCONPOLL_WRITE);
|
myloop.addselcon(m_tocmd, Netcon::NETCONPOLL_WRITE);
|
||||||
// Give up ownership
|
// Give up ownership
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef TEST_NETCON
|
#ifndef TEST_NETCON
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -1230,8 +1232,8 @@ int trycli(char *host, char *serv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
RefCntr<NetconWorker> worker =
|
STD_SHARED_PTR<NetconWorker> worker =
|
||||||
RefCntr<NetconWorker>(new CliNetconWorker());
|
STD_SHARED_PTR<NetconWorker>(new CliNetconWorker());
|
||||||
clicon->setcallback(worker);
|
clicon->setcallback(worker);
|
||||||
SelectLoop myloop;
|
SelectLoop myloop;
|
||||||
myloop.addselcon(con, Netcon::NETCONPOLL_WRITE);
|
myloop.addselcon(con, Netcon::NETCONPOLL_WRITE);
|
||||||
|
@ -1296,8 +1298,8 @@ protected:
|
||||||
if (con == 0) {
|
if (con == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
RefCntr<NetconWorker> worker =
|
STD_SHARED_PTR<NetconWorker> worker =
|
||||||
RefCntr<NetconWorker>(new ServNetconWorker());
|
STD_SHARED_PTR<NetconWorker>(new ServNetconWorker());
|
||||||
con->setcallback(worker);
|
con->setcallback(worker);
|
||||||
m_loop.addselcon(NetconP(con), NETCONPOLL_READ);
|
m_loop.addselcon(NetconP(con), NETCONPOLL_READ);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -16,11 +16,13 @@
|
||||||
* Free Software Foundation, Inc.,
|
* Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
/// A set of classes to manage client-server communication over a
|
/// A set of classes to manage client-server communication over a
|
||||||
/// connection-oriented network, or a pipe.
|
/// connection-oriented network, or a pipe.
|
||||||
|
@ -37,7 +39,7 @@
|
||||||
|
|
||||||
/// Base class for all network endpoints:
|
/// Base class for all network endpoints:
|
||||||
class Netcon;
|
class Netcon;
|
||||||
typedef RefCntr<Netcon> NetconP;
|
typedef STD_SHARED_PTR<Netcon> NetconP;
|
||||||
class SelectLoop;
|
class SelectLoop;
|
||||||
|
|
||||||
class Netcon {
|
class Netcon {
|
||||||
|
@ -240,7 +242,7 @@ public:
|
||||||
virtual int getline(char *buf, int cnt, int timeo = -1);
|
virtual int getline(char *buf, int cnt, int timeo = -1);
|
||||||
/// Set handler to be called when the connection is placed in the
|
/// Set handler to be called when the connection is placed in the
|
||||||
/// selectloop and an event occurs.
|
/// selectloop and an event occurs.
|
||||||
virtual void setcallback(RefCntr<NetconWorker> user) {
|
virtual void setcallback(STD_SHARED_PTR<NetconWorker> user) {
|
||||||
m_user = user;
|
m_user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +251,7 @@ private:
|
||||||
char *m_bufbase; // Pointer to current 1st byte of useful data
|
char *m_bufbase; // Pointer to current 1st byte of useful data
|
||||||
int m_bufbytes; // Bytes of data.
|
int m_bufbytes; // Bytes of data.
|
||||||
int m_bufsize; // Total buffer size
|
int m_bufsize; // Total buffer size
|
||||||
RefCntr<NetconWorker> m_user;
|
STD_SHARED_PTR<NetconWorker> m_user;
|
||||||
virtual int cando(Netcon::Event reason); // Selectloop slot
|
virtual int cando(Netcon::Event reason); // Selectloop slot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,15 @@
|
||||||
*/
|
*/
|
||||||
#ifndef _PATHUT_H_INCLUDED_
|
#ifndef _PATHUT_H_INCLUDED_
|
||||||
#define _PATHUT_H_INCLUDED_
|
#define _PATHUT_H_INCLUDED_
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "refcntr.h"
|
#include MEMORY_INCLUDE
|
||||||
|
|
||||||
/// Add a / at the end if none there yet.
|
/// Add a / at the end if none there yet.
|
||||||
extern void path_catslash(std::string &s);
|
extern void path_catslash(std::string &s);
|
||||||
|
@ -116,7 +118,7 @@ private:
|
||||||
bool m_noremove;
|
bool m_noremove;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef RefCntr<TempFileInternal> TempFile;
|
typedef STD_SHARED_PTR<TempFileInternal> TempFile;
|
||||||
|
|
||||||
/// Temporary directory class. Recursively deleted by destructor.
|
/// Temporary directory class. Recursively deleted by destructor.
|
||||||
class TempDir {
|
class TempDir {
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
#ifndef _REFCNTR_H_
|
#ifndef _REFCNTR_H_
|
||||||
#define _REFCNTR_H_
|
#define _REFCNTR_H_
|
||||||
|
/* Copyright (C) 2014 J.F.Dockes
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the
|
||||||
|
* Free Software Foundation, Inc.,
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
// See Stroustrup C++ 3rd ed, p. 783
|
// See Stroustrup C++ 3rd ed, p. 783
|
||||||
// This is only used if std::shared_ptr is not available
|
// This is only used if std::shared_ptr is not available
|
||||||
|
@ -33,8 +49,7 @@ public:
|
||||||
(*pcount)++;
|
(*pcount)++;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
void release()
|
void reset() {
|
||||||
{
|
|
||||||
if (pcount && --(*pcount) == 0) {
|
if (pcount && --(*pcount) == 0) {
|
||||||
delete rep;
|
delete rep;
|
||||||
delete pcount;
|
delete pcount;
|
||||||
|
@ -42,22 +57,14 @@ public:
|
||||||
rep = 0;
|
rep = 0;
|
||||||
pcount = 0;
|
pcount = 0;
|
||||||
}
|
}
|
||||||
void reset() {
|
|
||||||
release();
|
|
||||||
}
|
|
||||||
~RefCntr()
|
~RefCntr()
|
||||||
{
|
{
|
||||||
release();
|
reset();
|
||||||
}
|
}
|
||||||
X *operator->() {return rep;}
|
X *operator->() {return rep;}
|
||||||
X *getptr() const {return rep;}
|
|
||||||
X *get() const {return rep;}
|
X *get() const {return rep;}
|
||||||
const X *getconstptr() const {return rep;}
|
int use_count() const {return pcount ? *pcount : 0;}
|
||||||
int getcnt() const {return pcount ? *pcount : 0;}
|
|
||||||
bool isNull() const {return rep == 0;}
|
|
||||||
bool isNotNull() const {return rep != 0;}
|
|
||||||
operator bool() const {return rep != 0;}
|
operator bool() const {return rep != 0;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /*_REFCNTR_H_ */
|
#endif /*_REFCNTR_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue