# DBus-C++

## Desktop Communication Bus System

libdbus-c-- Documentation 0.9.0

- Files
- Data Structures
- Globals
- Main Page

property.h
Go to the documentation of this file.
1/*
2 *
3 * D-Bus++ - C++ bindings for D-Bus
4 *
5 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com>
6 *
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24
25#ifndef __DBUSXX_PROPERTY_H
26#define __DBUSXX_PROPERTY_H
27
28#include "api.h"
29#include "types.h"
30#include "interface.h"
31
32 namespace DBus
33{
34
35 template <typename T>
36 class PropertyAdaptor
37{
38 public:
39
40 PropertyAdaptor() : _data(0)
41 {}
42
43 void bind(PropertyData &data)
44 {
45 _data = &data;
46 }
47
48 T operator()(void) const
49 {
50 return _data->value.operator T();
51 }
52
53 PropertyAdaptor &operator = (const T &t)
54 {
55 _data->value.clear();
56 MessageIter wi = _data->value.writer();
57 wi << t;
58 return *this;
59 }
60
61 private:
62
63 PropertyData *_data;
64};
65
66 struct IntrospectedInterface;
67
68 class DXXAPI PropertiesAdaptor : public InterfaceAdaptor
69{
70 public:
71
72 PropertiesAdaptor();
73
74 Message Get(const CallMessage &);
75
76 Message Set(const CallMessage &);
77
78 protected:
79
80 virtual void on_get_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, Variant &/*value*/)
81 {}
82
83 virtual void on_set_property(InterfaceAdaptor &/*interface*/, const std::string &/*property*/, const Variant &/*value*/)
84 {}
85
86 IntrospectedInterface *introspect() const;
87};
88
89 class DXXAPI PropertiesProxy : public InterfaceProxy
90{
91 public:
92
93 PropertiesProxy();
94
95 Variant Get(const std::string &interface, const std::string &property);
96
97 void Set(const std::string &interface, const std::string &property, const Variant &value);
98};
99
100} /* namespace DBus */
101
102#endif//__DBUSXX_PROPERTY_H
103
api.h
DXXAPI
#define DXXAPI
Definition api.h:36
DBus::CallMessage
Definition message.h:269
DBus::InterfaceAdaptor::InterfaceAdaptor
InterfaceAdaptor(const std::string &name)
Definition interface.cpp:49
DBus::InterfaceProxy::InterfaceProxy
InterfaceProxy(const std::string &name)
Definition interface.cpp:123
DBus::MessageIter
Definition message.h:45
DBus::Message
Definition message.h:159
DBus::PropertiesAdaptor::PropertiesAdaptor
PropertiesAdaptor()
Definition property.cpp:37
DBus::PropertiesAdaptor::Set
Message Set(const CallMessage &)
Definition property.cpp:75
DBus::PropertiesAdaptor::on_get_property
virtual void on_get_property(InterfaceAdaptor &, const std::string &, Variant &)
Definition property.h:80
DBus::PropertiesAdaptor::on_set_property
virtual void on_set_property(InterfaceAdaptor &, const std::string &, const Variant &)
Definition property.h:83
DBus::PropertiesAdaptor::Get
Message Get(const CallMessage &)
Definition property.cpp:44
DBus::PropertiesProxy::PropertiesProxy
PropertiesProxy()
Definition property.cpp:139
DBus::PropertiesProxy::Set
void Set(const std::string &interface, const std::string &property, const Variant &value)
Definition property.cpp:151
DBus::PropertiesProxy::Get
Variant Get(const std::string &interface, const std::string &property)
Definition property.cpp:144
DBus::PropertyAdaptor::operator=
PropertyAdaptor & operator=(const T &t)
Definition property.h:53
DBus::PropertyAdaptor::PropertyAdaptor
PropertyAdaptor()
Definition property.h:40
DBus::PropertyAdaptor::bind
void bind(PropertyData &data)
Definition property.h:43
DBus::PropertyAdaptor::_data
PropertyData * _data
Definition property.h:63
DBus::PropertyAdaptor::operator()
T operator()(void) const
Definition property.h:48
DBus::Variant
Definition types.h:68
interface.h
DBus
Definition connection_p.h:42
DBus::IntrospectedInterface
Definition introspection.h:56
DBus::PropertyData
Definition interface.h:41
types.h