forked from Kistler-Group/sdbus-cpp
* Implement #104: add getObjectPath() for classes * Implement #104: changes requested in review Co-authored-by: Christian Schneider <cschneider@radiodata.biz>
This commit is contained in:
@ -131,6 +131,14 @@ namespace sdbus {
|
|||||||
getObject().unregister();
|
getObject().unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Returns object path of the underlying DBus object
|
||||||
|
*/
|
||||||
|
const std::string& getObjectPath() const
|
||||||
|
{
|
||||||
|
return getObject().getObjectPath();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using base_type = AdaptorInterfaces;
|
using base_type = AdaptorInterfaces;
|
||||||
};
|
};
|
||||||
|
@ -435,6 +435,11 @@ namespace sdbus {
|
|||||||
* @throws sdbus::Error in case of failure
|
* @throws sdbus::Error in case of failure
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] SignalEmitter emitSignal(const std::string& signalName);
|
[[nodiscard]] SignalEmitter emitSignal(const std::string& signalName);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Returns object path of the underlying DBus object
|
||||||
|
*/
|
||||||
|
virtual const std::string& getObjectPath() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Out-of-line member definitions
|
// Out-of-line member definitions
|
||||||
|
@ -266,6 +266,11 @@ namespace sdbus {
|
|||||||
* @throws sdbus::Error in case of failure
|
* @throws sdbus::Error in case of failure
|
||||||
*/
|
*/
|
||||||
[[nodiscard]] PropertySetter setProperty(const std::string& propertyName);
|
[[nodiscard]] PropertySetter setProperty(const std::string& propertyName);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Returns object path of the underlying DBus object
|
||||||
|
*/
|
||||||
|
virtual const std::string& getObjectPath() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/********************************************//**
|
/********************************************//**
|
||||||
|
@ -165,6 +165,14 @@ namespace sdbus {
|
|||||||
getProxy().unregister();
|
getProxy().unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* @brief Returns object path of the underlying DBus object
|
||||||
|
*/
|
||||||
|
const std::string& getObjectPath() const
|
||||||
|
{
|
||||||
|
return getProxy().getObjectPath();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using base_type = ProxyInterfaces;
|
using base_type = ProxyInterfaces;
|
||||||
};
|
};
|
||||||
|
@ -225,6 +225,11 @@ sdbus::IConnection& Object::getConnection() const
|
|||||||
return dynamic_cast<sdbus::IConnection&>(connection_);
|
return dynamic_cast<sdbus::IConnection&>(connection_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& Object::getObjectPath() const
|
||||||
|
{
|
||||||
|
return objectPath_;
|
||||||
|
}
|
||||||
|
|
||||||
const std::vector<sd_bus_vtable>& Object::createInterfaceVTable(InterfaceData& interfaceData)
|
const std::vector<sd_bus_vtable>& Object::createInterfaceVTable(InterfaceData& interfaceData)
|
||||||
{
|
{
|
||||||
auto& vtable = interfaceData.vtable;
|
auto& vtable = interfaceData.vtable;
|
||||||
|
@ -101,6 +101,7 @@ namespace sdbus::internal {
|
|||||||
bool hasObjectManager() const override;
|
bool hasObjectManager() const override;
|
||||||
|
|
||||||
sdbus::IConnection& getConnection() const override;
|
sdbus::IConnection& getConnection() const override;
|
||||||
|
const std::string& getObjectPath() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using InterfaceName = std::string;
|
using InterfaceName = std::string;
|
||||||
|
@ -198,6 +198,11 @@ void Proxy::unregister()
|
|||||||
interfaces_.clear();
|
interfaces_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& Proxy::getObjectPath() const
|
||||||
|
{
|
||||||
|
return objectPath_;
|
||||||
|
}
|
||||||
|
|
||||||
int Proxy::sdbus_async_reply_handler(sd_bus_message *sdbusMessage, void *userData, sd_bus_error */*retError*/)
|
int Proxy::sdbus_async_reply_handler(sd_bus_message *sdbusMessage, void *userData, sd_bus_error */*retError*/)
|
||||||
{
|
{
|
||||||
auto* asyncCallData = static_cast<AsyncCalls::CallData*>(userData);
|
auto* asyncCallData = static_cast<AsyncCalls::CallData*>(userData);
|
||||||
|
@ -60,6 +60,8 @@ namespace sdbus::internal {
|
|||||||
void finishRegistration() override;
|
void finishRegistration() override;
|
||||||
void unregister() override;
|
void unregister() override;
|
||||||
|
|
||||||
|
const std::string& getObjectPath() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class SyncCallReplyData
|
class SyncCallReplyData
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user