From df9b53dbcdc60ae33e1382b41ecedad7ae77e2d9 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 16 May 2013 13:49:46 +0200 Subject: [PATCH] add inline operators for qtype comparison, thanks Mark Zealey. Closes #646 --- pdns/qtype.cc | 5 ----- pdns/qtype.hh | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pdns/qtype.cc b/pdns/qtype.cc index 35d422b65d..3b00d6ab33 100644 --- a/pdns/qtype.cc +++ b/pdns/qtype.cc @@ -80,11 +80,6 @@ QType &QType::operator=(const char *p) return *this; } -bool QType::operator==(const QType &comp) const -{ - return(comp.code==code); -} - QType &QType::operator=(const string &s) { code=chartocode(s.c_str()); diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 4d063ed063..8ce807f779 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -69,8 +69,6 @@ public: ar & code; } - bool operator==(const QType &) const; //!< equality operator - const string getName() const; //!< Get a string representation of this type uint16_t getCode() const; //!< Get the integer representation of this type @@ -83,6 +81,22 @@ public: typedef pair namenum; static vector names; + inline bool operator==(const QType &comp) const { + return(comp.code==code); + } + + inline bool operator!=(const QType &comp) const { + return(comp.code!=code); + } + + inline bool operator==(QType::typeenum comp) const { + return(comp==code); + } + + inline bool operator!=(QType::typeenum comp) const { + return(comp!=code); + } + private: static class init { public: -- 2.47.3