mqtt_cpp
will.hpp
Go to the documentation of this file.
1 // Copyright Takatoshi Kondo 2015
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_WILL_HPP)
8 #define MQTT_WILL_HPP
9 
10 #include <string>
11 
12 #include <mqtt/namespace.hpp>
13 
14 #include <mqtt/namespace.hpp>
15 #include <mqtt/move.hpp>
16 #include <mqtt/publish.hpp>
18 
19 namespace MQTT_NS {
20 
21 class will {
22 public:
36  publish_options pubopts = {},
37  v5::properties props = {})
38  :topic_(force_move(topic)),
39  message_(force_move(message)),
40  pubopts_(pubopts),
41  props_(force_move(props))
42  {}
43 
44  constexpr buffer const& topic() const {
45  return topic_;
46  }
47  constexpr buffer& topic() {
48  return topic_;
49  }
50  constexpr buffer const& message() const {
51  return message_;
52  }
53  constexpr buffer& message() {
54  return message_;
55  }
56  constexpr retain get_retain() const {
57  return pubopts_.get_retain();
58  }
59  constexpr qos get_qos() const {
60  return pubopts_.get_qos();
61  }
62  constexpr v5::properties const& props() const {
63  return props_;
64  }
65  constexpr v5::properties& props() {
66  return props_;
67  }
68 
69 private:
70  buffer topic_;
71  buffer message_;
72  publish_options pubopts_;
73  v5::properties props_;
74 };
75 
76 } // namespace MQTT_NS
77 
78 #endif // MQTT_WILL_HPP
buffer that has string_view interface This class provides string_view interface. This class hold stri...
Definition: buffer.hpp:30
Definition: will.hpp:21
constexpr retain get_retain() const
Definition: will.hpp:56
constexpr buffer const & message() const
Definition: will.hpp:50
will(buffer topic, buffer message, publish_options pubopts={}, v5::properties props={})
constructor
Definition: will.hpp:34
constexpr buffer const & topic() const
Definition: will.hpp:44
constexpr buffer & message()
Definition: will.hpp:53
constexpr qos get_qos() const
Definition: will.hpp:59
constexpr v5::properties & props()
Definition: will.hpp:65
constexpr buffer & topic()
Definition: will.hpp:47
constexpr v5::properties const & props() const
Definition: will.hpp:62
std::vector< property_variant > properties
Definition: property_variant.hpp:51
Definition: any.hpp:27
constexpr std::remove_reference_t< T > && force_move(T &&t)
Definition: move.hpp:20
retain
Definition: publish.hpp:42
qos
Definition: subscribe_options.hpp:34
Definition: publish.hpp:53
constexpr qos get_qos() const
Definition: publish.hpp:84
constexpr retain get_retain() const
Definition: publish.hpp:80