mirror of https://github.com/djcb/mu.git
* mu-msg-iter-priv.cc: get rid of this with some void** casting tricks...
This commit is contained in:
parent
0c783567cf
commit
57498fb1a2
|
@ -74,7 +74,6 @@ libmu_la_SOURCES= \
|
|||
mu-msg-file.h \
|
||||
mu-msg-flags.c \
|
||||
mu-msg-flags.h \
|
||||
mu-msg-iter-priv.hh \
|
||||
mu-msg-iter.cc \
|
||||
mu-msg-iter.h \
|
||||
mu-msg-part.c \
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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 3 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef __MU_MSG_PRIV_HH__
|
||||
#define __MU_MSG_PRIV_HH__
|
||||
|
||||
#include <xapian.h>
|
||||
|
||||
/**
|
||||
* create a new MuMsgIter -- basically, an iterator over the search
|
||||
* results
|
||||
*
|
||||
* @param enq a Xapian::Enquiry providing access to search results
|
||||
* @param batchsize how many results to retrieve at once
|
||||
*
|
||||
* @return a new MuMsgIter, or NULL in case of error
|
||||
*/
|
||||
MuMsgIter *mu_msg_iter_new (const Xapian::Enquire& enq,
|
||||
size_t batchsize) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
#endif /*__MU_MSG_PRIV_HH__*/
|
|
@ -26,8 +26,6 @@
|
|||
#include "mu-util.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-iter-priv.hh"
|
||||
|
||||
|
||||
static gboolean update_msg (MuMsgIter *iter);
|
||||
|
||||
|
@ -62,10 +60,12 @@ struct _MuMsgIter {
|
|||
|
||||
|
||||
MuMsgIter*
|
||||
mu_msg_iter_new (const Xapian::Enquire& enq, size_t batchsize)
|
||||
mu_msg_iter_new (XapianEnquire *enq, size_t batchsize)
|
||||
{
|
||||
g_return_val_if_fail (enq, NULL);
|
||||
|
||||
try {
|
||||
return new MuMsgIter (enq, batchsize);
|
||||
return new MuMsgIter ((const Xapian::Enquire&)*enq, batchsize);
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,20 @@ G_BEGIN_DECLS
|
|||
struct _MuMsgIter;
|
||||
typedef struct _MuMsgIter MuMsgIter;
|
||||
|
||||
|
||||
/**
|
||||
* create a new MuMsgIter -- basically, an iterator over the search
|
||||
* results
|
||||
*
|
||||
* @param enq a Xapian::Enquire* cast to XapianEnquire* (because this
|
||||
* is C, not C++),providing access to search results
|
||||
* @param batchsize how many results to retrieve at once
|
||||
*
|
||||
* @return a new MuMsgIter, or NULL in case of error
|
||||
*/
|
||||
MuMsgIter *mu_msg_iter_new (XapianEnquire *enq,
|
||||
size_t batchsize) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get the next message (which you got from
|
||||
* e.g. mu_query_run)
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "mu-msg-fields.h"
|
||||
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-iter-priv.hh"
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "mu-str.h"
|
||||
|
@ -349,7 +348,7 @@ mu_query_run (MuQuery *self, const char* searchexpr,
|
|||
enq.set_query(query);
|
||||
enq.set_cutoff(0,0);
|
||||
|
||||
return mu_msg_iter_new (enq, batchsize);
|
||||
return mu_msg_iter_new ((XapianEnquire*)&enq, batchsize);
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ gboolean mu_util_check_dir (const gchar* path, gboolean readable,
|
|||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* get our the cache directory, typically, /tmp/mu-<userid>/
|
||||
*
|
||||
* @return the cache directory; don't free
|
||||
|
@ -244,11 +244,18 @@ enum {
|
|||
unsigned char mu_util_get_dtype_with_lstat (const char *path);
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* we need this when using Xapian::Document* from C
|
||||
*
|
||||
*/
|
||||
typedef gpointer XapianDocument;
|
||||
|
||||
/**
|
||||
* we need this when using Xapian::Enquire* from C
|
||||
*
|
||||
*/
|
||||
typedef gpointer XapianEnquire;
|
||||
|
||||
/**
|
||||
*
|
||||
* don't repeat these catch blocks everywhere...
|
||||
|
|
Loading…
Reference in New Issue