#include <GVariantMapReader.h>
Helper class to read values from a map represented by GLib's GVariant*
.
See GVariant Format Strings for type strings explanation.
◆ ~GVariantMapReader()
alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::~GVariantMapReader |
( |
| ) |
|
◆ GVariantMapReader() [1/3]
alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::GVariantMapReader |
( |
GVariant * |
originalVariant, |
|
|
bool |
useObjectPathAsKey = false |
|
) |
| |
|
explicit |
Constructor that initalizes the reader with a raw GVariant*
value.
- Parameters
-
originalVariant | A GVariant* to wrap |
useObjectPathAsKey | Set to true if map key type is object path instead of string |
◆ GVariantMapReader() [2/3]
alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::GVariantMapReader |
( |
ManagedGVariant & |
originalVariant, |
|
|
bool |
useObjectPathAsKey = false |
|
) |
| |
|
explicit |
Constructor that initalizes the reader with a reference to ManagedGVariant
.
- Parameters
-
originalVariant | A ManagedGVariant to wrap |
useObjectPathAsKey | Set to true if map key type is object path instead of string |
◆ GVariantMapReader() [3/3]
alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::GVariantMapReader |
( |
const GVariantMapReader & |
other | ) |
|
Copy constructor
- Parameters
-
◆ forEach()
bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::forEach |
( |
std::function< bool(char *key, GVariant *value)> |
iteratorFunction | ) |
const |
Helper method to traverse
- Parameters
-
iteratorFunction | A boolean(char *key, GVariant *value) callback that receives the items in a map. Callback may return true if it wants the traversal to stop. Returning false will continue the traversal. |
- Returns
- true if traversal was stopped because one of the callback invocations returned true. If none of the callback invocations returned false - method returns false.
◆ get()
GVariant* alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::get |
( |
| ) |
const |
Get the raw GVariant*
value attached to the reader
- Returns
- Raw
GVariant*
value attached to the reader.
◆ getBoolean()
bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::getBoolean |
( |
const char * |
name, |
|
|
gboolean * |
value |
|
) |
| const |
Get boolean value by the key
- Parameters
-
| name | A key to lookup map with |
[out] | value | A pointer to gboolean variable that will receive the result of the operation |
- Returns
- true if value exists, false otherwise. If value was not found the contents of the
value
is not changed.
◆ getCString()
bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::getCString |
( |
const char * |
name, |
|
|
char ** |
value |
|
) |
| const |
Get string value by the key
- Parameters
-
| name | A key to lookup map with |
[out] | value | A pointer to char* variable that will receive the result of the operation. Variable receives the pointer to an internal GVariant buffer and must not be freed. The pointer is valid while GVariant is valid. |
- Returns
- true if value exists, false otherwise. If value was not found the contents of the
value
is not changed.
◆ getInt32()
bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::getInt32 |
( |
const char * |
name, |
|
|
gint32 * |
value |
|
) |
| const |
Get int32 value by the key
- Parameters
-
| name | A key to lookup map with |
[out] | value | A pointer to gint32 variable that will receive the result of the operation |
- Returns
- true if value exists, false otherwise. If value was not found the contents of the
value
is not changed.
◆ getVariant()
ManagedGVariant alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::getVariant |
( |
const char * |
name | ) |
const |
Get a variant value by the key
- Parameters
-
name | A key to lookup map with |
- Returns
- A ManagedGVariant object containing a variant in case of success and an empty
ManagedGVariant
if value has not been found.
The documentation for this class was generated from the following file:
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0