diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
commit | f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch) | |
tree | 49e44c6f87febed37efb953ab5485aa49f6481a7 /src/lib/cc/cfg_to_element.h | |
parent | Initial commit. (diff) | |
download | isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.tar.xz isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.zip |
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/cc/cfg_to_element.h')
-rw-r--r-- | src/lib/cc/cfg_to_element.h | 48 |
1 files changed, 48 insertions, 0 deletions
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 <exceptions/exceptions.h> +#include <cc/data.h> + +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 |