![]() |
![]() |
![]() |
Xesam GLib Reference Manual | ![]() |
---|---|---|---|---|
XesamGHitPrivate; XesamGHit; const GValue* xesam_g_hit_get_field (XesamGHit *hit, const gchar *field_name); const gchar* xesam_g_hit_get_string (XesamGHit *hit, const gchar *field_name); const GValue* xesam_g_hit_get_field_by_id (XesamGHit *hit, guint field_id); guint xesam_g_hit_get_id (XesamGHit *hit); gchar** xesam_g_hit_get_field_names (XesamGHit *hit); const GPtrArray* xesam_g_hit_get_data (XesamGHit *hit);
The XesamGHit class conveniently maps the fields specified in the originating session's "hit-fields" property.
XesamGHit is available since 1.0
const GValue* xesam_g_hit_get_field (XesamGHit *hit, const gchar *field_name);
Get the value of a field by name look up. This method has the overhead
of a hash table look up. For even faster access use
xesam_g_hit_get_field_by_id()
.
Alternatively use xesam_g_hit_get_field_by_id()
if you know the
array index of the field in the session's hit-fields property.
If you know the data type of the field beforehand you can use the convenience
method xesam_g_hit_get_string()
to access the field value.
|
The hit object on which to look up a field value |
|
The fully qualified name of the field as set through the session property "hit-fields". |
Returns : |
The value of a named field. If the field is not known
NULL is returned.
|
const gchar* xesam_g_hit_get_string (XesamGHit *hit, const gchar *field_name);
Look up the value of a field containing a string. For generic field value
look ups use xesam_g_hit_get_field()
.
|
The hit to look up a string valued field on |
|
|
Returns : |
The string value of the field. The memory allocated by the string is private to the hit and should not be freed. |
const GValue* xesam_g_hit_get_field_by_id (XesamGHit *hit, guint field_id);
Look up a field value based on the offset of the field name in the sessions "hit-fields" property.
To look up a field by name use xesam_g_hit_get_field()
.
|
The hit object on which to look up a field value |
|
The offset the field in the session property "hit-fields". |
Returns : |
The value of a field given by its offset in the session's hit-fields property. |
guint xesam_g_hit_get_id (XesamGHit *hit);
The Hit id is the offset of the hit within the scope of all results returned by a XesamGSearch.
|
The hit to get the id for |
Returns : |
The hit id. This is defined as the offset of the hit relative to the total number of hits retrieved from the server. |
gchar** xesam_g_hit_get_field_names (XesamGHit *hit);
Return a NULL terminated array listing the field names
used in this Hit. You must free the array with g_strfreev()
.
|
The hit object for which to list the field names |
Returns : |
A NULL terminated array of strings
|
const GPtrArray* xesam_g_hit_get_data (XesamGHit *hit);
Get raw access to the hits field data. The data in the returned array map to the fields specified in "hit-fields" property.
|
The hit object for which to return the data list for |
Returns : |
A pointer array containing the raw hit data. This array should not be modified. |