20 Commits

Author SHA1 Message Date
Stanislav Angelovič
84a6fbbf86 fix: disable move in generated adaptor and proxy classes (#435)
Moving adaptor or proxy instances changes their `this` pointer. But `this` is captured by value in closures used by those instances, and this remains unchanged on move, leading to accessing an invalid instance when a lambda expression executes. Supporting move semantics would require unsubscribing/unregistering vtable, handlers, etc. and re-subscribing and re-registering all that, which is too complicated and may have side effects. Hence it has been decided that these classes are not moveable. One may use an indirection with e.g. `std::unique_ptr` to get move semantics.
2024-04-24 20:20:29 +02:00
Stanislav Angelovič
7894cda577 perf: provide also const char* overloads for convenience functions 2024-04-24 20:20:29 +02:00
Stanislav Angelovič
42f0bd07c0 refactor: add strong types to public API (#414)
This introduces strong types for `std::string`-based D-Bus types. This facilitates safer, less error-prone and more expressive API.

What previously was `auto proxy = createProxy("org.sdbuscpp.concatenator", "/org/sdbuscpp/concatenator");` is now written like `auto proxy = createProxy(ServiceName{"org.sdbuscpp.concatenator"}, ObjectPath{"/org/sdbuscpp/concatenator"});`.

These types are:
  * `ObjectPath` type for the object path (the type has been around already but now is also used consistently in sdbus-c++ API for object path strings),
  * `InterfaceName` type for D-Bus interface names,
  * `BusName` (and its aliases `ServiceName` and `ConnectionName`) type for bus/service/connection names,
  * `MemberName` (and its aliases `MethodName`, `SignalName` and `PropertyName`) type for D-Bus method, signal and property names,
  * `Signature` type for the D-Bus signature (the type has been around already but now is also used consistently in sdbus-c++ API for signature strings),
  * `Error::Name` type for D-Bus error names.
2024-04-24 20:20:29 +02:00
Stanislav Angelovič
3de2812a60 refactor: use optional for passing potential call errors (#396)
This switches from a raw pointer to std::optional type to pass prospective call errors to the client (using std::optional was not possible years back when sdbus-c++ was based on C++14). This makes the API a little clearer, safer, idiomatically more expressive, and removes potential confusion associated with raw pointers (like ownership, lifetime questions, etc.).
2024-04-24 20:20:29 +02:00
Stanislav Angelovič
84932a6985 refactor: improve Proxy signal subscription (#389)
This makes D-Bus proxy signal registration more flexible, more dynamic, and less error-prone since no `finishRegistration()` call is needed. A proxy can register to a signal at any time during its lifetime, and can unregister freely by simply destroying the associated slot.
2024-04-24 20:20:29 +02:00
Stanislav Angelovič
bdf313bc60 refactor: improve Object vtable registration (#388)
This improves the D-Bus object API registration/unregistration by making it more flexible, more dynamic, closer to sd-bus API design but still on high abstraction level, and -- most importantly -- less error-prone since no `finishRegistration()` call is needed anymore.
2024-04-24 20:20:29 +02:00
Stanislav Angelovič
c769637f3b chore: update years in header comments 2024-04-16 22:48:34 +02:00
Stanislav Angelovič
3e84b254e9 refactor: improve type extensibility and its safety (#348) 2023-08-09 12:39:16 +02:00
Marcel Hellwig
dcd9d46b9c style: remove trailing whitespace (#345)
* style: restore correct 644 file permission

* style: remove trailing whitespace
2023-08-04 13:26:45 +02:00
Stanislav Angelovic
aeae79003a refactor: support move semantics in generated adaptor and proxy classes 2022-09-20 17:05:59 +02:00
Stanislav Angelovic
2f7b35c5a8 Fix unused variable warnings for release builds 2020-07-21 15:44:16 +02:00
Stanislav Angelovic
e63357b222 Remove non-virtual-dtor warnings by making classes final 2020-07-21 11:12:57 +02:00
sangelovic
00d0837d98 Introduce support for cancellable async calls 2020-04-04 16:30:56 +02:00
sangelovic
3a4f343fb9 Provide better names to event loop-related IConnection methods 2020-02-02 22:22:26 +01:00
sangelovic
eade6a0e44 Add support for method and signal parameter names in introspection 2020-02-01 12:38:39 +01:00
sangelovic
4310a3bd17 Little fix of order of destruction in stress tests 2020-01-19 18:57:14 +01:00
sangelovic
ff944c9e95 Add protected non-virtual destructor in generated classes 2019-06-10 22:54:16 +02:00
sangelovic
fbb5242729 Add emit prefix to generated signal emitting methods 2019-06-04 21:30:09 +02:00
Stanislav Angelovič
91fa35140b Add support for ObjectManager and other standard D-Bus interfaces (#55)
Fixes #50
2019-05-29 22:28:15 +02:00
sangelovic
1b02c604d8 Rename test subdirectory to tests for higher consistency with OSS standards 2019-04-25 23:54:51 +02:00