* mu-msg-iter: remove offset/index, cosmetics

This commit is contained in:
Dirk-Jan C. Binnema
2011-06-02 17:59:49 +03:00
parent 9531cb9cd5
commit 4c1baccc86
2 changed files with 20 additions and 49 deletions

View File

@ -31,29 +31,27 @@
static gboolean update_msg (MuMsgIter *iter); static gboolean update_msg (MuMsgIter *iter);
struct _MuMsgIter { struct _MuMsgIter {
_MuMsgIter (const Xapian::Enquire &enq, size_t maxnum):
_MuMsgIter (const Xapian::Enquire &enq, size_t maxnum): _enq(enq), _msg(0) {
_enq(enq), _maxnum(maxnum), _offset(0), _msg(0) {
_matches = _enq.get_mset (0, maxnum);
_matches = _enq.get_mset (0, _maxnum); _cursor = _matches.begin();
_cursor = _matches.begin();
if (!_matches.empty())
if (!_matches.empty()) update_msg (this);
update_msg (this); }
}
~_MuMsgIter () {
if (_msg)
mu_msg_unref (_msg);
}
const Xapian::Enquire _enq; ~_MuMsgIter () {
Xapian::MSet _matches; if (_msg)
Xapian::MSet::const_iterator _cursor; mu_msg_unref (_msg);
size_t _maxnum, _offset; }
Xapian::Document _doc; const Xapian::Enquire _enq;
MuMsg *_msg; Xapian::MSet _matches;
Xapian::MSet::const_iterator _cursor;
Xapian::Document _doc;
MuMsg *_msg;
}; };
@ -136,7 +134,6 @@ mu_msg_iter_next (MuMsgIter *iter)
try { try {
++iter->_cursor; ++iter->_cursor;
++iter->_offset;
if (mu_msg_iter_is_done(iter)) if (mu_msg_iter_is_done(iter))
return FALSE; /* no more matches */ return FALSE; /* no more matches */
@ -187,9 +184,6 @@ mu_msg_iter_get_field (MuMsgIter *iter, MuMsgFieldId mfid)
return get_field (iter, mfid); return get_field (iter, mfid);
} }
static gint64 static gint64
get_field_numeric (MuMsgIter *iter, MuMsgFieldId mfid) get_field_numeric (MuMsgIter *iter, MuMsgFieldId mfid)
{ {
@ -206,16 +200,6 @@ mu_msg_iter_get_field_numeric (MuMsgIter *iter, MuMsgFieldId mfid)
return get_field_numeric (iter, mfid); return get_field_numeric (iter, mfid);
} }
unsigned int
mu_msg_iter_get_index (MuMsgIter *iter)
{
g_return_val_if_fail (iter, (unsigned int)-1);
return iter->_offset;
}
/* hmmm.... is it impossible to get a 0 docid, or just very improbable? */ /* hmmm.... is it impossible to get a 0 docid, or just very improbable? */
unsigned int unsigned int
mu_msg_iter_get_docid (MuMsgIter *iter) mu_msg_iter_get_docid (MuMsgIter *iter)

View File

@ -107,19 +107,6 @@ MuMsg* mu_msg_iter_get_msg (MuMsgIter *iter, GError **err)
unsigned int mu_msg_iter_get_docid (MuMsgIter *iter); unsigned int mu_msg_iter_get_docid (MuMsgIter *iter);
/**
* get the index for this iterator (ie. somewhere between [0..n-1],
* with being the number of matches, and increasing 1 for each
* iter_next)
*
* @param iter a valid MuMsgIter
*
* @return the index or (unsigned int)-1 in case of error
*/
unsigned int mu_msg_iter_get_index (MuMsgIter *iter);
/** /**
* get some message field * get some message field
* *