![]() |
R-Type
2
Doom but in better
|
Entry point for processing command-line arguments and running the main application logic. More...
#include "RealMain.hpp"
Go to the source code of this file.
Functions | |
std::vector< std::string > | extract_argument (char *arg) |
Extracts the flag and value from a command-line argument. | |
void | process_given_argument (Main &main, const std::vector< std::string > &args, std::string const &binName) |
Process the single argument that is provided. | |
void | process_arguments (Main &main, int argc, char **argv) |
Processes the command-line arguments and applies them to the main application object. | |
int | RealMain (int argc, char **argv) |
The main function for initializing and running the application. | |
Entry point for processing command-line arguments and running the main application logic.
Definition in file RealMain.cpp.
std::vector< std::string > extract_argument | ( | char * | arg | ) |
Extracts the flag and value from a command-line argument.
This function parses a command-line argument to split it into a flag and value. For example, if the argument is --key=value
, it will return a tuple ("key", "value")
. If there is no =
sign, it returns the flag with an empty value.
arg | The command-line argument as a C-style string. |
Definition at line 26 of file RealMain.cpp.
void process_arguments | ( | Main & | main, |
int | argc, | ||
char ** | argv ) |
Processes the command-line arguments and applies them to the main application object.
This function iterates through the provided command-line arguments, parses them using extract_argument
, and applies relevant changes to the application state.
main | A reference to the main application object. |
argc | The number of command-line arguments. |
argv | The array of command-line arguments as C-style strings. |
Definition at line 251 of file RealMain.cpp.
void process_given_argument | ( | Main & | main, |
const std::vector< std::string > & | args, | ||
std::string const & | binName ) |
Process the single argument that is provided.
main | The main class, initialised. |
args | The current argument |
binName | The name of the program binary. |
CustomExceptions::HelpFound(); | This is an information that allows the program to know that the help flag was passed. |
CustomExceptions::VersionFound(); | This is an information that allows the program to know that the version flag was passed. |
CustomExceptions::InvalidPort(args[1]); | This is an error informing the user that the port value they passed is invalid. |
CustomExceptions::NoFlagParameter(args[0]); | This is an error informing the user that a parameter was expected for the flag but was not found. |
CustomExceptions::UnknownArgument(args[0]); | This is an error informing the user that the flag they passed is unknown. |
CustomExceptions::InvalidFrameLimit(args[1]); | This is an error informing the user that the frame limit that was passed is invalid. |
CustomExceptions::InvalidWindowWidth(args[1]); | This is an error informing the user that the value for the window's width is invalid. |
CustomExceptions::InvalidWindowHeight(args[1]); | This is an error informing the user the the value for the window's height is invalid. |
Definition at line 73 of file RealMain.cpp.
int RealMain | ( | int | argc, |
char ** | argv ) |
The main function for initializing and running the application.
This function serves as the entry point for the R-Type GUI application. It initializes the main application object, processes command-line arguments, and starts the application's execution loop. Exceptions are caught and logged, and an error code is returned if any issues occur.
argc | The number of command-line arguments. |
argv | The array of command-line arguments as C-style strings. |
Definition at line 277 of file RealMain.cpp.