BIND 10 trac2522, updated. 7acdd8d445081e1a4c70ed58298367a96ccb55fd [2522] remove OldRdataFactory, make AbstractRdataFactory pure virtual

BIND 10 source code commits bind10-changes at lists.isc.org
Tue May 21 18:45:23 UTC 2013


The branch, trac2522 has been updated
       via  7acdd8d445081e1a4c70ed58298367a96ccb55fd (commit)
       via  c39edd26a68da49eb507b3d842b8929a57f2710b (commit)
      from  a2b82fc102f6a4f987bf9ba59b05a336dfde8ac4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7acdd8d445081e1a4c70ed58298367a96ccb55fd
Author: Paul Selkirk <pselkirk at isc.org>
Date:   Tue May 21 14:45:22 2013 -0400

    [2522] remove OldRdataFactory, make AbstractRdataFactory pure virtual

commit c39edd26a68da49eb507b3d842b8929a57f2710b
Author: Paul Selkirk <pselkirk at isc.org>
Date:   Tue May 21 14:25:57 2013 -0400

    [2522] add SSHFP::operator=

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/rdata/generic/sshfp_44.cc         |   16 ++++++++-
 src/lib/dns/rdata/generic/sshfp_44.h          |    1 +
 src/lib/dns/rrparamregistry-placeholder.cc    |   44 +++----------------------
 src/lib/dns/rrparamregistry.h                 |   17 +++-------
 src/lib/dns/tests/rrparamregistry_unittest.cc |    7 ++--
 5 files changed, 30 insertions(+), 55 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rdata/generic/sshfp_44.cc b/src/lib/dns/rdata/generic/sshfp_44.cc
index 8e11249..d7cf3ce 100644
--- a/src/lib/dns/rdata/generic/sshfp_44.cc
+++ b/src/lib/dns/rdata/generic/sshfp_44.cc
@@ -82,7 +82,7 @@ SSHFP::constructFromLexer(MasterLexer& lexer) {
 /// will make the construction fail with an exception.
 ///
 /// The Algorithm and Fingerprint Type fields must be within their valid
-/// ranges, but are not contrained to the values defined in RFC4255.
+/// ranges, but are not constrained to the values defined in RFC4255.
 ///
 /// The Fingerprint field may be absent, but if present it must contain a
 /// valid hex encoding of the fingerprint.
@@ -182,6 +182,20 @@ SSHFP::SSHFP(const SSHFP& other) :
         Rdata(), impl_(new SSHFPImpl(*other.impl_))
 {}
 
+SSHFP&
+SSHFP::operator=(const SSHFP& source)
+{
+    if (impl_ == source.impl_) {
+        return (*this);
+    }
+
+    SSHFPImpl* newimpl = new SSHFPImpl(*source.impl_);
+    delete impl_;
+    impl_ = newimpl;
+
+    return (*this);
+}
+
 SSHFP::~SSHFP() {
     delete impl_;
 }
diff --git a/src/lib/dns/rdata/generic/sshfp_44.h b/src/lib/dns/rdata/generic/sshfp_44.h
index 2f884ba..28ce0f3 100644
--- a/src/lib/dns/rdata/generic/sshfp_44.h
+++ b/src/lib/dns/rdata/generic/sshfp_44.h
@@ -37,6 +37,7 @@ public:
 
     SSHFP(uint8_t algorithm, uint8_t fingerprint_type,
           const std::string& fingerprint);
+    SSHFP& operator=(const SSHFP& source);
     ~SSHFP();
 
     ///
diff --git a/src/lib/dns/rrparamregistry-placeholder.cc b/src/lib/dns/rrparamregistry-placeholder.cc
index 5960759..ae735bc 100644
--- a/src/lib/dns/rrparamregistry-placeholder.cc
+++ b/src/lib/dns/rrparamregistry-placeholder.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2013  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -41,35 +41,6 @@ using namespace isc::dns::rdata;
 namespace isc {
 namespace dns {
 
-namespace rdata {
-
-RdataPtr
-AbstractRdataFactory::create(MasterLexer& lexer, const Name*,
-                             MasterLoader::Options,
-                             MasterLoaderCallbacks&) const
-{
-    std::string s;
-
-    while (true) {
-        const MasterToken& token = lexer.getNextToken();
-        if ((token.getType() == MasterToken::END_OF_FILE) ||
-            (token.getType() == MasterToken::END_OF_LINE)) {
-            lexer.ungetToken(); // let the upper layer handle the end-of token
-            break;
-        }
-
-        if (!s.empty()) {
-            s += " ";
-        }
-
-        s += token.getString();
-    }
-
-    return (create(s));
-}
-
-} // end of namespace isc::dns::rdata
-
 namespace {
 ///
 /// The following function and class are a helper to define case-insensitive
@@ -190,10 +161,8 @@ typedef map<RRTypeClass, RdataFactoryPtr> RdataFactoryMap;
 typedef map<RRType, RdataFactoryPtr> GenericRdataFactoryMap;
 
 template <typename T>
-class OldRdataFactory : public AbstractRdataFactory {
+class RdataFactory : public AbstractRdataFactory {
 public:
-    using AbstractRdataFactory::create;
-
     virtual RdataPtr create(const string& rdata_str) const
     {
         return (RdataPtr(new T(rdata_str)));
@@ -208,16 +177,11 @@ public:
     {
         return (RdataPtr(new T(dynamic_cast<const T&>(source))));
     }
-};
-
-template <typename T>
-class RdataFactory : public OldRdataFactory<T> {
-public:
-    using OldRdataFactory<T>::create;
 
     virtual RdataPtr create(MasterLexer& lexer, const Name* origin,
                             MasterLoader::Options options,
-                            MasterLoaderCallbacks& callbacks) const {
+                            MasterLoaderCallbacks& callbacks) const
+    {
         return (RdataPtr(new T(lexer, origin, options, callbacks)));
     }
 };
diff --git a/src/lib/dns/rrparamregistry.h b/src/lib/dns/rrparamregistry.h
index bf86436..1d59e01 100644
--- a/src/lib/dns/rrparamregistry.h
+++ b/src/lib/dns/rrparamregistry.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2013  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -55,11 +55,11 @@ namespace rdata {
 /// \brief The \c AbstractRdataFactory class is an abstract base class to
 /// encapsulate a set of Rdata factory methods in a polymorphic way.
 ///
-/// An external developers who want to introduce a new or experimental RR type
-/// are expected to define a corresponding derived class of \c
+/// An external developer who wants to introduce a new or experimental RR type
+/// is expected to define a corresponding derived class of \c
 /// AbstractRdataFactory and register it via \c RRParamRegistry.
 ///
-/// For other users of this API normally do not have to care about this class
+/// Other users of this API normally do not have to care about this class
 /// or its derived classes; this class is generally intended to be used
 /// as an internal utility of the API implementation.
 class AbstractRdataFactory {
@@ -125,16 +125,9 @@ public:
     /// of a specific RR type and class for \c RRParamRegistry::createRdata()
     /// that uses \c MasterLexer.  See its description for the expected
     /// behavior and meaning of the parameters.
-    ///
-    /// \note Right now this is not defined as a pure virtual method and
-    /// provides the default implementation.  This is an intermediate
-    /// workaround until we implement the underlying constructor for all
-    /// supported \c Rdata classes; once it's completed the workaround
-    /// default implementation should be removed and this method should become
-    /// pure virtual.
     virtual RdataPtr create(MasterLexer& lexer, const Name* origin,
                             MasterLoader::Options options,
-                            MasterLoaderCallbacks& callbacks) const;
+                            MasterLoaderCallbacks& callbacks) const = 0;
     //@}
 };
 
diff --git a/src/lib/dns/tests/rrparamregistry_unittest.cc b/src/lib/dns/tests/rrparamregistry_unittest.cc
index 08e0af1..b0d43a8 100644
--- a/src/lib/dns/tests/rrparamregistry_unittest.cc
+++ b/src/lib/dns/tests/rrparamregistry_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2010  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2013  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -108,13 +108,16 @@ TEST_F(RRParamRegistryTest, addError) {
 
 class TestRdataFactory : public AbstractRdataFactory {
 public:
-    using AbstractRdataFactory::create;
     virtual RdataPtr create(const string& rdata_str) const
     { return (RdataPtr(new in::A(rdata_str))); }
     virtual RdataPtr create(InputBuffer& buffer, size_t rdata_len) const
     { return (RdataPtr(new in::A(buffer, rdata_len))); }
     virtual RdataPtr create(const Rdata& source) const
     { return (RdataPtr(new in::A(dynamic_cast<const in::A&>(source)))); }
+    virtual RdataPtr create(MasterLexer& lexer, const Name* origin,
+                            MasterLoader::Options options,
+                            MasterLoaderCallbacks& callbacks) const
+    { return (RdataPtr(new in::A(lexer, origin, options, callbacks))); }
 };
 
 TEST_F(RRParamRegistryTest, addRemoveFactory) {



More information about the bind10-changes mailing list