libgphoto2 (libgphoto2): libgphoto2/gphoto2-list.h Source File

Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# gphoto2-list.h

    00001 /* gphoto2-list.h: Lists of files, folders, cameras, etc.
    00002  *
    00003  * Copyright © 2001 Scott Fritzinger
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Lesser General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Lesser General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Lesser General Public
    00016  * License along with this library; if not, write to the
    00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018  * Boston, MA 02111-1307, USA.
    00019  */
    00020
    00021 #ifndef __GPHOTO2_LIST_H__
    00022 #define __GPHOTO2_LIST_H__
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif /* __cplusplus */
    00027
    00028 #define MAX_ENTRIES 1024
    00029
    00030 /* Usage pattern for CameraList for users external of
    00031  * libgphoto2, such as libgphoto2 frontends:
    00032  *
    00033  *    CameraList *list;
    00034  *    gp_list_new (&list);
    00035  *    init_list_somehow (list);
    00036  *    for (i=0; i < gp_list_count(list); i++) {
    00037  *        char *name, *value;
    00038  *        gp_list_get_name (list, i, &name);
    00039  *        gp_list_get_name (list, i, &value);
    00040  *        do_something_with (name, value);
    00041  *    }
    00042  *    gp_list_free (list);
    00043  *
    00044  * Please do NOT directly instantiate a CameraList object like this:
    00045  *               CameraList foo;     // DO NOT DO THIS
    00046  * Please do NOT directly access the structure members like this:
    00047  *               list->entry[i].name // DO NOT DO THIS
    00048  */
    00049 struct _CameraList {
    00050         int  count;
    00051         struct {
    00052                 char name  [128];
    00053                 char value [128];
    00054         } entry [MAX_ENTRIES];
    00055         int ref_count;
    00056 };
    00057 typedef struct _CameraList CameraList;
    00058
    00059 int     gp_list_new   (CameraList **list);
    00060 int     gp_list_ref   (CameraList *list);
    00061 int     gp_list_unref (CameraList *list);
    00062 int     gp_list_free  (CameraList *list);
    00063
    00064 int     gp_list_count      (CameraList *list);
    00065 int     gp_list_append     (CameraList *list,
    00066                             const char *name, const char *value);
    00067 int     gp_list_reset      (CameraList *list);
    00068 int     gp_list_sort       (CameraList *list);
    00069
    00070 int gp_list_get_name  (CameraList *list, int index, const char **name);
    00071 int gp_list_get_value (CameraList *list, int index, const char **value);
    00072
    00073 int gp_list_set_name  (CameraList *list, int index, const char *name);
    00074 int gp_list_set_value (CameraList *list, int index, const char *value);
    00075
    00076 int gp_list_populate  (CameraList *list, const char *format, int count);
    00077
    00078 #ifdef __cplusplus
    00079 }
    00080 #endif /* __cplusplus */
    00081
    00082 #endif /* __GPHOTO2_LIST_H__ */