mqtt_cpp
property.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2018
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #if !defined(MQTT_PROPERTY_HPP)
8 #define MQTT_PROPERTY_HPP
9 
10 #include <string>
11 #include <vector>
12 #include <memory>
13 #include <algorithm>
14 
15 #include <boost/asio/buffer.hpp>
16 #include <boost/numeric/conversion/cast.hpp>
17 #include <boost/container/static_vector.hpp>
18 
19 #include <mqtt/namespace.hpp>
20 #include <mqtt/optional.hpp>
21 #include <mqtt/two_byte_util.hpp>
23 #include <mqtt/exception.hpp>
24 #include <mqtt/string_check.hpp>
25 #include <mqtt/property_id.hpp>
26 #include <mqtt/four_byte_util.hpp>
29 #include <mqtt/variable_length.hpp>
30 #include <mqtt/buffer.hpp>
31 #include <mqtt/move.hpp>
32 #include <mqtt/type.hpp>
33 
34 namespace MQTT_NS {
35 
36 namespace as = boost::asio;
37 
38 namespace v5 {
39 
40 namespace property {
41 
42 namespace detail {
43 
44 enum class ostream_format {
45  direct,
46  int_cast,
47  key_val,
49 };
50 
51 template <std::size_t N>
54  :id_(id) {}
55 
56  template <typename It>
58  :id_(id), buf_(force_move(b), force_move(e)) {}
59 
60  n_bytes_property(property::id id, boost::container::static_vector<char, N> buf)
61  :id_(id), buf_(force_move(buf)) {}
62 
67  void add_const_buffer_sequence(std::vector<as::const_buffer>& v) const {
68  v.emplace_back(as::buffer(&id_, 1));
69  v.emplace_back(as::buffer(buf_.data(), buf_.size()));
70  }
71 
78  template <typename It>
79  void fill(It b, It e) const {
80  (void)e; // Avoid warning in release builds about unused variable
81  BOOST_ASSERT(static_cast<std::size_t>(std::distance(b, e)) >= size());
82  *b++ = static_cast<typename std::iterator_traits<It>::value_type>(id_);
83  std::copy(buf_.begin(), buf_.end(), b);
84  }
85 
90  property::id id() const {
91  return id_;
92  }
93 
98  std::size_t size() const {
99  return 1 + buf_.size();
100  }
101 
106  static constexpr std::size_t num_of_const_buffer_sequence() {
107  return 2;
108  }
109 
110  static constexpr ostream_format const of_ = ostream_format::direct;
112  boost::container::static_vector<char, N> buf_;
113 };
114 
117  :id_(id),
118  buf_(force_move(buf)),
119  length_{ num_to_2bytes(boost::numeric_cast<std::uint16_t>(buf_.size())) } {
120  if (buf_.size() > 0xffff) throw property_length_error();
121  }
122 
127  void add_const_buffer_sequence(std::vector<as::const_buffer>& v) const {
128  v.emplace_back(as::buffer(&id_, 1));
129  v.emplace_back(as::buffer(length_.data(), length_.size()));
130  v.emplace_back(as::buffer(buf_.data(), buf_.size()));
131  }
132 
139  template <typename It>
140  void fill(It b, It e) const {
141  (void)e; // Avoid warning in release builds about unused variable
142  using dt = typename It::difference_type;
143 
144  BOOST_ASSERT(static_cast<std::size_t>(std::distance(b, e)) >= size());
145  *b++ = static_cast<typename std::iterator_traits<It>::value_type>(id_);
146  std::copy(length_.begin(), length_.end(), b);
147  std::advance(b, static_cast<dt>(length_.size()));
148  std::copy(buf_.begin(), buf_.end(), b);
149  }
150 
155  property::id id() const {
156  return id_;
157  }
158 
163  std::size_t size() const {
164  return 1 + length_.size() + buf_.size();
165  }
166 
171  static constexpr std::size_t num_of_const_buffer_sequence() {
172  return 2;
173  }
174 
175  constexpr buffer const& val() const {
176  return buf_;
177  }
178 
179  static constexpr ostream_format const of_ = ostream_format::direct;
182  boost::container::static_vector<char, 2> length_;
183 };
184 
186  string_property(property::id id, buffer buf, bool already_checked)
187  :binary_property(id, force_move(buf)) {
188  if (!already_checked) {
189  auto r = utf8string::validate_contents(this->val());
191  }
192  }
193 };
194 
196  variable_property(property::id id, std::size_t value)
197  :id_(id) {
198  variable_push(value_, value);
199  }
200 
205  void add_const_buffer_sequence(std::vector<as::const_buffer>& v) const {
206  v.emplace_back(as::buffer(&id_, 1));
207  v.emplace_back(as::buffer(value_.data(), value_.size()));
208  }
209 
216  template <typename It>
217  void fill(It b, It e) const {
218  (void)e; // Avoid warning in release builds about unused variable
219  BOOST_ASSERT(static_cast<std::size_t>(std::distance(b, e)) >= size());
220  *b++ = static_cast<typename std::iterator_traits<It>::value_type>(id_);
221  std::copy(value_.begin(), value_.end(), b);
222  }
223 
228  property::id id() const {
229  return id_;
230  }
231 
236  std::size_t size() const {
237  return 1 + value_.size();
238  }
239 
244  static constexpr std::size_t num_of_const_buffer_sequence() {
245  return 2;
246  }
247 
248  constexpr std::size_t val() const {
249  return std::get<0>(variable_length(value_));
250  }
251 
252  static constexpr ostream_format const of_ = ostream_format::direct;
254  boost::container::static_vector<char, 4> value_;
255 };
256 
257 } // namespace detail
258 
260 public:
265  string
266  };
267 
269  : detail::n_bytes_property<1>(id::payload_format_indicator, { fmt == binary ? char(0) : char(1) } ) {}
270 
271  template <typename It>
273  : detail::n_bytes_property<1>(id::payload_format_indicator, b, e) {}
274 
275  payload_format val() const {
276  return ( (buf_.front() == 0)
277  ? binary
278  : string);
279  }
280 
282 };
283 
284 
286 public:
291 
292  template <typename It>
294  : detail::n_bytes_property<4>(id::message_expiry_interval, b, e) {}
295 
296  std::uint32_t val() const {
297  return make_uint32_t(buf_.begin(), buf_.end());
298  }
299 };
300 
302 public:
303  explicit content_type(buffer val, bool already_checked = false)
304  : detail::string_property(id::content_type, force_move(val), already_checked) {}
305 };
306 
308 public:
309  explicit response_topic(buffer val, bool already_checked = false)
310  : detail::string_property(id::response_topic, force_move(val), already_checked) {}
311 };
312 
314 public:
315  explicit correlation_data(buffer val, bool already_checked = false)
316  : detail::string_property(id::correlation_data, force_move(val), already_checked) {}
317 };
318 
320 public:
323  subscription_identifier(std::size_t subscription_id)
324  : detail::variable_property(id::subscription_identifier, subscription_id) {}
325 };
326 
328 public:
333  static_assert(sizeof(session_expiry_interval_t) == 4, "sizeof(sesion_expiry_interval) should be 4");
334  }
335 
336  template <typename It>
338  : detail::n_bytes_property<4>(id::session_expiry_interval, b, e) {}
339 
341  return make_uint32_t(buf_.begin(), buf_.end());
342  }
343 };
344 
346 public:
347  explicit assigned_client_identifier(buffer val, bool already_checked = false)
348  : detail::string_property(id::assigned_client_identifier, force_move(val), already_checked) {}
349 };
350 
352 public:
355  server_keep_alive(std::uint16_t val)
356  : detail::n_bytes_property<2>(id::server_keep_alive, { num_to_2bytes(val) } ) {}
357 
358  template <typename It>
359  server_keep_alive(It b, It e)
360  : detail::n_bytes_property<2>(id::server_keep_alive, b, e) {}
361 
362  std::uint16_t val() const {
363  return make_uint16_t(buf_.begin(), buf_.end());
364  }
365 };
366 
368 public:
369  explicit authentication_method(buffer val, bool already_checked = false)
370  : detail::string_property(id::authentication_method, force_move(val), already_checked) {}
371 };
372 
374 public:
377 };
378 
380 public:
384  : detail::n_bytes_property<1>(id::request_problem_information, { value ? char(1) : char(0) } ) {}
385 
386  template <typename It>
388  : detail::n_bytes_property<1>(id::request_problem_information, b, e) {}
389 
390  bool val() const {
391  return buf_.front() == 1;
392  }
393 };
394 
396 public:
399  will_delay_interval(std::uint32_t val)
400  : detail::n_bytes_property<4>(id::will_delay_interval, { num_to_4bytes(val) } ) {}
401 
402  template <typename It>
404  : detail::n_bytes_property<4>(id::will_delay_interval, b, e) {}
405 
406  std::uint32_t val() const {
407  return make_uint32_t(buf_.begin(), buf_.end());
408  }
409 };
410 
412 public:
416  : detail::n_bytes_property<1>(id::request_response_information, { value ? char(1) : char(0) } ) {}
417 
418  template <typename It>
420  : detail::n_bytes_property<1>(id::request_response_information, b, e) {}
421 
422  bool val() const {
423  return buf_.front() == 1;
424  }
425 };
426 
428 public:
429  explicit response_information(buffer val, bool already_checked = false)
430  : detail::string_property(id::response_information, force_move(val), already_checked) {}
431 };
432 
434 public:
435  explicit server_reference(buffer val, bool already_checked = false)
436  : detail::string_property(id::server_reference, force_move(val), already_checked) {}
437 };
438 
440 public:
441  explicit reason_string(buffer val, bool already_checked = false)
442  : detail::string_property(id::reason_string, force_move(val), already_checked) {}
443 };
444 
446 public:
449  receive_maximum(std::uint16_t val)
450  : detail::n_bytes_property<2>(id::receive_maximum, { num_to_2bytes(val) } ) {}
451 
452  template <typename It>
453  receive_maximum(It b, It e)
454  : detail::n_bytes_property<2>(id::receive_maximum, b, e) {}
455 
456  std::uint16_t val() const {
457  return make_uint16_t(buf_.begin(), buf_.end());
458  }
459 };
460 
461 
463 public:
466  topic_alias_maximum(std::uint16_t val)
467  : detail::n_bytes_property<2>(id::topic_alias_maximum, { num_to_2bytes(val) } ) {}
468 
469  template <typename It>
471  : detail::n_bytes_property<2>(id::topic_alias_maximum, b, e) {}
472 
473  std::uint16_t val() const {
474  return make_uint16_t(buf_.begin(), buf_.end());
475  }
476 };
477 
478 
480 public:
481  using recv = topic_alias;
483  topic_alias(std::uint16_t val)
484  : detail::n_bytes_property<2>(id::topic_alias, { num_to_2bytes(val) } ) {}
485 
486  template <typename It>
487  topic_alias(It b, It e)
488  : detail::n_bytes_property<2>(id::topic_alias, b, e) {}
489 
490  std::uint16_t val() const {
491  return make_uint16_t(buf_.begin(), buf_.end());
492  }
493 };
494 
496 public:
497  using recv = maximum_qos;
500  : detail::n_bytes_property<1>(id::maximum_qos, { static_cast<char>(value) } ) {
501  if (value != qos::at_most_once &&
502  value != qos::at_least_once &&
503  value != qos::exactly_once) throw property_parse_error();
504  }
505 
506  template <typename It>
507  maximum_qos(It b, It e)
508  : detail::n_bytes_property<1>(id::maximum_qos, b, e) {}
509 
510  std::uint8_t val() const {
511  return static_cast<std::uint8_t>(buf_.front());
512  }
513 
515 };
516 
518 public:
521  retain_available(bool value)
522  : detail::n_bytes_property<1>(id::retain_available, { value ? char(1) : char(0) } ) {}
523 
524  template <typename It>
525  retain_available(It b, It e)
526  : detail::n_bytes_property<1>(id::retain_available, b, e) {}
527 
528  bool val() const {
529  return buf_.front() == 1;
530  }
531 };
532 
533 
535 public:
536  user_property(buffer key, buffer val, bool key_already_checked = false, bool val_already_checked = false)
537  : key_(force_move(key), key_already_checked), val_(force_move(val), val_already_checked) {}
538 
543  void add_const_buffer_sequence(std::vector<as::const_buffer>& v) const {
544  v.emplace_back(as::buffer(&id_, 1));
545  v.emplace_back(as::buffer(key_.len.data(), key_.len.size()));
546  v.emplace_back(as::buffer(key_.buf));
547  v.emplace_back(as::buffer(val_.len.data(), val_.len.size()));
548  v.emplace_back(as::buffer(val_.buf));
549  }
550 
551  template <typename It>
552  void fill(It b, It e) const {
553  (void)e; // Avoid warning in release builds about unused variable
554  using dt = typename It::difference_type;
555  BOOST_ASSERT(static_cast<std::size_t>(std::distance(b, e)) >= size());
556 
557  *b++ = static_cast<typename std::iterator_traits<It>::value_type>(id_);
558  {
559  std::copy(key_.len.begin(), key_.len.end(), b);
560  std::advance(b, static_cast<dt>(key_.len.size()));
561  auto ptr = key_.buf.data();
562  auto size = key_.buf.size();
563  std::copy(ptr, std::next(ptr, static_cast<dt>(size)), b);
564  std::advance(b, static_cast<dt>(size));
565  }
566  {
567  std::copy(val_.len.begin(), val_.len.end(), b);
568  std::advance(b, static_cast<dt>(val_.len.size()));
569  auto ptr = val_.buf.data();
570  auto size = val_.buf.size();
571  std::copy(ptr, std::next(ptr, static_cast<dt>(size)), b);
572  std::advance(b, static_cast<dt>(size));
573  }
574  }
575 
580  property::id id() const {
581  return id_;
582  }
583 
588  std::size_t size() const {
589  return
590  1 + // id_
591  key_.size() +
592  val_.size();
593  }
594 
599  static constexpr std::size_t num_of_const_buffer_sequence() {
600  return
601  1 + // header
602  2 + // key (len, buf)
603  2; // val (len, buf)
604  }
605 
606  constexpr buffer const& key() const {
607  return key_.buf;
608  }
609 
610  constexpr buffer const& val() const {
611  return val_.buf;
612  }
613 
615 
616 private:
617  struct len_str {
618  explicit len_str(buffer b, bool already_checked = false)
619  : buf(force_move(b)),
620  len{ num_to_2bytes(boost::numeric_cast<std::uint16_t>(buf.size())) }
621  {
622  if (!already_checked) {
623  auto r = utf8string::validate_contents(buf);
625  }
626  }
627 
628  std::size_t size() const {
629  return len.size() + buf.size();
630  }
631  buffer buf;
632  boost::container::static_vector<char, 2> len;
633  };
634 
635 private:
637  len_str key_;
638  len_str val_;
639 };
640 
642 public:
645  maximum_packet_size(std::uint32_t val)
646  : detail::n_bytes_property<4>(id::maximum_packet_size, { num_to_4bytes(val) } ) {}
647 
648  template <typename It>
650  : detail::n_bytes_property<4>(id::maximum_packet_size, b, e) {}
651 
652  std::uint32_t val() const {
653  return make_uint32_t(buf_.begin(), buf_.end());
654  }
655 };
656 
657 
659 public:
663  : detail::n_bytes_property<1>(id::wildcard_subscription_available, { value ? char(1) : char(0) } ) {}
664 
665  template <typename It>
667  : detail::n_bytes_property<1>(id::wildcard_subscription_available, b, e) {}
668 
669  bool val() const {
670  return buf_.front() == 1;
671  }
672 };
673 
674 
676 public:
680  : detail::n_bytes_property<1>(id::subscription_identifier_available, { value ? char(1) : char(0) } ) {}
681 
682  template <typename It>
685 
686  bool val() const {
687  return buf_.front() == 1;
688  }
689 };
690 
691 
693 public:
697  : detail::n_bytes_property<1>(id::shared_subscription_available, { value ? char(1) : char(0) } ) {}
698 
699  template <typename It>
701  : detail::n_bytes_property<1>(id::shared_subscription_available, b, e) {}
702 
703  bool val() const {
704  return buf_.front() == 1;
705  }
706 };
707 
708 template <typename Property>
709 std::enable_if_t< Property::of_ == detail::ostream_format::direct, std::ostream& >
710 operator<<(std::ostream& o, Property const& p) {
711  o << p.val();
712  return o;
713 }
714 
715 template <typename Property>
716 std::enable_if_t< Property::of_ == detail::ostream_format::int_cast, std::ostream& >
717 operator<<(std::ostream& o, Property const& p) {
718  o << static_cast<int>(p.val());
719  return o;
720 }
721 
722 template <typename Property>
723 std::enable_if_t< Property::of_ == detail::ostream_format::key_val, std::ostream& >
724 operator<<(std::ostream& o, Property const& p) {
725  o << p.key() << ':' << p.val();
726  return o;
727 }
728 
729 template <typename Property>
730 std::enable_if_t< Property::of_ == detail::ostream_format::binary_string, std::ostream& >
731 operator<<(std::ostream& o, Property const& p) {
732  // Note this only compiles because both strings below are the same length.
733  o << ((p.val() == payload_format_indicator::binary) ? "binary" : "string");
734  return o;
735 }
736 
737 
738 } // namespace property
739 } // namespace v5
740 } // namespace MQTT_NS
741 
742 #endif // MQTT_PROPERTY_HPP
buffer that has string_view interface This class provides string_view interface. This class hold stri...
Definition: buffer.hpp:30
assigned_client_identifier(buffer val, bool already_checked=false)
Definition: property.hpp:347
Definition: property.hpp:373
authentication_data(buffer val)
Definition: property.hpp:375
authentication_method(buffer val, bool already_checked=false)
Definition: property.hpp:369
Definition: property.hpp:301
content_type(buffer val, bool already_checked=false)
Definition: property.hpp:303
Definition: property.hpp:313
correlation_data(buffer val, bool already_checked=false)
Definition: property.hpp:315
Definition: property.hpp:641
std::uint32_t val() const
Definition: property.hpp:652
maximum_packet_size(It b, It e)
Definition: property.hpp:649
maximum_packet_size(std::uint32_t val)
Definition: property.hpp:645
Definition: property.hpp:495
maximum_qos(qos value)
Definition: property.hpp:499
std::uint8_t val() const
Definition: property.hpp:510
static constexpr const detail::ostream_format of_
Definition: property.hpp:514
maximum_qos(It b, It e)
Definition: property.hpp:507
message_expiry_interval(It b, It e)
Definition: property.hpp:293
std::uint32_t val() const
Definition: property.hpp:296
message_expiry_interval(std::uint32_t val)
Definition: property.hpp:289
static constexpr detail::ostream_format const of_
Definition: property.hpp:281
payload_format_indicator(It b, It e)
Definition: property.hpp:272
payload_format val() const
Definition: property.hpp:275
payload_format
Definition: property.hpp:263
payload_format_indicator(payload_format fmt=binary)
Definition: property.hpp:268
Definition: property.hpp:439
reason_string(buffer val, bool already_checked=false)
Definition: property.hpp:441
Definition: property.hpp:445
receive_maximum(std::uint16_t val)
Definition: property.hpp:449
std::uint16_t val() const
Definition: property.hpp:456
receive_maximum(It b, It e)
Definition: property.hpp:453
request_problem_information(It b, It e)
Definition: property.hpp:387
request_problem_information(bool value)
Definition: property.hpp:383
bool val() const
Definition: property.hpp:390
bool val() const
Definition: property.hpp:422
request_response_information(It b, It e)
Definition: property.hpp:419
request_response_information(bool value)
Definition: property.hpp:415
response_information(buffer val, bool already_checked=false)
Definition: property.hpp:429
Definition: property.hpp:307
response_topic(buffer val, bool already_checked=false)
Definition: property.hpp:309
Definition: property.hpp:517
bool val() const
Definition: property.hpp:528
retain_available(bool value)
Definition: property.hpp:521
retain_available(It b, It e)
Definition: property.hpp:525
Definition: property.hpp:351
server_keep_alive(It b, It e)
Definition: property.hpp:359
std::uint16_t val() const
Definition: property.hpp:362
server_keep_alive(std::uint16_t val)
Definition: property.hpp:355
Definition: property.hpp:433
server_reference(buffer val, bool already_checked=false)
Definition: property.hpp:435
session_expiry_interval(It b, It e)
Definition: property.hpp:337
session_expiry_interval_t val() const
Definition: property.hpp:340
session_expiry_interval(session_expiry_interval_t val)
Definition: property.hpp:331
shared_subscription_available(bool value)
Definition: property.hpp:696
shared_subscription_available(It b, It e)
Definition: property.hpp:700
bool val() const
Definition: property.hpp:703
bool val() const
Definition: property.hpp:686
subscription_identifier_available(It b, It e)
Definition: property.hpp:683
subscription_identifier_available(bool value)
Definition: property.hpp:679
subscription_identifier(std::size_t subscription_id)
Definition: property.hpp:323
Definition: property.hpp:462
topic_alias_maximum(It b, It e)
Definition: property.hpp:470
std::uint16_t val() const
Definition: property.hpp:473
topic_alias_maximum(std::uint16_t val)
Definition: property.hpp:466
Definition: property.hpp:479
std::uint16_t val() const
Definition: property.hpp:490
topic_alias(std::uint16_t val)
Definition: property.hpp:483
topic_alias(It b, It e)
Definition: property.hpp:487
Definition: property.hpp:534
std::size_t size() const
Get whole size of sequence.
Definition: property.hpp:588
static constexpr detail::ostream_format const of_
Definition: property.hpp:614
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition: property.hpp:599
property::id id() const
Get property::id.
Definition: property.hpp:580
constexpr buffer const & key() const
Definition: property.hpp:606
void fill(It b, It e) const
Definition: property.hpp:552
constexpr buffer const & val() const
Definition: property.hpp:610
void add_const_buffer_sequence(std::vector< as::const_buffer > &v) const
Add const buffer sequence into the given buffer.
Definition: property.hpp:543
user_property(buffer key, buffer val, bool key_already_checked=false, bool val_already_checked=false)
Definition: property.hpp:536
bool val() const
Definition: property.hpp:669
wildcard_subscription_available(bool value)
Definition: property.hpp:662
wildcard_subscription_available(It b, It e)
Definition: property.hpp:666
Definition: property.hpp:395
will_delay_interval(std::uint32_t val)
Definition: property.hpp:399
will_delay_interval(It b, It e)
Definition: property.hpp:403
std::uint32_t val() const
Definition: property.hpp:406
@ well_formed
UTF-8 string is well_formed. See http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3....
constexpr validation validate_contents(string_view str)
Definition: utf8encoded_strings.hpp:47
ostream_format
Definition: property.hpp:44
std::enable_if_t< Property::of_==detail::ostream_format::direct, std::ostream & > operator<<(std::ostream &o, Property const &p)
Definition: property.hpp:710
id
Definition: property_id.hpp:19
Definition: any.hpp:27
boost::container::static_vector< char, 4 > num_to_4bytes(std::uint32_t val)
Definition: four_byte_util.hpp:21
void variable_push(Container &c, std::size_t size)
Definition: variable_length.hpp:31
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20
boost::container::static_vector< char, 2 > num_to_2bytes(std::uint16_t val)
Definition: two_byte_util.hpp:20
constexpr std::tuple< std::size_t, std::size_t > variable_length(T const &bytes)
Definition: variable_length.hpp:42
qos
Definition: subscribe_options.hpp:34
constexpr std::uint16_t make_uint16_t(It b, It e)
Definition: two_byte_util.hpp:34
constexpr std::uint32_t make_uint32_t(It b, It e)
Definition: four_byte_util.hpp:39
std::uint32_t session_expiry_interval_t
Definition: type.hpp:16
Definition: buffer.hpp:242
const_buffer buffer(MQTT_NS::buffer const &data)
create boost::asio::const_buffer from the MQTT_NS::buffer boost::asio::const_buffer is a kind of view...
Definition: buffer.hpp:253
Definition: buffer.hpp:241
Definition: exception.hpp:115
Definition: exception.hpp:109
Definition: exception.hpp:51
static constexpr ostream_format const of_
Definition: property.hpp:179
property::id id_
Definition: property.hpp:180
binary_property(property::id id, buffer buf)
Definition: property.hpp:116
std::size_t size() const
Get whole size of sequence.
Definition: property.hpp:163
constexpr buffer const & val() const
Definition: property.hpp:175
boost::container::static_vector< char, 2 > length_
Definition: property.hpp:182
property::id id() const
Get property::id.
Definition: property.hpp:155
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition: property.hpp:171
void fill(It b, It e) const
Copy the internal information to the range between b and e it is for boost asio APIs.
Definition: property.hpp:140
buffer buf_
Definition: property.hpp:181
void add_const_buffer_sequence(std::vector< as::const_buffer > &v) const
Add const buffer sequence into the given buffer.
Definition: property.hpp:127
property::id id() const
Get property::id.
Definition: property.hpp:90
n_bytes_property(property::id id)
Definition: property.hpp:53
void add_const_buffer_sequence(std::vector< as::const_buffer > &v) const
Add const buffer sequence into the given buffer.
Definition: property.hpp:67
std::size_t size() const
Get whole size of sequence.
Definition: property.hpp:98
property::id id_
Definition: property.hpp:111
n_bytes_property(property::id id, It b, It e)
Definition: property.hpp:57
static constexpr ostream_format const of_
Definition: property.hpp:110
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition: property.hpp:106
n_bytes_property(property::id id, boost::container::static_vector< char, N > buf)
Definition: property.hpp:60
void fill(It b, It e) const
Copy the internal information to the range between b and e it is for boost asio APIs.
Definition: property.hpp:79
boost::container::static_vector< char, N > buf_
Definition: property.hpp:112
string_property(property::id id, buffer buf, bool already_checked)
Definition: property.hpp:186
void add_const_buffer_sequence(std::vector< as::const_buffer > &v) const
Add const buffer sequence into the given buffer.
Definition: property.hpp:205
constexpr std::size_t val() const
Definition: property.hpp:248
boost::container::static_vector< char, 4 > value_
Definition: property.hpp:254
property::id id_
Definition: property.hpp:253
variable_property(property::id id, std::size_t value)
Definition: property.hpp:196
static constexpr ostream_format const of_
Definition: property.hpp:252
std::size_t size() const
Get whole size of sequence.
Definition: property.hpp:236
static constexpr std::size_t num_of_const_buffer_sequence()
Get number of element of const_buffer_sequence.
Definition: property.hpp:244
void fill(It b, It e) const
Copy the internal information to the range between b and e it is for boost asio APIs.
Definition: property.hpp:217
property::id id() const
Get property::id.
Definition: property.hpp:228