libgphoto2 photo camera library (libgphoto2) API
2.5.10.1
|
#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>
Data Structures | |
struct | _entry |
struct | _CameraList |
Macros | |
#define | _BSD_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) |
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) |
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 |
References GP_OK.
Referenced by gp_abilities_list_detect(), gp_camera_autodetect(), gp_camera_get_single_config(), 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 |
Referenced by gp_camera_autodetect(), gp_camera_init(), gp_filesystem_dump(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_filesystem_number().
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.
int gp_list_free | ( | CameraList * | list | ) |
Frees the list
. It is recommended to use gp_list_unref instead.
list | the CameraList to be freed |
References GP_OK.
Referenced by gp_camera_autodetect(), gp_camera_init(), gp_filesystem_dump(), gp_filesystem_free(), gp_filesystem_number(), gp_filesystem_remove_dir(), and gp_list_unref().
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 |
References GP_OK.
Referenced by gp_camera_autodetect(), gp_camera_init(), gp_filesystem_dump(), gp_filesystem_list_files(), gp_filesystem_list_folders(), and gp_filesystem_number().
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 |
References GP_OK.
Referenced by gp_camera_autodetect(), and gp_camera_init().
int gp_list_new | ( | CameraList ** | list | ) |
Creates a new CameraList.
list |
References GP_OK.
Referenced by gp_camera_autodetect(), gp_camera_init(), gp_filesystem_dump(), gp_filesystem_free(), gp_filesystem_number(), and gp_filesystem_remove_dir().
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.
References gp_list_append(), gp_list_reset(), and GP_OK.
int gp_list_ref | ( | CameraList * | list | ) |
Increments the reference count of the list.
list | a CameraList |
References GP_OK.
int gp_list_reset | ( | CameraList * | list | ) |
Resets the list
and removes all entries.
list | a CameraList |
References GP_OK.
Referenced by gp_abilities_list_detect(), 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 |
References GP_OK.
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 |
References GP_OK.
int gp_list_sort | ( | CameraList * | list | ) |
Sorts the list
entries with respect to the names.
list | a CameraList |
References GP_OK.
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.
References gp_list_free(), and GP_OK.