Partition: add noexcept

This commit is contained in:
Max Kellermann 2019-05-31 13:54:52 +02:00
parent c3ccbfd407
commit 11ec7117ab
2 changed files with 27 additions and 27 deletions

View File

@ -30,7 +30,7 @@ Partition::Partition(Instance &_instance,
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
AudioFormat configured_audio_format, AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config) const ReplayGainConfig &replay_gain_config) noexcept
:instance(_instance), :instance(_instance),
name(_name), name(_name),
listener(new ClientListener(instance.event_loop, *this)), listener(new ClientListener(instance.event_loop, *this)),
@ -46,13 +46,13 @@ Partition::Partition(Instance &_instance,
Partition::~Partition() noexcept = default; Partition::~Partition() noexcept = default;
void void
Partition::EmitIdle(unsigned mask) Partition::EmitIdle(unsigned mask) noexcept
{ {
instance.EmitIdle(mask); instance.EmitIdle(mask);
} }
void void
Partition::UpdateEffectiveReplayGainMode() Partition::UpdateEffectiveReplayGainMode() noexcept
{ {
auto mode = replay_gain_mode; auto mode = replay_gain_mode;
if (mode == ReplayGainMode::AUTO) if (mode == ReplayGainMode::AUTO)
@ -68,7 +68,7 @@ Partition::UpdateEffectiveReplayGainMode()
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
const Database * const Database *
Partition::GetDatabase() const Partition::GetDatabase() const noexcept
{ {
return instance.GetDatabase(); return instance.GetDatabase();
} }
@ -80,7 +80,7 @@ Partition::GetDatabaseOrThrow() const
} }
void void
Partition::DatabaseModified(const Database &db) Partition::DatabaseModified(const Database &db) noexcept
{ {
playlist.DatabaseModified(db); playlist.DatabaseModified(db);
EmitIdle(IDLE_DATABASE); EmitIdle(IDLE_DATABASE);
@ -89,7 +89,7 @@ Partition::DatabaseModified(const Database &db)
#endif #endif
void void
Partition::TagModified() Partition::TagModified() noexcept
{ {
auto song = pc.LockReadTaggedSong(); auto song = pc.LockReadTaggedSong();
if (song) if (song)
@ -103,13 +103,13 @@ Partition::TagModified(const char *uri, const Tag &tag) noexcept
} }
void void
Partition::SyncWithPlayer() Partition::SyncWithPlayer() noexcept
{ {
playlist.SyncWithPlayer(pc); playlist.SyncWithPlayer(pc);
} }
void void
Partition::BorderPause() Partition::BorderPause() noexcept
{ {
playlist.BorderPause(pc); playlist.BorderPause(pc);
} }

View File

@ -71,17 +71,17 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
AudioFormat configured_audio_format, AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config); const ReplayGainConfig &replay_gain_config) noexcept;
~Partition() noexcept; ~Partition() noexcept;
void EmitGlobalEvent(unsigned mask) { void EmitGlobalEvent(unsigned mask) noexcept {
global_events.OrMask(mask); global_events.OrMask(mask);
} }
void EmitIdle(unsigned mask); void EmitIdle(unsigned mask) noexcept;
void ClearQueue() { void ClearQueue() noexcept {
playlist.Clear(pc); playlist.Clear(pc);
} }
@ -108,11 +108,11 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist.DeleteRange(pc, start, end); playlist.DeleteRange(pc, start, end);
} }
void StaleSong(const char *uri) { void StaleSong(const char *uri) noexcept {
playlist.StaleSong(pc, uri); playlist.StaleSong(pc, uri);
} }
void Shuffle(unsigned start, unsigned end) { void Shuffle(unsigned start, unsigned end) noexcept {
playlist.Shuffle(pc, start, end); playlist.Shuffle(pc, start, end);
} }
@ -142,7 +142,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist.SetPriorityId(pc, song_id, priority); playlist.SetPriorityId(pc, song_id, priority);
} }
void Stop() { void Stop() noexcept {
playlist.Stop(pc); playlist.Stop(pc);
} }
@ -174,27 +174,27 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
playlist.SeekCurrent(pc, seek_time, relative); playlist.SeekCurrent(pc, seek_time, relative);
} }
void SetRepeat(bool new_value) { void SetRepeat(bool new_value) noexcept {
playlist.SetRepeat(pc, new_value); playlist.SetRepeat(pc, new_value);
} }
bool GetRandom() const { bool GetRandom() const noexcept {
return playlist.GetRandom(); return playlist.GetRandom();
} }
void SetRandom(bool new_value) { void SetRandom(bool new_value) noexcept {
playlist.SetRandom(pc, new_value); playlist.SetRandom(pc, new_value);
} }
void SetSingle(SingleMode new_value) { void SetSingle(SingleMode new_value) noexcept {
playlist.SetSingle(pc, new_value); playlist.SetSingle(pc, new_value);
} }
void SetConsume(bool new_value) { void SetConsume(bool new_value) noexcept {
playlist.SetConsume(new_value); playlist.SetConsume(new_value);
} }
void SetReplayGainMode(ReplayGainMode mode) { void SetReplayGainMode(ReplayGainMode mode) noexcept {
replay_gain_mode = mode; replay_gain_mode = mode;
UpdateEffectiveReplayGainMode(); UpdateEffectiveReplayGainMode();
} }
@ -203,7 +203,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
* Publishes the effective #ReplayGainMode to all subsystems. * Publishes the effective #ReplayGainMode to all subsystems.
* #ReplayGainMode::AUTO is substituted. * #ReplayGainMode::AUTO is substituted.
*/ */
void UpdateEffectiveReplayGainMode(); void UpdateEffectiveReplayGainMode() noexcept;
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
/** /**
@ -211,7 +211,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
* if this MPD configuration has no database (no * if this MPD configuration has no database (no
* music_directory was configured). * music_directory was configured).
*/ */
const Database *GetDatabase() const; const Database *GetDatabase() const noexcept;
const Database &GetDatabaseOrThrow() const; const Database &GetDatabaseOrThrow() const;
@ -219,14 +219,14 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
* The database has been modified. Propagate the change to * The database has been modified. Propagate the change to
* all subsystems. * all subsystems.
*/ */
void DatabaseModified(const Database &db); void DatabaseModified(const Database &db) noexcept;
#endif #endif
/** /**
* A tag in the play queue has been modified by the player * A tag in the play queue has been modified by the player
* thread. Propagate the change to all subsystems. * thread. Propagate the change to all subsystems.
*/ */
void TagModified(); void TagModified() noexcept;
/** /**
* The tag of the given song has been modified. Propagate the * The tag of the given song has been modified. Propagate the
@ -237,13 +237,13 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
/** /**
* Synchronize the player with the play queue. * Synchronize the player with the play queue.
*/ */
void SyncWithPlayer(); void SyncWithPlayer() noexcept;
/** /**
* Border pause has just been enabled. Change single mode to off * Border pause has just been enabled. Change single mode to off
* if it was one-shot. * if it was one-shot.
*/ */
void BorderPause(); void BorderPause() noexcept;
private: private:
/* virtual methods from class QueueListener */ /* virtual methods from class QueueListener */