#include "AVEmbeddedLoader.h" #include "AVDisplayServer.h" #include "AVBuffer.h" #include "AVCandidate.h" #include "AVKeyCode.h" #include using std::vector; class AVLoader : public OVBase { public: static AVLoader* open() { if(globalLoader == NULL) globalLoader = new AVLoader(); return globalLoader; } static void close(); void initContext(int n); void connectDisplayServer(AVDisplayServer *svr); bool keyEvent(int n, AVKeyCode c); bool moduleName(int i, char *str); void unloadCurrentModule(); //Add these two functions temporarily, will refactor them later. int getInputMethodCount(); int getOutputFilterCount(); // int getSwitchedBoPoMoFoLayoutModIndex(); void getAllModuleNames(const char* nameList[]); protected: AVLoader(); ~AVLoader(); void loadPrefs(); void loadModules(); AVEmbeddedLoader *em; AVDisplayServer *dsvr; AVCandidate *candi; AVBuffer *buf; vector ctx_vector; vector ovof_vector; vector startedCtxVector; // 這是很浪費的作法 orz int activatedIm; bool hasBoPoMoFo; bool hasPhoneticHsu; private: static AVLoader *globalLoader; };