Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to store the values of a Variant into a string? #115

Open
overmyerD opened this issue Jul 30, 2020 · 1 comment
Open

Is there a way to store the values of a Variant into a string? #115

overmyerD opened this issue Jul 30, 2020 · 1 comment

Comments

@overmyerD
Copy link

Hello,

I was wondering if there a way to store the values of a Variant inside of a string, in the same fashion that sdbus does it? For example:

  sdbus::Variant var(std::vector<int>({1, 2, 3, 4, 5}));
  std::cout << var.toString() << endl; //prints 5 1 2 3 4 5

I ask this because I am using the the PropertiesChanged signal and with that it calls a function with a map of strings to Variants, so the type of the property changed can be unknown and I don't want to write out print statements for all possible types I receive.

@jwinarske
Copy link

jwinarske commented Feb 20, 2025

This decodes and prints the property map:
https://github.com/jwinarske/sdbus-cpp-examples/blob/main/src/utils/utils.cc#L47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants