diff --git a/src/client.cpp b/src/client.cpp index 59c5888..28e49b4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -25,9 +25,7 @@ namespace mqtt { const std::chrono::seconds client::DFLT_TIMEOUT = std::chrono::seconds(30); -#if __cplusplus < 201703L - constexpr int client::DFLT_QOS; -#endif +const int client::DFLT_QOS = 1; ///////////////////////////////////////////////////////////////////////////// diff --git a/src/message.cpp b/src/message.cpp index 9a16b69..28b1afb 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -1,7 +1,7 @@ // message.cpp /******************************************************************************* - * Copyright (c) 2013-2020 Frank Pagliughi + * Copyright (c) 2013-2023 Frank Pagliughi * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -25,10 +25,8 @@ namespace mqtt { ///////////////////////////////////////////////////////////////////////////// -#if __cplusplus < 201703L - constexpr int message::DFLT_QOS; - constexpr bool message::DFLT_RETAINED; -#endif +const int message::DFLT_QOS = 0; +const bool message::DFLT_RETAINED = false; const MQTTAsync_message message::DFLT_C_STRUCT = MQTTAsync_message_initializer; diff --git a/src/mqtt/client.h b/src/mqtt/client.h index eeeec7f..4e9f737 100644 --- a/src/mqtt/client.h +++ b/src/mqtt/client.h @@ -6,7 +6,7 @@ ///////////////////////////////////////////////////////////////////////////// /******************************************************************************* - * Copyright (c) 2013-2020 Frank Pagliughi + * Copyright (c) 2013-2023 Frank Pagliughi * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -40,7 +40,7 @@ class client : private callback /** An arbitrary, but relatively long timeout */ static const std::chrono::seconds DFLT_TIMEOUT; /** The default quality of service */ - static constexpr int DFLT_QOS = 1; + static const int DFLT_QOS; // =1; /** The actual client */ async_client cli_; diff --git a/src/mqtt/message.h b/src/mqtt/message.h index e732f90..3fc2858 100644 --- a/src/mqtt/message.h +++ b/src/mqtt/message.h @@ -6,7 +6,7 @@ ///////////////////////////////////////////////////////////////////////////// /******************************************************************************* - * Copyright (c) 2013-2020 Frank Pagliughi + * Copyright (c) 2013-2023 Frank Pagliughi * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -55,9 +55,9 @@ class message { public: /** The default QoS for a message */ - static constexpr int DFLT_QOS = 0; + static const int DFLT_QOS; // =0 /** The default retained flag */ - static constexpr bool DFLT_RETAINED = false; + static const bool DFLT_RETAINED; // =false private: /** Initializer for the C struct (from the C library) */ diff --git a/src/mqtt/subscribe_options.h b/src/mqtt/subscribe_options.h index 0853f23..e0cc181 100644 --- a/src/mqtt/subscribe_options.h +++ b/src/mqtt/subscribe_options.h @@ -53,17 +53,17 @@ public: using const_ptr_t = std::shared_ptr; /** Don't receive our own publications */ - static constexpr bool SUBSCRIBE_NO_LOCAL = true; + static const bool SUBSCRIBE_NO_LOCAL; // =true; /** Receive our own publications */ - static constexpr bool SUBSCRIBE_LOCAL = false; + static const bool SUBSCRIBE_LOCAL; // =false; /** * Retain flag is only set on publications sent by a broker if in * response to a subscribe request */ - static constexpr bool NO_RETAIN_AS_PUBLISHED = false; + static const bool NO_RETAIN_AS_PUBLISHED; // =false; /** Keep the retain flag as on the original publish message */ - static constexpr bool RETAIN_AS_PUBLISHED = true; + static const bool RETAIN_AS_PUBLISHED; // =true; /** The options for subscription retain handling */ enum RetainHandling { diff --git a/src/mqtt/will_options.h b/src/mqtt/will_options.h index 53d39e2..634c580 100644 --- a/src/mqtt/will_options.h +++ b/src/mqtt/will_options.h @@ -7,7 +7,7 @@ /******************************************************************************* * Copyright (c) 2016 Guilherme M. Ferreira - * Copyright (c) 2016-2019 Frank Pagliughi + * Copyright (c) 2016-2023 Frank Pagliughi * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -49,9 +49,9 @@ class will_options { public: /** The default QoS for the LWT, if unspecified */ - static constexpr int DFLT_QOS = 0; + static const int DFLT_QOS; // =0; /** The defalut retained flag for LWT, if unspecified */ - static constexpr bool DFLT_RETAINED = false; + static const bool DFLT_RETAINED; // =false; private: /** A default C struct to support re-initializing variables */ diff --git a/src/subscribe_options.cpp b/src/subscribe_options.cpp index efa01f8..faf36e4 100644 --- a/src/subscribe_options.cpp +++ b/src/subscribe_options.cpp @@ -22,13 +22,11 @@ namespace mqtt { ///////////////////////////////////////////////////////////////////////////// -#if __cplusplus < 201703L - constexpr bool subscribe_options::SUBSCRIBE_NO_LOCAL; - constexpr bool subscribe_options::SUBSCRIBE_LOCAL; +const bool subscribe_options::SUBSCRIBE_NO_LOCAL = true; +const bool subscribe_options::SUBSCRIBE_LOCAL = false; - constexpr bool subscribe_options::NO_RETAIN_AS_PUBLISHED; - constexpr bool subscribe_options::RETAIN_AS_PUBLISHED; -#endif +const bool subscribe_options::NO_RETAIN_AS_PUBLISHED = false; +const bool subscribe_options::RETAIN_AS_PUBLISHED = true; ///////////////////////////////////////////////////////////////////////////// // end namespace 'mqtt' diff --git a/src/will_options.cpp b/src/will_options.cpp index aa0c6b7..67aabf2 100644 --- a/src/will_options.cpp +++ b/src/will_options.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017-2020 Frank Pagliughi + * Copyright (c) 2017-2023 Frank Pagliughi * Copyright (c) 2016 Guilherme M. Ferreira * * All rights reserved. This program and the accompanying materials @@ -22,10 +22,8 @@ namespace mqtt { -#if __cplusplus < 201703L - constexpr int will_options::DFLT_QOS; - constexpr bool will_options::DFLT_RETAINED; -#endif +const int will_options::DFLT_QOS = 0; +const bool will_options::DFLT_RETAINED = false; const MQTTAsync_willOptions will_options::DFLT_C_STRUCT = MQTTAsync_willOptions_initializer;