From bf4314533bb81fdbc58fae19acb809977a228d04 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 17 May 2011 23:17:11 +0300 Subject: [PATCH] * mu-msg-db => mu-msg-doc --- src/{mu-msg-db.cc => mu-msg-doc.cc} | 19 ++++++------ src/{mu-msg-db.h => mu-msg-doc.h} | 46 ++++++++++++++--------------- 2 files changed, 32 insertions(+), 33 deletions(-) rename src/{mu-msg-db.cc => mu-msg-doc.cc} (82%) rename src/{mu-msg-db.h => mu-msg-doc.h} (61%) diff --git a/src/mu-msg-db.cc b/src/mu-msg-doc.cc similarity index 82% rename from src/mu-msg-db.cc rename to src/mu-msg-doc.cc index 5ded9f0c..15bc0eb0 100644 --- a/src/mu-msg-db.cc +++ b/src/mu-msg-doc.cc @@ -25,10 +25,10 @@ #include "mu-util.h" #include "mu-msg-fields.h" -#include "mu-msg-db.h" +#include "mu-msg-doc.h" -struct _MuMsgDb { - _MuMsgDb (const Xapian::Document& doc) : _doc (doc) {} +struct _MuMsgDoc { + _MuMsgDoc (const Xapian::Document& doc) : _doc (doc) {} const Xapian::Document doc() const { return _doc; } private: const Xapian::Document& _doc; @@ -36,14 +36,13 @@ private: }; -MuMsgDb* -mu_msg_db_new (const XapianDocument *doc, GError **err) +MuMsgDoc* +mu_msg_doc_new (const XapianDocument *doc, GError **err) { g_return_val_if_fail (doc, NULL); try { - MuMsgDb *db = new MuMsgDb ((const Xapian::Document&)*doc); - return db; + return new MuMsgDoc ((const Xapian::Document&)*doc); } MU_XAPIAN_CATCH_BLOCK_G_ERROR_RETURN(err, MU_ERROR_XAPIAN, NULL); @@ -51,7 +50,7 @@ mu_msg_db_new (const XapianDocument *doc, GError **err) } void -mu_msg_db_destroy (MuMsgDb *self) +mu_msg_doc_destroy (MuMsgDoc *self) { try { delete self; @@ -61,7 +60,7 @@ mu_msg_db_destroy (MuMsgDb *self) gchar* -mu_msg_db_get_str_field (MuMsgDb *self, MuMsgFieldId mfid, gboolean *do_free) +mu_msg_doc_get_str_field (MuMsgDoc *self, MuMsgFieldId mfid, gboolean *do_free) { g_return_val_if_fail (self, NULL); g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), NULL); @@ -78,7 +77,7 @@ mu_msg_db_get_str_field (MuMsgDb *self, MuMsgFieldId mfid, gboolean *do_free) gint64 -mu_msg_db_get_num_field (MuMsgDb *self, MuMsgFieldId mfid) +mu_msg_doc_get_num_field (MuMsgDoc *self, MuMsgFieldId mfid) { g_return_val_if_fail (self, -1); g_return_val_if_fail (mu_msg_field_id_is_valid(mfid), -1); diff --git a/src/mu-msg-db.h b/src/mu-msg-doc.h similarity index 61% rename from src/mu-msg-db.h rename to src/mu-msg-doc.h index 380fe367..6acd3a4d 100644 --- a/src/mu-msg-db.h +++ b/src/mu-msg-doc.h @@ -17,70 +17,70 @@ ** */ -#ifndef __MU_MSG_DB_H__ -#define __MU_MSG_DB_H__ +#ifndef __MU_MSG_DOC_H__ +#define __MU_MSG_DOC_H__ #include #include /* for XapianDocument */ G_BEGIN_DECLS -struct _MuMsgDb; -typedef struct _MuMsgDb MuMsgDb; +struct _MuMsgDoc; +typedef struct _MuMsgDoc MuMsgDoc; /** - * create a new MuMsgDb instance + * create a new MuMsgDoc instance * * @param doc a Xapian::Document* (you'll need to cast the * Xapian::Document* to XapianDocument*, because only C (not C++) is * allowed in this header file. * @param err receives error info, or NULL * - * @return a new MuMsgDb instance (free with mu_msg_db_destroy), or + * @return a new MuMsgDoc instance (free with mu_msg_doc_destroy), or * NULL in case of error. */ -MuMsgDb* mu_msg_db_new (const XapianDocument *doc, GError **err); - +MuMsgDoc* mu_msg_doc_new (const XapianDocument *doc, GError **err) + G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; /** - * destroy a MuMsgDb instance -- free all the resources. Note, after - * destroying, any strings returned from mu_msg_db_get_str_field with + * destroy a MuMsgDoc instance -- free all the resources. Note, after + * destroying, any strings returned from mu_msg_doc_get_str_field with * do_free==FALSE are no longer valid * - * @param self a MuMsgDb instance + * @param self a MuMsgDoc instance */ -void mu_msg_db_destroy (MuMsgDb *self); +void mu_msg_doc_destroy (MuMsgDoc *self); /** - * get a string parameter from the msgdb + * get a string parameter from the msgdoc * - * @param self a MuMsgDb instance + * @param self a MuMsgDoc instance * @param mfid a MuMsgFieldId for a string field * @param do_free receives either TRUE or FALSE, where TRUE means that * the caller owns the string, and has to free it (g_free) when done - * with it; FALSE means that the MuMsgDb owns the string, and it is - * only valid as long as the MuMsgDb is valid (ie., before - * mu_msg_db_destroy). + * with it; FALSE means that the MuMsgDoc owns the string, and it is + * only valid as long as the MuMsgDoc is valid (ie., before + * mu_msg_doc_destroy). * * @return a string for the given field (see do_free), or NULL in case of error */ -gchar* mu_msg_db_get_str_field (MuMsgDb *self, MuMsgFieldId mfid, gboolean *do_free); +gchar* mu_msg_doc_get_str_field (MuMsgDoc *self, MuMsgFieldId mfid, gboolean *do_free) + G_GNUC_WARN_UNUSED_RESULT; /** * - * get a numeric parameter from the msgdb + * get a numeric parameter from the msgdoc * - * @param self a MuMsgDb instance + * @param self a MuMsgDoc instance * @param mfid a MuMsgFieldId for a numeric field * * @return the numerical value, or -1 in case of error. You'll need to * cast this value to the actual type (e.g. time_t for MU_MSG_FIELD_ID_DATE) */ -gint64 mu_msg_db_get_num_field (MuMsgDb *self, MuMsgFieldId mfid); - +gint64 mu_msg_doc_get_num_field (MuMsgDoc *self, MuMsgFieldId mfid); G_END_DECLS -#endif /*__MU_MSG_DB_H__*/ +#endif /*__MU_MSG_DOC_H__*/