## IpatchRange

IpatchRange — A boxed type which defines a number range

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IpatchRange;
                        IpatchParamSpecRange;
    #define             IPATCH_TYPE_RANGE
    #define             IPATCH_VALUE_HOLDS_RANGE            (value)
    #define             IPATCH_RANGE_SET_VALUES             (range, val1, val2)
    #define             IPATCH_RANGE_SET_NULL               (range)
    IpatchRange *       ipatch_range_new                    (int low,
                                                             int high);
    IpatchRange *       ipatch_range_copy                   (IpatchRange *range);
    void                ipatch_range_free                   (IpatchRange *range);
    void                ipatch_value_set_range              (GValue *value,
                                                             const IpatchRange *range);
    void                ipatch_value_set_static_range       (GValue *value,
                                                             IpatchRange *range);
    IpatchRange *       ipatch_value_get_range              (const GValue *value);
    #define             IPATCH_TYPE_PARAM_RANGE
    GType               ipatch_param_spec_range_get_type    (void);
    GParamSpec *        ipatch_param_spec_range             (const char *name,
                                                             const char *nick,
                                                             const char *blurb,
                                                             int min,
                                                             int max,
                                                             int default_low,
                                                             int default_high,
                                                             GParamFlags flags);

## Description

Boxed type used for GValue and GParamSpec properties. Consists of a low and a high integer value defining a range.

## Details

### IpatchRange

    typedef struct {
      int low;		/* low endpoint of range or -1 if undefined */
      int high;	       /* high endpoint of range or -1 if undefined */
    } IpatchRange;

### IpatchParamSpecRange

    typedef struct {
      GParamSpec parent_instance;	/* derived from GParamSpec */
      int min, max;		  /* min and max values for range endpoints */
      int default_low, default_high; /* default vals for low and high endpoints */
    } IpatchParamSpecRange;

### IPATCH_TYPE_RANGE

    #define IPATCH_TYPE_RANGE   (ipatch_range_get_type ())

### IPATCH_VALUE_HOLDS_RANGE()

    #define             IPATCH_VALUE_HOLDS_RANGE(value)

### IPATCH_RANGE_SET_VALUES()

    #define             IPATCH_RANGE_SET_VALUES(range, val1, val2)

### IPATCH_RANGE_SET_NULL()

    #define             IPATCH_RANGE_SET_NULL(range)

### ipatch_range_new ()

    IpatchRange *       ipatch_range_new                    (int low,
                                                             int high);

Create a new value range structure (to store an integer range).

`low` : | Low value to initialize range to
`high` : | High value to initialize range to
Returns : | Newly allocated integer range structure.

### ipatch_range_copy ()

    IpatchRange *       ipatch_range_copy                   (IpatchRange *range);

Duplicates an integer range structure.

`range` : | Range structure to duplicate
Returns : | New duplicate range structure.

### ipatch_range_free ()

    void                ipatch_range_free                   (IpatchRange *range);

Free a range structure previously allocated with `ipatch_range_new()`.

`range` : | Integer range structure to free

### ipatch_value_set_range ()

    void                ipatch_value_set_range              (GValue *value,
                                                             const IpatchRange *range);

Set the range values of a IPATCH_TYPE_RANGE GValue. The `range` structure is copied.

`value` : | a valid GValue of IPATCH_TYPE_RANGE boxed type
`range` : | Range structure to assign to `value`

### ipatch_value_set_static_range ()

    void                ipatch_value_set_static_range       (GValue *value,
                                                             IpatchRange *range);

Set the range values of a IPATCH_TYPE_RANGE GValue. This function uses `range` directly and so it should be static, use `ipatch_value_set_range()` if the `range` value should be duplicated.

`value` : | A valid GValue of IPATCH_TYPE_RANGE boxed type
`range` : | Range structure to assign to `value`

### ipatch_value_get_range ()

    IpatchRange *       ipatch_value_get_range              (const GValue *value);

Get the range structure from a IPATCH_TYPE_RANGE GValue.

`value` : | A valid GValue of IPATCH_TYPE_RANGE boxed type
Returns : | IpatchRange structure containing the range values of `value` or `NULL` if not set. The returned structure is NOT duplicated and is the same pointer used in `value`.

### IPATCH_TYPE_PARAM_RANGE

    #define IPATCH_TYPE_PARAM_RANGE (ipatch_param_spec_range_get_type ())

### ipatch_param_spec_range_get_type ()

    GType               ipatch_param_spec_range_get_type    (void);

### ipatch_param_spec_range ()

    GParamSpec *        ipatch_param_spec_range             (const char *name,
                                                             const char *nick,
                                                             const char *blurb,
                                                             int min,
                                                             int max,
                                                             int default_low,
                                                             int default_high,
                                                             GParamFlags flags);

Create a parameter specification for IPATCH_TYPE_RANGE GValues.

`name` : | Property name
`nick` : | Property nick name
`blurb` : | Property description blurb
`min` : | Minimum value for range end points (can be -1 to allow undefined ranges)
`max` : | Maximum value for range end points
`default_low` : | Default value for low endpoint of range
`default_high` : | Default value for high endpoint of range
`flags` : | Property flags
Returns : | New range parameter specification.