FirteX-高性能全文索引和检索平台API Documentation |
00001 // 00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 00003 // All rights reserved. 00004 // This file is part of FirteX (www.firtex.org) 00005 // 00006 // Use of the FirteX is subject to the terms of the software license set forth in 00007 // the LICENSE file included with this software, and also available at 00008 // http://www.firtex.org/license.html 00009 // 00010 // Author : 郭瑞杰(GuoRuijie) 00011 // Email : ruijieguo@software.ict.ac.cn,ruijieguo@gmail.com 00012 // Created : 2006/7/9 00013 // 00014 #ifndef _PLUGINS_H 00015 #define _PLUGINS_H 00016 00017 #if _MSC_VER > 1000 00018 #pragma once 00019 #endif // _MSC_VER > 1000 00020 00021 #include <vector> 00022 #include "../com/Com.h" 00023 #include "../utility/StdHeader.h" 00024 #include "../utility/XML.h" 00025 #include "ParserPlugins.h" 00026 #include "AnalyzerPlugins.h" 00027 #include "ComObject.h" 00028 00029 using namespace firtex::com; 00030 using namespace std; 00031 using namespace firtex::utility; 00032 00033 namespace firtex 00034 { 00035 namespace plugin 00036 { 00037 class CPlugin 00038 { 00039 public: 00040 CPlugin(); 00041 ~CPlugin(); 00042 public: 00043 bool load(CXMLElement* pXMLPlugin); 00044 00045 const tstring& getCategory(){return m_category;} 00046 const tstring& getIdentifier(){return m_identifier;} 00047 const firtex::com::FX_CLSID& getCLSID(){return m_clsid;} 00048 tstring getCLSIDAsString(){return GUIDX::encode(&m_clsid);} 00049 const tstring& getName(){return m_name;} 00050 const tstring& getProgid(){return m_progid;} 00051 bool isEnabled(){return m_bEnable;} 00052 00053 bool isInstalled(){return m_bInstalled;} 00054 public: 00055 bool install(); 00056 bool uninstall(); 00057 protected: 00058 tstring m_category; 00059 tstring m_identifier; 00060 firtex::com::FX_CLSID m_clsid; 00061 tstring m_name; //插件名称 00062 tstring m_progid; 00063 tstring m_versionindependentprogid; 00064 tstring m_threadingmodel; 00065 tstring m_filename; //插件路径 00066 bool m_bEnable; //是否禁止 00067 bool m_bInstalled; 00068 friend class CPlugins; 00069 }; 00070 00071 00072 class CPlugins 00073 { 00074 public: 00075 CPlugins(void); 00076 virtual ~CPlugins(void); 00077 public: 00078 void enumerate(); 00079 void clear(); 00080 bool lookupCLSID(const tchar* category, const tchar* identifier, firtex::com::FX_CLSID& pCLSID); 00081 bool lookupEnable(FX_REFCLSID pCLSID, bool bDefault); 00082 bool lookupInstall(FX_REFCLSID pCLSID); 00083 public: 00084 CPlugin* findByFileName(const tchar* filename); 00085 public: 00086 void startIterator(); 00087 bool hasNext(); 00088 CPlugin* next(); 00089 public: 00090 CParserPlugins ParserPlugin; 00091 CAnalyzerPlugins AnalyzerPlugin; 00092 protected: 00093 vector<CPlugin*> m_plugins; 00094 vector<CPlugin*>::iterator m_iterator; 00095 }; 00097 // 00098 inline void CPlugins::startIterator() 00099 { 00100 m_iterator = m_plugins.begin(); 00101 } 00102 inline bool CPlugins::hasNext() 00103 { 00104 return (m_iterator != m_plugins.end()); 00105 } 00106 inline CPlugin* CPlugins::next() 00107 { 00108 return *m_iterator++; 00109 } 00110 00111 extern CPlugins GlobalPlugins; 00112 } 00113 } 00114 00115 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex