* cosmetics, re-indentation

This commit is contained in:
Dirk-Jan C. Binnema
2011-05-19 07:32:09 +03:00
parent f02a043741
commit 53a2a5c3ab
3 changed files with 32 additions and 29 deletions

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
**
** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify ** This program is free software; you can redistribute it and/or modify
@ -24,37 +25,37 @@
#include <xapian.h> #include <xapian.h>
#include "mu-util.h" #include "mu-util.h"
#include "mu-msg.h" #include "mu-msg.h"
#include "mu-msg-iter.h" #include "mu-msg-iter.h"
static gboolean update_msg (MuMsgIter *iter); static gboolean update_msg (MuMsgIter *iter);
struct _MuMsgIter { struct _MuMsgIter {
_MuMsgIter (const Xapian::Enquire &enq, size_t batchsize): _MuMsgIter (const Xapian::Enquire &enq, size_t batchsize):
_enq(enq), _batchsize(batchsize), _offset(0), _msg(0) { _enq(enq), _batchsize(batchsize), _offset(0), _msg(0) {
_matches = _enq.get_mset (0, _batchsize);
_cursor = _matches.begin();
_is_null = _matches.empty();
if (!_matches.empty())
update_msg (this);
}
_matches = _enq.get_mset (0, _batchsize); ~_MuMsgIter () {
_cursor = _matches.begin(); if (_msg)
_is_null = _matches.empty(); mu_msg_unref (_msg);
}
if (!_matches.empty())
update_msg (this);
}
~_MuMsgIter () {
if (_msg)
mu_msg_unref (_msg);
}
const Xapian::Enquire _enq; const Xapian::Enquire _enq;
Xapian::MSet _matches; Xapian::MSet _matches;
Xapian::MSet::const_iterator _cursor; Xapian::MSet::const_iterator _cursor;
size_t _batchsize, _offset; size_t _batchsize, _offset;
bool _is_null; bool _is_null;
Xapian::Document _doc; Xapian::Document _doc;
MuMsg *_msg; MuMsg *_msg;
}; };
@ -115,7 +116,7 @@ get_next_batch (MuMsgIter *iter)
iter->_cursor = iter->_matches.begin(); iter->_cursor = iter->_matches.begin();
iter->_is_null = false; iter->_is_null = false;
} }
return iter; return iter;
} }
@ -147,7 +148,7 @@ gboolean
mu_msg_iter_next (MuMsgIter *iter) mu_msg_iter_next (MuMsgIter *iter)
{ {
g_return_val_if_fail (iter, FALSE); g_return_val_if_fail (iter, FALSE);
if (mu_msg_iter_is_done(iter)) if (mu_msg_iter_is_done(iter))
return FALSE; return FALSE;
@ -169,7 +170,7 @@ mu_msg_iter_next (MuMsgIter *iter)
* it */ * it */
if (!message_is_readable (iter)) if (!message_is_readable (iter))
return mu_msg_iter_next (iter); return mu_msg_iter_next (iter);
/* try to get a new MuMsg based on the current doc */ /* try to get a new MuMsg based on the current doc */
return update_msg (iter); return update_msg (iter);
@ -195,7 +196,7 @@ mu_msg_iter_get_field (MuMsgIter *iter, MuMsgFieldId mfid)
{ {
g_return_val_if_fail (!mu_msg_iter_is_done(iter), NULL); g_return_val_if_fail (!mu_msg_iter_is_done(iter), NULL);
g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), NULL); g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), NULL);
return get_field (iter, mfid); return get_field (iter, mfid);
} }

View File

@ -1,5 +1,5 @@
/* /*
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** 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 ** under the terms of the GNU General Public License as published by the
@ -49,6 +49,7 @@ mu_msg_prio_char (MuMsgPrio prio)
g_return_val_if_fail (prio == 'l' || prio == 'n' || prio == 'h', g_return_val_if_fail (prio == 'l' || prio == 'n' || prio == 'h',
0); 0);
return (char)prio; return (char)prio;
} }

View File

@ -1,4 +1,5 @@
/* /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
**
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
** **
** This program is free software; you can redistribute it and/or modify it ** This program is free software; you can redistribute it and/or modify it