6
#include <QDBusArgument>
5
7
#include <xpathselect/node.h>
9
/// A simple data structure representing the state of a single node:
10
struct NodeIntrospectionData
16
Q_DECLARE_METATYPE(NodeIntrospectionData);
17
Q_DECLARE_METATYPE(QList<NodeIntrospectionData>);
19
QDBusArgument &operator<<(QDBusArgument &argument, const NodeIntrospectionData &node_data);
20
const QDBusArgument &operator>>(const QDBusArgument &argument, NodeIntrospectionData &node_data);
7
22
/// Base class for all Qt-based object nodes.
9
24
/// QtNode wraps a single QObject pointer. It derives from xpathselect::Node and,
10
25
/// like that class, is designed to be allocated on the heap and stored in a
11
26
/// std::shared_ptr.
12
class QtNode: public xpathselect::Node
27
class QtNode: public xpathselect::Node, public std::enable_shared_from_this<QtNode>
15
typedef std::shared_ptr<QtNode> Ptr;
30
typedef std::shared_ptr<const QtNode> Ptr;
17
QtNode(QObject* object, std::string const& parent_path);
32
QtNode(QObject* object, Ptr parent);
33
explicit QtNode(QObject* object);
19
35
QObject* getWrappedObject() const;
21
virtual QVariant IntrospectNode() const;
22
virtual qint64 GetObjectId() const;
36
xpathselect::Node::Ptr GetParent() const;
38
virtual NodeIntrospectionData GetIntrospectionData() const;
24
41
virtual std::string GetName() const;
25
42
virtual std::string GetPath() const;
26
virtual bool MatchProperty(const std::string& name, const std::string& value) const;
27
virtual xpathselect::NodeList Children() const;
43
virtual int32_t GetId() const;
44
virtual bool MatchStringProperty(const std::string& name, const std::string& value) const;
45
virtual bool MatchIntegerProperty(const std::string& name, int32_t value) const;
46
virtual bool MatchBooleanProperty(const std::string& name, bool value) const;
47
virtual xpathselect::NodeVector Children() const;
30
50
std::string full_path_;