~thomas-voss/dbus-cpp/add_fallback_objects

« back to all changes in this revision

Viewing changes to src/core/dbus/bus.cpp

  • Committer: thomas-voss
  • Date: 2014-03-24 19:15:56 UTC
  • Revision ID: thomas.voss@canonical.com-20140324191556-aij6cwkvc1s4jiyl
Refactor dtor of dbus::Object to unregister from the underlying service.
Refactor dtor of dbus::Service to give up name ownership when an instance goes out of scope.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
{
81
81
namespace dbus
82
82
{
83
 
Bus::Name::Name(Bus::Name&& rhs) : name(std::move(rhs.name))
84
 
{
85
 
}
86
 
 
87
 
Bus::Name& Bus::Name::operator=(Bus::Name&& rhs)
88
 
{
89
 
    name = std::move(rhs.name);
90
 
    return *this;
91
 
}
92
83
 
93
84
Bus::Name::Name(const std::string &name) : name(name)
94
85
{
202
193
    return d->message_factory_impl;
203
194
}
204
195
 
205
 
Bus::Name&& Bus::request_name_on_bus(
 
196
std::unique_ptr<Bus::Name> Bus::request_name_on_bus(
206
197
        const std::string& name,
207
198
        Bus::RequestNameFlag flags)
208
199
{
213
204
                static_cast<unsigned int>(flags),
214
205
                std::addressof(error.raw()));
215
206
 
216
 
    Bus::Name result{name};
 
207
    std::unique_ptr<Bus::Name> result{new Bus::Name{name}};
217
208
 
218
209
    switch (rc)
219
210
    {
227
218
    return std::move(result);
228
219
}
229
220
 
230
 
void Bus::release_name_on_bus(Bus::Name&& name)
 
221
void Bus::release_name_on_bus(std::unique_ptr<Bus::Name> name)
231
222
{
232
223
    Error error;
233
224
    dbus_bus_release_name(
234
225
                d->connection.get(),
235
 
                name.as_string().c_str(),
 
226
                name->as_string().c_str(),
236
227
                std::addressof(error.raw()));
237
228
}
238
229