1hdf_sort_obj(3)                 util/neo_hdf.h                 hdf_sort_obj(3)
2
3
4

NAME

6       hdf_sort_obj  - sort the children of an HDF node
7

SYNOPSIS

9       #include <util/neo_hdf.h>
10
11
12       hdf_sort_obj()
13
14
15

ARGUMENTS

17       h - HDF node
18       compareFunc - function which returns 1,0,-1 depending on some
19       criteria.  The arguments to this sort function
20       are pointers to pointers to HDF elements.  For
21       example:
22       int sortByName(const void *a, const void *b) {
23       HDF **ha = (HDF **)a;
24       HDF **hb = (HDF **)b;
25       *
26       return strcasecmp(hdf_obj_name(*ha), hdf_obj_name(*hb));
27       }
28       *
29
30

DESCRIPTION

32       hdf_sort_obj  will sort the children of an HDF node, based on the given
33       comparison function.  This function works by creating an array  of  the
34       pointers  for  each  child object of h, using qsort to sort that array,
35       and then re-ordering the linked list of children to the new order.  The
36       qsort  compare function uses a pointer to the value in the array, which
37       in our case is a pointer to an HDF struct, so your comparison  function
38       should work on HDF ** pointers.
39
40

RETURN VALUE

42       None (h children will be sorted)
43
44

SEE ALSO

46       hdf_set_symlink(3),         hdf_get_valuef(3),         compareFunc)(3),
47       hdf_dump_str(3),    hdf_get_int_value(3),    hdf_read_string_ignore(3),
48       hdf_copy(3),   hdf_get_node(3),   hdf_set_value(3),   hdf_obj_child(3),
49       hdf_read_string(3),      hdf_set_buf(3),      hdf_register_fileload(3),
50       hdf_get_obj(3),  hdf_get_attr(3),  hdf_obj_top(3),  hdf_dump_format(3),
51       hdf_destroy(3),  hdf_init(3),  hdf_obj_value(3),   hdf_write_string(3),
52       hdf_set_valuevf(3),      hdf_sort_obj(3),     hdf_write_file_atomic(3),
53       hdf_obj_attr(3), hdf_set_valuef(3), hdf_get_copy(3), hdf_write_file(3),
54       hdf_get_valuevf(3),          hdf_set_int_value(3),         hdf_dump(3),
55       hdf_get_value(3), hdf_set_copy(3), hdf_obj_next(3), hdf_search_path(3),
56       hdf_obj_name(3), hdf_set_attr(3), hdf_get_child(3), hdf_remove_tree
57
58
59
60ClearSilver                      12 July 2007                  hdf_sort_obj(3)
Impressum