camel-utils: Camel Reference Manual

## camel-utils camel-utils |

## Functions

gint64 | camel_util_bdata_get_number ()
void | camel_util_bdata_put_number ()
gchar * | camel_util_bdata_get_string ()
void | camel_util_bdata_put_string ()
time_t | camel_time_value_apply ()
GWeakRef * | camel_utils_weak_ref_new ()
void | camel_utils_weak_ref_free ()

## 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

### camel_utils_weak_ref_new ()

    GWeakRef *
    camel_utils_weak_ref_new (gpointer object);

Allocates a new GWeakRef and calls `g_weak_ref_set()` with `object` .

Free the returned GWeakRef with `camel_utils_weak_ref_free()`.

[skip]

#### Parameters

object | a GObject or `NULL`. | [nullable]

#### Returns

a new GWeakRef.

[transfer full]

Since: 3.38.4

### camel_utils_weak_ref_free ()

    void
    camel_utils_weak_ref_free (GWeakRef *weak_ref);

Frees a GWeakRef created by `camel_utils_weak_ref_new()`.

[skip]

#### Parameters

weak_ref | a GWeakRef |

Since: 3.38.4