SNode.C
Loading...
Searching...
No Matches
Exceptions.h
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#ifndef CLI_EXCEPTIONS_H
21#define CLI_EXCEPTIONS_H
22
23#ifndef DOXYGEN_SHOULD_SKIP_THIS
24
25#ifdef __GNUC__
26#pragma GCC diagnostic push
27#pragma GCC diagnostic ignored "-Wfloat-equal"
28#ifdef __has_warning
29#if __has_warning("-Wweak-vtables")
30#pragma GCC diagnostic ignored "-Wweak-vtables"
31#endif
32#if __has_warning("-Wcovered-switch-default")
33#pragma GCC diagnostic ignored "-Wcovered-switch-default"
34#endif
35#endif
36#endif
37#include "utils/CLI11.hpp"
38#ifdef __GNUC__
39#pragma GCC diagnostic pop
40#endif
41
42#include <string>
43
44#endif // DOXYGEN_SHOULD_SKIP_THIS
45
46namespace CLI {
47
48 class CallForCommandline : public CLI::Success {
49 public:
50 enum class Mode { REQUIRED, STANDARD, FULL, DEFAULT };
51
52 CallForCommandline(CLI::App* app, const std::string& description, Mode mode);
54
55 CLI::App* getApp() const;
56 Mode getMode() const;
57
58 private:
59 CLI::App* app;
61 };
62
63 class CallForShowConfig : public CLI::Success {
64 public:
65 explicit CallForShowConfig(CLI::App* app);
67
68 CLI::App* getApp() const;
69
70 private:
71 CLI::App* app;
72 };
73
74 class CallForWriteConfig : public CLI::Success {
75 public:
76 explicit CallForWriteConfig(const std::string& configFile);
78
79 std::string getConfigFile() const;
80
81 private:
83 };
84
85} // namespace CLI
86
87#endif // CLI_EXCEPTIONS_H
#define XSTR(s)
CLI::App * getApp() const
CallForCommandline(CLI::App *app, const std::string &description, Mode mode)
~CallForCommandline() override
CLI::App * getApp() const
~CallForShowConfig() override
CallForShowConfig(CLI::App *app)
std::string getConfigFile() const
~CallForWriteConfig() override
CallForWriteConfig(const std::string &configFile)
static void init()
Definition Logger.cpp:32
static void setQuiet(bool quiet=true)
Definition Logger.cpp:114
static bool parse1()
Definition Config.cpp:373
static char ** argv
Definition Config.h:107
static CLI::Option * logLevelOpt
Definition Config.h:120
static std::map< std::string, CLI::Option * > applicationOptions
Definition Config.h:125
static int getVerboseLevel()
Definition Config.cpp:947
static bool parse2()
Definition Config.cpp:532
static std::string configDirectory
Definition Config.h:111
static std::shared_ptr< CLI::App > app
Definition Config.h:103
static CLI::Option * groupNameOpt
Definition Config.h:118
static CLI::Option * verboseLevelOpt
Definition Config.h:121
static CLI::Option * quietOpt
Definition Config.h:122
static bool init(int argc, char *argv[])
Definition Config.cpp:106
static int argc
Definition Config.h:106
static std::string pidDirectory
Definition Config.h:113
static std::shared_ptr< CLI::Formatter > sectionFormatter
Definition Config.h:104
static std::map< std::string, std::string > aliases
Definition Config.h:124
static void required(CLI::App *instance, bool reqired=true)
Definition Config.cpp:804
static CLI::Option * logFileOpt
Definition Config.h:116
static CLI::Option * enforceLogFileOpt
Definition Config.h:119
static bool bootstrap()
Definition Config.cpp:343
static int getLogLevel()
Definition Config.cpp:943
static std::string applicationName
Definition Config.h:109
static std::string logDirectory
Definition Config.h:112
static void terminate()
Definition Config.cpp:614
static CLI::Option * userNameOpt
Definition Config.h:117
static CLI::Option * daemonizeOpt
Definition Config.h:115
#define STR(a)
Definition clients.h:26
Definition Config.h:37
static const std::shared_ptr< CLI::App > makeApp()
Definition Config.cpp:71
static std::string createCommandLineTemplate(CLI::App *app, CLI::CallForCommandline::Mode mode)
Definition Config.cpp:512
static const std::shared_ptr< CLI::HelpFormatter > makeSectionFormatter()
Definition Config.cpp:633
static void createCommandLineTemplate(std::stringstream &out, CLI::App *app, CLI::CallForCommandline::Mode mode)
Definition Config.cpp:497
static void createCommandLineOptions(std::stringstream &out, CLI::App *app, CLI::CallForCommandline::Mode mode)
Definition Config.cpp:409
static std::string createCommandLineOptions(CLI::App *app, CLI::CallForCommandline::Mode mode)
Definition Config.cpp:467
static std::string createCommandLineSubcommands(CLI::App *app, CLI::CallForCommandline::Mode mode)
Definition Config.cpp:482