00001 /* 00002 * plugin.h 00003 * This file is part of dbPager Classes Library (DCL) 00004 * 00005 * Copyright (c) 2008 Dennis Prochko <wolfsoft@mail.ru> 00006 * 00007 * DCL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation version 3. 00010 * 00011 * DCL is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with DCL; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, 00019 * Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef _PLUGIN_H_ 00023 #define _PLUGIN_H_ 00024 00025 #include <string> 00026 00027 #include <dcl/exception.h> 00028 00029 namespace dbp { 00030 00032 00036 class disposable { 00037 public: 00039 virtual ~disposable() { } 00040 }; 00041 00043 00047 class plugin_exception: public exception { 00048 public: 00050 plugin_exception(const std::string &msg): exception(msg) { } 00051 }; 00052 00054 00058 class plugin_int { 00059 public: 00061 virtual ~plugin_int() { } 00063 00081 virtual void load(const std::string &file_name) 00082 throw(plugin_exception) = 0; 00084 00092 virtual disposable* create_object(const std::string &object_name) = 0; 00094 00100 virtual void destroy_object(disposable *object) = 0; 00101 }; 00102 00104 00107 class plugin: public plugin_int { 00108 public: 00110 plugin(); 00112 ~plugin(); 00113 virtual void load(const std::string &file_name) throw(plugin_exception); 00114 virtual disposable* create_object(const std::string &object_name); 00115 virtual void destroy_object(disposable *object); 00116 private: 00117 plugin_int *_impl; 00118 }; 00119 00120 } // namespace 00121 00122 00123 #endif /*_PLUGIN_H_*/