## E2kResult (private) E2kResult (private) — private E2kResult methods |

## Synopsis

    GArray *            e2k_results_array_new               (void);
    void                e2k_results_array_add_from_multistatus
                                                            (GArray *results_array,
                                                             SoupMessage *msg);
    void                e2k_results_array_free              (GArray *results_array,
                                                             gboolean free_results);
    void                e2k_results_from_multistatus        (SoupMessage *msg,
                                                             E2kResult **results,
                                                             gint *nresults);
    E2kResult *         e2k_results_copy                    (E2kResult *results,
                                                             gint nresults);

    E2kHTTPStatus       (*E2kResultIterFetchFunc)           (E2kResultIter *iter,
                                                             E2kContext *ctx,
                                                             E2kOperation *op,
                                                             E2kResult **results,
                                                             gint *nresults,
                                                             gint *first,
                                                             gint *total,
                                                             gpointer user_data);
    void                (*E2kResultIterFreeFunc)            (E2kResultIter *iter,
                                                             gpointer user_data);
    E2kResultIter *     e2k_result_iter_new                 (E2kContext *ctx,
                                                             E2kOperation *op,
                                                             gboolean ascending,
                                                             gint total,
                                                             E2kResultIterFetchFunc fetch_func,
                                                             E2kResultIterFreeFunc free_func,
                                                             gpointer user_data);

## Description

These are the E2kOperation methods used internally by E2kContext.

## Details

### e2k_results_array_new ()

    GArray *            e2k_results_array_new               (void);

Creates a new results array

Returns : | the array

### e2k_results_array_add_from_multistatus ()

    void                e2k_results_array_add_from_multistatus
                                                            (GArray *results_array,
                                                             SoupMessage *msg);

Constructs an E2kResult for each response in `msg` and appends them to `results_array`.

`results_array` : | a results array, created by `e2k_results_array_new()`
`msg` : | a 207 Multi-Status response

### e2k_results_array_free ()

    void                e2k_results_array_free              (GArray *results_array,
                                                             gboolean free_results);

Frees `results_array`, and optionally its contents

`results_array` : | the array
`free_results` : | whether or not to also free the contents of the array

### e2k_results_from_multistatus ()

    void                e2k_results_from_multistatus        (SoupMessage *msg,
                                                             E2kResult **results,
                                                             gint *nresults);

Parses `msg` and puts the results in *`results` and *`nresults`. The caller should free the data with `e2k_results_free()`

`msg` : | a 207 Multi-Status response
`results` : | pointer to a variable to store an array of E2kResult in
`nresults` : | pointer to a variable to store the length of *`results` in

### e2k_results_copy ()

    E2kResult *         e2k_results_copy                    (E2kResult *results,
                                                             gint nresults);

Performs a deep copy of `results`

`results` : | a results array returned from `e2k_results_from_multistatus()`
`nresults` : | the length of `results`
Returns : | a copy of `results`.

### E2kResultIterFetchFunc ()

    E2kHTTPStatus       (*E2kResultIterFetchFunc)           (E2kResultIter *iter,
                                                             E2kContext *ctx,
                                                             E2kOperation *op,
                                                             E2kResult **results,
                                                             gint *nresults,
                                                             gint *first,
                                                             gint *total,
                                                             gpointer user_data);

`iter` : |
`ctx` : |
`op` : |
`results` : |
`nresults` : |
`first` : |
`total` : |
`user_data` : |
Returns : |

### E2kResultIterFreeFunc ()

    void                (*E2kResultIterFreeFunc)            (E2kResultIter *iter,
                                                             gpointer user_data);

`iter` : |
`user_data` : |

### e2k_result_iter_new ()

    E2kResultIter *     e2k_result_iter_new                 (E2kContext *ctx,
                                                             E2kOperation *op,
                                                             gboolean ascending,
                                                             gint total,
                                                             E2kResultIterFetchFunc fetch_func,
                                                             E2kResultIterFreeFunc free_func,
                                                             gpointer user_data);

Creates a object that can be used to return the results of a Multi-Status query on `ctx`.

`fetch_func` will be called to fetch results, and it may update the first and total fields if necessary. If `ascending` is `TRUE`, then `e2k_result_iter_next()` will first return the first result, then the second result, etc. If `ascending` is `FALSE`, it will return the last result, then the second-to-last result, etc.

When all of the results returned by the first `fetch_func` call have been returned to the caller, `fetch_func` will be called again to get more results. This will continue until `fetch_func` returns 0 results, or returns an error code.

`ctx` : | an E2kContext
`op` : | an E2kOperation, to use for cancellation
`ascending` : | `TRUE` if results should be returned in ascending order, `FALSE` if they should be returned in descending order
`total` : | the total number of results that will be returned, or -1 if not yet known
`fetch_func` : | function to call to fetch more results
`free_func` : | function to call when the iterator is freed
`user_data` : | data to pass to `fetch_func` and `free_func`
Returns : | the new iterator

## See Also

E2kResult, E2kContext