10#include <unordered_map>
14#include <userver/formats/bson/types.hpp>
15#include <userver/formats/common/iterator_direction.hpp>
17USERVER_NAMESPACE_BEGIN
19namespace formats::
bson {
26 using iterator_category = std::forward_iterator_tag;
27 using difference_type = ptrdiff_t;
28 using value_type = std::remove_const_t<ValueType>;
29 using reference = ValueType&;
30 using pointer = ValueType*;
33 using NativeIter = std::variant<impl::ParsedArray::const_iterator,
34 impl::ParsedArray::const_reverse_iterator,
35 impl::ParsedDocument::const_iterator>;
37 Iterator(impl::ValueImpl&, NativeIter);
40 Iterator(
const Iterator&);
41 Iterator(Iterator&&)
noexcept;
42 Iterator& operator=(
const Iterator&);
43 Iterator& operator=(Iterator&&)
noexcept;
47 Iterator operator++(
int);
48 Iterator& operator++();
49 reference operator*()
const;
50 pointer operator->()
const;
52 bool operator==(
const Iterator&)
const;
53 bool operator!=(
const Iterator&)
const;
58 template <
typename T =
void>
61 "Reverse iterator should be used only on arrays or null, "
62 "they do not have GetName()");
71 std::string GetNameImpl()
const;
72 void UpdateValue()
const;
74 impl::ValueImpl* iterable_;
76 mutable std::optional<value_type> current_;