Y2StdioComponent Class Reference

Interface to a component via stdio. More...

#include <Y2StdioComponent.h>

Inheritance diagram for Y2StdioComponent:

Y2Component

List of all members.

Public Member Functions

 Y2StdioComponent (bool is_server, bool to_stderr, bool in_batchmode=false)
 ~Y2StdioComponent ()
string name () const
YCPValue evaluate (const YCPValue &command)
void result (const YCPValue &result)
void setServerOptions (int argc, char **argv)
YCPValue doActualWork (const YCPList &arglist, Y2Component *user_interface)

Private Member Functions

void send (const YCPValue &v) const
YCPValue receive ()

Private Attributes

const bool is_server
bool to_stderr
bool batchmode
Parser parser


Detailed Description

Interface to a component via stdio.

Constructor & Destructor Documentation

Y2StdioComponent::Y2StdioComponent ( bool  is_server,
bool  to_stderr,
bool  in_batchmode = false 
)

Creates a new cat/stdio component.

Parameters:
to_stderr,: give true, if stderr should be used instead of stdout.

Y2StdioComponent::~Y2StdioComponent (  ) 

Cleans up


Member Function Documentation

YCPValue Y2StdioComponent::doActualWork ( const YCPList arglist,
Y2Component user_interface 
) [virtual]

Here the client does its actual work.

Parameters:
arglist YCPList of client arguments.
user_interface Option display server (user interface)
Returns:
The result value (exit code) of the called client. The result code has not yet been sent to the display server. Destroy it after use.
This method is only defined, if the component is a client.

Reimplemented from Y2Component.

References Parser::atEOF(), Y2Component::evaluate(), YCPElement::isNull(), parser, receive(), send(), and y2warning.

YCPValue Y2StdioComponent::evaluate ( const YCPValue command  )  [virtual]

Defined only for the "cat" component: Prints a command to stdout and waits for the answer on stdin.

Reimplemented from Y2Component.

References batchmode, is_server, YCPElement::isNull(), receive(), send(), and y2error.

string Y2StdioComponent::name (  )  const [virtual]

Returns "cat", if this is a server, or "stdio" if it's a module.

Implements Y2Component.

References batchmode, and to_stderr.

YCPValue Y2StdioComponent::receive (  )  [private]

Reads one YCP value from stdin. Return 0 if no one could be read.

References YCPElement::isNull(), Parser::parse(), parser, and y2debug.

Referenced by doActualWork(), and evaluate().

void Y2StdioComponent::result ( const YCPValue result  )  [virtual]

Defined only for the "cat" component: Prints result(..result..) on stdout.

Reimplemented from Y2Component.

References YCPTerm::add(), and send().

void Y2StdioComponent::send ( const YCPValue v  )  const [private]

Sends a YCP value to stdout.

References YCPElement::isNull(), to_stderr, and y2debug.

Referenced by doActualWork(), evaluate(), and result().

void Y2StdioComponent::setServerOptions ( int  argc,
char **  argv 
) [virtual]

Sets the commandline options of the server. Server options for the cat server are simply ignored.

This method is only defined, if the component is a server.

Reimplemented from Y2Component.


Member Data Documentation

If true, we're running in batchmode (i.e testsuite) As a client (called via doActualWork()) nothing changes As a server (called via evaluate()) no input is read

Referenced by evaluate(), and name().

const bool Y2StdioComponent::is_server [private]

It this component a server or a client?

Referenced by evaluate().

Parser used to parse stdin

Referenced by doActualWork(), and receive().

If true, this is the 'stderr' component, which reads from stdin, but writes to stderr.

Referenced by name(), and send().


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

Generated on a sunny day for yast2-core by doxygen 1.5.9