neighbor/{Explorer,Listener}: add "noexcept"

This commit is contained in:
Max Kellermann 2018-01-02 16:58:14 +01:00
parent dcd483bd99
commit cd6de3b24e
7 changed files with 20 additions and 18 deletions

View File

@ -98,14 +98,14 @@ Instance::OnDatabaseSongRemoved(const char *uri)
#ifdef ENABLE_NEIGHBOR_PLUGINS
void
Instance::FoundNeighbor(gcc_unused const NeighborInfo &info)
Instance::FoundNeighbor(gcc_unused const NeighborInfo &info) noexcept
{
for (auto &partition : partitions)
partition.EmitIdle(IDLE_NEIGHBOR);
}
void
Instance::LostNeighbor(gcc_unused const NeighborInfo &info)
Instance::LostNeighbor(gcc_unused const NeighborInfo &info) noexcept
{
for (auto &partition : partitions)
partition.EmitIdle(IDLE_NEIGHBOR);

View File

@ -139,8 +139,8 @@ private:
#ifdef ENABLE_NEIGHBOR_PLUGINS
/* virtual methods from class NeighborListener */
void FoundNeighbor(const NeighborInfo &info) override;
void LostNeighbor(const NeighborInfo &info) override;
void FoundNeighbor(const NeighborInfo &info) noexcept override;
void LostNeighbor(const NeighborInfo &info) noexcept override;
#endif
/* callback for #idle_monitor */

View File

@ -40,7 +40,7 @@ class NeighborExplorer {
protected:
NeighborListener &listener;
explicit NeighborExplorer(NeighborListener &_listener)
explicit NeighborExplorer(NeighborListener &_listener) noexcept
:listener(_listener) {}
public:
@ -49,7 +49,7 @@ public:
/**
* Free instance data.
*/
virtual ~NeighborExplorer() {}
virtual ~NeighborExplorer() noexcept {}
/**
* Start exploring the neighborhood.

View File

@ -30,12 +30,12 @@
#include <stdexcept>
NeighborGlue::Explorer::~Explorer()
NeighborGlue::Explorer::~Explorer() noexcept
{
delete explorer;
}
NeighborGlue::~NeighborGlue() {}
NeighborGlue::~NeighborGlue() noexcept {}
static NeighborExplorer *
CreateNeighborExplorer(EventLoop &loop, NeighborListener &listener,
@ -86,7 +86,7 @@ NeighborGlue::Open()
}
void
NeighborGlue::Close()
NeighborGlue::Close() noexcept
{
for (auto i = explorers.begin(), end = explorers.end(); i != end; ++i)
i->explorer->Close();

View File

@ -38,9 +38,11 @@ class NeighborGlue {
struct Explorer {
NeighborExplorer *const explorer;
Explorer(NeighborExplorer *_explorer):explorer(_explorer) {}
Explorer(NeighborExplorer *_explorer) noexcept
:explorer(_explorer) {}
Explorer(const Explorer &) = delete;
~Explorer();
~Explorer() noexcept;
};
Mutex mutex;
@ -52,9 +54,9 @@ public:
NeighborGlue() = default;
NeighborGlue(const NeighborGlue &) = delete;
~NeighborGlue();
~NeighborGlue() noexcept;
bool IsEmpty() const {
bool IsEmpty() const noexcept {
return explorers.empty();
}
@ -64,7 +66,7 @@ public:
void Init(EventLoop &loop, NeighborListener &listener);
void Open();
void Close();
void Close() noexcept;
/**
* Get the combined list of all neighbors from all active

View File

@ -29,8 +29,8 @@ class NeighborExplorer;
*/
class NeighborListener {
public:
virtual void FoundNeighbor(const NeighborInfo &info) = 0;
virtual void LostNeighbor(const NeighborInfo &info) = 0;
virtual void FoundNeighbor(const NeighborInfo &info) noexcept = 0;
virtual void LostNeighbor(const NeighborInfo &info) noexcept = 0;
};
#endif

View File

@ -43,12 +43,12 @@ public:
class MyNeighborListener final : public NeighborListener {
public:
/* virtual methods from class NeighborListener */
virtual void FoundNeighbor(const NeighborInfo &info) override {
virtual void FoundNeighbor(const NeighborInfo &info) noexcept override {
printf("found '%s' (%s)\n",
info.display_name.c_str(), info.uri.c_str());
}
virtual void LostNeighbor(const NeighborInfo &info) override {
virtual void LostNeighbor(const NeighborInfo &info) noexcept override {
printf("lost '%s' (%s)\n",
info.display_name.c_str(), info.uri.c_str());
}