cae
0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1
#include "
CAE/Application.hpp
"
2
3
#include "
Utils/Logger.hpp
"
4
5
int
main
(
const
int
argc,
const
char
*
const
*argv,
const
char
*
const
*envp)
6
{
7
std::unique_ptr<cae::Application> app =
nullptr
;
8
9
utl::Logger::init
();
10
try
11
{
12
cae::ArgsConfig
argsConfig =
cae::ArgsHandler::ParseArgs
(argc, argv);
13
cae::EnvConfig
envConfig =
cae::ArgsHandler::ParseEnv
(envp);
14
if
(!argsConfig.
run
)
15
{
16
return
EXIT_SUCCESS;
17
}
18
app = std::make_unique<cae::Application>(argsConfig, envConfig);
19
app->start();
20
app->stop();
21
}
22
catch
(
const
std::exception &e)
23
{
24
utl::Logger::log
(std::string(
"Exception: "
) + e.what() +
'\n'
,
utl::LogLevel::WARNING
);
25
return
EXIT_FAILURE;
26
}
27
catch
(...)
28
{
29
utl::Logger::log
(std::string(
"Unknown exception"
),
utl::LogLevel::WARNING
);
30
return
EXIT_FAILURE;
31
}
32
return
EXIT_SUCCESS;
33
}
Application.hpp
This file contains the Application class declaration.
Logger.hpp
This file contains the Logger class.
cae::ArgsHandler::ParseArgs
static ArgsConfig ParseArgs(int argc, const char *const *argv)
Parse command line arguments.
Definition
argsHandler.cpp:8
cae::ArgsHandler::ParseEnv
static EnvConfig ParseEnv(const char *const *envp)
Parse environment variables.
Definition
argsHandler.cpp:52
utl::Logger::init
static void init()
Initialize the logger.
Definition
logger.cpp:7
utl::Logger::log
static void log(const std::string &message, const LogLevel &logLevel)
Log a message with a specific log level.
Definition
Logger.hpp:71
main
int main(const int argc, const char *const *argv, const char *const *envp)
Definition
main.cpp:5
utl::LogLevel::WARNING
@ WARNING
cae::ArgsConfig
Struct for command line arguments configuration.
Definition
ArgsHandler.hpp:20
cae::ArgsConfig::run
bool run
Definition
ArgsHandler.hpp:21
cae::EnvConfig
Struct for environment variables configuration.
Definition
ArgsHandler.hpp:31
src
main.cpp
Generated by
1.11.0