From: Francis Dupont Date: Fri, 8 May 2020 20:42:02 +0000 (+0200) Subject: [#1211] Added copy assignment operator to OptionDescriptor X-Git-Tag: Kea-1.7.9~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1a1117cf9de98bd98fdc271d4e04baab5aa1bf4;p=thirdparty%2Fkea.git [#1211] Added copy assignment operator to OptionDescriptor --- diff --git a/src/lib/dhcpsrv/cfg_option.h b/src/lib/dhcpsrv/cfg_option.h index bc61ef7bc0..a28365d32a 100644 --- a/src/lib/dhcpsrv/cfg_option.h +++ b/src/lib/dhcpsrv/cfg_option.h @@ -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. diff --git a/src/lib/dns/labelsequence.h b/src/lib/dns/labelsequence.h index 63aec202cf..91dbe591a2 100644 --- a/src/lib/dns/labelsequence.h +++ b/src/lib/dns/labelsequence.h @@ -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.