From 22cf10a454f726df45c1c017b7f3187a5c4498e1 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Thu, 19 Sep 2024 13:29:57 -0700 Subject: [PATCH] Formatting --- include/aws/iot/MqttRequestResponseClient.h | 76 ++++++++++++--------- source/iot/MqttRequestResponseClient.cpp | 11 +-- 2 files changed, 46 insertions(+), 41 deletions(-) diff --git a/include/aws/iot/MqttRequestResponseClient.h b/include/aws/iot/MqttRequestResponseClient.h index 3cfb282e9..c482636f9 100644 --- a/include/aws/iot/MqttRequestResponseClient.h +++ b/include/aws/iot/MqttRequestResponseClient.h @@ -28,7 +28,7 @@ namespace Aws { class Mqtt5Client; } - } + } // namespace Crt namespace Iot { @@ -64,20 +64,24 @@ namespace Aws class AWS_CRT_CPP_API SubscriptionStatusEvent { public: - SubscriptionStatusEvent() : m_type(SubscriptionStatusEventType::SubscriptionEstablished), m_errorCode(0) {} + SubscriptionStatusEvent() : m_type(SubscriptionStatusEventType::SubscriptionEstablished), m_errorCode(0) + { + } SubscriptionStatusEvent(const SubscriptionStatusEvent &rhs) = default; SubscriptionStatusEvent(SubscriptionStatusEvent &&rhs) = default; ~SubscriptionStatusEvent() = default; - SubscriptionStatusEvent &operator =(const SubscriptionStatusEvent &rhs) = default; - SubscriptionStatusEvent &operator =(SubscriptionStatusEvent &&rhs) = default; + SubscriptionStatusEvent &operator=(const SubscriptionStatusEvent &rhs) = default; + SubscriptionStatusEvent &operator=(SubscriptionStatusEvent &&rhs) = default; - SubscriptionStatusEvent &WithType(SubscriptionStatusEventType type) { + SubscriptionStatusEvent &WithType(SubscriptionStatusEventType type) + { m_type = type; return *this; } - SubscriptionStatusEvent &WithErrorCode(int errorCode) { + SubscriptionStatusEvent &WithErrorCode(int errorCode) + { m_errorCode = errorCode; return *this; } @@ -86,7 +90,6 @@ namespace Aws int GetErrorCode() const { return m_errorCode; } private: - SubscriptionStatusEventType m_type; int m_errorCode; }; @@ -102,10 +105,11 @@ namespace Aws IncomingPublishEvent(IncomingPublishEvent &&rhs) = default; ~IncomingPublishEvent() = default; - IncomingPublishEvent &operator =(const IncomingPublishEvent &rhs) = default; - IncomingPublishEvent &operator =(IncomingPublishEvent &&rhs) = default; + IncomingPublishEvent &operator=(const IncomingPublishEvent &rhs) = default; + IncomingPublishEvent &operator=(IncomingPublishEvent &&rhs) = default; - IncomingPublishEvent &WithPayload(Aws::Crt::ByteCursor payload) { + IncomingPublishEvent &WithPayload(Aws::Crt::ByteCursor payload) + { m_payload = payload; return *this; } @@ -113,7 +117,6 @@ namespace Aws Aws::Crt::ByteCursor GetPayload() const { return m_payload; } private: - Aws::Crt::ByteCursor m_payload; }; @@ -127,7 +130,8 @@ namespace Aws class AWS_CRT_CPP_API UnmodeledResponse { public: - UnmodeledResponse() : m_topic(), m_payload() { + UnmodeledResponse() : m_topic(), m_payload() + { AWS_ZERO_STRUCT(m_payload); AWS_ZERO_STRUCT(m_topic); } @@ -135,15 +139,17 @@ namespace Aws UnmodeledResponse(UnmodeledResponse &&rhs) = default; ~UnmodeledResponse() = default; - UnmodeledResponse &operator =(const UnmodeledResponse &rhs) = default; - UnmodeledResponse &operator =(UnmodeledResponse &&rhs) = default; + UnmodeledResponse &operator=(const UnmodeledResponse &rhs) = default; + UnmodeledResponse &operator=(UnmodeledResponse &&rhs) = default; - UnmodeledResponse &WithPayload(Aws::Crt::ByteCursor payload) { + UnmodeledResponse &WithPayload(Aws::Crt::ByteCursor payload) + { m_payload = payload; return *this; } - UnmodeledResponse &WithTopic(Aws::Crt::ByteCursor topic) { + UnmodeledResponse &WithTopic(Aws::Crt::ByteCursor topic) + { m_topic = topic; return *this; } @@ -153,7 +159,6 @@ namespace Aws Aws::Crt::ByteCursor GetTopic() const { return m_topic; } private: - /** * MQTT Topic that the response was received on. Different topics map to different types within the * service model, so we need this value in order to know what to deserialize the payload into. @@ -230,11 +235,9 @@ namespace Aws using UnmodeledResultHandler = std::function; - template - class StreamingOperationOptions + template class StreamingOperationOptions { public: - StreamingOperationOptions() = default; StreamingOperationOptions(const StreamingOperationOptions &rhs) = default; StreamingOperationOptions(StreamingOperationOptions &&rhs) = default; @@ -243,21 +246,26 @@ namespace Aws StreamingOperationOptions &operator=(const StreamingOperationOptions &rhs) = default; StreamingOperationOptions &operator=(StreamingOperationOptions &&rhs) = default; - StreamingOperationOptions &WithSubscriptionStatusEventHandler(const SubscriptionStatusEventHandler &handler) { + StreamingOperationOptions &WithSubscriptionStatusEventHandler( + const SubscriptionStatusEventHandler &handler) + { m_subscriptionStatusEventHandler = handler; return *this; } - StreamingOperationOptions &WithStreamHandler(const std::function &handler) { + StreamingOperationOptions &WithStreamHandler(const std::function &handler) + { m_streamHandler = handler; return *this; } - const SubscriptionStatusEventHandler &GetSubscriptionStatusEventHandler() const { return m_subscriptionStatusEventHandler; } + const SubscriptionStatusEventHandler &GetSubscriptionStatusEventHandler() const + { + return m_subscriptionStatusEventHandler; + } const std::function &GetStreamHandler() const { return m_streamHandler; } private: - SubscriptionStatusEventHandler m_subscriptionStatusEventHandler; std::function m_streamHandler; @@ -267,10 +275,8 @@ namespace Aws struct AWS_CRT_CPP_API StreamingOperationOptionsInternal { public: - StreamingOperationOptionsInternal() : - subscriptionTopicFilter(), - subscriptionStatusEventHandler(), - incomingPublishEventHandler() + StreamingOperationOptionsInternal() + : subscriptionTopicFilter(), subscriptionStatusEventHandler(), incomingPublishEventHandler() { AWS_ZERO_STRUCT(subscriptionTopicFilter); } @@ -304,17 +310,21 @@ namespace Aws RequestResponseClientOptions &operator=(const RequestResponseClientOptions &rhs) = default; RequestResponseClientOptions &operator=(RequestResponseClientOptions &&rhs) = default; - RequestResponseClientOptions &WithMaxRequestResponseSubscriptions(uint32_t maxRequestResponseSubscriptions) { + RequestResponseClientOptions &WithMaxRequestResponseSubscriptions( + uint32_t maxRequestResponseSubscriptions) + { m_maxRequestResponseSubscriptions = maxRequestResponseSubscriptions; return *this; } - RequestResponseClientOptions &WithMaxStreamingSubscriptions(uint32_t maxStreamingSubscriptions) { + RequestResponseClientOptions &WithMaxStreamingSubscriptions(uint32_t maxStreamingSubscriptions) + { m_maxStreamingSubscriptions = maxStreamingSubscriptions; return *this; } - RequestResponseClientOptions &WithOperationTimeoutInSeconds(uint32_t operationTimeoutInSeconds) { + RequestResponseClientOptions &WithOperationTimeoutInSeconds(uint32_t operationTimeoutInSeconds) + { m_operationTimeoutInSeconds = operationTimeoutInSeconds; return *this; } @@ -349,8 +359,8 @@ namespace Aws const aws_mqtt_request_operation_options &requestOptions, UnmodeledResultHandler &&resultHandler) = 0; - virtual std::shared_ptr CreateStream(const StreamingOperationOptionsInternal &options) = 0; - + virtual std::shared_ptr CreateStream( + const StreamingOperationOptionsInternal &options) = 0; }; AWS_CRT_CPP_API std::shared_ptr NewClientFrom5( diff --git a/source/iot/MqttRequestResponseClient.cpp b/source/iot/MqttRequestResponseClient.cpp index 8a84aef2d..7eb4c779d 100644 --- a/source/iot/MqttRequestResponseClient.cpp +++ b/source/iot/MqttRequestResponseClient.cpp @@ -95,7 +95,6 @@ namespace Aws static void OnTerminatedCallback(void *user_data); private: - StreamingOperationOptionsInternal m_config; struct aws_mqtt_rr_client_operation *m_stream; @@ -120,8 +119,7 @@ namespace Aws struct aws_mqtt_rr_client_operation *stream, const StreamingOperationOptionsInternal &options, struct aws_event_loop *protocolLoop) - : m_config(options), m_stream(stream), m_protocolLoop(protocolLoop), m_lock(), - m_closed(false) + : m_config(options), m_stream(stream), m_protocolLoop(protocolLoop), m_lock(), m_closed(false) { aws_rw_lock_init(&m_lock); } @@ -220,7 +218,6 @@ namespace Aws class StreamingOperation : public IStreamingOperation { public: - static std::shared_ptr Create( Aws::Crt::Allocator *allocator, const StreamingOperationOptionsInternal &options, @@ -232,7 +229,6 @@ namespace Aws virtual void Open(); private: - std::shared_ptr m_impl; }; @@ -417,7 +413,6 @@ namespace Aws class MqttRequestResponseClient : public IMqttRequestResponseClient { public: - explicit MqttRequestResponseClient(MqttRequestResponseClientImpl *impl); virtual ~MqttRequestResponseClient(); @@ -425,10 +420,10 @@ namespace Aws const aws_mqtt_request_operation_options &requestOptions, UnmodeledResultHandler &&resultHandler) override; - std::shared_ptr CreateStream(const StreamingOperationOptionsInternal &options) override; + std::shared_ptr CreateStream( + const StreamingOperationOptionsInternal &options) override; private: - MqttRequestResponseClientImpl *m_impl; };