*** empty log message ***
This commit is contained in:
parent
7a7e77cfae
commit
24ea431872
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.1 2005-12-01 16:23:09 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: sortseq.cpp,v 1.2 2005-12-02 14:18:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -13,49 +13,49 @@ class CompareDocs {
|
|||||||
public:
|
public:
|
||||||
CompareDocs(const RclSortSpec &sortspec) : ss(sortspec) {}
|
CompareDocs(const RclSortSpec &sortspec) : ss(sortspec) {}
|
||||||
|
|
||||||
int operator()(const Rcl::Doc &x, const Rcl::Doc &y) {
|
int operator()(const Rcl::Doc &x, const Rcl::Doc &y)
|
||||||
|
{
|
||||||
|
LOGDEB(("Comparing .. \n"));
|
||||||
for (unsigned int i = 0; i < ss.crits.size(); i++) {
|
for (unsigned int i = 0; i < ss.crits.size(); i++) {
|
||||||
switch (ss.crits[i]) {
|
switch (ss.crits[i]) {
|
||||||
case RclSortSpec::RCLFLD_MTIME:
|
case RclSortSpec::RCLFLD_MTIME:
|
||||||
{
|
{
|
||||||
|
LOGDEB((" MTIME\n"));
|
||||||
long xmtime = x.dmtime.empty() ? atol(x.fmtime.c_str()) :
|
long xmtime = x.dmtime.empty() ? atol(x.fmtime.c_str()) :
|
||||||
atol(x.dmtime.c_str());
|
atol(x.dmtime.c_str());
|
||||||
long ymtime = y.dmtime.empty() ? atol(y.fmtime.c_str()) :
|
long ymtime = y.dmtime.empty() ? atol(y.fmtime.c_str()) :
|
||||||
atol(y.dmtime.c_str());
|
atol(y.dmtime.c_str());
|
||||||
if (ss.dirs[i])
|
|
||||||
return xmtime > ymtime;
|
if (ss.dirs[i] ? xmtime > ymtime : xmtime < ymtime)
|
||||||
else
|
return 1;
|
||||||
return xmtime < ymtime;
|
|
||||||
}
|
}
|
||||||
continue;
|
break;
|
||||||
case RclSortSpec::RCLFLD_URL:
|
case RclSortSpec::RCLFLD_URL:
|
||||||
if (ss.dirs[i])
|
LOGDEB((" URL\n"));
|
||||||
return x.url > y.url;
|
if (ss.dirs[i] ? x.url > y.url : x.url < y.url)
|
||||||
else
|
return 1;
|
||||||
return x.url < y.url;
|
break;
|
||||||
continue;
|
|
||||||
case RclSortSpec::RCLFLD_IPATH:
|
case RclSortSpec::RCLFLD_IPATH:
|
||||||
if (ss.dirs[i])
|
LOGDEB((" IPATH\n"));
|
||||||
return x.ipath > y.ipath;
|
if (ss.dirs[i] ? x.ipath > y.ipath : x.ipath < y.ipath)
|
||||||
else
|
return 1;
|
||||||
return x.ipath < y.ipath;
|
break;
|
||||||
continue;
|
|
||||||
case RclSortSpec::RCLFLD_MIMETYPE:
|
case RclSortSpec::RCLFLD_MIMETYPE:
|
||||||
if (ss.dirs[i])
|
LOGDEB((" MIMETYPE\n"));
|
||||||
return x.mimetype > y.mimetype;
|
if (ss.dirs[i] ? x.mimetype > y.mimetype :
|
||||||
else
|
x.mimetype < y.mimetype)
|
||||||
return x.mimetype < y.mimetype;
|
return 1;
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Did all comparisons: must be equal
|
// Did all comparisons
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec)
|
DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec)
|
||||||
{
|
{
|
||||||
LOGDEB1(("DocSeqSorted:: input cnt %d\n", cnt));
|
LOGDEB(("DocSeqSorted:: count %d\n", cnt));
|
||||||
|
|
||||||
m_docs.resize(cnt);
|
m_docs.resize(cnt);
|
||||||
m_pcs.resize(cnt);
|
m_pcs.resize(cnt);
|
||||||
@ -67,7 +67,7 @@ DocSeqSorted::DocSeqSorted(DocSequence &iseq, int cnt, RclSortSpec &sortspec)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_count = i;
|
m_count = i;
|
||||||
LOGDEB1(("DocSeqSorted:: m_count %d\n", m_count));
|
LOGDEB(("DocSeqSorted:: m_count %d\n", m_count));
|
||||||
m_docs.resize(m_count);
|
m_docs.resize(m_count);
|
||||||
m_pcs.resize(m_count);
|
m_pcs.resize(m_count);
|
||||||
m_title = string("Sorted ") + iseq.title();
|
m_title = string("Sorted ") + iseq.title();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user