mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 10:32:58 +01:00
Problem: inconsistent polymorphic inheritance
Solution: consistently use virtual, override and final
This commit is contained in:
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <unity.h>
|
||||
#include "../src/macros.hpp"
|
||||
#include "../tests/testutil.hpp"
|
||||
#include "../tests/testutil_unity.hpp"
|
||||
#include "../unittests/unittest_resolver_common.hpp"
|
||||
@@ -39,7 +40,7 @@ void tearDown ()
|
||||
{
|
||||
}
|
||||
|
||||
class test_ip_resolver_t : public zmq::ip_resolver_t
|
||||
class test_ip_resolver_t ZMQ_FINAL : public zmq::ip_resolver_t
|
||||
{
|
||||
public:
|
||||
test_ip_resolver_t (zmq::ip_resolver_options_t opts_) :
|
||||
@@ -55,10 +56,10 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
|
||||
const char *ipv6;
|
||||
};
|
||||
|
||||
virtual int do_getaddrinfo (const char *node_,
|
||||
const char *service_,
|
||||
const struct addrinfo *hints_,
|
||||
struct addrinfo **res_)
|
||||
int do_getaddrinfo (const char *node_,
|
||||
const char *service_,
|
||||
const struct addrinfo *hints_,
|
||||
struct addrinfo **res_) ZMQ_FINAL
|
||||
{
|
||||
static const struct dns_lut_t dns_lut[] = {
|
||||
{"ip.zeromq.org", "10.100.0.1", "fdf5:d058:d656::1"},
|
||||
@@ -105,7 +106,7 @@ class test_ip_resolver_t : public zmq::ip_resolver_t
|
||||
return zmq::ip_resolver_t::do_getaddrinfo (ip, NULL, &ai, res_);
|
||||
}
|
||||
|
||||
virtual unsigned int do_if_nametoindex (const char *ifname_)
|
||||
unsigned int do_if_nametoindex (const char *ifname_) ZMQ_FINAL
|
||||
{
|
||||
static const char *dummy_interfaces[] = {
|
||||
"lo0",
|
||||
|
||||
@@ -63,7 +63,7 @@ struct test_events_t : zmq::i_poll_events
|
||||
(void) _fd;
|
||||
}
|
||||
|
||||
virtual void in_event ()
|
||||
void in_event () ZMQ_OVERRIDE
|
||||
{
|
||||
_poller.rm_fd (_handle);
|
||||
_handle = (zmq::poller_t::handle_t) NULL;
|
||||
@@ -73,13 +73,13 @@ struct test_events_t : zmq::i_poll_events
|
||||
}
|
||||
|
||||
|
||||
virtual void out_event ()
|
||||
void out_event () ZMQ_OVERRIDE
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
||||
virtual void timer_event (int id_)
|
||||
void timer_event (int id_) ZMQ_OVERRIDE
|
||||
{
|
||||
LIBZMQ_UNUSED (id_);
|
||||
_poller.rm_fd (_handle);
|
||||
|
||||
Reference in New Issue
Block a user