storage::SystemCmd Class Reference

#include <SystemCmd.h>

List of all members.

Public Types

enum  OutputStream { IDX_STDOUT, IDX_STDERR }

Public Member Functions

 SystemCmd (const char *Command_Cv)
 SystemCmd (const string &Command_Cv)
 SystemCmd ()
virtual ~SystemCmd ()
int execute (const string &Command_Cv)
int executeBackground (const string &Command_Cv)
int executeRestricted (const string &Command_Cv, unsigned long MaxTimeSec, unsigned long MaxLineOut, bool &ExceedTime, bool &ExceedLines)
void setOutputHandler (void(*Handle_f)(void *, string, bool), void *Par_p)
void logOutput ()
void setOutputProcessor (OutputProcessor *proc)
int select (string Reg_Cv, bool Invert_bv=false, unsigned Idx_ii=IDX_STDOUT)
const string & stderr () const
const string & stdout () const
const string & cmd () const
const string * getString (unsigned Idx_ii=IDX_STDOUT) const
const string * getLine (unsigned Num_iv, bool Selected_bv=false, unsigned Idx_ii=IDX_STDOUT) const
unsigned numLines (bool Selected_bv=false, unsigned Idx_ii=IDX_STDOUT) const
void setCombine (const bool Combine_b=true)
int retcode () const
int getStdout (std::vector< string > &Ret_Cr, const bool Append_bv=false) const
int getStderr (std::vector< string > &Ret_Cr, const bool Append_bv=false) const
int getStdout (std::list< string > &Ret_Cr, const bool Append_bv=false) const
int getStderr (std::list< string > &Ret_Cr, const bool Append_bv=false) const

Protected Member Functions

int placeOutput (unsigned Which_iv, std::vector< string > &Ret_Cr, const bool Append_bv) const
int placeOutput (unsigned Which_iv, std::list< string > &Ret_Cr, const bool Append_bv) const
void invalidate ()
void closeOpenFds ()
int doExecute (string Cmd_Cv)
bool doWait (bool Hang_bv, int &Ret_ir)
void checkOutput ()
void getUntilEOF (FILE *File_Cr, std::vector< string > &Lines_Cr, bool &NewLineSeen_br, bool Stderr_bv)
void extractNewline (const char *Buf_ti, int Cnt_ii, bool &NewLineSeen_br, string &Text_Cr, std::vector< string > &Lines_Cr)
void addLine (string Text_Cv, std::vector< string > &Lines_Cr)
void init ()

Protected Attributes

string Text_aC [2]
bool Valid_ab [2]
FILE * File_aC [2]
std::vector< string > Lines_aC [2]
std::vector< string * > SelLines_aC [2]
bool NewLineSeen_ab [2]
bool Combine_b
bool Background_b
string lastCmd
int Ret_i
int Pid_i
void(* OutputHandler_f )(void *, string, bool)
void * HandlerPar_p
OutputProcessoroutput_proc
struct pollfd pfds [2]

Static Protected Attributes

static int Nr_i = 0


Member Enumeration Documentation

Enumerator:
IDX_STDOUT 
IDX_STDERR 


Constructor & Destructor Documentation

SystemCmd::SystemCmd ( const char *  Command_Cv  ) 

References execute(), init(), Nr_i, and y2milestone.

SystemCmd::SystemCmd ( const string &  Command_Cv  ) 

References execute(), init(), Nr_i, and y2milestone.

SystemCmd::SystemCmd (  ) 

References init(), Nr_i, and y2milestone.

SystemCmd::~SystemCmd (  )  [virtual]

References File_aC, IDX_STDERR, and IDX_STDOUT.


Member Function Documentation

int SystemCmd::execute ( const string &  Command_Cv  ) 

int SystemCmd::executeBackground ( const string &  Command_Cv  ) 

int storage::SystemCmd::executeRestricted ( const string &  Command_Cv,
unsigned long  MaxTimeSec,
unsigned long  MaxLineOut,
bool &  ExceedTime,
bool &  ExceedLines 
)

void SystemCmd::setOutputHandler ( void(*)(void *, string, bool)  Handle_f,
void *  Par_p 
)

References HandlerPar_p, and OutputHandler_f.

void SystemCmd::logOutput (  ) 

References getLine(), IDX_STDERR, numLines(), and y2milestone.

Referenced by doExecute().

void storage::SystemCmd::setOutputProcessor ( OutputProcessor proc  )  [inline]

int SystemCmd::select ( string  Reg_Cv,
bool  Invert_bv = false,
unsigned  Idx_ii = IDX_STDOUT 
)

const string& storage::SystemCmd::stderr (  )  const [inline]

References getString(), and IDX_STDERR.

Referenced by storage::Container::setExtError().

const string& storage::SystemCmd::stdout (  )  const [inline]

const string& storage::SystemCmd::cmd (  )  const [inline]

References lastCmd.

Referenced by storage::Container::setExtError().

const string * SystemCmd::getString ( unsigned  Idx_ii = IDX_STDOUT  )  const

const string * SystemCmd::getLine ( unsigned  Num_iv,
bool  Selected_bv = false,
unsigned  Idx_ii = IDX_STDOUT 
) const

unsigned SystemCmd::numLines ( bool  Selected_bv = false,
unsigned  Idx_ii = IDX_STDOUT 
) const

void SystemCmd::setCombine ( const bool  Combine_b = true  ) 

References Combine_b.

Referenced by storage::Volume::resizeFs().

int storage::SystemCmd::retcode (  )  const [inline]

int storage::SystemCmd::getStdout ( std::vector< string > &  Ret_Cr,
const bool  Append_bv = false 
) const [inline]

References IDX_STDOUT, and placeOutput().

int storage::SystemCmd::getStderr ( std::vector< string > &  Ret_Cr,
const bool  Append_bv = false 
) const [inline]

References IDX_STDERR, and placeOutput().

int storage::SystemCmd::getStdout ( std::list< string > &  Ret_Cr,
const bool  Append_bv = false 
) const [inline]

References IDX_STDOUT, and placeOutput().

int storage::SystemCmd::getStderr ( std::list< string > &  Ret_Cr,
const bool  Append_bv = false 
) const [inline]

References IDX_STDERR, and placeOutput().

int storage::SystemCmd::placeOutput ( unsigned  Which_iv,
std::vector< string > &  Ret_Cr,
const bool  Append_bv 
) const [protected]

Referenced by getStderr(), and getStdout().

int storage::SystemCmd::placeOutput ( unsigned  Which_iv,
std::list< string > &  Ret_Cr,
const bool  Append_bv 
) const [protected]

void SystemCmd::invalidate (  )  [protected]

References Lines_aC, NewLineSeen_ab, SelLines_aC, and Valid_ab.

Referenced by doExecute().

void SystemCmd::closeOpenFds (  )  [protected]

Referenced by doExecute().

int SystemCmd::doExecute ( string  Cmd_Cv  )  [protected]

bool SystemCmd::doWait ( bool  Hang_bv,
int &  Ret_ir 
) [protected]

void SystemCmd::checkOutput (  )  [protected]

void storage::SystemCmd::getUntilEOF ( FILE *  File_Cr,
std::vector< string > &  Lines_Cr,
bool &  NewLineSeen_br,
bool  Stderr_bv 
) [protected]

Referenced by checkOutput().

void storage::SystemCmd::extractNewline ( const char *  Buf_ti,
int  Cnt_ii,
bool &  NewLineSeen_br,
string &  Text_Cr,
std::vector< string > &  Lines_Cr 
) [protected]

void storage::SystemCmd::addLine ( string  Text_Cv,
std::vector< string > &  Lines_Cr 
) [protected]

void SystemCmd::init (  )  [protected]


Member Data Documentation

string storage::SystemCmd::Text_aC[2] [mutable, protected]

Referenced by getString().

bool storage::SystemCmd::Valid_ab[2] [mutable, protected]

Referenced by getString(), and invalidate().

FILE* storage::SystemCmd::File_aC[2] [protected]

std::vector<string> storage::SystemCmd::Lines_aC[2] [protected]

std::vector<string*> storage::SystemCmd::SelLines_aC[2] [protected]

Referenced by getLine(), invalidate(), numLines(), and select().

Referenced by checkOutput(), and invalidate().

Referenced by doExecute(), doWait(), init(), and setCombine().

string storage::SystemCmd::lastCmd [protected]

Referenced by cmd(), and doExecute().

int storage::SystemCmd::Ret_i [protected]

Referenced by doExecute(), and retcode().

int storage::SystemCmd::Pid_i [protected]

Referenced by doExecute(), doWait(), and select().

void(* storage::SystemCmd::OutputHandler_f)(void *, string, bool) [protected]

Referenced by init(), and setOutputHandler().

Referenced by init(), and setOutputHandler().

struct pollfd storage::SystemCmd::pfds[2] [read, protected]

Referenced by doExecute(), doWait(), and init().

int SystemCmd::Nr_i = 0 [static, protected]

Referenced by SystemCmd().


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

Generated on Sun Jun 8 10:48:06 2008 for yast2-storage by  doxygen 1.5.5