12 #include "../../macros.h" 13 #include "../../stringutils.h" 14 #include "../objectvtable.h" 15 #include "../utils_p.h" 17 #include "objectvtable_p_libdbus.h" 27 ObjectVTableBasePrivate::~ObjectVTableBasePrivate() {}
30 std::lock_guard<std::mutex> lock(q->privateDataMutexForType());
31 auto *p = q->privateDataForType();
35 for (
const auto &m : methods_) {
36 auto *method = m.second;
38 stringutils::concat(
"<method name=\"", method->name(),
"\">");
39 for (
auto &type : splitDBusSignature(method->signature())) {
40 p->xml_ += stringutils::concat(
"<arg direction=\"in\" type=\"",
43 for (
auto &type : splitDBusSignature(method->ret())) {
44 p->xml_ += stringutils::concat(
"<arg direction=\"out\" type=\"",
47 p->xml_ +=
"</method>";
50 for (
const auto &s : sigs_) {
53 stringutils::concat(
"<signal name=\"", sig->name(),
"\">");
54 for (
auto &type : splitDBusSignature(sig->signature())) {
55 p->xml_ += stringutils::concat(
"<arg type=\"", type,
"\"/>");
57 p->xml_ +=
"</signal>";
60 for (
const auto &pr : properties_) {
61 auto *prop = pr.second;
62 if (prop->writable()) {
63 p->xml_ += stringutils::concat(
64 "<property access=\"readwrite\" type=\"", prop->signature(),
65 "\" name=\"", prop->name(),
"\">");
67 p->xml_ += stringutils::concat(
68 "<property access=\"read\" type=\"", prop->signature(),
69 "\" name=\"", prop->name(),
"\">");
71 p->xml_ +=
"</property>";
79 ObjectVTableBase::ObjectVTableBase()
80 : d_ptr(std::make_unique<ObjectVTableBasePrivate>()) {}
82 ObjectVTableBase::~ObjectVTableBase() {}
86 d->methods_[method->name()] = method;
91 d->properties_[
property->name()] = property;
96 d->sigs_[signal->name()] = signal;
101 auto iter = d->methods_.find(name);
102 if (iter == d->methods_.end()) {
110 auto iter = d->properties_.find(name);
111 if (iter == d->properties_.end()) {
124 if (
auto *bus = d->slot_->bus_.get()) {
138 return d->slot_->path_;
143 return d->slot_->interface_;
156 std::shared_ptr<ObjectVTablePrivate> ObjectVTableBase::newSharedPrivateData() {
157 return std::make_shared<ObjectVTablePrivate>();
160 void ObjectVTableBase::setSlot(
Slot *slot) {
162 d->slot_.reset(static_cast<DBusObjectVTableSlot *>(slot));
Basic DBus type of a DBus message.
bool isRegistered() const
Return whether this object is registered to a bus.
Register a DBus read-only property to current DBus VTable.
Bus * bus()
Return the bus that the object is registered to.
Virtual base class represent some internal registration of the bus.
A class that represents a connection to the Bus.
void setCurrentMessage(Message *message)
Set the current dbus message.
void releaseSlot()
Unregister the dbus object from the bus.
const std::string & interface() const
Return the registered dbus interface of the object.
Message * currentMessage() const
Return the current dbus message for current method.
Register a DBus method to current DBus VTable.
const std::string & path() const
Return the registered dbus object path of the object.
Register a DBus signal to current DBus VTable.