I am trying to de-serialize below Tuple, but getting issues while getting internal vector variant. initial 2 values are retrieved but vector variant is giving me some trouble I am not able to understand why its not working
Glib::Variant < std::tuple < std::uint32_t, // First unsigned integer
std::uint32_t, // First unsigned integer
std::vector < // Array of dictionaries
std::tuple < std::uint32_t, // Inner unsigned integer
std::int32_t, // Inner unsigned integer
std::vector < // Array of dictionaries
std::map < Glib::ustring, // Dictionary key (string)
Glib::VariantBase // Dictionary value (variant)
>
> > > , std::vector < // Array of dictionaries
std::map < Glib::ustring, // Dictionary key (string)
Glib::VariantBase // Dictionary value (variant)
>
> > > response_variant;
//here is my de - serialization code:
Glib::Variant < std::uint32_t > firstVariant;
Glib::Variant < std::uint32_t > secondVariant;
call_result.get_child(firstVariant, 0);
std::uint32_t first_value = firstVariant.get();
std::cout << "fist_value: " << first_value << std::endl;
call_result.get_child(secondVariant, 1);
std::uint32_t second_value = secondVariant.get();
std::cout << "second_value: " << second_value << std::endl;
Glib::Variant <
std::vector <
std::tuple < std::uint32_t, std::int32_t,
std::vector <
std::map < Glib::ustring,
Glib::VariantBase >> > >
>
thirdVariant;
call_result.get_child(thirdVariant, 2);
// Check if the variant is an array
if (thirdVariant.get_type_string() == "a(uia{sv})") {
std::size_t innerTupleCount = thirdVariant.get_n_children();
std::cout << "innerTupleCount: " << innerTupleCount << std::endl;
Glib::Variant < std::tuple < std::uint32_t, std::int32_t, std::vector < std::map < Glib::ustring, Glib::VariantBase >>> > baseVariant;
for (std::size_t i = 0; i < innerTupleCount; ++i) {
Glib::Variant < std::tuple < std::uint32_t, std::int32_t, std::vector < std::map < Glib::ustring, Glib::VariantBase >>> > tupleVariant;
//thirdVariant.get_child(tupleVariant, i); //compilation error no matching function for call
//tupleVariant = thirdVariant.get_child(i); //Compilation error no match for 'operator='
}
} else {
std::cerr << "Unexpected variant type: " << thirdVariant.get_type_string() << std::endl;
}
I am able to get number of children of vector but when I tried to retrive tuple code give me compilation errors. May be I am not able to understand the object here !
I tried to do below, But getting compilation errors:
//thirdVariant.get_child(tupleVariant, i); //compilation error no matching function for call
//tupleVariant = thirdVariant.get_child(i); //Compilation error no match for 'operator='
Looking for help, thanks in advance.
I tried multiple ways but nothing works
//thirdVariant.get_child(tupleVariant, i); //compilation error no matching function for call
//tupleVariant = thirdVariant.get_child(i); //Compilation error no match for 'operator='