SNode.C
Loading...
Searching...
No Matches
ConfigSection.hpp
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "net/config/ConfigSection.h" // IWYU pragma: export
21
22#ifndef DOXYGEN_SHOULD_SKIP_THIS
23
24#ifdef __GNUC__
25#pragma GCC diagnostic push
26#pragma GCC diagnostic ignored "-Wfloat-equal"
27#ifdef __has_warning
28#if __has_warning("-Wweak-vtables")
29#pragma GCC diagnostic ignored "-Wweak-vtables"
30#endif
31#if __has_warning("-Wcovered-switch-default")
32#pragma GCC diagnostic ignored "-Wcovered-switch-default"
33#endif
34#endif
35#endif
36#include "utils/CLI11.hpp" // IWYU pragma: export
37#ifdef __GNUC__
38#pragma GCC diagnostic pop
39#endif
40
41#endif // DOXYGEN_SHOULD_SKIP_THIS
42
43namespace net::config {
44
45 template <typename ValueType>
46 CLI::Option*
47 ConfigSection::addOption(const std::string& name, const std::string& description, const std::string& typeName, ValueType defaultValue) {
48 return addOption(name, description, typeName) //
49 ->default_val(defaultValue);
50 }
51
52 template <typename ValueType>
53 CLI::Option* ConfigSection::addOption(const std::string& name,
54 const std::string& description,
55 const std::string& typeName,
56 ValueType defaultValue,
57 const CLI::Validator& additionalValidator) {
58 return addOption(name, description, typeName, defaultValue) //
59 ->check(additionalValidator);
60 }
61
62 template <typename ValueType>
63 CLI::Option*
64 ConfigSection::addFlag(const std::string& name, const std::string& description, const std::string& typeName, ValueType defaultValue) {
65 return addFlag(name, description, typeName) //
66 ->default_val(defaultValue);
67 }
68
69 template <typename ValueType>
70 CLI::Option* ConfigSection::addFlag(const std::string& name,
71 const std::string& description,
72 const std::string& typeName,
73 ValueType defaultValue,
74 const CLI::Validator& additionalValidator) {
75 return addFlag(name, description, typeName, defaultValue) //
76 ->check(additionalValidator);
77 }
78
79} // namespace net::config
StaticMiddleware & appendStdHeaders(const std::string &field, const std::string &value)
web::http::ConnectionState defaultConnectionState
StaticMiddleware(const StaticMiddleware &)=delete
StaticMiddleware & setStdHeaders(const std::map< std::string, std::string > &stdHeaders)
StaticMiddleware & operator=(const StaticMiddleware &)=delete
static class StaticMiddleware & instance(const std::string &root)
StaticMiddleware & appendStdCookie(const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
StaticMiddleware & appendStdHeaders(const std::map< std::string, std::string > &stdHeaders)
StaticMiddleware(const std::string &root)
StaticMiddleware & afterResponse(web::http::ConnectionState connectionState)
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
CLI::Option * addFlag(const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue)
CLI::Option * addOption(const std::string &name, const std::string &description, const std::string &typeName, ValueType defaultValue, const CLI::Validator &additionalValidator)
int main(int argc, char *argv[])
#define QUOTE_INCLUDE(a)
Definition clients.h:25
#define STR_INCLUDE(a)
Definition servers.h:26
static express::Router getRouter()
Definition servers.h:46
static WebApp getWebApp(const std::string &name)
Definition servers.h:57
static WebApp getWebApp(const std::string &name)
Definition servers.h:74