summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-02-04 16:34:41 +0100
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-02-04 16:34:41 +0100
commite447289f015ff0c0496cfcbd45edbbbfcfd7ba57 (patch)
tree961221fe953941336e0ff9e8971c1208c6a2b83d
parente4c956e03c2e34ad1a51509889114aebb5737668 (diff)
downloadabrt-e447289f015ff0c0496cfcbd45edbbbfcfd7ba57.tar.gz
abrt-e447289f015ff0c0496cfcbd45edbbbfcfd7ba57.tar.xz
abrt-e447289f015ff0c0496cfcbd45edbbbfcfd7ba57.zip
tabs are replaced by spaces
setting the settings are moved to the MW
-rw-r--r--lib/MiddleWare/CrashCatcherPlugin.cpp121
-rw-r--r--lib/MiddleWare/CrashCatcherPlugin.h51
2 files changed, 52 insertions, 120 deletions
diff --git a/lib/MiddleWare/CrashCatcherPlugin.cpp b/lib/MiddleWare/CrashCatcherPlugin.cpp
index e50ba53..04ff3a8 100644
--- a/lib/MiddleWare/CrashCatcherPlugin.cpp
+++ b/lib/MiddleWare/CrashCatcherPlugin.cpp
@@ -22,133 +22,70 @@
#include "CrashCatcherPlugin.h"
CCrashCatcherPlugin::CCrashCatcherPlugin(const std::string& pLibPath) :
- m_pDynamicLibrary(NULL),
- m_pPluginInfo(NULL),
- m_pFnPluginNew(NULL),
- m_bEnabled(false)
+ 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;
- }
+ 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;
+ }
}
CCrashCatcherPlugin::~CCrashCatcherPlugin()
{
- if (m_pDynamicLibrary != NULL)
- {
- delete m_pDynamicLibrary;
- }
-}
-
-void CCrashCatcherPlugin::LoadSettings(const std::string& pPath)
-{
- std::ifstream fIn;
- fIn.open(pPath.c_str());
- if (fIn.is_open())
- {
- std::string line;
- while (!fIn.eof())
- {
- getline(fIn, line);
-
- int ii;
- bool is_value = false;
- std::string key = "";
- std::string value = "";
- for (ii = 0; ii < line.length(); ii++)
- {
- if (!isspace(line[ii]))
- {
- if (line[ii] == '#')
- {
- break;
- }
- else if (line[ii] == '=')
- {
- is_value = true;
- }
- else if (line[ii] == '=' && is_value)
- {
- key = "";
- value = "";
- break;
- }
- else if (!is_value)
- {
- key += line[ii];
- }
- else
- {
- value += line[ii];
- }
- }
- }
- if (key != "")
- {
- m_mapSettings[key] = value;
- }
- }
- fIn.close();
- }
-}
-
-const bool CCrashCatcherPlugin::IsEnabled()
-{
- return m_mapSettings["Enabled"] == "yes";
+ if (m_pDynamicLibrary != NULL)
+ {
+ delete m_pDynamicLibrary;
+ }
}
const std::string& CCrashCatcherPlugin::GetVersion()
{
- return m_pPluginInfo->m_sVersion;
+ return m_pPluginInfo->m_sVersion;
}
const int CCrashCatcherPlugin::GetMagicNumber()
{
- return m_pPluginInfo->m_nMagicNumber;
+ return m_pPluginInfo->m_nMagicNumber;
}
const std::string& CCrashCatcherPlugin::GetName()
{
- return m_pPluginInfo->m_sName;
+ return m_pPluginInfo->m_sName;
}
const std::string& CCrashCatcherPlugin::GetDescription()
{
- return m_pPluginInfo->m_sDescription;
+ return m_pPluginInfo->m_sDescription;
}
const std::string& CCrashCatcherPlugin::GetEmail()
{
- return m_pPluginInfo->m_sEmail;
+ return m_pPluginInfo->m_sEmail;
}
const std::string& CCrashCatcherPlugin::GetWWW()
{
- return m_pPluginInfo->m_sWWW;
+ return m_pPluginInfo->m_sWWW;
}
const plugin_type_t CCrashCatcherPlugin::GetType()
{
- return m_pPluginInfo->m_Type;
+ return m_pPluginInfo->m_Type;
}
CPlugin* CCrashCatcherPlugin::PluginNew()
{
- return m_pFnPluginNew();
-}
-
-const map_settings_t& CCrashCatcherPlugin::GetSettings()
-{
- return m_mapSettings;
+ return m_pFnPluginNew();
}
diff --git a/lib/MiddleWare/CrashCatcherPlugin.h b/lib/MiddleWare/CrashCatcherPlugin.h
index 0dcf4af..c5ecff5 100644
--- a/lib/MiddleWare/CrashCatcherPlugin.h
+++ b/lib/MiddleWare/CrashCatcherPlugin.h
@@ -30,34 +30,29 @@
class CCrashCatcherPlugin
{
- private:
-
- typedef const plugin_info_t* p_plugin_info_t;
- typedef CPlugin* (*p_fn_plugin_new_t)();
-
- CDynamicLibrary* m_pDynamicLibrary;
- p_plugin_info_t m_pPluginInfo;
- p_fn_plugin_new_t m_pFnPluginNew;
-
- bool m_bEnabled;
-
- map_settings_t m_mapSettings;
- public:
- CCrashCatcherPlugin(const std::string& pLibPath);
- ~CCrashCatcherPlugin();
-
- void LoadSettings(const std::string& pPath);
- const bool IsEnabled();
- const std::string& GetVersion();
- const int GetMagicNumber();
- const std::string& GetName();
- const std::string& GetDescription();
- const std::string& GetEmail();
- const std::string& GetWWW();
- const plugin_type_t GetType();
-
- CPlugin* PluginNew();
- const map_settings_t& GetSettings();
+ private:
+
+ typedef const plugin_info_t* p_plugin_info_t;
+ typedef CPlugin* (*p_fn_plugin_new_t)();
+
+ CDynamicLibrary* m_pDynamicLibrary;
+ p_plugin_info_t m_pPluginInfo;
+ p_fn_plugin_new_t m_pFnPluginNew;
+
+ public:
+ CCrashCatcherPlugin(const std::string& pLibPath);
+ ~CCrashCatcherPlugin();
+
+ const std::string& GetVersion();
+ const int GetMagicNumber();
+ const std::string& GetName();
+ const std::string& GetDescription();
+ const std::string& GetEmail();
+ const std::string& GetWWW();
+ const plugin_type_t GetType();
+
+ CPlugin* PluginNew();
+ const map_settings_t& GetSettings();
};
#endif /*CRASHCATCHERPLUGIN_H_*/