00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: Y2StdioComponent.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Klaus Kaempf <kkaempf@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 /* 00022 * Component that communicates via stdin/out/err 00023 * 00024 * Author: Mathias Kettner <kettner@suse.de> 00025 */ 00026 00027 #ifndef Y2StdioComponent_h 00028 #define Y2StdioComponent_h 00029 00030 #include "Y2Component.h" 00031 #include <ycp/Parser.h> 00032 00036 class Y2StdioComponent : public Y2Component 00037 { 00041 const bool is_server; 00042 00047 bool to_stderr; 00048 00054 bool batchmode; 00055 00059 Parser parser; 00060 00061 public: 00062 00067 Y2StdioComponent (bool is_server, bool to_stderr, bool in_batchmode = false); 00068 00072 ~Y2StdioComponent(); 00073 00078 string name() const; 00079 00085 YCPValue evaluate(const YCPValue& command); 00086 00091 void result(const YCPValue& result); 00092 00099 void setServerOptions(int argc, char **argv); 00100 00111 YCPValue doActualWork(const YCPList& arglist, Y2Component *user_interface); 00112 00113 private: 00117 void send (const YCPValue& v) const; 00118 00123 YCPValue receive (); 00124 00125 }; 00126 00127 00128 #endif // Y2StdioComponent_h