libgphoto2 photo camera library (libgphoto2) Internals
2.5.23
|
#include "config.h"
#include <gphoto2/gphoto2-list.h>
#include <gphoto2/gphoto2-port-log.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gphoto2/gphoto2-result.h>
Go to the source code of this file.
Data Structures | |
struct | _entry |
struct | _CameraList |
Macros | |
#define | _DEFAULT_SOURCE |
#define | CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);} |
Functions | |
int | gp_list_new (CameraList **list) |
Creates a new CameraList. More... | |
int | gp_list_ref (CameraList *list) |
Increments the reference count of the list. More... | |
int | gp_list_unref (CameraList *list) |
Decrements the reference count of the list . More... | |
int | gp_list_free (CameraList *list) |
int | gp_list_reset (CameraList *list) |
int | gp_list_append (CameraList *list, const char *name, const char *value) |
static int | cmp_list (const void *a, const void *b) |
int | gp_list_sort (CameraList *list) |
int | gp_list_count (CameraList *list) |
int | gp_list_find_by_name (CameraList *list, int *index, const char *name) |
int | gp_list_get_name (CameraList *list, int index, const char **name) |
int | gp_list_get_value (CameraList *list, int index, const char **value) |
int | gp_list_set_value (CameraList *list, int index, const char *value) |
int | gp_list_set_name (CameraList *list, int index, const char *name) |
int | gp_list_populate (CameraList *list, const char *format, int count) |
Definition in file gphoto2-list.c.
#define _DEFAULT_SOURCE |
Definition at line 25 of file gphoto2-list.c.
Definition at line 37 of file gphoto2-list.c.
|
static |
Definition at line 198 of file gphoto2-list.c.
References _entry::name.
Referenced by gp_list_sort().
int gp_list_append | ( | CameraList * | list, |
const char * | name, | ||
const char * | value | ||
) |
Appends name
and value
to the list
.
list | a CameraList |
name | the name of the entry to append |
value | the value of the entry to append |
Definition at line 174 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _CameraList::max, _entry::name, _CameraList::ref_count, _CameraList::used, and _entry::value.
Referenced by _get_widget_names(), foreach_func(), gp_abilities_list_detect(), gp_camera_autodetect(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_list_populate().
int gp_list_count | ( | CameraList * | list | ) |
Counts the entries in the list
.
list | a CameraList |
Definition at line 229 of file gphoto2-list.c.
References _CameraList::ref_count, and _CameraList::used.
Referenced by gp_abilities_list_load_dir(), gp_camera_autodetect(), gp_camera_init(), gp_filesystem_delete_all_one_by_one(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_filesystem_scan().
int gp_list_find_by_name | ( | CameraList * | list, |
int * | index, | ||
const char * | name | ||
) |
Retrieves the index
of an arbitrary entry with name
.
list | a CameraList |
index | pointer to the result index (may be NULL, only set if found) |
name | name of the entry |
No guarantees as to the speed of the search, or in what sequence the list is searched.
Definition at line 249 of file gphoto2-list.c.
References _CameraList::entry, GP_ERROR, GP_OK, _entry::name, _CameraList::ref_count, and _CameraList::used.
int gp_list_free | ( | CameraList * | list | ) |
Frees the list
. It is recommended to use gp_list_unref instead.
list | the CameraList to be freed |
Definition at line 120 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _entry::name, _CameraList::ref_count, _CameraList::used, and _entry::value.
Referenced by gp_abilities_list_load_dir(), gp_camera_autodetect(), gp_camera_init(), gp_filesystem_append(), gp_filesystem_delete_all_one_by_one(), gp_filesystem_number(), gp_filesystem_remove_dir(), gp_filesystem_scan(), gp_list_unref(), lookup_folder(), and lookup_folder_file().
int gp_list_get_name | ( | CameraList * | list, |
int | index, | ||
const char ** | name | ||
) |
Retrieves the name
of entry with index
.
list | a CameraList |
index | index of the entry |
name |
Definition at line 280 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _entry::name, and _CameraList::ref_count.
Referenced by gp_abilities_list_load_dir(), gp_camera_autodetect(), gp_camera_init(), gp_filesystem_delete_all_one_by_one(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_filesystem_scan().
int gp_list_get_value | ( | CameraList * | list, |
int | index, | ||
const char ** | value | ||
) |
Retrieves the value of entry with index
.
list | a CameraList |
index | index of the entry |
value |
Definition at line 301 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _CameraList::ref_count, and _entry::value.
Referenced by gp_camera_autodetect(), and gp_camera_init().
int gp_list_new | ( | CameraList ** | list | ) |
Creates a new CameraList.
list |
Definition at line 63 of file gphoto2-list.c.
References GP_OK.
Referenced by gp_abilities_list_load_dir(), gp_camera_autodetect(), gp_camera_init(), gp_filesystem_append(), gp_filesystem_delete_all_one_by_one(), gp_filesystem_number(), gp_filesystem_remove_dir(), gp_filesystem_scan(), lookup_folder(), and lookup_folder_file().
int gp_list_populate | ( | CameraList * | list, |
const char * | format, | ||
int | count | ||
) |
Adds count
entries to the list.
list | a CameraList |
format | the format |
count | number of entries to be added to the list return a gphoto2 error code |
Typically, this function is called by a camera driver when there is no way of retrieving the real name of a picture. In this case, when asked for a file list (see CameraFilesystemListFunc), the list is populated with dummy names generated by this function.
Definition at line 373 of file gphoto2-list.c.
References CHECK_RESULT, gp_list_append(), gp_list_reset(), GP_OK, and _CameraList::ref_count.
int gp_list_ref | ( | CameraList * | list | ) |
Increments the reference count of the list.
list | a CameraList |
Definition at line 82 of file gphoto2-list.c.
References GP_OK, and _CameraList::ref_count.
int gp_list_reset | ( | CameraList * | list | ) |
Resets the list
and removes all entries.
list | a CameraList |
Definition at line 148 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _entry::name, _CameraList::ref_count, _CameraList::used, and _entry::value.
Referenced by gp_abilities_list_detect(), gp_abilities_list_load_dir(), gp_camera_folder_list_files(), gp_camera_folder_list_folders(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_list_populate().
int gp_list_set_name | ( | CameraList * | list, |
int | index, | ||
const char * | name | ||
) |
Sets the name of an entry.
list | a CameraList |
index | index of entry |
name | name to be set |
Definition at line 345 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _entry::name, and _CameraList::ref_count.
int gp_list_set_value | ( | CameraList * | list, |
int | index, | ||
const char * | value | ||
) |
Sets the value
of an entry.
list | a CameraList |
index | index of the entry |
value | the value to be set |
Definition at line 322 of file gphoto2-list.c.
References _CameraList::entry, GP_OK, _CameraList::ref_count, and _entry::value.
int gp_list_sort | ( | CameraList * | list | ) |
Sorts the list
entries with respect to the names.
list | a CameraList |
Definition at line 213 of file gphoto2-list.c.
References cmp_list(), _CameraList::entry, GP_OK, _CameraList::ref_count, and _CameraList::used.
Referenced by gp_camera_folder_list_files(), and gp_camera_folder_list_folders().
int gp_list_unref | ( | CameraList * | list | ) |
Decrements the reference count of the list
.
list | a CameraList |
If there are no references left, the list
will be freed.
Definition at line 101 of file gphoto2-list.c.
References gp_list_free(), GP_OK, and _CameraList::ref_count.