cpp-msgpack-rpc
0.2.0
An RPC library implementing MessagePack RPC.
Toggle main menu visibility
Loading...
Searching...
No Matches
format_msgpack_object.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 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 <fmt/base.h>
23
#include <msgpack.hpp>
24
25
#include "msgpack_rpc/impl/msgpack_rpc_export.h"
26
27
namespace
msgpack_rpc::util::impl
{
28
32
class
MSGPACK_RPC_EXPORT
FmtMsgpackObjectProxy
{
33
public
:
39
explicit
FmtMsgpackObjectProxy
(
const
msgpack::object&
object
);
40
46
[[nodiscard]]
const
msgpack::object&
object
()
const
noexcept
;
47
48
private
:
50
const
msgpack::object&
51
object_
;
// NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
52
// This class is used only as temporary objects.
53
};
54
55
}
// namespace msgpack_rpc::util::impl
56
57
namespace
fmt
{
58
63
template
<>
64
struct
formatter<
msgpack_rpc
::util::impl::FmtMsgpackObjectProxy> {
65
public
:
72
constexpr
format_parse_context::iterator
parse
(
// NOLINT
73
format_parse_context& context) {
74
return
context.end();
75
}
76
84
[[nodiscard]] MSGPACK_RPC_EXPORT format_context::iterator format(
85
const
msgpack_rpc::util::impl::FmtMsgpackObjectProxy
& value,
86
format_context& context)
const
;
87
};
88
89
}
// namespace fmt
90
91
namespace
msgpack_rpc::util
{
92
99
[[nodiscard]] MSGPACK_RPC_EXPORT
impl::FmtMsgpackObjectProxy
100
format_msgpack_object
(
const
msgpack::object&
object
);
101
102
}
// namespace msgpack_rpc::util
msgpack_rpc::util::impl::FmtMsgpackObjectProxy
Class to format objects in msgpack library using fmt library.
Definition
format_msgpack_object.h:32
msgpack_rpc::util::impl::FmtMsgpackObjectProxy::object
const msgpack::object & object() const noexcept
Get the object in msgpack library.
Definition
format_msgpack_object.cpp:29
msgpack_rpc::util::impl::FmtMsgpackObjectProxy::object_
const msgpack::object & object_
Object in msgpack library.
Definition
format_msgpack_object.h:51
msgpack_rpc::util::impl::FmtMsgpackObjectProxy::FmtMsgpackObjectProxy
FmtMsgpackObjectProxy(const msgpack::object &object)
Constructor.
Definition
format_msgpack_object.cpp:26
fmt
Namespace of fmt library.
Definition
uri.h:113
msgpack_rpc::util::impl
Namespace of internal implementations.
Definition
format_msgpack_object.h:27
msgpack_rpc::util
Namespace of utilities.
Definition
format_msgpack_object.h:27
msgpack_rpc::util::format_msgpack_object
impl::FmtMsgpackObjectProxy format_msgpack_object(const msgpack::object &object)
Format an object in msgpack library using fmt library.
Definition
format_msgpack_object.cpp:50
msgpack_rpc
Namespace of cpp-msgpack-rpc library.
Definition
i_address.h:26
fmt::formatter< msgpack_rpc::util::impl::FmtMsgpackObjectProxy >::parse
constexpr format_parse_context::iterator parse(format_parse_context &context)
Parse format.
Definition
format_msgpack_object.h:72
include
msgpack_rpc
util
format_msgpack_object.h
Generated on
for cpp-msgpack-rpc by
1.18.0