vars.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _KLONE_VARLIST_H_
00012 #define _KLONE_VARLIST_H_
00013
00014 #include <u/libu.h>
00015 #include <klone/var.h>
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00021 enum {
00022 VARS_FLAG_NONE = 0,
00023 VARS_FLAG_FOREIGN = 1 << 0
00024 };
00025
00026 struct vars_s;
00027 typedef struct vars_s vars_t;
00028
00029 typedef int (*vars_cb_t)(var_t*, void*);
00030
00031 int vars_create(vars_t ** pvs);
00032 int vars_free(vars_t *vs);
00033
00034 int vars_set_flags(vars_t *vs, int flags);
00035
00036 int vars_add(vars_t *vs, var_t *v);
00037 int vars_del(vars_t *vs, var_t *v);
00038
00039
00040 int vars_add_strvar(vars_t *vs, const char *str);
00041
00042
00043 int vars_add_urlvar(vars_t *vs, const char *cstr, var_t **v);
00044
00045 var_t* vars_getn(vars_t *vs, size_t n);
00046 size_t vars_count(vars_t *vs);
00047
00048 size_t vars_countn(vars_t *vs, const char *name);
00049
00050 void vars_foreach(vars_t *vs, int (*foreach)(var_t*, void*), void *arg);
00051
00052
00053 var_t* vars_get(vars_t *vs, const char *name);
00054 const char* vars_get_value(vars_t *vs, const char *name);
00055 int vars_get_value_i(vars_t *vs, const char *name);
00056 u_string_t* vars_get_value_s(vars_t *vs, const char *name);
00057
00058
00059 var_t* vars_geti(vars_t *vs, const char *name, size_t ith);
00060 const char* vars_geti_value(vars_t *vs, const char *name, size_t ith);
00061 int vars_geti_value_i(vars_t *vs, const char *name, size_t ith);
00062 u_string_t* vars_geti_value_s(vars_t *vs, const char *name, size_t ith);
00063
00064 #ifdef __cplusplus
00065 }
00066 #endif
00067
00068 #endif