camel-utils

camel-utils

Functions

Description

Functions

camel_util_bdata_get_number ()

gint64
camel_util_bdata_get_number (gchar **bdata_ptr,
                             gint64 default_value);

Reads a numeric data from the bdata_ptr and moves the bdata_ptr after that number. If the number cannot be read, then the default_value is returned instead and the bdata_ptr is left unchanged. The number might be previously stored with the camel_util_bdata_put_number().

Parameters

bdata_ptr

a backend specific data (bdata) pointer

 

default_value

a value to return, when no data can be read

 

Returns

The read number, or the default_value , if the bdata_ptr doesn't point to a number.

Since: 3.24


camel_util_bdata_put_number ()

void
camel_util_bdata_put_number (GString *bdata_str,
                             gint64 value);

Puts the number value at the end of the bdata_str . In case the bdata_str is not empty a space is added before the numeric value . The stored value can be read back with the camel_util_bdata_get_number().

Parameters

bdata_str

a GString to store a backend specific data (bdata)

 

value

a value to store

 

Since: 3.24


camel_util_bdata_get_string ()

gchar *
camel_util_bdata_get_string (gchar **bdata_ptr,
                             const gchar *default_value);

Reads a string data from the bdata_ptr and moves the bdata_ptr after that string. If the string cannot be read, then the default_value is returned instead and the bdata_ptr is left unchanged. The string might be previously stored with the camel_util_bdata_put_string().

Parameters

bdata_ptr

a backend specific data (bdata) pointer

 

default_value

a value to return, when no data can be read

 

Returns

Newly allocated string, which was read, or dupped the default_value , if the bdata_ptr doesn't point to a string. Free returned pointer with g_free() when done with it.

[transfer full]

Since: 3.24


camel_util_bdata_put_string ()

void
camel_util_bdata_put_string (GString *bdata_str,
                             const gchar *value);

Puts the string value at the end of the bdata_str . In case the bdata_str is not empty a space is added before the string value . The stored value can be read back with the camel_util_bdata_get_string().

The strings are encoded as "length-value", quotes for clarity only.

Parameters

bdata_str

a GString to store a backend specific data (bdata)

 

value

a value to store

 

Since: 3.24


camel_time_value_apply ()

time_t
camel_time_value_apply (time_t src_time,
                        CamelTimeUnit unit,
                        gint value);

Applies the given time value in unit unit to the src_time . Use negative value to subtract it. The time part is rounded to the beginning of the day.

Parameters

src_time

a time_t to apply the value to, or -1 to use the current time

 

unit

a CamelTimeUnit

 

value

a value to apply

 

Returns

src_time modified by the given parameters as date, with the time part being beginning of the day.

Since: 3.24