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 Y2WFMComponent : public Y2Component
00034 {
00035
00036 public:
00040 Y2WFMComponent();
00041
00045 ~Y2WFMComponent();
00046
00050 virtual string name() const;
00051
00055 virtual YCPValue doActualWork(const YCPList& arglist, Y2Component *displayserver);
00056
00057 static Y2WFMComponent* instance();
00058
00059 YCPInteger SCROpen (const YCPString& name, const YCPBoolean &check_version);
00060 void SCRClose (const YCPInteger& handle);
00061 YCPString SCRGetName (const YCPInteger &handle);
00062 void SCRSetDefault (const YCPInteger &handle);
00063 YCPInteger SCRGetDefault () const;
00064 YCPValue Args (const YCPInteger& index = YCPNull ()) const;
00065 YCPString GetLanguage () const;
00066 YCPString GetEncoding () const;
00067 YCPString SetLanguage (const YCPString& language, const YCPString& encoding = YCPNull ());
00068 YCPValue Read (const YCPPath &path, const YCPValue& arg);
00069 YCPValue Write (const YCPPath &path, const YCPValue& arg1, const YCPValue& arg2 = YCPNull ());
00070 YCPValue Execute (const YCPPath &path, const YCPValue& arg1);
00071 YCPValue CallFunction (const YCPString& client, const YCPList& args = YCPList ());
00072 YCPString GetEnvironmentEncoding ();
00073
00074 virtual Y2Namespace* import (const char* name_space);
00075
00082 void setupComponent (string client_name, string fullname,
00083 const YCPValue& script);
00084
00085 private:
00086
00087 bool createDefaultSCR ();
00088
00092 typedef vector <WFMSubAgent*> WFMSubAgents;
00093 WFMSubAgents scrs;
00094
00098 WFMSubAgents::iterator find_handle (int);
00099
00103 int handle_cnt;
00104
00108 int default_handle;
00109
00113 WFMSubAgent local;
00114
00118 const char* get_env_lang () const;
00119
00123 string modulename;
00124
00130 YCPList argumentlist;
00131
00132 string currentLanguage;
00133 string currentEncoding;
00134
00138 string systemEncoding;
00139
00143 string environmentEncoding;
00144
00145
00146 static Y2WFMComponent* current_wfm;
00147
00151 YCPValue script;
00152
00156 string client_name;
00157
00161 string fullname;
00162 };
00163
00164
00165 #endif // Y2WFMComponent_h