Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
Args.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
6
11struct AppConfig {
12 int port;
13 std::string machine;
15 bool dev = false;
17};
18
24class Args {
25 public:
26 Args(int argc, char** argv);
27
32 bool isValid() const;
33
38 bool isHelpRequested() const;
39
44 int exitCode() const;
45
50 AppConfig getConfig() const;
51
52 private:
53 enum class ParseResult { Success, HelpRequested, Error };
54
55 int SUCCESS = 0;
56 int ERROR = 84;
57
58 AppConfig config = {-1, "localhost", false};
59 ParseResult result = ParseResult::Error;
60
61 void parseArgs(int argc, char** argv);
62 void setError(const std::string& message, const std::string& progName);
63 static void printUsage(const std::string& progName);
64};
int exitCode() const
Definition Args.cpp:11
static constexpr int SUCCESS
ServerConfig config
ParseResult result
Definition Args.hpp:59
ServerConfig getConfig() const
Definition Args.cpp:19
static constexpr int ERROR
bool isHelpRequested() const
Definition Args.cpp:9
bool isValid() const
Definition Args.cpp:7
Language
Definition I18n.hpp:16
Represents the configuration for the application, including the port, machine, and headless mode.
Definition Args.hpp:11
bool headless
Definition Args.hpp:14
bool dev
Definition Args.hpp:15
I18n::Language language
Definition Args.hpp:16
int port
Definition Args.hpp:12
std::string machine
Definition Args.hpp:13