Kea  2.1.7-git
dhcp_space.h
Go to the documentation of this file.
1 // Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef ISC_UTIL_DHCP_SPACE_H
8 #define ISC_UTIL_DHCP_SPACE_H 1
9 
10 #include <string>
11 
12 #include <boost/algorithm/string/replace.hpp>
13 
14 namespace isc {
15 namespace util {
16 
17 enum DhcpSpace {
20 };
21 
27 template <DhcpSpace D>
28 char const* cStringDhcpSpace();
29 
35 template <DhcpSpace D>
36 std::string formatDhcpSpace(char const* const format_string) {
37  std::string result(format_string);
38  boost::replace_all(result, "{}", cStringDhcpSpace<D>());
39  return result;
40 }
41 
42 } // namespace util
43 } // namespace isc
44 
45 #endif // ISC_UTIL_DHCP_SPACE_H
std::string formatDhcpSpace(char const *const format_string)
Replaces all occurences of {} with 4 or 6 based on the templated DHCP space.
Definition: dhcp_space.h:36
char const * cStringDhcpSpace()
Provides the C string representation of the DHCP space.
Defines the logger used by the top-level component of kea-lfc.