cpp-msgpack-light 0.3.0
A light library to serialize MessagePack.
Loading...
Searching...
No Matches
object_ref.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
25#include "msgpack_light/details/object_ref_decl.h" // IWYU pragma: keep
26
27namespace msgpack_light {
28
45template <typename Allocator>
47 : public details::mutable_object_base<mutable_object_ref<Allocator>,
48 Allocator> {
49public:
51 using base_type =
53
54 using typename base_type::allocator_type;
55
60
70
72
79
85 [[nodiscard]] details::object_data& data() noexcept { return *data_; }
86
92 [[nodiscard]] const details::object_data& data() const noexcept {
93 return *data_;
94 }
95
102 return *allocator_;
103 }
104
106
107private:
110
113};
114
129class const_object_ref : public details::const_object_base<const_object_ref> {
130public:
133
138
146
148
155
161 [[nodiscard]] const details::object_data& data() const noexcept {
162 return *data_;
163 }
164
166
167private:
170};
171
172} // namespace msgpack_light
Definition of allocator_wrapper class.
const details::object_data & data() const noexcept
Get the internal data.
Definition object_ref.h:161
const_object_ref(const details::object_data &data)
Constructor.
Definition object_ref.h:144
details::const_object_base< const_object_ref > base_type
Type of the base class.
Definition object_ref.h:132
const details::object_data * data_
Data.
Definition object_ref.h:169
Base class of constant objects in MessagePack.
Definition object_base.h:48
Base class of non-constant objects in MessagePack.
details::allocator_wrapper< Allocator > * allocator_
Allocator.
Definition object_ref.h:112
details::object_data & data() noexcept
Get the internal data.
Definition object_ref.h:85
const details::object_data & data() const noexcept
Get the internal data.
Definition object_ref.h:92
details::mutable_object_base< mutable_object_ref< Allocator >, Allocator > base_type
Type of the base class.
Definition object_ref.h:51
details::allocator_wrapper< Allocator > & allocator() noexcept
Get the allocator.
Definition object_ref.h:101
details::object_data * data_
Data.
Definition object_ref.h:109
mutable_object_ref(details::object_data &data, details::allocator_wrapper< Allocator > &allocator)
Constructor.
Definition object_ref.h:67
Namespace of this project.
Definition binary.h:33
Definition of base classes of objects.
Definition of object_data struct.
Declaration of classes of references to objects.
Struct of data of objects in MessagePack.
Definition object_data.h:94