Changeset 5c9512f for set.h


Ignore:
Timestamp:
2006-06-30T09:17:18Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
0a3c243
Parents:
1719464
Message:

Made set.c API more generic so it's not specific to irc_t structures anymore,
but can be used for account_t structures too, for example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • set.h

    r1719464 r5c9512f  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2002-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2002-2006 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    2626typedef struct set
    2727{
     28        void *data;
     29       
    2830        char *key;
    2931        char *value;
    3032        char *def;      /* Default */
    3133       
    32         /* Eval: Returns NULL if the value is incorrect. Can return a
    33            corrected value. set_setstr() should be able to free() the
    34            returned string! */
    35         char *(*eval) ( irc_t *irc, struct set *set, char *value );
     34        /* Eval: Returns NULL if the value is incorrect or exactly the
     35           passed value variable. When returning a corrected value,
     36           set_setstr() should be able to free() the returned string! */
     37        char *(*eval) ( struct set *set, char *value );
    3638        struct set *next;
    3739} set_t;
    3840
    39 set_t *set_add( irc_t *irc, char *key, char *def, void *eval );
    40 G_MODULE_EXPORT set_t *set_find( irc_t *irc, char *key );
    41 G_MODULE_EXPORT char *set_getstr( irc_t *irc, char *key );
    42 G_MODULE_EXPORT int set_getint( irc_t *irc, char *key );
    43 int set_setstr( irc_t *irc, char *key, char *value );
    44 int set_setint( irc_t *irc, char *key, int value );
    45 void set_del( irc_t *irc, char *key );
     41set_t *set_add( set_t **head, char *key, char *def, void *eval, void *data );
     42G_MODULE_EXPORT set_t *set_find( set_t **head, char *key );
     43G_MODULE_EXPORT char *set_getstr( set_t **head, char *key );
     44G_MODULE_EXPORT int set_getint( set_t **head, char *key );
     45int set_setstr( set_t **head, char *key, char *value );
     46int set_setint( set_t **head, char *key, int value );
     47void set_del( set_t **head, char *key );
    4648
    47 char *set_eval_int( irc_t *irc, set_t *set, char *value );
    48 char *set_eval_bool( irc_t *irc, set_t *set, char *value );
     49char *set_eval_int( set_t *set, char *value );
     50char *set_eval_bool( set_t *set, char *value );
    4951
    50 char *set_eval_to_char( irc_t *irc, set_t *set, char *value );
    51 char *set_eval_ops( irc_t *irc, set_t *set, char *value );
    52 char *set_eval_charset( irc_t *irc, set_t *set, char *value );
     52char *set_eval_to_char( set_t *set, char *value );
     53char *set_eval_ops( set_t *set, char *value );
     54char *set_eval_charset( set_t *set, char *value );
Note: See TracChangeset for help on using the changeset viewer.