diff options
| author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-03-04 12:52:13 +0100 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-03-04 12:52:13 +0100 |
| commit | 7d0b86ce4ce9401b7177c91874cac9e1e0ee42c7 (patch) | |
| tree | 2cb061660f9ad48e8fcc8dd859f6f2aa0ff14b34 /lib/MiddleWare/ABRTPlugin.cpp | |
| parent | 6f13bfb6b3e6007d75ccc2d727d5db45c50cb57a (diff) | |
| parent | 60150bac2c6ecc10a1d761bdecef696566d9ef43 (diff) | |
| download | abrt-7d0b86ce4ce9401b7177c91874cac9e1e0ee42c7.tar.gz abrt-7d0b86ce4ce9401b7177c91874cac9e1e0ee42c7.tar.xz abrt-7d0b86ce4ce9401b7177c91874cac9e1e0ee42c7.zip | |
Merge branch 'master' of git://git.fedorahosted.org/git/crash-catcher
Diffstat (limited to 'lib/MiddleWare/ABRTPlugin.cpp')
| -rw-r--r-- | lib/MiddleWare/ABRTPlugin.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/MiddleWare/ABRTPlugin.cpp b/lib/MiddleWare/ABRTPlugin.cpp new file mode 100644 index 00000000..788d5c9e --- /dev/null +++ b/lib/MiddleWare/ABRTPlugin.cpp @@ -0,0 +1,91 @@ +/* + ABRTPlugin.cpp + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include "ABRTPlugin.h" + +CABRTPlugin::CABRTPlugin(const std::string& pLibPath) : + m_pDynamicLibrary(NULL), + m_pPluginInfo(NULL), + m_pFnPluginNew(NULL) +{ + try + { + m_pDynamicLibrary = new CDynamicLibrary(pLibPath); + if (m_pDynamicLibrary == NULL) + { + throw std::string("Not enought memory."); + } + m_pPluginInfo = (p_plugin_info_t) m_pDynamicLibrary->FindSymbol("plugin_info"); + m_pFnPluginNew = (p_fn_plugin_new_t) m_pDynamicLibrary->FindSymbol("plugin_new"); + } + catch (...) + { + throw; + } +} + +CABRTPlugin::~CABRTPlugin() +{ + if (m_pDynamicLibrary != NULL) + { + delete m_pDynamicLibrary; + } +} + +const std::string& CABRTPlugin::GetVersion() +{ + return m_pPluginInfo->m_sVersion; +} + +const int CABRTPlugin::GetMagicNumber() +{ + return m_pPluginInfo->m_nMagicNumber; +} + +const std::string& CABRTPlugin::GetName() +{ + return m_pPluginInfo->m_sName; +} + +const std::string& CABRTPlugin::GetDescription() +{ + return m_pPluginInfo->m_sDescription; +} + +const std::string& CABRTPlugin::GetEmail() +{ + return m_pPluginInfo->m_sEmail; +} + +const std::string& CABRTPlugin::GetWWW() +{ + return m_pPluginInfo->m_sWWW; +} + +const plugin_type_t CABRTPlugin::GetType() +{ + return m_pPluginInfo->m_Type; +} + +CPlugin* CABRTPlugin::PluginNew() +{ + return m_pFnPluginNew(); +} |
