Top | ![]() |
![]() |
![]() |
![]() |
The ENamedParameters is a structure, which holds a name~>value pairs. It's usually used to pass credentials between callers.
ENamedParameters *
e_named_parameters_new (void
);
Creates a new instance of an ENamedParameters. This should be freed
with e_named_parameters_free()
, when no longer needed. Names are
compared case insensitively.
The structure is not thread safe, if the caller requires thread safety, then it should provide it on its own.
Since: 3.8
ENamedParameters *
e_named_parameters_new_strv (const gchar * const *strv
);
Creates a new instance of an ENamedParameters, with initial content
being taken from strv
. This should be freed with e_named_parameters_free()
,
when no longer needed. Names are compared case insensitively.
The structure is not thread safe, if the caller requires thread safety, then it should provide it on its own.
strv |
NULL-terminated string array to be used as a content of a newly created ENamedParameters |
Since: 3.8
ENamedParameters *
e_named_parameters_new_string (const gchar *str
);
Creates a new instance of an ENamedParameters, with initial content being
taken from str
. This should be freed with e_named_parameters_free()
,
when no longer needed. Names are compared case insensitively.
The str
should be created with e_named_parameters_to_string()
, to be
properly encoded.
The structure is not thread safe, if the caller requires thread safety, then it should provide it on its own.
Since: 3.18
ENamedParameters *
e_named_parameters_new_clone (const ENamedParameters *parameters
);
Creates a new instance of an ENamedParameters, with initial content
being taken from parameters
. This should be freed with e_named_parameters_free()
,
when no longer needed. Names are compared case insensitively.
The structure is not thread safe, if the caller requires thread safety, then it should provide it on its own.
parameters |
an ENamedParameters to be used as a content of a newly created ENamedParameters |
Since: 3.16
void
e_named_parameters_free (ENamedParameters *parameters
);
Frees an instance of ENamedParameters, previously allocated
with e_named_parameters_new()
. Function does nothing, if
parameters
is NULL
.
Since: 3.8
void
e_named_parameters_clear (ENamedParameters *parameters
);
Removes all stored parameters from parameters
.
Since: 3.8
void e_named_parameters_assign (ENamedParameters *parameters
,const ENamedParameters *from
);
Makes content of the parameters
the same as from
.
Functions clears content of parameters
if from
is NULL
.
parameters |
an ENamedParameters to assign values to |
|
from |
an ENamedParameters to get values from, or |
[nullable] |
Since: 3.8
void e_named_parameters_set (ENamedParameters *parameters
,const gchar *name
,const gchar *value
);
Sets parameter named name
to value value
. If value
is NULL,
then the parameter is removed. value
can be an empty string.
Note: There is a restriction on parameter names, it cannot be empty or contain a colon character (':'), otherwise it can be pretty much anything.
parameters |
||
name |
name of a parameter to set |
|
value |
value to set, or |
[nullable] |
Since: 3.8
const gchar * e_named_parameters_get (const ENamedParameters *parameters
,const gchar *name
);
Returns current value of a parameter with name name
. If not such
exists, then returns NULL
.
Since: 3.8
gchar **
e_named_parameters_to_strv (const ENamedParameters *parameters
);
Since: 3.8
gchar *
e_named_parameters_to_string (const ENamedParameters *parameters
);
Since: 3.18
gboolean e_named_parameters_test (const ENamedParameters *parameters
,const gchar *name
,const gchar *value
,gboolean case_sensitively
);
Compares current value of parameter named name
with given value
and returns whether they are equal, either case sensitively or
insensitively, based on case_sensitively
argument. Function
returns FALSE
, if no such parameter exists.
parameters |
||
name |
name of a parameter to test |
|
value |
value to test |
|
case_sensitively |
whether to compare case sensitively |
Since: 3.8
gboolean e_named_parameters_exists (const ENamedParameters *parameters
,const gchar *name
);
Since: 3.18
guint
e_named_parameters_count (const ENamedParameters *parameters
);
Since: 3.18
gchar * e_named_parameters_get_name (const ENamedParameters *parameters
,gint index
);
The name of the parameters at index index
,
or NULL
, of the index
is out of bounds or other error. The returned
string should be freed with g_free()
when done with it.
[transfer full][nullable]
Since: 3.18
gboolean e_named_parameters_equal (const ENamedParameters *parameters1
,const ENamedParameters *parameters2
);
Compares the two parameters objects and returns whether they equal.
Note a NULL
and empty parameters are also considered equal.
Since: 3.46