userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
iterator.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <cstdint>
7
#include <iterator>
8
#include <optional>
9
10
#include <
userver/formats/yaml/types.hpp
>
11
#include <
userver/utils/fast_pimpl.hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
formats::yaml
{
16
18
template
<
typename
IterTraits>
19
class
Iterator final {
20
public
:
21
using
iterator_category = std::forward_iterator_tag;
22
using
difference_type = std::ptrdiff_t;
23
using
value_type =
typename
IterTraits::value_type;
24
using
reference =
typename
IterTraits::reference;
25
using
pointer =
typename
IterTraits::pointer;
26
27
Iterator();
28
Iterator(
const
typename
IterTraits::native_iter& iter,
int
index,
const
formats::yaml::Path
& path);
29
Iterator(
const
Iterator& other);
30
Iterator(Iterator&& other)
noexcept
;
31
Iterator& operator=(
const
Iterator& other);
32
Iterator& operator=(Iterator&& other)
noexcept
;
33
~Iterator();
34
35
Iterator operator++(
int
);
36
Iterator& operator++();
37
reference operator*()
const
;
38
pointer operator->()
const
;
39
40
bool
operator==(
const
Iterator& other)
const
;
41
bool
operator!=(
const
Iterator& other)
const
;
42
46
std::string
GetName
()
const
;
51
uint32_t
GetIndex
()
const
;
52
54
Type
GetIteratorType
()
const
;
55
56
private
:
57
void
UpdateValue()
const
;
58
59
static
constexpr
std::size_t kNativeIterSize = 48;
60
static
constexpr
std::size_t kNativeIterAlignment =
alignof
(
void
*);
61
utils::FastPimpl<typename IterTraits::native_iter, kNativeIterSize, kNativeIterAlignment>
iter_pimpl_;
62
formats::yaml::Path
path_;
63
// Temporary object replaced on every value access.
64
mutable
int
index_;
65
mutable
std::optional<value_type> current_;
66
};
67
68
}
// namespace formats::yaml
69
70
USERVER_NAMESPACE_END
userver
formats
yaml
iterator.hpp
Generated on
for userver by
Doxygen
1.17.0