AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader Class Reference

#include <GVariantMapReader.h>

Public Member Functions

 ~GVariantMapReader ()
 
 GVariantMapReader (GVariant *originalVariant, bool useObjectPathAsKey=false)
 
 GVariantMapReader (ManagedGVariant &originalVariant, bool useObjectPathAsKey=false)
 
 GVariantMapReader (const GVariantMapReader &other)
 
bool getCString (const char *name, char **value) const
 
bool getInt32 (const char *name, gint32 *value) const
 
bool getBoolean (const char *name, gboolean *value) const
 
ManagedGVariant getVariant (const char *name) const
 
bool forEach (std::function< bool(char *key, GVariant *value)> iteratorFunction) const
 
GVariant * get () const
 

Detailed Description

Helper class to read values from a map represented by GLib's GVariant* .

See GVariant Format Strings for type strings explanation.

Constructor & Destructor Documentation

◆ ~GVariantMapReader()

alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::~GVariantMapReader ( )

Destructor

◆ 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
originalVariantA GVariant* to wrap
useObjectPathAsKeySet 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
originalVariantA ManagedGVariant to wrap
useObjectPathAsKeySet 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
other

Member Function Documentation

◆ forEach()

bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantMapReader::forEach ( std::function< bool(char *key, GVariant *value)>  iteratorFunction) const

Helper method to traverse

Parameters
iteratorFunctionA 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
nameA key to lookup map with
[out]valueA 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
nameA key to lookup map with
[out]valueA 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
nameA key to lookup map with
[out]valueA 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
nameA 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