Typedefs | |
typedef struct stp_list_item | stp_list_item_t |
The list item opaque data type. | |
typedef struct stp_list | stp_list_t |
The list opaque data type. | |
typedef void(* | stp_node_freefunc )(void *) |
A callback function to free the data a node contains. | |
typedef void *(* | stp_node_copyfunc )(const void *) |
A callback function to copy the data a node contains. | |
typedef const char *(* | stp_node_namefunc )(const void *) |
A callback function to get the name of a node. | |
typedef int(* | stp_node_sortfunc )(const void *, const void *) |
A callback function to compare two nodes. | |
Functions | |
void | stp_list_node_free_data (void *item) |
Free node data allocated with stp_malloc. | |
stp_list_t * | stp_list_create (void) |
Create a new list object. | |
stp_list_t * | stp_list_copy (const stp_list_t *list) |
Copy and allocate a list object. | |
int | stp_list_destroy (stp_list_t *list) |
Destroy a list object. | |
stp_list_item_t * | stp_list_get_start (const stp_list_t *list) |
Find the first item in a list. | |
stp_list_item_t * | stp_list_get_end (const stp_list_t *list) |
Find the last item in a list. | |
stp_list_item_t * | stp_list_get_item_by_index (const stp_list_t *list, int idx) |
Find an item in a list by its index. | |
stp_list_item_t * | stp_list_get_item_by_name (const stp_list_t *list, const char *name) |
Find an item in a list by its name. | |
stp_list_item_t * | stp_list_get_item_by_long_name (const stp_list_t *list, const char *long_name) |
Find an item in a list by its long name. | |
int | stp_list_get_length (const stp_list_t *list) |
Get the length of a list. | |
void | stp_list_set_freefunc (stp_list_t *list, stp_node_freefunc freefunc) |
Set a list node free function. | |
stp_node_freefunc | stp_list_get_freefunc (const stp_list_t *list) |
Get a list node free function. | |
void | stp_list_set_copyfunc (stp_list_t *list, stp_node_copyfunc copyfunc) |
Set a list node copy function. | |
stp_node_copyfunc | stp_list_get_copyfunc (const stp_list_t *list) |
Get a list node copy function. | |
void | stp_list_set_namefunc (stp_list_t *list, stp_node_namefunc namefunc) |
Set a list node name function. | |
stp_node_namefunc | stp_list_get_namefunc (const stp_list_t *list) |
Get a list node name function. | |
void | stp_list_set_long_namefunc (stp_list_t *list, stp_node_namefunc long_namefunc) |
Set a list node long name function. | |
stp_node_namefunc | stp_list_get_long_namefunc (const stp_list_t *list) |
Get a list node long name function. | |
void | stp_list_set_sortfunc (stp_list_t *list, stp_node_sortfunc sortfunc) |
Set a list node sort function. | |
stp_node_sortfunc | stp_list_get_sortfunc (const stp_list_t *list) |
Get a list node sort function. | |
int | stp_list_item_create (stp_list_t *list, stp_list_item_t *next, const void *data) |
Create a new list item. | |
int | stp_list_item_destroy (stp_list_t *list, stp_list_item_t *item) |
Destroy a list item. | |
stp_list_item_t * | stp_list_item_prev (const stp_list_item_t *item) |
Get the previous item in the list. | |
stp_list_item_t * | stp_list_item_next (const stp_list_item_t *item) |
Get the next item in the list. | |
void * | stp_list_item_get_data (const stp_list_item_t *item) |
Get the data associated with a list item. | |
int | stp_list_item_set_data (stp_list_item_t *item, void *data) |
Set the data associated with a list item. |
It supports all of the operations you might want in a list (insert, remove, iterate over the list, copy whole lists), plus some (optional) less common features: finding items by index, name or long name, and sorting. These should also be fairly fast, due to caching in the list head.
|
The list item opaque data type. This object is a node in the list. |
|
The list opaque data type. This object represents the list as a whole. |
|
A callback function to copy the data a node contains. The parameter is a pointer to the node data. The return value is a pointer to the new copy of the data. |
|
A callback function to free the data a node contains. The parameter is a pointer to the node data. |
|
A callback function to get the name of a node. The parameter is a pointer to the node data. The return value is a pointer to the name of the node, or NULL if there is no name. |
|
A callback function to compare two nodes. The two parameters are pointers to node data. The return value is <0 if the first sorts before the second, 0 if they sort identically, and >0 if the first sorts after the second. |
|
Copy and allocate a list object. list must be a valid list object previously created with stp_list_create().
Definition at line 162 of file print-list.c. References check_list, stp_list_item::data, stp_list::start, stp_list_create(), stp_list_get_copyfunc(), stp_list_get_freefunc(), stp_list_get_long_namefunc(), stp_list_get_namefunc(), stp_list_get_sortfunc(), stp_list_item_create(), stp_list_item_next(), stp_list_set_copyfunc(), stp_list_set_freefunc(), stp_list_set_long_namefunc(), stp_list_set_namefunc(), and stp_list_set_sortfunc(). Referenced by stp_string_list_create_copy(). |
|
Create a new list object.
Definition at line 136 of file print-list.c. References stp_list::copyfunc, stp_list::end, stp_list::freefunc, stp_list::index_cache, stp_list::index_cache_node, stp_list::length, stp_list::long_name_cache, stp_list::long_name_cache_node, stp_list::long_namefunc, stp_list::name_cache, stp_list::name_cache_node, stp_list::namefunc, stp_list::sortfunc, stp_list::start, STP_DBG_LIST, stp_deprintf(), and stp_malloc(). Referenced by create_compdata_list(), create_vars_list(), stp_list_copy(), stp_module_get_class(), stp_module_load(), stp_parameter_list_create(), stp_path_search(), stp_string_list_create(), stp_xml_dither_cache_set(), stp_xml_parse_file_named(), stp_xml_preinit(), stpi_init_color_list(), stpi_init_printer_list(), stpi_paper_list_init(), and stpi_xml_process_family(). |
|
Destroy a list object. It is an error to destroy the list more than once.
Definition at line 192 of file print-list.c. References check_list, clear_cache(), stp_list_item::next, STP_DBG_LIST, stp_deprintf(), stp_free(), and stp_list_item_destroy(). Referenced by stp_module_exit(), stp_module_load(), stp_parameter_list_destroy(), stp_string_list_destroy(), stp_vars_copy(), stp_vars_destroy(), stp_xml_init_defaults(), stp_xml_parse_file_named(), stpi_init_color_list(), stpi_init_printer_list(), stpi_paper_list_init(), and stpi_xml_process_family(). |
|
Get a list node copy function.
Definition at line 484 of file print-list.c. References check_list. Referenced by stp_list_copy(). |
|
Find the last item in a list.
Definition at line 232 of file print-list.c. |
|
Get a list node free function.
Definition at line 469 of file print-list.c. References check_list. Referenced by stp_list_copy(). |
|
Find an item in a list by its index.
Definition at line 239 of file print-list.c. References check_list, stp_list_item::next, and stp_list_item::prev. Referenced by stp_get_color_by_index(), stp_get_papersize_by_index(), stp_get_printer_by_index(), stp_parameter_list_param(), and stp_string_list_param(). |
|
Find an item in a list by its long name.
Definition at line 410 of file print-list.c. References check_list, stp_list_item::data, stp_list_item::next, set_long_name_cache(), and stp_list_get_item_by_long_name_internal(). Referenced by stp_get_printer_by_long_name(). |
|
|
Get the length of a list.
Definition at line 213 of file print-list.c. References check_list. Referenced by stp_color_count(), stp_known_papersizes(), stp_parameter_list_count(), stp_parameter_list_param(), stp_printer_model_count(), and stp_string_list_count(). |
|
Get a list node long name function.
Definition at line 514 of file print-list.c. References check_list. Referenced by stp_list_copy(). |
|
Get a list node name function.
Definition at line 499 of file print-list.c. References check_list. Referenced by stp_list_copy(). |
|
Get a list node sort function.
Definition at line 529 of file print-list.c. References check_list. Referenced by stp_list_copy(). |
|
Find the first item in a list.
Definition at line 224 of file print-list.c. Referenced by copy_compdata_list(), copy_value_list(), stp_color_unregister(), stp_family_register(), stp_family_unregister(), stp_get_color_by_colorfuncs(), stp_initialize_printer_defaults(), stp_module_get_class(), stp_module_init(), stp_module_load(), stp_module_open(), stp_path_search(), stp_prune_inactive_options(), stp_xml_dither_cache_get(), stp_xml_init_defaults(), stp_xml_parse_file_named(), stpi_paper_create(), stpi_paper_destroy(), and stpi_xml_process_family(). |
|
Create a new list item.
Definition at line 548 of file print-list.c. References check_list, clear_cache(), stp_list_item::data, stp_list_item::next, stp_list_item::prev, STP_DBG_LIST, stp_deprintf(), stp_free(), and stp_malloc(). Referenced by copy_compdata_list(), copy_value_list(), set_default_raw_parameter(), set_raw_parameter(), stp_allocate_component_data(), stp_color_register(), stp_family_register(), stp_list_copy(), stp_module_get_class(), stp_module_register(), stp_parameter_list_add_param(), stp_parameter_list_append(), stp_parameter_list_copy(), stp_path_search(), stp_path_split(), stp_register_xml_parser(), stp_register_xml_preload(), stp_set_array_parameter(), stp_set_boolean_parameter(), stp_set_curve_parameter(), stp_set_default_array_parameter(), stp_set_default_boolean_parameter(), stp_set_default_curve_parameter(), stp_set_default_dimension_parameter(), stp_set_default_float_parameter(), stp_set_default_int_parameter(), stp_set_dimension_parameter(), stp_set_float_parameter(), stp_set_int_parameter(), stp_string_list_add_string(), stp_xml_dither_cache_set(), stpi_paper_create(), and stpi_xml_process_family(). |
|
Destroy a list item.
Definition at line 647 of file print-list.c. References check_list, clear_cache(), stp_list_item::next, stp_list_item::prev, STP_DBG_LIST, stp_deprintf(), and stp_free(). Referenced by set_raw_parameter(), stp_allocate_component_data(), stp_clear_boolean_parameter(), stp_clear_dimension_parameter(), stp_clear_float_parameter(), stp_clear_int_parameter(), stp_color_unregister(), stp_destroy_component_data(), stp_family_unregister(), stp_list_destroy(), stp_module_close(), stp_prune_inactive_options(), stp_set_array_parameter(), stp_set_curve_parameter(), stp_string_list_remove_string(), stp_unregister_xml_parser(), stp_unregister_xml_preload(), and stpi_paper_destroy(). |
|
Get the data associated with a list item.
Definition at line 687 of file print-list.c. References stp_list_item::data. Referenced by copy_value_list(), get_parameter_active_generic(), set_parameter_active_generic(), set_raw_parameter(), stp_color_unregister(), stp_family_register(), stp_family_unregister(), stp_get_array_parameter(), stp_get_boolean_parameter(), stp_get_color_by_colorfuncs(), stp_get_color_by_index(), stp_get_color_by_name(), stp_get_component_data(), stp_get_curve_parameter(), stp_get_dimension_parameter(), stp_get_file_parameter(), stp_get_float_parameter(), stp_get_int_parameter(), stp_get_papersize_by_index(), stp_get_papersize_by_name(), stp_get_printer_by_driver(), stp_get_printer_by_index(), stp_get_printer_by_long_name(), stp_get_raw_parameter(), stp_get_string_parameter(), stp_initialize_printer_defaults(), stp_module_get_class(), stp_module_init(), stp_module_load(), stp_module_open(), stp_parameter_find(), stp_parameter_list_param(), stp_path_search(), stp_prune_inactive_options(), stp_register_xml_parser(), stp_set_array_parameter(), stp_set_boolean_parameter(), stp_set_curve_parameter(), stp_set_dimension_parameter(), stp_set_float_parameter(), stp_set_int_parameter(), stp_string_list_find(), stp_string_list_param(), stp_xml_dither_cache_get(), stp_xml_init_defaults(), stp_xml_parse_file_named(), stpi_paper_create(), stpi_paper_destroy(), stpi_xml_process_family(), and stpi_xml_process_node(). |
|
Get the next item in the list.
Definition at line 680 of file print-list.c. References stp_list_item::next. Referenced by copy_compdata_list(), copy_value_list(), stp_color_unregister(), stp_family_register(), stp_family_unregister(), stp_get_color_by_colorfuncs(), stp_initialize_printer_defaults(), stp_list_copy(), stp_module_get_class(), stp_module_init(), stp_module_load(), stp_module_open(), stp_path_search(), stp_prune_inactive_options(), stp_xml_dither_cache_get(), stp_xml_init_defaults(), stp_xml_parse_file_named(), stpi_paper_create(), stpi_paper_destroy(), and stpi_xml_process_family(). |
|
Get the previous item in the list.
Definition at line 673 of file print-list.c. References stp_list_item::prev. |
|
Set the data associated with a list item.
Definition at line 694 of file print-list.c. References stp_list_item::data. |
|
Free node data allocated with stp_malloc. This function is indended for use as an stp_node_freefunc, which uses stp_free to free the node data.
Definition at line 121 of file print-list.c. References STP_DBG_LIST, stp_deprintf(), and stp_free(). Referenced by stp_module_load(), stp_path_search(), and stp_xml_parse_file_named(). |
|
Set a list node copy function. This callback function will be called whenever a list item is copied. Its intended use is for automatic object copying (since C lacks a copy constructor).
Definition at line 477 of file print-list.c. References check_list. Referenced by stp_list_copy(), and stp_string_list_create(). |
|
Set a list node free function. This callback function will be called whenever a list item is destroyed. Its intended use is for automatic object destruction and any other cleanup required.
Definition at line 462 of file print-list.c. References check_list. Referenced by create_compdata_list(), create_vars_list(), stp_list_copy(), stp_module_load(), stp_path_search(), stp_string_list_create(), stp_xml_parse_file_named(), stp_xml_preinit(), stpi_init_printer_list(), and stpi_paper_list_init(). |
|
Set a list node long name function. This callback function will be called whenever the long name of a list item needs to be determined. This is used to find list items by long name.
Definition at line 507 of file print-list.c. References check_list. Referenced by stp_list_copy(), stp_parameter_list_create(), stp_string_list_create(), stpi_init_color_list(), stpi_init_printer_list(), and stpi_paper_list_init(). |
|
Set a list node name function. This callback function will be called whenever the name of a list item needs to be determined. This is used to find list items by name.
Definition at line 492 of file print-list.c. References check_list. Referenced by create_compdata_list(), create_vars_list(), stp_list_copy(), stp_parameter_list_create(), stp_string_list_create(), stp_xml_preinit(), stpi_init_color_list(), stpi_init_printer_list(), and stpi_paper_list_init(). |
|
Set a list node sort function. This callback function will be called to determine the sort order for list items in sorted lists.
Definition at line 522 of file print-list.c. References check_list. Referenced by stp_list_copy(). |