MemphisRuleSet

## MemphisRuleSet MemphisRuleSet — Defines drawing rules for the renderer. |

## Synopsis

                        MemphisRuleSet;
    MemphisRuleSet*     memphis_rule_set_new                ();
    void                memphis_rule_set_free               (MemphisRuleSet *rules);
    void                memphis_rule_set_load_from_file     (MemphisRuleSet *rules,
                                                             const gchar *filename,
                                                             GError **error);
    void                memphis_rule_set_load_from_data     (MemphisRuleSet *rules,
                                                             const gchar *data,
                                                             guint size,
                                                             GError **error);
    void                memphis_rule_set_set_bg_color       (MemphisRuleSet *rules,
                                                             guint8 r,
                                                             guint8 g,
                                                             guint8 b,
                                                             guint8 a);
    void                memphis_rule_set_get_bg_color       (MemphisRuleSet *rules,
                                                             guint8 *r,
                                                             guint8 *g,
                                                             guint8 *b,
                                                             guint8 *a);
    GList*              memphis_rule_set_get_rule_ids       (MemphisRuleSet *rules);
    void                memphis_rule_set_set_rule           (MemphisRuleSet *rules,
                                                             MemphisRule *rule);
    MemphisRule*        memphis_rule_set_get_rule           (MemphisRuleSet *rules,
                                                             const gchar *id);
    gboolean            memphis_rule_set_remove_rule        (MemphisRuleSet *rules,
                                                             const gchar *id);

## Object Hierarchy

      GObject
       +----MemphisRuleSet

## Description

This Object defines drawing rules for a MemphisRenderer. The rules can be loaded from an XML file or can they be defined during execution time.

## Details

### MemphisRuleSet

    typedef struct _MemphisRuleSet MemphisRuleSet;

### memphis_rule_set_new ()

    MemphisRuleSet*     memphis_rule_set_new                ();

Returns : | a new MemphisRuleSet whithout any rules.

Since 0.1

### memphis_rule_set_free ()

    void                memphis_rule_set_free               (MemphisRuleSet *rules);

Frees the memory of a MemphisRuleSet.

`rules` : | a MemphisRuleSet

Since 0.1

### memphis_rule_set_load_from_file ()

    void                memphis_rule_set_load_from_file     (MemphisRuleSet *rules,
                                                             const gchar *filename,
                                                             GError **error);

Load rules from an XML file.

`rules` : | a MemphisRuleSet
`filename` : | a path to a rules file
`error` : | a pointer to a GError or NULL

Since 0.2

### memphis_rule_set_load_from_data ()

    void                memphis_rule_set_load_from_data     (MemphisRuleSet *rules,
                                                             const gchar *data,
                                                             guint size,
                                                             GError **error);

Load rules data from an XML file.

`rules` : | a MemphisRuleSet
`data` : | a character array with rules XML data
`size` : | the size of the array
`error` : | a pointer to a GError or NULL

Since 0.2

### memphis_rule_set_set_bg_color ()

    void                memphis_rule_set_set_bg_color       (MemphisRuleSet *rules,
                                                             guint8 r,
                                                             guint8 g,
                                                             guint8 b,
                                                             guint8 a);

Sets the background color and transparency rule.

`rules` : | a MemphisRuleSet
`r` : | red color component
`g` : | green color component
`b` : | blue color component
`a` : | transparency

Since 0.1

### memphis_rule_set_get_bg_color ()

    void                memphis_rule_set_get_bg_color       (MemphisRuleSet *rules,
                                                             guint8 *r,
                                                             guint8 *g,
                                                             guint8 *b,
                                                             guint8 *a);

Assigns the background color and the transparency of the background to r, g, b and a.

`rules` : | a MemphisRuleSet
`r` : | red color component. [out]
`g` : | green color component. [out]
`b` : | blue color component. [out]
`a` : | transparency. [out]

Since 0.1

### memphis_rule_set_get_rule_ids ()

    GList*              memphis_rule_set_get_rule_ids       (MemphisRuleSet *rules);

`rules` : | a MemphisRuleSet
Returns : | a list of rule id strings. Free the list with g_list_free when done. These strings have the following form: key1|key2|...|keyN:value1|value2|...|valueM Example: "waterway:river|stream|canal". [transfer full]

Since 0.1

### memphis_rule_set_set_rule ()

    void                memphis_rule_set_set_rule           (MemphisRuleSet *rules,
                                                             MemphisRule *rule);

Adds the given rule to the rule set.

`rules` : | a MemphisRuleSet
`rule` : | a MemphisRule

Since 0.1

### memphis_rule_set_get_rule ()

    MemphisRule*        memphis_rule_set_get_rule           (MemphisRuleSet *rules,
                                                             const gchar *id);

`rules` : | a MemphisRuleSet
`id` : | an id string
Returns : | a MemphisRule that has the given id string or NULL otherwise. [allow-none]

Since 0.1

### memphis_rule_set_remove_rule ()

    gboolean            memphis_rule_set_remove_rule        (MemphisRuleSet *rules,
                                                             const gchar *id);

Removes the rule with the given id from the rules set.

`rules` : | a MemphisRuleSet
`id` : | an id string
Returns : | true if the rule could be found and removed.

Since 0.1