11 static void unwrapList(std::vector<T> &list,
const Glib::VariantContainerBase &wrapped) {
12 for (uint i = 0; i < wrapped.get_n_children (); i++) {
13 Glib::Variant<T> item;
14 wrapped.get_child(item, i);
15 list.push_back(item.get());
19 static std::vector<Glib::ustring> stdStringVecToGlibStringVec(
const std::vector<std::string> &strv) {
20 std::vector<Glib::ustring> newStrv;
21 for (uint i = 0; i < strv.size(); i++) {
22 newStrv.push_back(strv[i]);
28 static std::vector<std::string> glibStringVecToStdStringVec(
const std::vector<Glib::ustring> &strv) {
29 std::vector<std::string> newStrv;
30 for (uint i = 0; i < strv.size(); i++) {
31 newStrv.push_back(strv[i]);
37 static std::map<std::string, std::string> glibStringMapToStdStringMap(
const std::map<Glib::ustring, Glib::ustring> &strm) {
38 std::map<std::string, std::string> newStrm;
39 for (std::pair<Glib::ustring, Glib::ustring> pair : strm) {
40 std::pair<std::string, std::string> newPair(pair.first, pair.second);
41 newStrm.insert(newPair);
47 template <
typename T0,
typename T1>
48 static std::vector<T1> mapVector(
const std::vector<T0> &vector0, std::function<T1(T0)> mapFunction) {
49 std::vector<T1> vector1;
50 for (T0 &e : vector0) {
51 vector1.push_back(mapFunction(e));
62 const Glib::RefPtr<Gio::DBus::MethodInvocation> getMessage() {
68 Glib::VariantContainerBase empty;
69 m_message->return_value(empty);
72 template <
typename T0>
73 void returnValue(T0 p0)
75 std::vector<Glib::VariantBase> vlist;
76 vlist.push_back(Glib::Variant<T0>::create(p0));
78 m_message->return_value(Glib::Variant<Glib::VariantBase>::create_tuple(vlist));
81 template <
typename T0,
typename T1>
82 void returnValue(T0 p0, T1 p1)
84 std::vector<Glib::VariantBase> vlist;
85 vlist.push_back(Glib::Variant<T0>::create(p0));
86 vlist.push_back(Glib::Variant<T1>::create(p1));
88 m_message->return_value(Glib::Variant<Glib::VariantBase>::create_tuple(vlist));
91 void returnError(
const std::string &errorMessage)
93 Gio::DBus::Error error(Gio::DBus::Error::FAILED, errorMessage);
94 m_message->return_error(error);
98 Glib::RefPtr<Gio::DBus::MethodInvocation> m_message;