AndroMeta  2.0.0
Public Member Functions | Static Public Attributes
Meta::MCommand Class Reference

Execute commands controlling standard input and reading from standard output and error as strings. More...

#include <MCommand.h>

List of all members.

Public Member Functions

 MCommand (const mstr &command, int mode=0)
 ~MCommand ()
bool readOutput (mstr &out, const mtime &timeout)
void matchOutput (const mstr &re, mvec &m)
bool matchOutput (const mstr &re, mvec &m, const mtime &timeout)
bool readError (mstr &err, const mtime &timeout)
void matchError (const mstr &re, mvec &m)
bool matchError (const mstr &re, mvec &m, const mtime &timeout)
void write (const mstr &in)
int await ()
int processId ()
int status ()
void close ()

Static Public Attributes

static const int Input = 0x01
static const int Output = 0x02
static const int Error = 0x04
static const int Persistent = 0x08

Detailed Description

Execute commands controlling standard input and reading from standard output and error as strings.


Constructor & Destructor Documentation

Meta::MCommand::MCommand ( const mstr command,
int  mode = 0 
)

Constructor.

The mode masks which can be bitwise OR of InputMode, OutputMode, and ErrorMode.

Destructor.


Member Function Documentation

Wait for the command to exit and return status.

Close the command process.

void Meta::MCommand::matchError ( const mstr re,
mvec m 
)

Read from standard error until a regular expression has been matched.

Parameters:
reThe regular expression to match.
mOn output, the matched sub-expressions.
bool Meta::MCommand::matchError ( const mstr re,
mvec m,
const mtime timeout 
)

Read from standard error until a regular expression has been matched with timeout.

Parameters:
reThe regular expression to match.
mOn output, the matched sub-expressions.
timeoutReturn after timeout if output is not matched.
Returns:
true if successful.
void Meta::MCommand::matchOutput ( const mstr re,
mvec m 
)

Read from standard output until a regular expression has been matched.

Parameters:
reThe regular expression to match.
mOn output, the matched sub-expressions.
bool Meta::MCommand::matchOutput ( const mstr re,
mvec m,
const mtime timeout 
)

Read from standard output until a regular expression has been matched with timeout.

Parameters:
reThe regular expression to match.
mOn output, the matched sub-expressions.
timeoutReturn after timeout if output is not matched.
Returns:
true if successful.
Returns:
the process id for the command.
bool Meta::MCommand::readError ( mstr err,
const mtime timeout 
)

Read standard error from the last time clearError() was called.

bool Meta::MCommand::readOutput ( mstr out,
const mtime timeout 
)

Read standard output from the last time clearOutput() was called.

Check the status of the command.

Returns:
The status code if the command has exited else -1.
void Meta::MCommand::write ( const mstr in)

Write to standard input.


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