]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1211] Added copy assignment operator to OptionDescriptor
authorFrancis Dupont <fdupont@isc.org>
Fri, 8 May 2020 20:42:02 +0000 (22:42 +0200)
committerFrancis Dupont <fdupont@isc.org>
Mon, 15 Jun 2020 15:43:16 +0000 (15:43 +0000)
src/lib/dhcpsrv/cfg_option.h
src/lib/dns/labelsequence.h

index bc61ef7bc030b6d7bb9b55a3fd0348237c582f72..a28365d32aeaee38e47eb3c5de4cf5f23106e024 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2020 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -98,7 +98,7 @@ public:
         : data::StampedElement(), option_(OptionPtr()), persistent_(persist),
           formatted_value_(), space_name_() {};
 
-    /// @brief Constructor.
+    /// @brief Copy constructor.
     ///
     /// @param desc option descriptor to be copied.
     OptionDescriptor(const OptionDescriptor& desc)
@@ -110,6 +110,22 @@ public:
         setContext(desc.getContext());
     };
 
+    /// @brief Assignment operator.
+    ///
+    /// @param other option descriptor to be assigned from.
+    OptionDescriptor& operator=(const OptionDescriptor& other) {
+        if (this != &other) {
+            // Not self-assignment.
+            data::StampedElement(other);
+            option_ = other.option_;
+            persistent_ = other.persistent_;
+            formatted_value_ = other.formatted_value_;
+            space_name_ = other.space_name_;
+            setContext(other.getContext());
+        }
+        return (*this);
+    }
+
     /// @brief Factory function creating an instance of the @c OptionDescriptor.
     ///
     /// @param opt option instance.
index 63aec202cf986184a1d47902ed4bef1ff2cd9890..91dbe591a2efed64a8d7b53e3857c709ef894141 100644 (file)
@@ -137,7 +137,7 @@ public:
     /// \note No validation is done on the given data upon construction;
     ///       use with care.
     ///
-    /// \param ls The LabelSequence to construct a LabelSequence from
+    /// \param other The LabelSequence to assign a LabelSequence from
     LabelSequence& operator=(const LabelSequence& other) {
         if (this != &other) {
             // Not self-assignment.