* mu-msg-field.[ch]: provide information about whether a field is a
range-field (i.e.., size, date)
This commit is contained in:
@ -60,8 +60,10 @@ enum _FieldFlags {
|
||||
* body */
|
||||
FLAG_NORMALIZE = 1 << 8, /* field needs flattening for
|
||||
* case/accents */
|
||||
FLAG_DONT_CACHE = 1 << 9 /* don't cache this field in
|
||||
FLAG_DONT_CACHE = 1 << 9, /* don't cache this field in
|
||||
* the MuMsg cache */
|
||||
FLAG_RANGE_FIELD = 1 << 10 /* whether this is a range field */
|
||||
|
||||
};
|
||||
typedef enum _FieldFlags FieldFlags;
|
||||
|
||||
@ -122,7 +124,7 @@ static const MuMsgField FIELD_DATA[] = {
|
||||
MU_MSG_FIELD_TYPE_TIME_T,
|
||||
"date", 'd', 'D',
|
||||
FLAG_GMIME | FLAG_XAPIAN_TERM | FLAG_XAPIAN_VALUE |
|
||||
FLAG_XAPIAN_BOOLEAN | FLAG_XAPIAN_PREFIX_ONLY
|
||||
FLAG_XAPIAN_BOOLEAN | FLAG_XAPIAN_PREFIX_ONLY | FLAG_RANGE_FIELD
|
||||
},
|
||||
|
||||
{
|
||||
@ -194,7 +196,7 @@ static const MuMsgField FIELD_DATA[] = {
|
||||
MU_MSG_FIELD_TYPE_BYTESIZE,
|
||||
"size", 'z', 'Z', /* siZe */
|
||||
FLAG_GMIME | FLAG_XAPIAN_TERM | FLAG_XAPIAN_VALUE |
|
||||
FLAG_XAPIAN_PREFIX_ONLY
|
||||
FLAG_XAPIAN_PREFIX_ONLY | FLAG_RANGE_FIELD
|
||||
},
|
||||
|
||||
{
|
||||
@ -267,7 +269,7 @@ static const MuMsgField* mu_msg_field (MuMsgFieldId id)
|
||||
|
||||
|
||||
void
|
||||
mu_msg_field_foreach (MuMsgFieldForEachFunc func, gconstpointer data)
|
||||
mu_msg_field_foreach (MuMsgFieldForeachFunc func, gconstpointer data)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i != MU_MSG_FIELD_ID_NUM; ++i)
|
||||
@ -286,7 +288,7 @@ mu_msg_field_id_from_name (const char* str, gboolean err)
|
||||
if (g_strcmp0(str, FIELD_DATA[i]._name) == 0)
|
||||
return FIELD_DATA[i]._id;
|
||||
|
||||
if (err)
|
||||
if (err)
|
||||
g_return_val_if_reached (MU_MSG_FIELD_ID_NONE);
|
||||
|
||||
return MU_MSG_FIELD_ID_NONE;
|
||||
@ -338,6 +340,15 @@ mu_msg_field_xapian_term (MuMsgFieldId id)
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
mu_msg_field_is_range_field (MuMsgFieldId id)
|
||||
{
|
||||
g_return_val_if_fail (mu_msg_field_id_is_valid(id),FALSE);
|
||||
return mu_msg_field(id)->_flags & FLAG_RANGE_FIELD ? TRUE: FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gboolean
|
||||
mu_msg_field_uses_boolean_prefix (MuMsgFieldId id)
|
||||
{
|
||||
|
||||
@ -82,7 +82,7 @@ enum _MuMsgFieldType {
|
||||
typedef guint8 MuMsgFieldType;
|
||||
static const MuMsgFieldType MU_MSG_FIELD_TYPE_NONE = (MuMsgFieldType)-1;
|
||||
|
||||
typedef void (*MuMsgFieldForEachFunc) (MuMsgFieldId id,
|
||||
typedef void (*MuMsgFieldForeachFunc) (MuMsgFieldId id,
|
||||
gconstpointer data);
|
||||
|
||||
/**
|
||||
@ -91,7 +91,7 @@ typedef void (*MuMsgFieldForEachFunc) (MuMsgFieldId id,
|
||||
* @param func a function called for each field
|
||||
* @param data a user data pointer passed the callback function
|
||||
*/
|
||||
void mu_msg_field_foreach (MuMsgFieldForEachFunc func, gconstpointer data);
|
||||
void mu_msg_field_foreach (MuMsgFieldForeachFunc func, gconstpointer data);
|
||||
|
||||
|
||||
/**
|
||||
@ -137,6 +137,7 @@ char mu_msg_field_xapian_prefix (MuMsgFieldId id) G_GNUC_PURE;
|
||||
MuMsgFieldType mu_msg_field_type (MuMsgFieldId id) G_GNUC_PURE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* is the field a string?
|
||||
*
|
||||
@ -221,7 +222,6 @@ gboolean mu_msg_field_xapian_value (MuMsgFieldId id) G_GNUC_PURE;
|
||||
gboolean mu_msg_field_uses_boolean_prefix (MuMsgFieldId id) G_GNUC_PURE;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* wether this fields needs a prefix in queries -- ie,
|
||||
* 'msgid:<some-message-id>' will only match with the explicit prefix,
|
||||
@ -253,10 +253,19 @@ gboolean mu_msg_field_xapian_escape (MuMsgFieldId id) G_GNUC_PURE;
|
||||
*
|
||||
* @param field a MuMsgField
|
||||
*
|
||||
* @return TRUE if the field is normalized, FALSE otherwise
|
||||
* @return TRUE if the field is to be normalized, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_msg_field_normalize (MuMsgFieldId id) G_GNUC_PURE;
|
||||
|
||||
/**
|
||||
* is this a range-field? ie. date, or size
|
||||
*
|
||||
* @param id a MuMsgField
|
||||
*
|
||||
* @return TRUE if this field is a range field, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_msg_field_is_range_field (MuMsgFieldId id) G_GNUC_PURE;
|
||||
|
||||
|
||||
/**
|
||||
* should this field be stored as contact information? This means that
|
||||
|
||||
Reference in New Issue
Block a user