00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef Y2WFMComponent_h
00021 #define Y2WFMComponent_h
00022
00023 #include <y2/Y2Component.h>
00024
00025 #include <ycp/YCPInteger.h>
00026 #include <ycp/YCPList.h>
00027 #include <ycp/YCPString.h>
00028
00029 #include "WFMSubAgent.h"
00030
00031 #define MAX_CLIENT_NAME_LEN 160
00032
00033 class Y2SystemNamespace;
00034
00035 class Y2WFMComponent : public Y2Component
00036 {
00037
00038 public:
00042 Y2WFMComponent();
00043
00047 ~Y2WFMComponent();
00048
00052 virtual string name() const;
00053
00057 virtual YCPValue doActualWork(const YCPList& arglist, Y2Component *displayserver);
00058
00059 static Y2WFMComponent* instance();
00060
00061 YCPInteger SCROpen (const YCPString& name, const YCPBoolean &check_version);
00062 void SCRClose (const YCPInteger& handle);
00063 YCPString SCRGetName (const YCPInteger &handle);
00064 void SCRSetDefault (const YCPInteger &handle);
00065 YCPInteger SCRGetDefault () const;
00066 YCPValue Args (const YCPInteger& index = YCPNull ()) const;
00067 YCPString GetLanguage () const;
00068 YCPString GetEncoding () const;
00069 YCPString SetLanguage (const YCPString& language, const YCPString& encoding = YCPNull ());
00070 YCPValue Read (const YCPPath &path, const YCPValue& arg);
00071 YCPValue Write (const YCPPath &path, const YCPValue& arg1, const YCPValue& arg2 = YCPNull ());
00072 YCPValue Execute (const YCPPath &path, const YCPValue& arg1);
00073 YCPValue CallFunction (const YCPString& client, const YCPList& args = YCPList ());
00074 YCPString GetEnvironmentEncoding ();
00075 YCPBoolean ClientExists (const YCPString& client);
00076
00077 virtual Y2Namespace* import (const char* name_space);
00078
00085 void setupComponent (string client_name, string fullname,
00086 const YCPValue& script);
00087
00088 private:
00089
00090 bool createDefaultSCR ();
00091
00095 typedef vector <WFMSubAgent*> WFMSubAgents;
00096 typedef vector <Y2SystemNamespace*> SystemNamespaces;
00097
00098 WFMSubAgents scrs;
00099 SystemNamespaces system_namespaces;
00100
00104 WFMSubAgents::iterator find_handle (int);
00105
00109 int handle_cnt;
00110
00114 int default_handle;
00115
00119 WFMSubAgent local;
00120
00124 const char* get_env_lang () const;
00125
00129 string modulename;
00130
00136 YCPList argumentlist;
00137
00138 string currentLanguage;
00139 string currentEncoding;
00140
00144 string systemEncoding;
00145
00149 string environmentEncoding;
00150
00151
00152 static Y2WFMComponent* current_wfm;
00153
00157 YCPValue script;
00158
00162 string client_name;
00163
00167 string fullname;
00168 };
00169
00170
00171 #endif // Y2WFMComponent_h