gphoto2-list.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /** \file gphoto2-list.h
  2. *
  3. * Lists of files, folders, cameras, etc.
  4. *
  5. * \author Copyright 2001 Scott Fritzinger
  6. *
  7. * \note
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * \note
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * \note
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the
  22. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  23. * Boston, MA 02110-1301 USA
  24. */
  25. #ifndef __GPHOTO2_LIST_H__
  26. #define __GPHOTO2_LIST_H__
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif /* __cplusplus */
  30. /**
  31. * \brief A generic list
  32. *
  33. * This structure provides a list with \a name:value pairs that is used in various
  34. * parts of libgphoto2. Its details are internal, please use the
  35. * gp_list_xxx accessor functions.
  36. *
  37. * Usage pattern for CameraList for users external of
  38. * libgphoto2, such as libgphoto2 frontends:
  39. *
  40. * \code
  41. * CameraList *list;
  42. * gp_list_new (&list);
  43. * init_list_somehow (list);
  44. * for (i=0; i < gp_list_count(list); i++) {
  45. * char *name, *value;
  46. * gp_list_get_name (list, i, &name);
  47. * gp_list_get_name (list, i, &value);
  48. * do_something_with (name, value);
  49. * }
  50. * gp_list_free (list);
  51. * \endcode
  52. *
  53. * Please do NOT directly instantiate a CameraList object like this:
  54. * \code
  55. * CameraList foo; // DO NOT DO THIS
  56. * \endcode
  57. *
  58. * Please do NOT directly access the structure members like this:
  59. * \code
  60. * list->entry[i].name // DO NOT DO THIS
  61. * \endcode
  62. */
  63. typedef struct _CameraList CameraList;
  64. int gp_list_new (CameraList **list);
  65. int gp_list_ref (CameraList *list);
  66. int gp_list_unref (CameraList *list);
  67. int gp_list_free (CameraList *list);
  68. int gp_list_count (CameraList *list);
  69. int gp_list_append (CameraList *list,
  70. const char *name, const char *value);
  71. int gp_list_reset (CameraList *list);
  72. int gp_list_sort (CameraList *list);
  73. int gp_list_find_by_name (CameraList *list, int *index, const char *name);
  74. int gp_list_get_name (CameraList *list, int index, const char **name);
  75. int gp_list_get_value (CameraList *list, int index, const char **value);
  76. int gp_list_set_name (CameraList *list, int index, const char *name);
  77. int gp_list_set_value (CameraList *list, int index, const char *value);
  78. int gp_list_populate (CameraList *list, const char *format, int count);
  79. #ifdef __cplusplus
  80. }
  81. #endif /* __cplusplus */
  82. #endif /* __GPHOTO2_LIST_H__ */