schroot::main_base Class Reference

Frontend base for schroot programs. More...

#include <schroot-main-base.h>

Inheritance diagram for schroot::main_base:

Inheritance graph
[legend]
Collaboration diagram for schroot::main_base:

Collaboration graph
[legend]
List of all members.

Public Types

typedef sbuild::custom_error<
error_code
error
 Exception type.
 CHROOTS_NOTFOUND
 Chroots not found.
 CHROOT_FILE
 No chroots are defined in ....
 CHROOT_FILE2
 No chroots are defined in ... or ....
 CHROOT_NOTDEFINED
 The specified chroots are not defined.
 CHROOT_NOTFOUND
 Chroot not found.
enum  error_code {
  CHROOTS_NOTFOUND, CHROOT_FILE, CHROOT_FILE2, CHROOT_NOTDEFINED,
  CHROOT_NOTFOUND
}
 Error codes. More...

Public Member Functions

 main_base (std::string const &program_name, std::string const &program_usage, options_base::ptr &options)
 The constructor.
virtual ~main_base ()
 The destructor.
virtual void action_list ()=0
 List chroots.
virtual void action_info ()
 Print detailed information about chroots.
virtual void action_location ()
 Print location of chroots.
virtual void action_config ()=0
 Dump configuration file for chroots.

Protected Member Functions

virtual int run_impl ()
 Run the program.
virtual sbuild::string_list get_chroot_options ()
 Get a list of chroots based on the specified options (--all, --chroot).
virtual void compat_check ()
 Check compatibility.
virtual void load_config ()
 Load configuration.
virtual void create_session (sbuild::session::operation sess_op)=0
 Create a session.

Protected Attributes

options_base::ptr options
 The program options.
sbuild::chroot_config::ptr config
 The chroot configuration.
sbuild::string_list chroots
 The chroots to use.
sbuild::session::ptr session
 The session.

Detailed Description

Frontend base for schroot programs.

This class is used to "run" schroot programs. This class contains functionality common to all schroot programs (schroot, dchroot, dchroot-dsa).


Member Typedef Documentation

typedef sbuild::custom_error<error_code> schroot::main_base::error

Exception type.


Member Enumeration Documentation

enum schroot::main_base::error_code

Error codes.

Enumerator:
CHROOTS_NOTFOUND  Chroots not found.
CHROOT_FILE  No chroots are defined in ....
CHROOT_FILE2  No chroots are defined in ... or ....
CHROOT_NOTDEFINED  The specified chroots are not defined.
CHROOT_NOTFOUND  Chroot not found.


Constructor & Destructor Documentation

main_base::main_base ( std::string const &  program_name,
std::string const &  program_usage,
options_base::ptr options 
)

The constructor.

Parameters:
program_name the program name.
program_usage the program usage message.
options the command-line options to use.

Reimplemented in dchroot::main_base.

main_base::~main_base (  )  [virtual]

The destructor.

Reimplemented in dchroot::main_base.


Member Function Documentation

virtual void schroot::main_base::action_config (  )  [pure virtual]

Dump configuration file for chroots.

Implemented in schroot::main, and dchroot::main_base.

void main_base::action_info (  )  [virtual]

Print detailed information about chroots.

virtual void schroot::main_base::action_list (  )  [pure virtual]

List chroots.

Implemented in schroot::main, and dchroot::main_base.

void main_base::action_location (  )  [virtual]

Print location of chroots.

Reimplemented in dchroot::main.

void main_base::compat_check (  )  [protected, virtual]

Check compatibility.

Does nothing, but derived classes may use it as they see fit.

Reimplemented in dchroot::main_base.

virtual void schroot::main_base::create_session ( sbuild::session::operation  sess_op  )  [protected, pure virtual]

Create a session.

This sets the session member.

Parameters:
sess_op the session operation to perform.

Implemented in schroot::main, dchroot::main, and dchroot_dsa::main.

sbuild::string_list main_base::get_chroot_options (  )  [protected, virtual]

Get a list of chroots based on the specified options (--all, --chroot).

Returns:
a list of chroots.

void main_base::load_config (  )  [protected, virtual]

Load configuration.

Reimplemented in dchroot::main, and dchroot_dsa::main.

int main_base::run_impl (  )  [protected, 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.

Implements schroot_base::main.


Member Data Documentation

sbuild::string_list schroot::main_base::chroots [protected]

The chroots to use.

sbuild::chroot_config::ptr schroot::main_base::config [protected]

The chroot configuration.

options_base::ptr schroot::main_base::options [protected]

The program options.

sbuild::session::ptr schroot::main_base::session [protected]

The session.


The documentation for this class was generated from the following files:
Generated on Mon Sep 11 23:20:08 2006 for schroot by  doxygen 1.4.7