MemphisRuleSet: libmemphis Reference Manual

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

## Functions

MemphisRuleSet * | memphis_rule_set_new ()
void | memphis_rule_set_free ()
void | memphis_rule_set_load_from_file ()
void | memphis_rule_set_load_from_data ()
void | memphis_rule_set_set_bg_color ()
void | memphis_rule_set_get_bg_color ()
GList * | memphis_rule_set_get_rule_ids ()
void | memphis_rule_set_set_rule ()
MemphisRule * | memphis_rule_set_get_rule ()
gboolean | memphis_rule_set_remove_rule ()

## Types and Values

| MemphisRuleSet

## 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.

## Functions

### 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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

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);

#### Parameters

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.

#### Parameters

rules | a MemphisRuleSet |
id | an id string |

#### Returns

true if the rule could be found and removed.

Since: 0.1

## Types and Values

### MemphisRuleSet

    typedef struct _MemphisRuleSet MemphisRuleSet;