pars 0.2.1
Loading...
Searching...
No Matches
nngxx::msg_body Struct Reference

#include <msg_body.h>

Public Member Functions

 msg_body (nng_msg *m) noexcept
 
std::size_t size () const noexcept
 
template<typename char_t>
char_t * data () noexcept
 
template<typename char_t>
char_t *const data () const noexcept
 
template<uint_c uint_t>
clev::expected< uint_t > append () noexcept
 
template<uint_c uint_t>
clev::expected< uint_t > trim () noexcept
 
clev::expected< void > trim (std::size_t sz) noexcept
 
template<uint_c uint_t>
clev::expected< uint_t > chop () noexcept
 
clev::expected< void > chop (std::size_t sz) noexcept
 

Detailed Description

Definition at line 39 of file msg_body.h.

Constructor & Destructor Documentation

◆ msg_body()

nngxx::msg_body::msg_body ( nng_msg * m)
inlinenoexcept

Definition at line 41 of file msg_body.h.

42 : m{m}
43 {
44 }

Member Function Documentation

◆ append()

template<uint_c uint_t>
clev::expected< uint_t > nngxx::msg_body::append ( )
inlinenodiscardnoexcept

Definition at line 64 of file msg_body.h.

65 {
66 uint_t x;
67
68 int (*append)(nng_msg*, uint_t*);
69
70 if constexpr (std::is_same_v<uint_t, uint16_t>)
71 {
72 append = nng_msg_append;
73 }
74 else if constexpr (std::is_same_v<uint_t, uint32_t>)
75 {
76 append = nng_msg_trim_u32;
77 }
78 else if constexpr (std::is_same_v<uint_t, uint64_t>)
79 {
80 append = nng_msg_trim_u64;
81 }
82
83 return nngxx::invoke(append, m, &x);
84 }
clev::expected< void > invoke(ret_t(*f)(args_t...), args_t... args) noexcept
Definition err.h:123
clev::expected< uint_t > append() noexcept
Definition msg_body.h:64

References append(), and nngxx::invoke().

Referenced by append().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chop() [1/2]

template<uint_c uint_t>
clev::expected< uint_t > nngxx::msg_body::chop ( )
inlinenodiscardnoexcept

Definition at line 115 of file msg_body.h.

116 {
117 uint_t x;
118
119 int (*chop)(nng_msg*, uint_t*);
120
121 if constexpr (std::is_same_v<uint_t, uint16_t>)
122 {
123 chop = nng_msg_chop;
124 }
125 else if constexpr (std::is_same_v<uint_t, uint32_t>)
126 {
127 chop = nng_msg_chop_u32;
128 }
129 else if constexpr (std::is_same_v<uint_t, uint64_t>)
130 {
131 chop = nng_msg_chop_u64;
132 }
133
134 return nngxx::invoke(chop, m, &x);
135 }
clev::expected< uint_t > chop() noexcept
Definition msg_body.h:115

References chop(), and nngxx::invoke().

Referenced by chop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ chop() [2/2]

clev::expected< void > nngxx::msg_body::chop ( std::size_t sz)
inlinenodiscardnoexcept

Definition at line 137 of file msg_body.h.

138 {
139 return nngxx::invoke(nng_msg_chop, m, sz);
140 }

References nngxx::invoke().

Here is the call graph for this function:

◆ data() [1/2]

template<typename char_t>
char_t *const nngxx::msg_body::data ( ) const
inlinenodiscardnoexcept

Definition at line 58 of file msg_body.h.

59 {
60 return static_cast<char_t* const>(nng_msg_body(m));
61 }

◆ data() [2/2]

template<typename char_t>
char_t * nngxx::msg_body::data ( )
inlinenodiscardnoexcept

Definition at line 52 of file msg_body.h.

53 {
54 return static_cast<char_t*>(nng_msg_body(m));
55 }

◆ size()

std::size_t nngxx::msg_body::size ( ) const
inlinenodiscardnoexcept

Definition at line 46 of file msg_body.h.

47 {
48 return nng_msg_len(m);
49 }

◆ trim() [1/2]

template<uint_c uint_t>
clev::expected< uint_t > nngxx::msg_body::trim ( )
inlinenodiscardnoexcept

Definition at line 87 of file msg_body.h.

88 {
89 uint_t x;
90
91 int (*trim)(nng_msg*, uint_t*);
92
93 if constexpr (std::is_same_v<uint_t, uint16_t>)
94 {
95 trim = nng_msg_trim_u16;
96 }
97 else if constexpr (std::is_same_v<uint_t, uint32_t>)
98 {
99 trim = nng_msg_trim_u32;
100 }
101 else if constexpr (std::is_same_v<uint_t, uint64_t>)
102 {
103 trim = nng_msg_trim_u64;
104 }
105
106 return nngxx::invoke(trim, m, &x);
107 }
clev::expected< uint_t > trim() noexcept
Definition msg_body.h:87

References nngxx::invoke(), and trim().

Referenced by trim().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trim() [2/2]

clev::expected< void > nngxx::msg_body::trim ( std::size_t sz)
inlinenodiscardnoexcept

Definition at line 109 of file msg_body.h.

110 {
111 return nngxx::invoke(nng_msg_trim, m, sz);
112 }

References nngxx::invoke().

Here is the call graph for this function:

The documentation for this struct was generated from the following file: