## Sorting Utilities

Sorting Utilities

## Synopsis

    gboolean            e_table_sorting_utils_affects_sort  (ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint compare_col);
    void                e_table_sorting_utils_sort          (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows);
    gint                e_table_sorting_utils_insert        (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows,
                                                             gint row);
    gint                e_table_sorting_utils_check_position
                                                            (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows,
                                                             gint view_row);
    void                e_table_sorting_utils_tree_sort     (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count);
    gint                e_table_sorting_utils_tree_check_position
                                                            (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count,
                                                             gint old_index);
    gint                e_table_sorting_utils_tree_insert   (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count,
                                                             ETreePath path);
    gpointer            e_table_sorting_utils_create_cmp_cache
                                                            (void);
    void                e_table_sorting_utils_free_cmp_cache
                                                            (gpointer cmp_cache);
    void                e_table_sorting_utils_add_to_cmp_cache
                                                            (gpointer cmp_cache,
                                                             const gchar *key,
                                                             gchar *value);
    const gchar *       e_table_sorting_utils_lookup_cmp_cache
                                                            (gpointer cmp_cache,
                                                             const gchar *key);

## Description

## Details

### e_table_sorting_utils_affects_sort ()

    gboolean            e_table_sorting_utils_affects_sort  (ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint compare_col);

### e_table_sorting_utils_sort ()

    void                e_table_sorting_utils_sort          (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows);

### e_table_sorting_utils_insert ()

    gint                e_table_sorting_utils_insert        (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows,
                                                             gint row);

### e_table_sorting_utils_check_position ()

    gint                e_table_sorting_utils_check_position
                                                            (ETableModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             gint *map_table,
                                                             gint rows,
                                                             gint view_row);

### e_table_sorting_utils_tree_sort ()

    void                e_table_sorting_utils_tree_sort     (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count);

### e_table_sorting_utils_tree_check_position ()

    gint                e_table_sorting_utils_tree_check_position
                                                            (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count,
                                                             gint old_index);

### e_table_sorting_utils_tree_insert ()

    gint                e_table_sorting_utils_tree_insert   (ETreeModel *source,
                                                             ETableSortInfo *sort_info,
                                                             ETableHeader *full_header,
                                                             ETreePath *map_table,
                                                             gint count,
                                                             ETreePath path);

### e_table_sorting_utils_create_cmp_cache ()

    gpointer            e_table_sorting_utils_create_cmp_cache
                                                            (void);

Creates a new compare cache, which is storing pairs of string keys and string values. This can be accessed by `e_table_sorting_utils_lookup_cmp_cache()` and `e_table_sorting_utils_add_to_cmp_cache()`.

Returned pointer should be freed with `e_table_sorting_utils_free_cmp_cache()`.

### e_table_sorting_utils_free_cmp_cache ()

    void                e_table_sorting_utils_free_cmp_cache
                                                            (gpointer cmp_cache);

Frees a compare cache previously created with `e_table_sorting_utils_create_cmp_cache()`.

`cmp_cache` : | a compare cache; cannot be `NULL`

### e_table_sorting_utils_add_to_cmp_cache ()

    void                e_table_sorting_utils_add_to_cmp_cache
                                                            (gpointer cmp_cache,
                                                             const gchar *key,
                                                             gchar *value);

Adds a new value for a given key to a compare cache. If such key already exists in a cache then its value will be replaced. Note: Given `value` will be stolen and later freed with g_free.

`cmp_cache` : | a compare cache; cannot be `NULL`
`key` : | unique key to a cache; cannot be `NULL`
`value` : | value to store for a key

### e_table_sorting_utils_lookup_cmp_cache ()

    const gchar *       e_table_sorting_utils_lookup_cmp_cache
                                                            (gpointer cmp_cache,
                                                             const gchar *key);

Looks ups `key` in `cmp_cache`, which is passed in GCompareDataFunc as 'data'.

`cmp_cache` : | a compare cache
`key` : | unique key to a cache
Returns : | `NULL` when not found or the cache wasn't provided.