1BSON_ITER_INIT_FROM_DATA_AT_OFFSET(3)libbsoBnSON_ITER_INIT_FROM_DATA_AT_OFFSET(3)
2
3
4

NAME

6       bson_iter_init_from_data_at_offset  -  bson_iter_init_from_data_at_off‐
7       set()
8

SYNOPSIS

10          bool
11          bson_iter_init_from_data_at_offset (bson_iter_t *iter,
12                                              const uint8_t *data,
13                                              size_t length,
14                                              uint32_t offset,
15                                              uint32_t keylen);
16

PARAMETERS

18iter: A bson_iter_t.
19
20data: A buffer to initialize with. This is not validated.
21
22length: The length of data in bytes. This is not validated.
23
24offset: The offset of the field to start iterating. This is not vali‐
25         dated.   This   should   be   an   offset  previously  obtained  from
26         bson_iter_offset().
27
28keylen: The string length of the key of the field to start iterating.
29         This  is  not  validated. This should be a length previously obtained
30         from bson_iter_key_len().
31

DESCRIPTION

33       Creates a bson_iter_t and starts iteration on a field at the offset.
34
35       bson_iter_init_from_data_at_offset() is useful for situations where the
36       progress of a bson_iter_t must be saved and restored without relying on
37       the bson_iter_t data layout. Saving the progress could be  accomplished
38       by:
39
40       • Saving the current field's key length with bson_iter_key_len()
41
42       • Saving the current offset with bson_iter_offset()
43
44       • Saving the data pointer of the iterated bson_t with bson_get_data()
45
46       • Saving  the  data  length  of the iterated bson_t with the len struct
47         field
48
49       Then    later,    these    saved    values    can    be    passed    to
50       bson_iter_init_from_data_at_offset()  to reconstruct the bson_iter_t in
51       constant time.
52

RETURNS

54       Returns true if the iter was successfully initialized.
55
56       SEE ALSO:
57          bson_iter_key_len()
58
59          bson_iter_offset()
60
61          bson_get_data()
62
63

AUTHOR

65       MongoDB, Inc
66
68       2017-present, MongoDB, Inc
69
70
71
72
731.23.1                           Oct 20, 2B0S2O2N_ITER_INIT_FROM_DATA_AT_OFFSET(3)
Impressum