|
yast2-core
|
Interface to a component via stdio. More...
#include <Y2StdioComponent.h>
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) |
Public Member Functions inherited from Y2Component | |
| Y2Component () | |
| virtual | ~Y2Component () |
| virtual Y2Namespace * | import (const char *name_space) |
| virtual SCRAgent * | getSCRAgent () |
| virtual bool | remote () const |
Private Member Functions | |
| void | send (const YCPValue &v) const |
| YCPValue | receive () |
Private Attributes | |
| const bool | is_server |
| bool | to_stderr |
| bool | batchmode |
| Parser | parser |
Interface to a component via stdio.
| Y2StdioComponent::Y2StdioComponent | ( | bool | is_server, |
| bool | to_stderr, | ||
| bool | in_batchmode = false |
||
| ) |
Creates a new cat/stdio component.
| to_stderr | give true, if stderr should be used instead of stdout. |
| Y2StdioComponent::~Y2StdioComponent | ( | ) |
Cleans up
|
virtual |
Here the client does its actual work.
| arglist | YCPList of client arguments. |
| user_interface | Option display server (user interface) |
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.
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.
|
virtual |
Returns "cat", if this is a server, or "stdio" if it's a module.
Implements Y2Component.
|
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().
|
virtual |
Defined only for the "cat" component: Prints result(..result..) on stdout.
Reimplemented from Y2Component.
References YCPTerm::add(), and send().
|
private |
Sends a YCP value to stdout.
References YCPElement::isNull(), to_stderr, y2debug, and y2error.
Referenced by doActualWork(), evaluate(), and result().
|
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.
|
private |
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().
|
private |
It this component a server or a client?
Referenced by evaluate().
|
private |
Parser used to parse stdin
Referenced by doActualWork(), and receive().
|
private |
1.8.6