From bce0c3d0a21c4a0f53984d55c00d1505957353a3 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 20 May 2025 16:49:49 +0200 Subject: lib: add wrapper for id --- lib/src/turns-participant.h | 2 +- lib/src/turnsmm/participant.cpp | 5 +++++ lib/src/turnsmm/participant.hpp | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/src') diff --git a/lib/src/turns-participant.h b/lib/src/turns-participant.h index 6ed8ac6..edfdf9e 100644 --- a/lib/src/turns-participant.h +++ b/lib/src/turns-participant.h @@ -68,7 +68,7 @@ TurnsParticipantDisposition turns_participant_get_disposition(TurnsParticipant c * @brief Get the id of a participant. * * @param self A participant instance. The value *must not* be NULL. - * @return The id of the instance. The value is owned by the caller of the function. + * @return The id of the instance. The data ist owned by the instance. */ gchar const * turns_participant_get_id(TurnsParticipant const * self); diff --git a/lib/src/turnsmm/participant.cpp b/lib/src/turnsmm/participant.cpp index 38dfb3e..170c3a2 100644 --- a/lib/src/turnsmm/participant.cpp +++ b/lib/src/turnsmm/participant.cpp @@ -110,6 +110,11 @@ namespace Turns return static_cast(turns_participant_get_disposition(const_cast(unwrap(this)))); } + auto Participant::get_id() const noexcept -> Glib::ustring + { + return Glib::convert_const_gchar_ptr_to_ustring(turns_participant_get_id(unwrap(this))); + } + auto Participant::get_name() const -> Glib::ustring { return turns_participant_get_name(const_cast(unwrap(this))); diff --git a/lib/src/turnsmm/participant.hpp b/lib/src/turnsmm/participant.hpp index b23fd42..c76cc29 100644 --- a/lib/src/turnsmm/participant.hpp +++ b/lib/src/turnsmm/participant.hpp @@ -47,6 +47,7 @@ namespace Turns [[nodiscard]] auto get_active() const noexcept -> bool; [[nodiscard]] auto get_defeated() const noexcept -> bool; [[nodiscard]] auto get_disposition() const noexcept -> Disposition; + [[nodiscard]] auto get_id() const noexcept -> Glib::ustring; [[nodiscard]] auto get_name() const -> Glib::ustring; [[nodiscard]] auto get_priority() const noexcept -> float; -- cgit v1.2.3