Zappy Server
C++ game server: world, rules, scheduler, network
Loading...
Searching...
No Matches
Args Class Reference

#include <Args.hpp>

+ Collaboration diagram for Args:

Public Member Functions

 Args (int argc, char **argv)
 
bool isValid () const
 Checks if the parsed arguments are valid and if the application should run.
 
bool isHelpRequested () const
 Checks if the help flag was provided in the arguments.
 
int exitCode () const
 Gets the exit code for the application.
 
ServerConfig getConfig () const
 Gets the configuration for the server application.
 

Private Types

enum class  ParseResult { Success , HelpRequested , Error }
 

Private Attributes

ServerConfig config = {-1, -1, -1, {}, 10, 100, 0}
 
ParseResult result = ParseResult::Error
 

Static Private Attributes

static constexpr int SUCCESS = 0
 
static constexpr int ERROR = 84
 

Detailed Description

Definition at line 43 of file Args.hpp.

Member Enumeration Documentation

◆ ParseResult

enum class Args::ParseResult
strongprivate
Enumerator
Success 
HelpRequested 
Error 

Definition at line 72 of file Args.hpp.

Constructor & Destructor Documentation

◆ Args()

Member Function Documentation

◆ exitCode()

int Args::exitCode ( ) const

Gets the exit code for the application.

Returns
The exit code.

Definition at line 93 of file Args.cpp.

References Error, ERROR, result, and SUCCESS.

Referenced by main().

+ Here is the caller graph for this function:

◆ getConfig()

ServerConfig Args::getConfig ( ) const

Gets the configuration for the server application.

Returns
The configuration.

Definition at line 91 of file Args.cpp.

References config.

Referenced by main().

+ Here is the caller graph for this function:

◆ isHelpRequested()

bool Args::isHelpRequested ( ) const

Checks if the help flag was provided in the arguments.

Returns
true if the help flag was provided, false otherwise.

Definition at line 90 of file Args.cpp.

References HelpRequested, and result.

Referenced by main().

+ Here is the caller graph for this function:

◆ isValid()

bool Args::isValid ( ) const

Checks if the parsed arguments are valid and if the application should run.

Returns
true if the arguments are valid and the application should run, false otherwise.

Definition at line 89 of file Args.cpp.

References result, and Success.

Referenced by main().

+ Here is the caller graph for this function:

Member Data Documentation

◆ config

ServerConfig Args::config = {-1, -1, -1, {}, 10, 100, 0}
private

Definition at line 77 of file Args.hpp.

Referenced by Args(), and getConfig().

◆ ERROR

constexpr int Args::ERROR = 84
staticconstexprprivate

Definition at line 75 of file Args.hpp.

Referenced by exitCode().

◆ result

ParseResult Args::result = ParseResult::Error
private

Definition at line 78 of file Args.hpp.

Referenced by Args(), exitCode(), isHelpRequested(), and isValid().

◆ SUCCESS

constexpr int Args::SUCCESS = 0
staticconstexprprivate

Definition at line 74 of file Args.hpp.

Referenced by exitCode().


The documentation for this class was generated from the following files: