claw::application Class Reference

#include <application.hpp>

List of all members.


Detailed Description

A class to represent the application.

The claw::application understand the following command line arguments :

Author:
Julien Jorge

Definition at line 60 of file 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.

Constructor & Destructor Documentation

claw::application::application ( int &  argc,
char **&  argv 
)

Constructor.

Parameters:
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::log_system::set(), and claw::log_system::set_level().

00043   : m_arguments( argc, argv )
00044 {
00045   m_arguments.add_long("--log-file",
00046                        "The file to use to store log informations.", true,
00047                        "file" );
00048   m_arguments.add_long("--log-level",
00049                        "Level of log informations:\n"
00050            "\t\terror: error messages,\n"
00051                        "\t\twarning: warning and error messages,\n"
00052                        "\t\tverbose: all messages.", true, "string" );
00053   
00054   if ( m_arguments.has_value("--log-file") )
00055     {
00056       std::string log_file = m_arguments.get_string("--log-file");
00057       logger.set( new file_logger(log_file) );
00058     }
00059   else
00060     logger.set( new console_logger() );
00061 
00062   if ( m_arguments.has_value( "--log-level" ) )
00063     {
00064       std::string level = m_arguments.get_string("--log-level");
00065 
00066       if (level == "error")
00067   logger.set_level( log_error );
00068       else if (level == "warning")
00069   logger.set_level( log_warning );
00070       else if (level == "verbose")
00071   logger.set_level( log_verbose );
00072       else
00073   logger.set_level( m_arguments.get_integer("--log-level") );
00074     }
00075 
00076 } // application::application()

claw::application::~application (  )  [virtual]

Destructor.

Definition at line 82 of file application.cpp.

References claw::log_system::clear(), and claw::logger.

00083 {
00084   logger.clear();
00085 } // application::~application()


Member Function Documentation

virtual int claw::application::run (  )  [pure virtual]


Member Data Documentation

The arguments passed by the system.

Definition at line 70 of file application.hpp.

Referenced by application().


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

Generated on Thu Jun 26 09:35:05 2008 for CLAW Library (a C++ Library Absolutely Wonderful) by  doxygen 1.5.6