bson_string_t(3)

bson_string_t3

Usage

#include <bson/bson.h>
typedef struct {
   char *str;
   uint32_t len;
   uint32_t alloc;
} bson_string_t;

WARNING:

Deprecated since version 1.29.0.

String Building Abstraction

Overview

bson_string_t is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two.

This API is useful if you need to build UTF-8 encoded strings.

Examples

bson_string_t *str;
str = bson_string_new (NULL);
bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123);
printf ("%s\n", str->str);
bson_string_free (str, true);

TIP:

You can call bson_string_free() with false if you would like to take ownership of str->str. Some APIs that do this might call return bson_string_free (str, false); after building the string.

Releases

5 releases since Debian 9 (Stretch); the text changed 4 times.

  1. 9
  2. 10
  3. 11
  4. 12
  5. 13

Author

MongoDB, Inc

From libbson-doc 1.30.4-1+deb13u3 in Debian 13 (Trixie). Parsed by carta from the page's man source.