cpp-msgpack-light
0.3.0
A light library to serialize MessagePack.
Toggle main menu visibility
Loading...
Searching...
No Matches
map_iterator_impl.h
Go to the documentation of this file.
1
/*
2
* Copyright 2024 MusicScience37 (Kenta Kabashima)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
20
#pragma once
21
22
#include <utility>
23
24
#include "
msgpack_light/details/map_iterator.h
"
25
#include "
msgpack_light/details/object_data.h
"
26
#include "
msgpack_light/details/object_ref.h
"
// IWYU pragma: keep
27
28
namespace
msgpack_light
{
29
30
/*
31
* Definition of some members of mutable_map_iterator.
32
*/
33
34
template
<
typename
Allocator>
35
inline
std::pair<mutable_object_ref<Allocator>,
mutable_object_ref<Allocator>
>
36
mutable_map_iterator<Allocator>::operator*
() const noexcept {
37
return
{
mutable_object_ref<Allocator>
(
pointer_
->key, *
allocator_
),
38
mutable_object_ref<Allocator>
(
pointer_
->value, *
allocator_
)};
39
}
40
50
template
<
typename
Allocator>
51
[[nodiscard]]
inline
bool
operator==
(
mutable_map_iterator<Allocator>
lhs,
52
mutable_map_iterator<Allocator>
rhs)
noexcept
{
53
return
&(*lhs).first.data() == &(*rhs).first.data();
54
}
55
65
template
<
typename
Allocator>
66
[[nodiscard]]
inline
bool
operator!=
(
mutable_map_iterator<Allocator>
lhs,
67
mutable_map_iterator<Allocator>
rhs)
noexcept
{
68
return
!(lhs == rhs);
69
}
70
71
/*
72
* Definition of some members of const_map_iterator.
73
*/
74
75
inline
std::pair<const_object_ref, const_object_ref>
76
const_map_iterator::operator*
() const noexcept {
77
return
{
const_object_ref
{
pointer_
->
key
},
const_object_ref
{
pointer_
->
value
}};
78
}
79
88
[[nodiscard]]
inline
bool
operator==
(
89
const_map_iterator
lhs,
const_map_iterator
rhs)
noexcept
{
90
return
&(*lhs).first.data() == &(*rhs).first.data();
91
}
92
101
[[nodiscard]]
inline
bool
operator!=
(
102
const_map_iterator
lhs,
const_map_iterator
rhs)
noexcept
{
103
return
!(lhs == rhs);
104
}
105
106
}
// namespace msgpack_light
msgpack_light::const_map_iterator
Class of iterators of maps to access constant objects.
Definition
map_iterator.h:120
msgpack_light::const_map_iterator::operator*
std::pair< const_object_ref, const_object_ref > operator*() const noexcept
Dereference this iterator.
Definition
map_iterator_impl.h:76
msgpack_light::const_map_iterator::pointer_
const details::key_value_pair_data * pointer_
Pointer to the current data.
Definition
map_iterator.h:176
msgpack_light::const_object_ref
Class to access constant objects.
Definition
object_ref.h:129
msgpack_light::mutable_map_iterator
Class of iterators of maps to access non-constant objects.
Definition
map_iterator.h:45
msgpack_light::mutable_map_iterator::allocator_
details::allocator_wrapper< Allocator > * allocator_
Allocator.
Definition
map_iterator.h:107
msgpack_light::mutable_map_iterator::operator*
std::pair< mutable_object_ref< Allocator >, mutable_object_ref< Allocator > > operator*() const noexcept
Dereference this iterator.
Definition
map_iterator_impl.h:36
msgpack_light::mutable_map_iterator::pointer_
details::key_value_pair_data * pointer_
Pointer to the current data.
Definition
map_iterator.h:104
msgpack_light::mutable_object_ref
Class to access non-constant objects.
Definition
object_ref.h:48
msgpack_light::mutable_object_ref::mutable_object_ref
mutable_object_ref(details::object_data &data, details::allocator_wrapper< Allocator > &allocator)
Constructor.
Definition
object_ref.h:67
map_iterator.h
Definition of classes of iterators of maps.
msgpack_light
Namespace of this project.
Definition
binary.h:33
msgpack_light::operator==
bool operator==(binary_view lhs, binary_view rhs)
Compare two binary data.
Definition
binary.h:384
msgpack_light::operator!=
bool operator!=(binary_view lhs, binary_view rhs)
Compare two binary data.
Definition
binary.h:397
object_data.h
Definition of object_data struct.
object_ref.h
Definition of classes of references to objects.
msgpack_light::details::key_value_pair_data::key
object_data key
Key.
Definition
object_data.h:137
msgpack_light::details::key_value_pair_data::value
object_data value
Value.
Definition
object_data.h:140
include
msgpack_light
details
map_iterator_impl.h
Generated on
for cpp-msgpack-light by
1.18.0