schroot_base::main Class Reference

Frontend base for schroot programs. More...

#include <schroot-base-main.h>

Inheritance diagram for schroot_base::main:

Inheritance graph
[legend]
Collaboration diagram for schroot_base::main:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 main (std::string const &program_name, std::string const &program_usage, options::ptr const &program_options, bool use_syslog)
 The constructor.
virtual ~main ()
 The destructor.
int run (int argc, char *argv[])
 Run the program.
virtual void action_help (std::ostream &stream)
 Print help information.
virtual void action_version (std::ostream &stream)
 Print version information.

Protected Member Functions

virtual int run_impl ()=0
 Run the program.

Protected Attributes

std::string program_name
 The name of the program.
std::string program_usage
 The usage text of the program.
options::ptr program_options
 The program options.
bool use_syslog
 Use syslog for message logging>.

Detailed Description

Frontend base for schroot programs.

This class is used to "run" schroot programs. It contains functionality common to all programs, such as help and version output.

Definition at line 35 of file schroot-base-main.h.


Constructor & Destructor Documentation

main::main ( std::string const &  program_name,
std::string const &  program_usage,
options::ptr const &  program_options,
bool  use_syslog 
)

The constructor.

Parameters:
program_name the program name.
program_usage the program usage message.
program_options the command-line options to use.
use_syslog whether to open a connection to the system logger.

Definition at line 41 of file schroot-base-main.cc.

main::~main (  )  [virtual]

The destructor.

Reimplemented in schroot::main, schroot_listmounts::main, schroot_releaselock::main, dchroot::main, dchroot_dsa::main, and csbuild::main.

Definition at line 52 of file schroot-base-main.cc.


Member Function Documentation

int main::run ( int  argc,
char *  argv[] 
)

Run the program.

Parameters:
argc the number of arguments
argv argument vector
Returns:
0 on success, 1 on failure or the exit status of the chroot command.

Definition at line 86 of file schroot-base-main.cc.

References sbuild::DEBUG_CRITICAL, sbuild::debug_level, sbuild::log_exception_error(), sbuild::log_info(), program_options, and run_impl().

void main::action_help ( std::ostream &  stream  )  [virtual]

Print help information.

Parameters:
stream the stream to output to.

Definition at line 75 of file schroot-base-main.cc.

References program_name, program_options, and program_usage.

Referenced by schroot::main_base::run_impl(), schroot_releaselock::main::run_impl(), schroot_listmounts::main::run_impl(), and csbuild::main::run_impl().

Here is the caller graph for this function:

void main::action_version ( std::ostream &  stream  )  [virtual]

Print version information.

Parameters:
stream the stream to output to.

Definition at line 57 of file schroot-base-main.cc.

References program_name.

Referenced by schroot::main_base::run_impl(), schroot_releaselock::main::run_impl(), schroot_listmounts::main::run_impl(), and csbuild::main::run_impl().

Here is the caller graph for this function:

virtual int schroot_base::main::run_impl (  )  [protected, pure virtual]

Run the program.

This is the program-specific run method which must be implemented in a derived class.

Returns:
0 on success, 1 on failure or the exit status of the chroot command.

Implemented in schroot::main_base, schroot_listmounts::main, schroot_releaselock::main, and csbuild::main.

Referenced by run().

Here is the caller graph for this function:


Member Data Documentation

std::string schroot_base::main::program_name [protected]

The name of the program.

Definition at line 95 of file schroot-base-main.h.

Referenced by schroot::main::action_config(), dchroot::main_base::action_config(), action_help(), action_version(), dchroot::main_base::check_dchroot_conf(), and dchroot::main_base::compat_check().

std::string schroot_base::main::program_usage [protected]

The usage text of the program.

Definition at line 97 of file schroot-base-main.h.

Referenced by action_help().

options::ptr schroot_base::main::program_options [protected]

The program options.

Definition at line 99 of file schroot-base-main.h.

Referenced by action_help(), and run().

bool schroot_base::main::use_syslog [protected]

Use syslog for message logging>.

Definition at line 101 of file schroot-base-main.h.


The documentation for this class was generated from the following files:
Generated on Sun Jul 8 21:24:30 2007 for schroot by  doxygen 1.5.2