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

18       · iter: A bson_iter_t.
19
20       · data: A buffer to initialize with. This is not validated.
21
22       · length: The length of data in bytes. This is not validated.
23
24       · offset: 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
28       · keylen: 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

SEE ALSO

54       · bson_iter_key_len()
55
56       · bson_iter_offset()
57
58       · bson_get_data()
59

RETURNS

61       Returns true if the iter was successfully initialized.
62

AUTHOR

64       MongoDB, Inc
65
67       2017-present, MongoDB, Inc
68
69
70
71
721.13.1                           Jan 24, 2B0S1O9N_ITER_INIT_FROM_DATA_AT_OFFSET(3)
Impressum