#include <application_shell.h>
Inheritance diagram for application_shell:


Public Types | |
| enum | limits { LOG_FILE_SIZE = 1244688 } |
Public Member Functions | |
| application_shell (const istring &filename_root, int max_log=LOG_FILE_SIZE, ini_configurator::file_location_default where=ini_configurator::ALL_USERS_DIRECTORY) | |
| constructs an application_shell object given the program name. | |
| virtual | ~application_shell () |
| virtual int | execute ()=0 |
| forwards application_base responsibility upwards to derived objects. | |
| chaos & | randomizer () const |
| provides access to the random number generator owned by this app. | |
| istring | filename_root () const |
| returns the name of this object. | |
| ini_configurator & | ini () const |
| allows access to the ini_configurator object. | |
| istring | ini_name () const |
| returns the filename of the INI file. | |
| istring | log_name () const |
| returns the filename of the log file. | |
| virtual outcome | log (const istring &to_print) |
| logs a debugging line "to_print" with a time-stamp in front. | |
| virtual outcome | log (const istring &to_print, int filter) |
| as above, logs a line "to_print" but only if the "filter" is enabled. | |
| log_base & | logger () const |
| provides access to the combo_logger object that is used for debugging. | |
| log_base * | swap_logger (log_base *new_logger) |
| replaces the default log_base object with "new_logger". | |
Friends | |
| application_shell & | operator<< (application_shell &out, const istring &to_print) |
| mimics the iostream operation, but is a synonym for log(). | |
It is generally used in that context (console mode), but can be employed as the root of windowed programs also. The application_shell provides a few features, such as logging functionality and INI file editing, that make it a bit easier than starting up a program from scratch every time.
Definition at line 31 of file application_shell.h.
| application_shell::application_shell | ( | const istring & | filename_root, | |
| int | max_log = LOG_FILE_SIZE, |
|||
| ini_configurator::file_location_default | where = ini_configurator::ALL_USERS_DIRECTORY | |||
| ) |
constructs an application_shell object given the program name.
"filename_root" is used as the base part of the logging filename. the "max_log" parameter specifies how large the output log is allowed to grow; if it's zero, then no log will be created. the "where" parameter specifies where the main ini file for the app will reside.
Definition at line 27 of file application_shell.cpp.
| application_shell::~application_shell | ( | ) | [virtual] |
| virtual int application_shell::execute | ( | ) | [pure virtual] |
forwards application_base responsibility upwards to derived objects.
Implements application_base.
Implemented in version_stamper, write_build_config, tiny_shell, wx_tiny_shell, t_wxext_frame, and test_nt_security.
| chaos& application_shell::randomizer | ( | ) | const [inline] |
provides access to the random number generator owned by this app.
Definition at line 52 of file application_shell.h.
| istring application_shell::filename_root | ( | ) | const |
returns the name of this object.
the name is passed to the constructor and cannot be changed during execution of the application_shell. the name should not contain any characters that are invalid for filenames, because it is also used for the base-name of the log file.
Definition at line 45 of file application_shell.cpp.
Referenced by tiny_shell::Create(), ini_name(), log_name(), tiny_shell::OnClose(), and tiny_shell::OnCreate().
| ini_configurator & application_shell::ini | ( | ) | const |
allows access to the ini_configurator object.
Definition at line 47 of file application_shell.cpp.
Referenced by tiny_shell::Create(), write_build_config::execute(), and tiny_shell::OnClose().
| istring application_shell::ini_name | ( | ) | const |
returns the filename of the INI file.
Definition at line 49 of file application_shell.cpp.
References filename_root(), and INI_NAME.
| istring application_shell::log_name | ( | ) | const |
returns the filename of the log file.
Definition at line 55 of file application_shell.cpp.
References filename_root().
logs a debugging line "to_print" with a time-stamp in front.
this mirrors its output to the console when it logs to the log file (depending on whether the program-wide logger has been swapped out to change that behavior).
why why why? not a good idea to automatically add this. if (temp_log.length()) temp_log.insert(0, utility::timestamp(true, true));
Reimplemented in tiny_shell, and wx_tiny_shell.
Definition at line 58 of file application_shell.cpp.
References log_base::log(), and program_wide_logger().
Referenced by version_stamper::execute().
as above, logs a line "to_print" but only if the "filter" is enabled.
the second version uses the filter value to assess whether to print the string or not. the string will not print if that filter is not enabled for the program wide logger.
Definition at line 77 of file application_shell.cpp.
References istring::insert(), istring::length(), log_base::log(), common::OKAY, program_wide_logger(), and utility::timestamp().
| log_base & application_shell::logger | ( | ) | const |
provides access to the combo_logger object that is used for debugging.
this allows the user to manipulate filter values and so forth. note that if you print directly to the logger, then you will not see this information on the console.
Definition at line 71 of file application_shell.cpp.
References program_wide_logger().
replaces the default log_base object with "new_logger".
this allows a derived application_shell to use a different type of logging. this also retasks the program wide logger to use the "new_logger". the returned log_base object is the previously hooked up logger and it must be dealt with appropriately.
Definition at line 73 of file application_shell.cpp.
References retask_program_wide_logger().
| application_shell& operator<< | ( | application_shell & | out, | |
| const istring & | to_print | |||
| ) | [friend] |
mimics the iostream operation, but is a synonym for log().
Definition at line 67 of file application_shell.cpp.
1.5.1