Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

vars.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com>
00003  * All rights reserved.
00004  *
00005  * This file is part of KLone, and as such it is subject to the license stated
00006  * in the LICENSE file which you have received as part of this distribution.
00007  *
00008  * $Id: vars.h,v 1.9 2006/01/09 12:38:38 tat Exp $
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 struct vars_s;
00022 typedef struct vars_s vars_t;
00023 
00024 typedef int (*vars_cb_t)(var_t*, void*);
00025 
00026 int vars_create(vars_t ** pvs);
00027 int vars_free(vars_t *vs);
00028 
00029 int vars_add(vars_t *vs, var_t *v);
00030 int vars_del(vars_t *vs, var_t *v);
00031 
00032 /* str must be a 'name=value' string */
00033 int vars_add_strvar(vars_t *vs, const char *str);
00034 
00035 /* str must be a (possibly url-encoded) 'name=value' string */
00036 int vars_add_urlvar(vars_t *vs, const char *cstr, var_t **v);
00037 
00038 var_t* vars_getn(vars_t *vs, size_t n);
00039 size_t vars_count(vars_t *vs);
00040 
00041 size_t vars_countn(vars_t *vs, const char *name);
00042 
00043 void vars_foreach(vars_t *vs, int (*foreach)(var_t*, void*), void *arg);
00044 
00045 /* get first variable called "name" */
00046 var_t* vars_get(vars_t *vs, const char *name);
00047 const char* vars_get_value(vars_t *vs, const char *name);
00048 int vars_get_value_i(vars_t *vs, const char *name);
00049 u_string_t* vars_get_value_s(vars_t *vs, const char *name);
00050 
00051 /* get i-th variable called "name" */
00052 var_t* vars_geti(vars_t *vs, const char *name, size_t ith);
00053 const char* vars_geti_value(vars_t *vs, const char *name, size_t ith);
00054 int vars_geti_value_i(vars_t *vs, const char *name, size_t ith);
00055 u_string_t* vars_geti_value_s(vars_t *vs, const char *name, size_t ith);
00056 
00057 #ifdef __cplusplus
00058 }
00059 #endif 
00060 
00061 #endif

←Products
© 2005-2006 - KoanLogic S.r.l. - All rights reserved