BIND 10 trac2432, updated. cfbb9eada0a6e0ff8a2faead73f870d3ca3400fc [2432] Document whether rrsets can be modified after being added

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 3 09:28:45 UTC 2013


The branch, trac2432 has been updated
       via  cfbb9eada0a6e0ff8a2faead73f870d3ca3400fc (commit)
       via  8bca74f57a81fa7e2dc2569692b253dbf19270b4 (commit)
       via  34929974f3655f19029d83234e4c5b89b85eaf99 (commit)
      from  98d515d5e653a75762b5da424555ac301e7f9af5 (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 cfbb9eada0a6e0ff8a2faead73f870d3ca3400fc
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Jan 3 14:58:13 2013 +0530

    [2432] Document whether rrsets can be modified after being added

commit 8bca74f57a81fa7e2dc2569692b253dbf19270b4
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Jan 3 14:55:21 2013 +0530

    [2432] Document the state of the collection for empty constructor

commit 34929974f3655f19029d83234e4c5b89b85eaf99
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Jan 3 14:53:07 2013 +0530

    [2432] Rename iterator class to Iterator

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

Summary of changes:
 src/lib/dns/rrset_collection.h                 |    8 ++++++++
 src/lib/dns/rrset_collection_base.h            |   22 +++++++++++-----------
 src/lib/dns/tests/rrset_collection_unittest.cc |    6 +++---
 3 files changed, 22 insertions(+), 14 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/rrset_collection.h b/src/lib/dns/rrset_collection.h
index dfa4dd7..fe9152c 100644
--- a/src/lib/dns/rrset_collection.h
+++ b/src/lib/dns/rrset_collection.h
@@ -31,6 +31,10 @@ namespace dns {
 class RRsetCollection : public RRsetCollectionBase {
 public:
     /// \brief Constructor.
+    ///
+    /// This constructor creates an empty collection without any data in
+    /// it. RRsets can be added to the collection with the \c addRRset()
+    /// method.
     RRsetCollection() {}
 
     /// \brief Constructor.
@@ -73,6 +77,10 @@ public:
     /// and managed by the \c RRsetCollection. It throws an
     /// \c isc::InvalidParameter exception if an rrset with the same
     /// class, type and name already exists.
+    ///
+    /// Callers must not modify the RRset after adding it to the
+    /// collection, as the rrset is indexed internally by the
+    /// collection.
     void addRRset(isc::dns::RRsetPtr rrset);
 
     /// \brief Remove an RRset from the collection.
diff --git a/src/lib/dns/rrset_collection_base.h b/src/lib/dns/rrset_collection_base.h
index eae7f6d..20849cc 100644
--- a/src/lib/dns/rrset_collection_base.h
+++ b/src/lib/dns/rrset_collection_base.h
@@ -105,11 +105,11 @@ public:
     ///
     /// It behaves like a \c std::iterator forward iterator, so please
     /// see its documentation for usage.
-    class iterator : std::iterator<std::forward_iterator_tag,
+    class Iterator : std::iterator<std::forward_iterator_tag,
                                    const isc::dns::AbstractRRset>
     {
     public:
-        explicit iterator(IterPtr iter) :
+        explicit Iterator(IterPtr iter) :
             iter_(iter)
         {}
 
@@ -117,22 +117,22 @@ public:
             return (iter_->getValue());
         }
 
-        iterator& operator++() {
+        Iterator& operator++() {
             iter_ = iter_->getNext();
             return (*this);
         }
 
-        iterator operator++(int) {
-            iterator tmp(iter_);
+        Iterator operator++(int) {
+            Iterator tmp(iter_);
             ++*this;
             return (tmp);
         }
 
-        bool operator==(const iterator& other) const {
+        bool operator==(const Iterator& other) const {
             return (iter_->equals(*other.iter_));
         }
 
-        bool operator!=(const iterator& other) const {
+        bool operator!=(const Iterator& other) const {
             return (!iter_->equals(*other.iter_));
         }
 
@@ -142,14 +142,14 @@ public:
 
     /// \brief Returns an iterator pointing to the beginning of the
     /// collection.
-    iterator begin() {
-      return iterator(getBeginning());
+    Iterator begin() {
+      return Iterator(getBeginning());
     }
 
     /// \brief Returns an iterator pointing past the end of the
     /// collection.
-    iterator end() {
-      return iterator(getEnd());
+    Iterator end() {
+      return Iterator(getEnd());
     }
 };
 
diff --git a/src/lib/dns/tests/rrset_collection_unittest.cc b/src/lib/dns/tests/rrset_collection_unittest.cc
index 7d1b6f6..a4834e9 100644
--- a/src/lib/dns/tests/rrset_collection_unittest.cc
+++ b/src/lib/dns/tests/rrset_collection_unittest.cc
@@ -44,8 +44,8 @@ TEST_F(RRsetCollectionTest, istreamConstructor) {
     std::ifstream fs(TEST_DATA_SRCDIR "/example.org");
     RRsetCollection collection2(fs, origin, rrclass);
 
-    RRsetCollectionBase::iterator iter = collection.begin();
-    RRsetCollectionBase::iterator iter2 = collection2.begin();
+    RRsetCollectionBase::Iterator iter = collection.begin();
+    RRsetCollectionBase::Iterator iter2 = collection2.begin();
     while (iter != collection.end()) {
          EXPECT_TRUE(iter2 != collection2.end());
          EXPECT_EQ((*iter).toText(), (*iter2).toText());
@@ -184,7 +184,7 @@ TEST_F(RRsetCollectionTest, iteratorTest) {
 
     // Here, we just count the records and do some basic tests on them.
     size_t count = 0;
-    for (RRsetCollection::iterator it = collection.begin();
+    for (RRsetCollection::Iterator it = collection.begin();
          it != collection.end(); ++it) {
          ++count;
          const AbstractRRset& rrset = *it;



More information about the bind10-changes mailing list