forked from len0rd/rockbox
New plugin library framework for loading and saving .cfg files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4912 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d1df184f0f
commit
897fb63ec8
2 changed files with 152 additions and 0 deletions
44
apps/plugins/lib/configfile.h
Normal file
44
apps/plugins/lib/configfile.h
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 Linus Nielsen Feltzing
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef CONFIGFILE_H
|
||||
#define CONFIGFILE_H
|
||||
|
||||
#define TYPE_INT 1
|
||||
#define TYPE_ENUM 2
|
||||
#define TYPE_STRING 3
|
||||
|
||||
struct configdata
|
||||
{
|
||||
int type; /* See TYPE_ macros above */
|
||||
int min; /* Min value for integers, should be 0 for enums */
|
||||
int max; /* Max value for enums and integers,
|
||||
buffer size for strings */
|
||||
int *val; /* Pointer to integer/enum value,
|
||||
NULL if the item is a string */
|
||||
char *name; /* Pointer to the name of the item */
|
||||
char **values; /* List of strings for enums, NULL if not enum */
|
||||
char *string; /* Pointer to a string buffer if the item is a string,
|
||||
NULL otherwise */
|
||||
};
|
||||
|
||||
void configfile_init(struct plugin_api* newrb);
|
||||
int configfile_save(char *filename, struct configdata *cfg, int num_items);
|
||||
int configfile_load(char *filename, struct configdata *cfg, int num_items);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue