A class to represent the application. More...
#include <application.hpp>
Public Member Functions | |
application (int &argc, char **&argv) | |
Constructor. | |
virtual | ~application () |
Destructor. | |
virtual int | run ()=0 |
Protected Attributes | |
arguments_table | m_arguments |
The arguments passed by the system. |
A class to represent the application.
The claw::application understand the following command line arguments :
Definition at line 60 of file application.hpp.
claw::application::application | ( | int & | argc, | |
char **& | argv | |||
) |
Constructor.
argc | Number of arguments to the program. | |
argv | The arguments of the program. |
The constructor removes from argv all supported arguments, and updates the value of argc.
Definition at line 42 of file application.cpp.
References claw::arguments_table::add_long(), claw::arguments_table::get_integer(), claw::arguments_table::get_string(), claw::arguments_table::has_value(), claw::log_error, claw::log_verbose, claw::log_warning, claw::logger, m_arguments, claw::arguments_table::parse(), claw::log_system::set(), and claw::log_system::set_level().
: m_arguments( argc, argv ) { m_arguments.add_long("--log-file", "The file to use to store log informations.", true, "file" ); m_arguments.add_long("--log-level", "Level of log informations:\n" "\t\terror: error messages,\n" "\t\twarning: warning and error messages,\n" "\t\tverbose: all messages.", true, "string" ); m_arguments.parse( argc, argv ); if ( m_arguments.has_value("--log-file") ) { std::string log_file = m_arguments.get_string("--log-file"); logger.set( new file_logger(log_file) ); } else logger.set( new console_logger() ); if ( m_arguments.has_value( "--log-level" ) ) { std::string level = m_arguments.get_string("--log-level"); if (level == "error") logger.set_level( log_error ); else if (level == "warning") logger.set_level( log_warning ); else if (level == "verbose") logger.set_level( log_verbose ); else logger.set_level( m_arguments.get_integer("--log-level") ); } } // application::application()
claw::application::~application | ( | ) | [virtual] |
Destructor.
Definition at line 83 of file application.cpp.
References claw::log_system::clear(), and claw::logger.
{ logger.clear(); } // application::~application()
virtual int claw::application::run | ( | ) | [pure virtual] |
arguments_table claw::application::m_arguments [protected] |
The arguments passed by the system.
Definition at line 70 of file application.hpp.
Referenced by application().