GrssFeedItem: libgrss Reference Manual

## GrssFeedItem GrssFeedItem — a feed item |

## Functions

GrssFeedItem * | grss_feed_item_new ()
GrssFeedChannel * | grss_feed_item_get_parent ()
void | grss_feed_item_set_id ()
const gchar * | grss_feed_item_get_id ()
void | grss_feed_item_set_title ()
const gchar * | grss_feed_item_get_title ()
void | grss_feed_item_set_description ()
const gchar * | grss_feed_item_get_description ()
void | grss_feed_item_add_category ()
const GList * | grss_feed_item_get_categories ()
gboolean | grss_feed_item_set_source ()
const gchar * | grss_feed_item_get_source ()
gboolean | grss_feed_item_set_real_source ()
void | grss_feed_item_get_real_source ()
void | grss_feed_item_set_related ()
const gchar * | grss_feed_item_get_related ()
void | grss_feed_item_set_copyright ()
const gchar * | grss_feed_item_get_copyright ()
void | grss_feed_item_set_author ()
GrssPerson * | grss_feed_item_get_author ()
void | grss_feed_item_add_contributor ()
const GList * | grss_feed_item_get_contributors ()
gboolean | grss_feed_item_set_comments_url ()
const gchar * | grss_feed_item_get_comments_url ()
void | grss_feed_item_set_geo_point ()
gboolean | grss_feed_item_get_geo_point ()
void | grss_feed_item_set_publish_time ()
time_t | grss_feed_item_get_publish_time ()
void | grss_feed_item_add_enclosure ()
const GList * | grss_feed_item_get_enclosures ()

## Types and Values

#define | GRSS_FEED_ITEM_TYPE

## Object Hierarchy

        GObject
        ╰── GrssFeedItem

## Description

GrssFeedItem is an abstraction for an item, collects all information about a single element found into a feed. It mostly is a passive container for attributes.

## Functions

### grss_feed_item_new ()

    GrssFeedItem *
    grss_feed_item_new (GrssFeedChannel *parent);

To allocate a new empty GrssFeedItem.

#### Parameters

parent | the feed from which the new item belongs. |

#### Returns

a new GrssFeedItem.

### grss_feed_item_get_parent ()

    GrssFeedChannel *
    grss_feed_item_get_parent (GrssFeedItem *item);

Retrieves the feed from which the item belongs.

#### Parameters

item | a GrssFeedItem. |

#### Returns

the parent feed, as set in `grss_feed_item_new()`.

[transfer none]

### grss_feed_item_set_id ()

    void
    grss_feed_item_set_id (GrssFeedItem *item,
                           gchar *id);

To set the ID of the `item` . This parameter has not a particular format: it is just a string used to identify in unique way the item.

#### Parameters

item | a GrssFeedItem. |
id | the new ID to set. |

### grss_feed_item_get_id ()

    const gchar *
    grss_feed_item_get_id (GrssFeedItem *item);

Retrieves the ID assigned to the `item` . If no ID was set with `grss_feed_item_set_id()` this returns the same of `grss_feed_item_get_source()`. Pay attention to the fact this library do not check uniqueness of assigned IDs.

#### Parameters

item | GrssFeedItem from which retrieve the ID. |

#### Returns

ID of the item.

### grss_feed_item_set_title ()

    void
    grss_feed_item_set_title (GrssFeedItem *item,
                              gchar *title);

To set a title to the `item` .

#### Parameters

item | a GrssFeedItem. |
title | title of the item. |

### grss_feed_item_get_title ()

    const gchar *
    grss_feed_item_get_title (GrssFeedItem *item);

Retrieves the title assigned to `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

title of the element.

### grss_feed_item_set_description ()

    void
    grss_feed_item_set_description (GrssFeedItem *item,
                                    gchar *description);

To set the description of `item` . Usually "description" means his content.

#### Parameters

item | a GrssFeedItem. |
description | content of the item. |

### grss_feed_item_get_description ()

    const gchar *
    grss_feed_item_get_description (GrssFeedItem *item);

Retrieves the description of the `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

description of `item` .

### grss_feed_item_add_category ()

    void
    grss_feed_item_add_category (GrssFeedItem *item,
                                 gchar *category);

Adds a category to the `item` . The complete list can be obtained with `grss_feed_item_get_categories()`.

#### Parameters

item | a GrssFeedItem. |
category | a new category to assign to the item. |

### grss_feed_item_get_categories ()

    const GList *
    grss_feed_item_get_categories (GrssFeedItem *item);

Retrieves list of categories assigned to the `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

list of strings, one for assigned category. Do not free or modify this list.

[element-type utf8][transfer none]

### grss_feed_item_set_source ()

    gboolean
    grss_feed_item_set_source (GrssFeedItem *item,
                               gchar *source);

To set the source of the `item` .

#### Parameters

item | a GrssFeedItem. |
source | URL of the item. |

#### Returns

`TRUE` if `source` is a valid URL, `FALSE` otherwise

### grss_feed_item_get_source ()

    const gchar *
    grss_feed_item_get_source (GrssFeedItem *item);

Retrieves the URL where the `item` can be found.

#### Parameters

item | a GrssFeedItem. |

#### Returns

URL of the item, or `NULL`.

### grss_feed_item_set_real_source ()

    gboolean
    grss_feed_item_set_real_source (GrssFeedItem *item,
                                    gchar *realsource,
                                    gchar *title);

To set an alternative real source for `item` . This parameter is used by web aggregators to explicit the origin of a content reproduced in them.

#### Parameters

item | a GrssFeedItem. |
realsource | URL of the real source for the item. |
title | title of the real source. |

#### Returns

`TRUE` if `realsource` is a valid URL, `FALSE` otherwise

### grss_feed_item_get_real_source ()

    void
    grss_feed_item_get_real_source (GrssFeedItem *item,
                                    const gchar **realsource,
                                    const gchar **title);

Retrieves references to the real source of `item` .

#### Parameters

item | a GrssFeedItem. |
realsource | will be assigned to the URL of the real source, or `NULL`. |
title | will be assigned to the title of the real source, or `NULL`. |

### grss_feed_item_set_related ()

    void
    grss_feed_item_set_related (GrssFeedItem *item,
                                gchar *related);

To set reference to a post related to `item` .

#### Parameters

item | a GrssFeedItem. |
related | reference to a related post. |

### grss_feed_item_get_related ()

    const gchar *
    grss_feed_item_get_related (GrssFeedItem *item);

Retrieves indication about posts related to `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

related posts, or `NULL`.

### grss_feed_item_set_copyright ()

    void
    grss_feed_item_set_copyright (GrssFeedItem *item,
                                  gchar *copyright);

To set a copyright reference to `item` .

#### Parameters

item | a GrssFeedItem. |
copyright | copyright declaration for the item. |

### grss_feed_item_get_copyright ()

    const gchar *
    grss_feed_item_get_copyright (GrssFeedItem *item);

Retrieves copyright reference for the `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

copyright mark, or `NULL`.

### grss_feed_item_set_author ()

    void
    grss_feed_item_set_author (GrssFeedItem *item,
                               GrssPerson *author);

To assign an author to the `item` .

#### Parameters

item | a GrssFeedItem. |
author | a GrssPerson. |

### grss_feed_item_get_author ()

    GrssPerson *
    grss_feed_item_get_author (GrssFeedItem *item);

Retrieves the author of `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

GrssPerson, or `NULL`.

### grss_feed_item_add_contributor ()

    void
    grss_feed_item_add_contributor (GrssFeedItem *item,
                                    GrssPerson *contributor);

To add a contributor to the `item` .

#### Parameters

item | a GrssFeedItem. |
contributor | a GrssPerson. |

### grss_feed_item_get_contributors ()

    const GList *
    grss_feed_item_get_contributors (GrssFeedItem *item);

Retrieves contributors for `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

list of contributors to the item.

[element-type GrssPerson][transfer none]

### grss_feed_item_set_comments_url ()

    gboolean
    grss_feed_item_set_comments_url (GrssFeedItem *item,
                                     gchar *url);

To assign the URL where to fetch comments for the item.

#### Parameters

item | a GrssFeedItem. |
url | URL where to retrieve comments to the item. |

#### Returns

`TRUE` if `url` is a valid URL, `FALSE` otherwise

### grss_feed_item_get_comments_url ()

    const gchar *
    grss_feed_item_get_comments_url (GrssFeedItem *item);

Retrieves the URL where to catch comments to the `item` .

#### Parameters

item | a GrssFeedItem. |

#### Returns

URL to parse to read comments for `item` , or `NULL`.

### grss_feed_item_set_geo_point ()

    void
    grss_feed_item_set_geo_point (GrssFeedItem *item,
                                  double latitude,
                                  double longitude);

To assign geographic context to the `item` . Passing -1 as `latitude` or `longitude` , the relative value is untouched in the object. This is to easy assignment of coordinates in more than a single step. If both are -1, nothing happens.

#### Parameters

item | a GrssFeedItem. |
latitude | latitude of the point, or -1 to leave the previous one. |
longitude | longitude of the point, or -1 to leave the previous one. |

### grss_feed_item_get_geo_point ()

    gboolean
    grss_feed_item_get_geo_point (GrssFeedItem *item,
                                  double *latitude,
                                  double *longitude);

Retrieves the geo reference of the `item` .

#### Parameters

item | a GrssFeedItem. |
latitude | will be assigned to the latitude of the point, or `NULL`. |
longitude | will be assigned to the longitude of the point, or `NULL`. |

#### Returns

`TRUE` if `item` has geographic coordinates assigned and `latitude` and `longitude` have been set, `FALSE` if `item` has not geo reference.

### grss_feed_item_set_publish_time ()

    void
    grss_feed_item_set_publish_time (GrssFeedItem *item,
                                     time_t publish);

To set the publish time of the item.

#### Parameters

item | a GrssFeedItem. |
publish | publishing timestamp of the item. |

### grss_feed_item_get_publish_time ()

    time_t
    grss_feed_item_get_publish_time (GrssFeedItem *item);

Retrieves the publish time of the item. By default this value is the current timestamp assigned when creating the GrssFeedItem, and may be changed with `grss_feed_item_set_publish_time()`.

#### Parameters

item | a GrssFeedItem. |

#### Returns

publish time of `item` .

### grss_feed_item_add_enclosure ()

    void
    grss_feed_item_add_enclosure (GrssFeedItem *item,
                                  GrssFeedEnclosure *enclosure);

Adds an enclosure to the `item` . That external elements may be references to images, videos, or other contents (usually multimedial) embedded in the element.

#### Parameters

item | a GrssFeedItem. |
enclosure | a GrssFeedEnclosure to add to the item. |

### grss_feed_item_get_enclosures ()

    const GList *
    grss_feed_item_get_enclosures (GrssFeedItem *item);

Retrieves the list of enclosures added with `grss_feed_item_add_enclosure()`.

#### Parameters

item | a GrssFeedItem. |

#### Returns

a list of GrssFeedEnclosure. This is a direct reference to the internal list, do not free or modify it.

[element-type GrssFeedEnclosure][transfer none]

## Types and Values

### GRSS_FEED_ITEM_TYPE

    #define GRSS_FEED_ITEM_TYPE		(grss_feed_item_get_type())