1BSON_ITER_INIT_FROM_DATA_AT_OFFSET(3)libbsoBnSON_ITER_INIT_FROM_DATA_AT_OFFSET(3)
2
3
4
6 bool
7 bson_iter_init_from_data_at_offset (bson_iter_t *iter,
8 const uint8_t *data,
9 size_t length,
10 uint32_t offset,
11 uint32_t keylen);
12
14 • iter: A bson_iter_t.
15
16 • data: A buffer to initialize with. This is not validated.
17
18 • length: The length of data in bytes. This is not validated.
19
20 • offset: The offset of the field to start iterating. This is not vali‐
21 dated. This should be an offset previously obtained from
22 bson_iter_offset().
23
24 • keylen: The string length of the key of the field to start iterating.
25 This is not validated. This should be a length previously obtained
26 from bson_iter_key_len().
27
29 Creates a bson_iter_t and starts iteration on a field at the offset.
30
31 bson_iter_init_from_data_at_offset() is useful for situations where the
32 progress of a bson_iter_t must be saved and restored without relying on
33 the bson_iter_t data layout. Saving the progress could be accomplished
34 by:
35
36 • Saving the current field's key length with bson_iter_key_len()
37
38 • Saving the current offset with bson_iter_offset()
39
40 • Saving the data pointer of the iterated bson_t with bson_get_data()
41
42 • Saving the data length of the iterated bson_t with the len struct
43 field
44
45 Then later, these saved values can be passed to
46 bson_iter_init_from_data_at_offset() to reconstruct the bson_iter_t in
47 constant time.
48
50 Returns true if the iter was successfully initialized.
51
52 SEE ALSO:
53 bson_iter_key_len()
54
55 bson_iter_offset()
56
57 bson_get_data()
58
59
61 MongoDB, Inc
62
64 2017-present, MongoDB, Inc
65
66
67
68
691.25.1 Nov 08, 2B0S2O3N_ITER_INIT_FROM_DATA_AT_OFFSET(3)