hb-map: HarfBuzz Manual

## hb-map hb-map — Object representing integer to integer mapping |

## Functions

hb_bool_t | hb_map_allocation_successful ()
void | hb_map_clear ()
hb_map_t * | hb_map_copy ()
hb_map_t * | hb_map_create ()
void | hb_map_del ()
void | hb_map_destroy ()
hb_codepoint_t | hb_map_get ()
hb_map_t * | hb_map_get_empty ()
unsigned int | hb_map_get_population ()
hb_bool_t | hb_map_is_equal ()
void * | hb_map_get_user_data ()
hb_bool_t | hb_map_has ()
unsigned int | hb_map_hash ()
hb_bool_t | hb_map_is_empty ()
hb_map_t * | hb_map_reference ()
void | hb_map_set ()
hb_bool_t | hb_map_set_user_data ()

## Types and Values

#define | HB_MAP_VALUE_INVALID
typedef | hb_map_t

## Includes

    #include <hb.h>

## Description

Map objects are integer-to-integer hash-maps. Currently they are not used in the HarfBuzz public API, but are provided for client's use if desired.

## Functions

### hb_map_allocation_successful ()

    hb_bool_t
    hb_map_allocation_successful (const hb_map_t *map);

Tests whether memory allocation for a set was successful.

#### Parameters

map | A map |

#### Returns

`true` if allocation succeeded, `false` otherwise

Since: 1.7.7

### hb_map_clear ()

    void
    hb_map_clear (hb_map_t *map);

Clears out the contents of `map` .

#### Parameters

map | A map |

Since: 1.7.7

### hb_map_copy ()

    hb_map_t *
    hb_map_copy (const hb_map_t *map);

Allocate a copy of `map` .

#### Parameters

map | A map |

#### Returns

Newly-allocated map.

Since: 4.4.0

### hb_map_create ()

    hb_map_t *
    hb_map_create (void);

Creates a new, initially empty map.

#### Returns

The new hb_map_t.

[transfer full]

Since: 1.7.7

### hb_map_del ()

    void
    hb_map_del (hb_map_t *map,
                hb_codepoint_t key);

Removes `key` and its stored value from `map` .

#### Parameters

map | A map |
key | The key to delete |

Since: 1.7.7

### hb_map_destroy ()

    void
    hb_map_destroy (hb_map_t *map);

Decreases the reference count on a map. When the reference count reaches zero, the map is destroyed, freeing all memory.

[skip]

#### Parameters

map | A map |

Since: 1.7.7

### hb_map_get ()

    hb_codepoint_t
    hb_map_get (const hb_map_t *map,
                hb_codepoint_t key);

Fetches the value stored for `key` in `map` .

#### Parameters

map | A map |
key | The key to query |

Since: 1.7.7

### hb_map_get_empty ()

    hb_map_t *
    hb_map_get_empty (void);

Fetches the singleton empty hb_map_t.

#### Returns

The empty hb_map_t.

[transfer full]

Since: 1.7.7

### hb_map_get_population ()

    unsigned int
    hb_map_get_population (const hb_map_t *map);

Returns the number of key-value pairs in the map.

#### Parameters

map | A map |

#### Returns

The population of `map`

Since: 1.7.7

### hb_map_is_equal ()

    hb_bool_t
    hb_map_is_equal (const hb_map_t *map,
                     const hb_map_t *other);

Tests whether `map` and `other` are equal (contain the same elements).

#### Parameters

map | A map |
other | Another map |

#### Returns

`true` if the two maps are equal, `false` otherwise.

Since: 4.3.0

### hb_map_get_user_data ()

    void *
    hb_map_get_user_data (const hb_map_t *map,
                          hb_user_data_key_t *key);

Fetches the user data associated with the specified key, attached to the specified map.

[skip]

#### Parameters

map | A map |
key | The user-data key to query |

#### Returns

A pointer to the user data.

[transfer none]

Since: 1.7.7

### hb_map_has ()

    hb_bool_t
    hb_map_has (const hb_map_t *map,
                hb_codepoint_t key);

Tests whether `key` is an element of `map` .

#### Parameters

map | A map |
key | The key to query |

#### Returns

`true` if `key` is found in `map` , `false` otherwise

Since: 1.7.7

### hb_map_hash ()

    unsigned int
    hb_map_hash (const hb_map_t *map);

Creates a hash representing `map` .

#### Parameters

map | A map |

#### Returns

A hash of `map` .

Since: 4.4.0

### hb_map_is_empty ()

    hb_bool_t
    hb_map_is_empty (const hb_map_t *map);

Tests whether `map` is empty (contains no elements).

#### Parameters

map | A map |

#### Returns

`true` if `map` is empty

Since: 1.7.7

### hb_map_reference ()

    hb_map_t *
    hb_map_reference (hb_map_t *map);

Increases the reference count on a map.

[skip]

#### Parameters

map | A map |

#### Returns

The map.

[transfer full]

Since: 1.7.7

### hb_map_set ()

    void
    hb_map_set (hb_map_t *map,
                hb_codepoint_t key,
                hb_codepoint_t value);

Stores `key` :`value` in the map.

#### Parameters

map | A map |
key | The key to store in the map |
value | The value to store for `key` |

Since: 1.7.7

### hb_map_set_user_data ()

    hb_bool_t
    hb_map_set_user_data (hb_map_t *map,
                          hb_user_data_key_t *key,
                          void *data,
                          hb_destroy_func_t destroy,
                          hb_bool_t replace);

Attaches a user-data key/data pair to the specified map.

[skip]

#### Parameters

map | A map |
key | The user-data key to set |
data | A pointer to the user data to set |
destroy | A callback to call when `data` is not needed anymore. | [nullable]
replace | Whether to replace an existing data with the same key |

#### Returns

`true` if success, `false` otherwise

Since: 1.7.7

## Types and Values

### HB_MAP_VALUE_INVALID

    #define HB_MAP_VALUE_INVALID ((hb_codepoint_t) -1)

Unset hb_map_t value.

Since: 1.7.7

### hb_map_t

    typedef struct hb_map_t hb_map_t;

Data type for holding integer-to-integer hash maps.