Skip to content

Commit d91f404

Browse files
Use proper deprecated tags for doxygen
1 parent c60a82a commit d91f404

13 files changed

Lines changed: 54 additions & 28 deletions

AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,32 @@ All source files must have the LiveKit Apache 2.0 copyright header. Use the curr
146146
- `lk_log.h` lives under `src/` (internal). The public-facing logging API is `include/livekit/logging.h`.
147147
- spdlog must not appear in any public header or installed header.
148148

149+
#### Deprecating a public API
150+
151+
When superseding a public API (renaming, replacing, or removing in a future major
152+
version), every retained back-compat shim must carry **both** annotations:
153+
154+
1. The C++11 `[[deprecated("...")]]` attribute so the compiler warns at every
155+
call site. The message should name the replacement (e.g.
156+
`"AudioFrame::sample_rate is deprecated; use AudioFrame::sampleRate instead"`).
157+
2. A Doxygen `/// @deprecated Use <newName>() instead.` line immediately above
158+
the attribute so the generated docs render a deprecation callout and add the
159+
symbol to Doxygen's auto-generated *Deprecated List* page. Doxygen does not
160+
read the C++ attribute, so this line is required even though it duplicates
161+
information.
162+
163+
Example:
164+
165+
```cpp
166+
/// @deprecated Use sampleRate() instead.
167+
[[deprecated("AudioFrame::sample_rate is deprecated; use AudioFrame::sampleRate instead")]]
168+
int sample_rate() const noexcept { return sampleRate(); }
169+
```
170+
171+
Keep the prose consistent: `Use <newName>() instead.` Per-symbol deprecations
172+
must use `///` (not `//`); only section-level asides (e.g. "Deprecated public
173+
mutators" group headers) may stay as plain `//` comments.
174+
149175
### Include Conventions
150176
151177
- **Public headers (`include/livekit/*.h`) must include other public headers

include/livekit/audio_frame.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,31 @@ class LIVEKIT_API AudioFrame {
8686
/// A human-readable description.
8787
std::string toString() const;
8888

89-
// Deprecated - see totalSamples()
89+
/// @deprecated Use totalSamples() instead.
9090
[[deprecated("AudioFrame::total_samples is deprecated; use AudioFrame::totalSamples instead")]]
9191
std::size_t total_samples() const noexcept { // NOLINT(readability-identifier-naming)
9292
return totalSamples();
9393
}
9494

95-
// Deprecated - see sampleRate()
95+
/// @deprecated Use sampleRate() instead.
9696
[[deprecated("AudioFrame::sample_rate is deprecated; use AudioFrame::sampleRate instead")]]
9797
int sample_rate() const noexcept { // NOLINT(readability-identifier-naming)
9898
return sampleRate();
9999
}
100100

101-
// Deprecated - see numChannels()
101+
/// @deprecated Use numChannels() instead.
102102
[[deprecated("AudioFrame::num_channels is deprecated; use AudioFrame::numChannels instead")]]
103103
int num_channels() const noexcept { // NOLINT(readability-identifier-naming)
104104
return numChannels();
105105
}
106106

107-
// Deprecated - see samplesPerChannel()
107+
/// @deprecated Use samplesPerChannel() instead.
108108
[[deprecated("AudioFrame::samples_per_channel is deprecated; use AudioFrame::samplesPerChannel instead")]]
109109
int samples_per_channel() const noexcept { // NOLINT(readability-identifier-naming)
110110
return samplesPerChannel();
111111
}
112112

113-
// Deprecated - see toString()
113+
/// @deprecated Use toString() instead.
114114
[[deprecated("AudioFrame::to_string is deprecated; use AudioFrame::toString instead")]]
115115
std::string to_string() const; // NOLINT(readability-identifier-naming)
116116

include/livekit/audio_source.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,19 @@ class LIVEKIT_API AudioSource {
8686
/// Underlying FFI handle ID used in FFI requests.
8787
std::uint64_t ffiHandleId() const noexcept { return static_cast<std::uint64_t>(handle_.get()); }
8888

89-
// Deprecated - see sampleRate()
89+
/// @deprecated Use sampleRate() instead.
9090
[[deprecated("AudioSource::sample_rate is deprecated; use AudioSource::sampleRate instead")]]
9191
int sample_rate() const noexcept { // NOLINT(readability-identifier-naming)
9292
return sampleRate();
9393
}
9494

95-
// Deprecated - see numChannels()
95+
/// @deprecated Use numChannels() instead.
9696
[[deprecated("AudioSource::num_channels is deprecated; use AudioSource::numChannels instead")]]
9797
int num_channels() const noexcept { // NOLINT(readability-identifier-naming)
9898
return numChannels();
9999
}
100100

101-
// Deprecated - see ffiHandleId()
101+
/// @deprecated Use ffiHandleId() instead.
102102
[[deprecated("AudioSource::ffi_handle_id is deprecated; use AudioSource::ffiHandleId instead")]]
103103
std::uint64_t ffi_handle_id() const noexcept { // NOLINT(readability-identifier-naming)
104104
return ffiHandleId();

include/livekit/local_audio_track.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class LIVEKIT_API LocalAudioTrack : public Track {
7979
/// including its SID and name. Useful for debugging and logging.
8080
std::string toString() const;
8181

82-
// Deprecated - see toString()
82+
/// @deprecated Use toString() instead.
8383
// NOLINTBEGIN(readability-identifier-naming)
8484
[[deprecated("LocalAudioTrack::to_string is deprecated; use LocalAudioTrack::toString instead")]]
8585
std::string to_string() const;

include/livekit/local_video_track.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class LIVEKIT_API LocalVideoTrack : public Track {
7979
/// including its SID and name. Useful for debugging and logging.
8080
std::string toString() const;
8181

82-
// Deprecated - see toString()
82+
/// @deprecated Use toString() instead.
8383
// NOLINTBEGIN(readability-identifier-naming)
8484
[[deprecated("LocalVideoTrack::to_string is deprecated; use LocalVideoTrack::toString instead")]]
8585
std::string to_string() const;

include/livekit/participant.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,43 @@ class LIVEKIT_API Participant {
6060

6161
// NOLINTBEGIN(readability-identifier-naming)
6262

63-
// Deprecated - see setName() (also deprecated; see notes above).
63+
/// @deprecated Use setName() instead.
6464
[[deprecated("Participant::set_name is deprecated; use LocalParticipant::setName instead")]]
6565
void set_name(std::string name) noexcept {
6666
name_ = std::move(name);
6767
}
6868

69-
// Deprecated - see setMetadata() (also deprecated; see notes above).
69+
/// @deprecated Use setMetadata() instead.
7070
[[deprecated("Participant::set_metadata is deprecated; use LocalParticipant::setMetadata instead")]]
7171
void set_metadata(std::string metadata) noexcept {
7272
metadata_ = std::move(metadata);
7373
}
7474

75-
// Deprecated - see setAttributes() (also deprecated; see notes above).
75+
/// @deprecated Use setAttributes() instead.
7676
[[deprecated("Participant::set_attributes is deprecated; use LocalParticipant::setAttributes instead")]]
7777
void set_attributes(std::unordered_map<std::string, std::string> attrs) noexcept {
7878
attributes_ = std::move(attrs);
7979
}
8080

81-
// Deprecated - see setAttribute() (also deprecated; see notes above).
81+
/// @deprecated Use setAttribute() instead.
8282
[[deprecated("Participant::set_attribute is deprecated; use LocalParticipant::setAttributes instead")]]
8383
void set_attribute(const std::string& key, const std::string& value) {
8484
attributes_[key] = value;
8585
}
8686

87-
// Deprecated - see removeAttribute() (also deprecated; see notes above).
87+
/// @deprecated Use removeAttribute() instead.
8888
[[deprecated("Participant::remove_attribute is deprecated; use LocalParticipant::setAttributes instead")]]
8989
void remove_attribute(const std::string& key) {
9090
attributes_.erase(key);
9191
}
9292

93-
// Deprecated - see setKind() (also deprecated; see notes above).
93+
/// @deprecated Kind is server-determined and not user-settable; this mutator will be removed.
9494
[[deprecated("Participant::set_kind is deprecated; Kind is server-determined and not user-settable")]]
9595
void set_kind(ParticipantKind kind) noexcept {
9696
kind_ = kind;
9797
}
9898

99-
// Deprecated - see setDisconnectReason() (also deprecated; see notes above).
99+
/// @deprecated DisconnectReason is server-determined and not user-settable; this mutator will be removed.
100100
[[deprecated(
101101
"Participant::set_disconnect_reason is deprecated; DisconnectReason is server-determined and not "
102102
"user-settable")]]

include/livekit/remote_audio_track.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class LIVEKIT_API RemoteAudioTrack : public Track {
5353
/// including its SID and name. Useful for debugging and logging.
5454
std::string toString() const;
5555

56-
// Deprecated - see toString()
56+
/// @deprecated Use toString() instead.
5757
// NOLINTBEGIN(readability-identifier-naming)
5858
[[deprecated("RemoteAudioTrack::to_string is deprecated; use RemoteAudioTrack::toString instead")]]
5959
std::string to_string() const;

include/livekit/remote_participant.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LIVEKIT_API RemoteParticipant : public Participant {
4343

4444
std::string toString() const;
4545

46-
// Deprecated - see toString()
46+
/// @deprecated Use toString() instead.
4747
// NOLINTBEGIN(readability-identifier-naming)
4848
[[deprecated("RemoteParticipant::to_string is deprecated; use RemoteParticipant::toString instead")]]
4949
std::string to_string() const;

include/livekit/remote_video_track.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class LIVEKIT_API RemoteVideoTrack : public Track {
5353
/// including its SID and name. Useful for debugging and logging.
5454
std::string toString() const;
5555

56-
// Deprecated - see toString()
56+
/// @deprecated Use toString() instead.
5757
// NOLINTBEGIN(readability-identifier-naming)
5858
[[deprecated("RemoteVideoTrack::to_string is deprecated; use RemoteVideoTrack::toString instead")]]
5959
std::string to_string() const;

include/livekit/result.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class [[nodiscard]] Result {
6060
/// Allows `if (result)` style success checks.
6161
explicit operator bool() const noexcept { return ok(); }
6262

63-
// Deprecated - see hasError()
63+
/// @deprecated Use hasError() instead.
6464
// NOLINTBEGIN(readability-identifier-naming)
6565
[[deprecated("Result::has_error is deprecated; use Result::hasError instead")]]
6666
bool has_error() const noexcept {

0 commit comments

Comments
 (0)