Skip to content

Commit

Permalink
LyricsPage: add noexcept
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Sep 9, 2024
1 parent 2b1e72d commit 347de93
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/LyricsPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class LyricsPage final : public TextPage, PluginResponseHandler {
CoarseTimerEvent plugin_timeout;

public:
LyricsPage(ScreenManager &_screen, const Window _window, Size size)
LyricsPage(ScreenManager &_screen, const Window _window, Size size) noexcept
:TextPage(_screen, _window, size),
plugin_timeout(_screen.GetEventLoop(),
BIND_THIS_METHOD(OnTimeout)) {}

~LyricsPage() override {
~LyricsPage() noexcept override {
Cancel();
}

Expand All @@ -75,19 +75,19 @@ class LyricsPage final : public TextPage, PluginResponseHandler {
plugin_cycle = nullptr;
}

void Cancel();
void Cancel() noexcept;

/**
* Repaint and update the screen, if it is currently active.
*/
void RepaintIfActive() {
void RepaintIfActive() noexcept {
if (screen.IsVisible(*this))
Repaint();

/* XXX repaint the screen title */
}

void Set(const char *s);
void Set(const char *s) noexcept;

void StartPluginCycle() noexcept;

Expand All @@ -99,12 +99,12 @@ class LyricsPage final : public TextPage, PluginResponseHandler {
MaybeLoad(*new_song);
}

void Reload();
void Reload() noexcept;

bool Save();
bool Save() noexcept;

/** save current lyrics to a file and run editor on it */
void Edit();
void Edit() noexcept;

void OnTimeout() noexcept;

Expand All @@ -123,7 +123,7 @@ class LyricsPage final : public TextPage, PluginResponseHandler {
};

void
LyricsPage::Cancel()
LyricsPage::Cancel() noexcept
{
if (plugin_cycle != nullptr)
StopPluginCycle();
Expand All @@ -141,7 +141,7 @@ LyricsPage::Cancel()
}

bool
LyricsPage::Save()
LyricsPage::Save() noexcept
{
FILE *lyr_file = cache.Save(artist, title);
if (lyr_file == nullptr)
Expand All @@ -155,7 +155,7 @@ LyricsPage::Save()
}

void
LyricsPage::Set(const char *s)
LyricsPage::Set(const char *s) noexcept
{
if (reloading) {
unsigned saved_start = lw.GetOrigin();
Expand Down Expand Up @@ -272,7 +272,7 @@ LyricsPage::MaybeLoad(const struct mpd_song &new_song) noexcept
}

void
LyricsPage::Reload()
LyricsPage::Reload() noexcept
{
if (plugin_cycle == nullptr && artist != nullptr && title != nullptr) {
reloading = true;
Expand All @@ -282,7 +282,7 @@ LyricsPage::Reload()
}

static std::unique_ptr<Page>
lyrics_screen_init(ScreenManager &_screen, const Window window, Size size)
lyrics_screen_init(ScreenManager &_screen, const Window window, Size size) noexcept
{
return std::make_unique<LyricsPage>(_screen, window, size);
}
Expand Down Expand Up @@ -334,7 +334,7 @@ LyricsPage::GetTitle(std::span<char> buffer) const noexcept
}

void
LyricsPage::Edit()
LyricsPage::Edit() noexcept
{
const auto path = cache.MakePath(artist, title);
if (path.empty()) {
Expand Down

0 comments on commit 347de93

Please sign in to comment.