tdebluez
libtdeobex/interfaces/introspectableInterface.cpp
Go to the documentation of this file.
1 // File autogenerated
2 
3 // declaration include
5 
6 // TQt includes
7 #include <tqdom.h>
8 #include <tqstring.h>
9 
10 // TQt D-Bus includes
11 #include <tqdbuserror.h>
12 #include <tqdbusmessage.h>
13 
14 
15 namespace org
16 {
17 namespace freedesktop
18 {
19 namespace DBus
20 {
21 
22 void IntrospectableInterface::buildIntrospectionData(TQDomElement& interfaceElement)
23 {
24  interfaceElement.setAttribute("name", "org.freedesktop.DBus.Introspectable");
25 
26  TQDomDocument document = interfaceElement.ownerDocument();
27  TQDomElement methodElement = document.createElement("method");
28  methodElement.setAttribute("name", "Introspect");
29 
30  TQDomElement argumentElement = document.createElement("arg");
31  argumentElement.setAttribute("name", "xml");
32  argumentElement.setAttribute("type", "s");
33  argumentElement.setAttribute("direction", "out");
34  methodElement.appendChild(argumentElement);
35 
36  interfaceElement.appendChild(methodElement);
37 }
38 
39 TQT_DBusMessage IntrospectableInterface::callIntrospect(const TQT_DBusMessage& message)
40 {
41  TQT_DBusError error;
42  TQT_DBusMessage reply;
43 
44  TQString _xml;
45 
46  if (Introspect(_xml, error))
47  {
48  reply = TQT_DBusMessage::methodReply(message);
49  reply << TQT_DBusData::fromString(_xml);
50  }
51  else
52  {
53  if (!error.isValid())
54  {
55  tqWarning("Call to implementation of org::freedesktop::DBus::IntrospectableInterface::Introspect returned 'false' but error object is not valid!");
56 
57  error = TQT_DBusError::stdFailed("org.freedesktop.DBus.Introspectable.Introspect execution failed");
58  }
59 
60  reply = TQT_DBusMessage::methodError(message, error);
61  }
62 
63  return reply;
64 }
65 
66 bool IntrospectableInterface::handleMethodCall(const TQT_DBusMessage& message)
67 {
68  if (message.interface() != "org.freedesktop.DBus.Introspectable") return false;
69 
70  if (message.member() == "Introspect")
71  {
72  TQT_DBusMessage reply = callIntrospect(message);
73  handleMethodReply(reply);
74 
75  return true;
76  }
77 
78  return false;
79 }
80 
81 }; // namespace DBus
82 
83 }; // namespace freedesktop
84 
85 }; // namespace org
86 
87 // End of File
88 
virtual void handleMethodReply(const TQT_DBusMessage &reply)=0
virtual bool Introspect(TQString &xml, TQT_DBusError &error)=0