[svn] commit: r460 - in /branches/jinmei-dnsrrparams/src/lib/dns/cpp: rrclass.h rrclass_unittest.cc rrtype.h rrtype_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Jan 13 09:08:50 UTC 2010


Author: jinmei
Date: Wed Jan 13 09:08:50 2010
New Revision: 460

Log:
added [n]equals() according to the coding guidelines.

Modified:
    branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass.h
    branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass_unittest.cc
    branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype.h
    branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype_unittest.cc

Modified: branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass.h
==============================================================================
--- branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass.h (original)
+++ branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass.h Wed Jan 13 09:08:50 2010
@@ -201,16 +201,22 @@
     ///
     /// \param other the \c RRClass object to compare against.
     /// \return true if the two RRClasses are equal; otherwise false.
-    bool operator==(const RRClass& other) const
+    bool equals(const RRClass& other) const
     { return (classcode_ == other.classcode_); }
+    /// \brief Same as \c equals().
+    bool operator==(const RRClass& other) const { return (equals(other)); }
+
     /// \brief Return true iff two RRClasses are equal.
     ///
     /// This method never throws an exception.
     ///
     /// \param other the \c RRClass object to compare against.
     /// \return true if the two RRClasses are not equal; otherwise false.
-    bool operator!=(const RRClass& other) const
+    bool nequals(const RRClass& other) const
     { return (classcode_ != other.classcode_); }
+    /// \brief Same as \c nequals().
+    bool operator!=(const RRClass& other) const { return (nequals(other)); } 
+
     /// \brief Less-than comparison for RRClass against \c other
     ///
     /// We define the less-than relationship based on their class codes;

Modified: branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass_unittest.cc
==============================================================================
--- branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass_unittest.cc (original)
+++ branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrclass_unittest.cc Wed Jan 13 09:08:50 2010
@@ -138,7 +138,8 @@
 TEST_F(RRClassTest, compare)
 {
     EXPECT_TRUE(RRClass(1) == RRClass("IN"));
-    EXPECT_TRUE(RRClass(0) != RRClass("IN"));
+    EXPECT_TRUE(RRClass(1).equals(RRClass("IN")));
+    EXPECT_TRUE(RRClass(0).nequals(RRClass("IN")));
 
     EXPECT_TRUE(RRClass("IN") < RRClass("CH"));
     EXPECT_TRUE(RRClass(100) < RRClass(65535));

Modified: branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype.h
==============================================================================
--- branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype.h (original)
+++ branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype.h Wed Jan 13 09:08:50 2010
@@ -208,16 +208,22 @@
     ///
     /// \param other the \c RRType object to compare against.
     /// \return true if the two RRTypes are equal; otherwise false.
-    bool operator==(const RRType& other) const
+    bool equals(const RRType& other) const
     { return (typecode_ == other.typecode_); }
+    /// \brief Same as \c equals().
+    bool operator==(const RRType& other) const { return equals(other); }
+
     /// \brief Return true iff two RRTypes are equal.
     ///
     /// This method never throws an exception.
     ///
     /// \param other the \c RRType object to compare against.
     /// \return true if the two RRTypes are not equal; otherwise false.
-    bool operator!=(const RRType& other) const
+    bool nequals(const RRType& other) const 
     { return (typecode_ != other.typecode_); }
+    /// \brief Same as \c nequals().
+    bool operator!=(const RRType& other) const { return nequals(other); }
+ 
     /// \brief Less-than comparison for RRType against \c other
     ///
     /// We define the less-than relationship based on their type codes;

Modified: branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype_unittest.cc
==============================================================================
--- branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype_unittest.cc (original)
+++ branches/jinmei-dnsrrparams/src/lib/dns/cpp/rrtype_unittest.cc Wed Jan 13 09:08:50 2010
@@ -143,7 +143,9 @@
 TEST_F(RRTypeTest, compare)
 {
     EXPECT_TRUE(RRType(1) == RRType("A"));
+    EXPECT_TRUE(RRType(1).equals(RRType("A")));
     EXPECT_TRUE(RRType(0) != RRType("A"));
+    EXPECT_TRUE(RRType(0).nequals(RRType("A")));
 
     EXPECT_TRUE(RRType("A") < RRType("NS"));
     EXPECT_TRUE(RRType(100) < RRType(65535));




More information about the bind10-changes mailing list