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::GVariantTupleReader Class Reference

#include <GVariantTupleReader.h>

Public Member Functions

 ~GVariantTupleReader ()
 
 GVariantTupleReader (GVariant *originalVariant)
 
 GVariantTupleReader (ManagedGVariant &originalVariant)
 
 GVariantTupleReader (const GVariantTupleReader &other)
 
char * getCString (gsize index) const
 
char * getObjectPath (gsize index) const
 
gint32 getInt32 (gsize index) const
 
gboolean getBoolean (gsize index) const
 
ManagedGVariant getVariant (gsize index) const
 
gsize size () const
 
bool forEach (std::function< bool(GVariant *value)> iteratorFunction) const
 

Detailed Description

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

See GVariant Format Strings for type strings explanation.

Constructor & Destructor Documentation

◆ ~GVariantTupleReader()

alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::~GVariantTupleReader ( )

Destructor

◆ GVariantTupleReader() [1/3]

alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::GVariantTupleReader ( GVariant *  originalVariant)
explicit

Constructor to initialize the reader with raw GVariant* value

Parameters
originalVariantGVariant* value

◆ GVariantTupleReader() [2/3]

alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::GVariantTupleReader ( ManagedGVariant originalVariant)
explicit

Constructor to initialize the reader with the reference to ManagedGVariant

Parameters
originalVariantA reference to ManagedGVariant

◆ GVariantTupleReader() [3/3]

alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::GVariantTupleReader ( const GVariantTupleReader other)

Member Function Documentation

◆ forEach()

bool alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::forEach ( std::function< bool(GVariant *value)>  iteratorFunction) const

Helper function to traverse all the elements in a tuple

Parameters
iteratorFunctionAccepts GVariant* and returns true if iteration should be continued and false if no more iterations required.
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.

◆ getBoolean()

gboolean alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::getBoolean ( gsize  index) const

Get the boolean value by index

Parameters
indexZero based index of the value in tuple
Returns
A gboolean value. The default value is false.

◆ getCString()

char* alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::getCString ( gsize  index) const

Get string value by index (not the difference with object path type value)

Parameters
indexZero based index of the value in tuple
Returns
A pointer to a C-style string with the value. Method returns nullptr if there is no such value. The returned value points to an internal GVariant buffer and must not be freed. The pointer is valid while GVariant is valid.

◆ getInt32()

gint32 alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::getInt32 ( gsize  index) const

Get the int32 value by index

Parameters
indexZero based index of the value in tuple
Returns
A gint32 value. The default value is 0.

◆ getObjectPath()

char* alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::getObjectPath ( gsize  index) const

Get the object path value by index (not the difference with string type value)

Parameters
indexZero based index of the value in tuple
Returns
A pointer to a C-style string with the value. Method returns nullptr if there is no such value. The returned value points to an internal GVariant buffer and must not be freed.

◆ getVariant()

ManagedGVariant alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::getVariant ( gsize  index) const

Get the GVariant value by index and return it as ManagedGVariant.

Parameters
indexZero based index of the value in tuple
Returns
A ManagedGVariant value. The default is an empty ManagedGVariant.

◆ size()

gsize alexaClientSDK::bluetoothImplementations::blueZ::GVariantTupleReader::size ( ) const

Returns a number of elements in a tuple.

Returns
Number of elements in a tuple.

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