AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ManagedGError.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MANAGEDGERROR_H_
17 #define ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MANAGEDGERROR_H_
18 
19 #include <string>
20 
21 #include <gio/gio.h>
22 
23 namespace alexaClientSDK {
24 namespace bluetoothImplementations {
25 namespace blueZ {
26 
31 public:
37  explicit ManagedGError(GError* error);
38 
42  ManagedGError();
43 
49  bool hasError();
50 
56  GError** toOutputParameter();
57 
62 
69  const char* getMessage();
70 
71 private:
75  GError* m_error;
76 };
77 
78 inline ManagedGError::ManagedGError(GError* error) : m_error{error} {
79 }
80 
82  m_error = nullptr;
83 }
84 
85 inline bool ManagedGError::hasError() {
86  return m_error != nullptr;
87 }
88 
90  return &m_error;
91 }
92 
94  if (m_error != nullptr) {
95  g_error_free(m_error);
96  }
97 }
98 
99 inline const char* ManagedGError::getMessage() {
100  return m_error == nullptr ? nullptr : m_error->message;
101 }
102 
103 } // namespace blueZ
104 } // namespace bluetoothImplementations
105 } // namespace alexaClientSDK
106 
107 #endif // ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_MANAGEDGERROR_H_
GError ** toOutputParameter()
Definition: ManagedGError.h:89
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
const char * getMessage()
Definition: ManagedGError.h:99

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0