|
From: Or G. <ob...@gm...> - 2010-07-25 07:52:56
|
Hi
How do I assign a value to a new variant type ?
For example:
::DBus::Variant Server::get(const std::string& key) {
::DBus::Variant var;
// var = std::string("test"); // not this way
// var.writer() << std::string("test"); // not this way either
return var;
}
Next question - suppose a Variant contains an array of strings, how do I
detect that + how do I parse that ?
For example:
void Server::set(const std::string& key, const ::DBus::Variant& value) {
if (value.signature().c_str()[0] == 'a') {
// array
//Am I suppose to parse the signature here ?
} else {
// basic type
std::string str = value;
std::cout << str << std::endl;
}
}
Thanks,
Or
|