cpp-msgpack-light
0.3.0
A light library to serialize MessagePack.
Toggle main menu visibility
Loading...
Searching...
No Matches
array_iterator.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 <cstddef>
23
24
#include "
msgpack_light/details/allocator_wrapper.h
"
25
#include "
msgpack_light/details/object_data.h
"
26
#include "
msgpack_light/details/object_ref_decl.h
"
27
#include "
msgpack_light/standard_allocator.h
"
28
29
namespace
msgpack_light
{
30
43
template
<
typename
Allocator = standard_allocator>
44
class
mutable_array_iterator
{
45
public
:
47
using
difference_type
= std::ptrdiff_t;
48
50
using
value_type
=
mutable_object_ref<Allocator>
;
51
53
using
reference
=
mutable_object_ref<Allocator>
;
54
58
mutable_array_iterator
() noexcept
59
:
pointer_
(
nullptr
),
allocator_
(
nullptr
) {}
60
67
mutable_array_iterator
(
details::object_data
* pointer,
68
details::allocator_wrapper<Allocator>
* allocator) noexcept
69
:
pointer_
(pointer),
allocator_
(allocator) {}
70
76
mutable_object_ref<Allocator>
operator*
() const noexcept;
77
83
mutable_array_iterator
& operator++() noexcept {
84
++
pointer_
;
85
return
*
this
;
86
}
87
93
const
mutable_array_iterator
// NOLINT(readability-const-return-type)
94
operator++
(
int
)
noexcept
{
95
mutable_array_iterator
copy{*
this
};
96
++(*this);
97
return
copy;
98
}
99
100
private
:
102
details::object_data
*
pointer_
;
103
105
details::allocator_wrapper<Allocator>
*
allocator_
;
106
};
107
118
class
const_array_iterator
{
119
public
:
121
using
difference_type
= std::ptrdiff_t;
122
124
using
value_type
=
const_object_ref
;
125
127
using
reference
=
const_object_ref
;
128
132
const_array_iterator
() noexcept :
pointer_
(
nullptr
) {}
133
139
explicit
const_array_iterator
(
const
details::object_data
* pointer) noexcept
140
:
pointer_
(pointer) {}
141
147
const_object_ref
operator*
() const noexcept;
148
154
const_array_iterator
& operator++() noexcept {
155
++
pointer_
;
156
return
*
this
;
157
}
158
164
const
const_array_iterator
// NOLINT(readability-const-return-type)
165
operator++
(
int
)
noexcept
{
166
const_array_iterator
copy{*
this
};
167
++(*this);
168
return
copy;
169
}
170
171
private
:
173
const
details::object_data
*
pointer_
;
174
};
175
176
}
// namespace msgpack_light
allocator_wrapper.h
Definition of allocator_wrapper class.
msgpack_light::const_array_iterator
Class of iterators of arrays to access constant objects.
Definition
array_iterator.h:118
msgpack_light::const_array_iterator::const_array_iterator
const_array_iterator(const details::object_data *pointer) noexcept
Constructor.
Definition
array_iterator.h:139
msgpack_light::const_array_iterator::pointer_
const details::object_data * pointer_
Pointer to the current data.
Definition
array_iterator.h:173
msgpack_light::const_array_iterator::operator++
const const_array_iterator operator++(int) noexcept
Increment this iterator.
Definition
array_iterator.h:165
msgpack_light::const_array_iterator::operator*
const_object_ref operator*() const noexcept
Dereference this iterator.
Definition
array_iterator_impl.h:71
msgpack_light::const_array_iterator::value_type
const_object_ref value_type
Type of values.
Definition
array_iterator.h:124
msgpack_light::const_array_iterator::reference
const_object_ref reference
Type of references.
Definition
array_iterator.h:127
msgpack_light::const_array_iterator::const_array_iterator
const_array_iterator() noexcept
Constructor.
Definition
array_iterator.h:132
msgpack_light::const_array_iterator::difference_type
std::ptrdiff_t difference_type
Type of differences.
Definition
array_iterator.h:121
msgpack_light::const_object_ref
Class to access constant objects.
Definition
object_ref.h:129
msgpack_light::details::allocator_wrapper
Class to wrap allocators.
Definition
allocator_wrapper.h:35
msgpack_light::mutable_array_iterator
Class of iterators of arrays to access non-constant objects.
Definition
array_iterator.h:44
msgpack_light::mutable_array_iterator::mutable_array_iterator
mutable_array_iterator(details::object_data *pointer, details::allocator_wrapper< Allocator > *allocator) noexcept
Constructor.
Definition
array_iterator.h:67
msgpack_light::mutable_array_iterator::operator*
mutable_object_ref< Allocator > operator*() const noexcept
Dereference this iterator.
Definition
array_iterator_impl.h:33
msgpack_light::mutable_array_iterator::difference_type
std::ptrdiff_t difference_type
Type of differences.
Definition
array_iterator.h:47
msgpack_light::mutable_array_iterator::reference
mutable_object_ref< Allocator > reference
Type of references.
Definition
array_iterator.h:53
msgpack_light::mutable_array_iterator::mutable_array_iterator
mutable_array_iterator() noexcept
Constructor.
Definition
array_iterator.h:58
msgpack_light::mutable_array_iterator::operator++
const mutable_array_iterator operator++(int) noexcept
Increment this iterator.
Definition
array_iterator.h:94
msgpack_light::mutable_array_iterator::value_type
mutable_object_ref< Allocator > value_type
Type of values.
Definition
array_iterator.h:50
msgpack_light::mutable_array_iterator< Allocator >::allocator_
details::allocator_wrapper< Allocator > * allocator_
Definition
array_iterator.h:105
msgpack_light::mutable_array_iterator< Allocator >::pointer_
details::object_data * pointer_
Definition
array_iterator.h:102
msgpack_light::mutable_object_ref
Class to access non-constant objects.
Definition
object_ref.h:48
msgpack_light
Namespace of this project.
Definition
binary.h:33
object_data.h
Definition of object_data struct.
object_ref_decl.h
Declaration of classes of references to objects.
standard_allocator.h
Definition of standard_allocator class.
msgpack_light::details::object_data
Struct of data of objects in MessagePack.
Definition
object_data.h:94
include
msgpack_light
details
array_iterator.h
Generated on
for cpp-msgpack-light by
1.18.0