From 52c021ee0b0c6ad2128ed550c694aad0d11d4c3f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 16:53:22 +0200 Subject: Adding upstream version 2.5.7. Signed-off-by: Daniel Baumann --- src/lib/cc/cfg_to_element.h | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/lib/cc/cfg_to_element.h (limited to 'src/lib/cc/cfg_to_element.h') diff --git a/src/lib/cc/cfg_to_element.h b/src/lib/cc/cfg_to_element.h new file mode 100644 index 0000000..480dd1f --- /dev/null +++ b/src/lib/cc/cfg_to_element.h @@ -0,0 +1,48 @@ +// Copyright (C) 2017 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef CFG_TO_ELEMENT_H +#define CFG_TO_ELEMENT_H + +#include +#include + +namespace isc { + +/// @brief Cannot unparse error +/// +/// This exception is expected to be thrown when toElement fails +/// and to skip flawed elements is not wanted. +class ToElementError : public isc::Exception { +public: + ToElementError(const char* file, size_t line, const char* what) : + isc::Exception(file, line, what) { }; +}; + +namespace data { + +/// @brief Abstract class for configuration Cfg_* classes +/// +struct CfgToElement { + /// Destructor + virtual ~CfgToElement() { } + + /// @brief Unparse a configuration object + /// + /// Returns an element which must parse into the same object, i.e. + /// @code + /// for all valid config C parse(parse(C)->toElement()) == parse(C) + /// @endcode + /// + /// @return a pointer to a configuration which can be parsed into + /// the initial configuration object + virtual isc::data::ElementPtr toElement() const = 0; +}; + +}; // namespace isc::dhcp +}; // namespace isc + +#endif // CFG_TO_ELEMENT_H -- cgit v1.2.3