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

vars_t - variables handling


Functions

u_string_t * vars_get_value_s (vars_t *vs, const char *name)
 Get u_string_t value of a variable.
int vars_create (vars_t **pvs)
int vars_free (vars_t *vs)
int vars_add (vars_t *vs, var_t *v)
int vars_del (vars_t *vs, var_t *v)
var_tvars_getn (vars_t *vs, size_t i)
 Get ith variable.
size_t vars_count (vars_t *vs)
 Count the number of variables.
size_t vars_countn (vars_t *vs, const char *name)
 Count the number of variables with given name.
int vars_add_urlvar (vars_t *vs, const char *cstr, var_t **v)
 Add an URL variable.
int vars_add_strvar (vars_t *vs, const char *str)
var_tvars_geti (vars_t *vs, const char *var_name, size_t i)
 Get i-th variable with given name.
var_tvars_get (vars_t *vs, const char *var_name)
 Get a variable with given name.
int vars_geti_value_i (vars_t *vs, const char *name, size_t ith)
 Get the integer value of a variable with a given name and index.
u_string_t * vars_geti_value_s (vars_t *vs, const char *name, size_t ith)
 Get u_string_t value of i-th variable.
int vars_get_value_i (vars_t *vs, const char *name)
 Get the integer value of a variable with a given name.
const char * vars_geti_value (vars_t *vs, const char *name, size_t ith)
 Get the value of the variable at a given index.
const char * vars_get_value (vars_t *vs, const char *name)
 Get the value of the variable with given name.
void vars_foreach (vars_t *vs, int(*cb)(var_t *, void *), void *arg)
 Execute a function on a list of variables.

Detailed Description


Function Documentation

int vars_add vars_t vs,
var_t v
 

Definition at line 96 of file vars.c.

References var_t, and vars_t.

Referenced by session_set(), vars_add_strvar(), and vars_add_urlvar().

int vars_add_strvar vars_t vs,
const char *  str
 

Definition at line 268 of file vars.c.

References var_create(), var_free(), var_t, vars_add(), and vars_t.

int vars_add_urlvar vars_t vs,
const char *  cstr,
var_t **  v
 

Parse the "name=value" string cstr, url-decode name and value and push it into vs. The variable is returned at *v.

Parameters:
vs variables' list where the variable is pushed
cstr URL string to parse
v the generated variable as a value-result argument
Returns:
0 if successful, non-zero on error

Definition at line 196 of file vars.c.

References u_urlncpy(), URLCPY_DECODE, var_bin_create(), var_free(), var_t, vars_add(), and vars_t.

Referenced by session_prv_load_from_io().

size_t vars_count vars_t vs  ) 
 

Return a the number of variables in a list

Parameters:
vs variable list
Returns:
the number of elements in vs

Definition at line 151 of file vars.c.

References vars_t.

Referenced by request_get_uploaded_file(), and session_save().

size_t vars_countn vars_t vs,
const char *  name
 

Return a the number of variables in a list with given name name

Parameters:
vs variable list
name name of the variables to count
Returns:
the number of elements in vs whose name is name

Definition at line 168 of file vars.c.

References var_s::sname, var_t, and vars_t.

int vars_create vars_t **  pvs  ) 
 

Definition at line 58 of file vars.c.

References vars_free(), and vars_t.

Referenced by request_create(), and session_prv_init().

int vars_del vars_t vs,
var_t v
 

Definition at line 104 of file vars.c.

References var_t, and vars_t.

Referenced by session_clean(), session_del(), session_prv_load_from_io(), and vars_free().

void vars_foreach vars_t vs,
int(*)(var_t *, void *)  cb,
void *  arg
 

Execute function cb with optional arguments arg on all variables in list vs

Parameters:
vs variable list
cb function to be called on each variable (see prototype)
arg argument to cb
Returns:
nothing

Definition at line 486 of file vars.c.

References var_t, and vars_t.

Referenced by request_free(), session_prv_save_to_buf(), and session_prv_save_to_io().

int vars_free vars_t vs  ) 
 

Definition at line 78 of file vars.c.

References var_free(), var_t, vars_del(), and vars_t.

Referenced by request_free(), session_free(), and vars_create().

var_t* vars_get vars_t vs,
const char *  var_name
 

Return a var_t object with name name in list vs.

Parameters:
vs variable list
var_name variable name
Returns:
  • the var_t object found
  • NULL if there's no variable called var_name in vs

Definition at line 346 of file vars.c.

References var_t, vars_geti(), and vars_t.

Referenced by request_get_arg(), request_get_cookie(), session_del(), session_get(), session_prv_load_from_io(), session_set(), and vars_get_value_s().

const char* vars_get_value vars_t vs,
const char *  name
 

Return the string value of the variable with name name in list vs.

Parameters:
vs variable list that is scanned
name variable name to search
Returns:
  • the value string corresponding to name
  • NULL if no value could be found

Definition at line 466 of file vars.c.

References vars_geti_value(), and vars_t.

int vars_get_value_i vars_t vs,
const char *  name
 

Return the integer value of the variable with name name in list vs.

Parameters:
vs variable list
name variable name
Returns:
  • the integer value of name
  • 0 if no value could be found

Definition at line 420 of file vars.c.

References vars_geti_value_i(), and vars_t.

u_string_t* vars_get_value_s vars_t vs,
const char *  name
 

Return an u_string_t containing the value of variable with name in variable list vs.

Parameters:
vs variable list
name name of variable
Returns:
the variable value (may be NULL)

Definition at line 44 of file vars.c.

References var_get_value_s(), var_t, vars_get(), and vars_t.

var_t* vars_geti vars_t vs,
const char *  var_name,
size_t  i
 

Return the var_t object at index i with name var_name in list vs.

Parameters:
vs variable list
var_name variable name
i index
Returns:
  • the var_t object found
  • NULL if there's no i-th variable called var_name in vs

Definition at line 314 of file vars.c.

References var_s::sname, var_t, and vars_t.

Referenced by request_get_uploaded_file(), vars_get(), vars_geti_value(), and vars_geti_value_s().

const char* vars_geti_value vars_t vs,
const char *  name,
size_t  ith
 

Return the string value of the variable with name name and index ith in list vs.

Parameters:
vs variable list that is scanned
name variable name to search
ith index of the searched variable
Returns:
  • the value string corresponding to name at i-th position
  • NULL if no value could be found

Definition at line 442 of file vars.c.

References var_get_value(), var_t, vars_geti(), and vars_t.

Referenced by vars_get_value(), and vars_geti_value_i().

int vars_geti_value_i vars_t vs,
const char *  name,
size_t  ith
 

Get the integer value of the variable with name name and index ith in list vs.

Parameters:
vs variable list
name variable name
ith index
Returns:
  • the integer value of name
  • 0 if no value could be found

Definition at line 368 of file vars.c.

References vars_geti_value(), and vars_t.

Referenced by vars_get_value_i().

u_string_t* vars_geti_value_s vars_t vs,
const char *  name,
size_t  ith
 

Return an u_string_t containing the value of i-th variable with name in variable list vs.

Parameters:
vs variable list
name name of variable
ith index
Returns:
the variable value (may be NULL)

Definition at line 394 of file vars.c.

References var_get_value_s(), var_t, vars_geti(), and vars_t.

var_t* vars_getn vars_t vs,
size_t  i
 

Return the var_t at index i in list vs.

Parameters:
vs variable list
i index
Returns:
the ith variable or NULL if there's no ith var in vs

Definition at line 125 of file vars.c.

References var_t, and vars_t.

Referenced by session_clean().


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