Spm::Util::Command Class Reference

Launch command and get their output. More...

#include <command.h>

List of all members.

Public Member Functions

 Command (const miniXml::ustring &cmd)
 Command ()
void setCommand (const miniXml::ustring &cmd)
void add (const miniXml::ustring &arg)
 add an argument to the command line
void add (const miniXml::ustring &var, const miniXml::ustring &val)
 add an environement variable
bool execSync (miniXml::ustring &out, miniXml::ustring &err)
 Execute this Command synchronously.
bool execASync (int &out, int &err, int &in)
 Execute this Command asynchronously.
const boost::filesystem::path & getWorkingDir ()
void setWorkingDir (const boost::filesystem::path &dir)
unsigned int getPid ()
int getReturnValue ()
bool wait ()
 Wait for the end of the execution of the command.
void kill (int signal=9)

Static Public Member Functions

static int exec (const miniXml::ustring &cmd, miniXml::ustring &out, miniXml::ustring &err)
static void argsFromString (const miniXml::ustring &str, std::vector< miniXml::ustring > &args)
 separate an arguments string in a vector of substring


Detailed Description

Launch command and get their output.


Constructor & Destructor Documentation

Spm::Util::Command::Command ( const miniXml::ustring &  cmd  ) 

Parameters:
cmd The command to run

Spm::Util::Command::Command (  ) 


Member Function Documentation

void Spm::Util::Command::setCommand ( const miniXml::ustring &  cmd  ) 

void Spm::Util::Command::add ( const miniXml::ustring &  arg  ) 

add an argument to the command line

Parameters:
arg The arg to add

void Spm::Util::Command::add ( const miniXml::ustring &  var,
const miniXml::ustring &  val 
)

add an environement variable

Parameters:
var The name of the variable
val The value of the variable

bool Spm::Util::Command::execSync ( miniXml::ustring &  out,
miniXml::ustring &  err 
)

Execute this Command synchronously.

Parameters:
out The output of this command
err The error of this command

bool Spm::Util::Command::execASync ( int &  out,
int &  err,
int &  in 
)

Execute this Command asynchronously.

Parameters:
out The output stream of the launched command
err The err stream of the launched command
in The input stream of the launched command

const boost::filesystem::path& Spm::Util::Command::getWorkingDir (  ) 

Returns:
The directory from where this Command is executed

void Spm::Util::Command::setWorkingDir ( const boost::filesystem::path &  dir  ) 

Parameters:
dir The directory from where this Command will be executed

unsigned int Spm::Util::Command::getPid (  ) 

Returns:
The PID of this launched Command

int Spm::Util::Command::getReturnValue (  ) 

Returns:
the value returned by the command

static int Spm::Util::Command::exec ( const miniXml::ustring &  cmd,
miniXml::ustring &  out,
miniXml::ustring &  err 
) [static]

bool Spm::Util::Command::wait (  ) 

Wait for the end of the execution of the command.

Returns:
false if an error occured while waiting

void Spm::Util::Command::kill ( int  signal = 9  ) 

static void Spm::Util::Command::argsFromString ( const miniXml::ustring &  str,
std::vector< miniXml::ustring > &  args 
) [static]

separate an arguments string in a vector of substring

Parameters:
str The string to separate
args The vector of arguments


The documentation for this class was generated from the following file:
Generated on Sat Mar 21 17:00:14 2009 for libSpm by  doxygen 1.5.2