aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-03-14 20:35:25 +0000
committerVincent Richard <[email protected]>2005-03-14 20:35:25 +0000
commit362fa346f94e2b3a8c0abb7badfbd7a749a9de1c (patch)
treee7e127f8c8dba44367e4ccdf556791cc547823c1
parentFixed parameters not showing as child components + fixed parsing bounds in ty... (diff)
downloadvmime-362fa346f94e2b3a8c0abb7badfbd7a749a9de1c.tar.gz
vmime-362fa346f94e2b3a8c0abb7badfbd7a749a9de1c.zip
Removed 'singleton' and 'singletonManager' classes.
-rw-r--r--ChangeLog5
-rw-r--r--SConstruct1
-rw-r--r--src/encoderFactory.cpp7
-rw-r--r--src/headerFieldFactory.cpp7
-rw-r--r--src/messaging/serviceFactory.cpp7
-rw-r--r--src/options.cpp7
-rw-r--r--src/parameterFactory.cpp7
-rw-r--r--src/textPartFactory.cpp7
-rw-r--r--src/utility/singleton.cpp53
-rw-r--r--vmime/encoderFactory.hpp7
-rw-r--r--vmime/headerFieldFactory.hpp7
-rw-r--r--vmime/messaging/serviceFactory.hpp7
-rw-r--r--vmime/options.hpp7
-rw-r--r--vmime/parameterFactory.hpp7
-rw-r--r--vmime/textPartFactory.hpp7
-rw-r--r--vmime/utility/singleton.hpp92
16 files changed, 65 insertions, 170 deletions
diff --git a/ChangeLog b/ChangeLog
index 9909da71..0fdeac69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
VERSION 0.6.4cvs
================
+2005-03-14 Vincent Richard <[email protected]>
+
+ * removed singleton<> and singletonManager classes: useless and quite
+ confusing in Doxygen-generated documentation.
+
2005-02-06 Vincent Richard <[email protected]>
* mailboxList.{cpp|hpp}: dropped protected inheritance which was not
diff --git a/SConstruct b/SConstruct
index 3a40bc04..a50d1c0b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -147,7 +147,6 @@ libvmime_sources = [
'utility/md5.cpp', 'utility/md5.hpp',
'utility/path.cpp', 'utility/path.hpp',
'utility/random.cpp', 'utility/random.hpp',
- 'utility/singleton.cpp', 'utility/singleton.hpp',
'utility/smartPtr.hpp',
'utility/stream.cpp', 'utility/stream.hpp',
'utility/stringProxy.cpp', 'utility/stringProxy.hpp',
diff --git a/src/encoderFactory.cpp b/src/encoderFactory.cpp
index 2cf1bd66..76f05f48 100644
--- a/src/encoderFactory.cpp
+++ b/src/encoderFactory.cpp
@@ -54,6 +54,13 @@ encoderFactory::~encoderFactory()
}
+encoderFactory* encoderFactory::getInstance()
+{
+ static encoderFactory instance;
+ return (&instance);
+}
+
+
encoder* encoderFactory::create(const string& name)
{
return (getEncoderByName(name)->create());
diff --git a/src/headerFieldFactory.cpp b/src/headerFieldFactory.cpp
index 306e2c8e..807ffe4d 100644
--- a/src/headerFieldFactory.cpp
+++ b/src/headerFieldFactory.cpp
@@ -63,6 +63,13 @@ headerFieldFactory::~headerFieldFactory()
}
+headerFieldFactory* headerFieldFactory::getInstance()
+{
+ static headerFieldFactory instance;
+ return (&instance);
+}
+
+
headerField* headerFieldFactory::create
(const string& name, const string& body)
{
diff --git a/src/messaging/serviceFactory.cpp b/src/messaging/serviceFactory.cpp
index 3007488d..a4ce70a4 100644
--- a/src/messaging/serviceFactory.cpp
+++ b/src/messaging/serviceFactory.cpp
@@ -45,6 +45,13 @@ serviceFactory::~serviceFactory()
}
+serviceFactory* serviceFactory::getInstance()
+{
+ static serviceFactory instance;
+ return (&instance);
+}
+
+
service* serviceFactory::create
(session* sess, const string& protocol, authenticator* auth)
{
diff --git a/src/options.cpp b/src/options.cpp
index 609dbeb1..d99b248b 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -24,6 +24,13 @@ namespace vmime
{
+options* options::getInstance()
+{
+ static options instance;
+ return (&instance);
+}
+
+
options::multipartOptions::multipartOptions()
: m_prologText("This is a multi-part message in MIME format. Your mail reader " \
"does not understand MIME message format."),
diff --git a/src/parameterFactory.cpp b/src/parameterFactory.cpp
index 57504276..cd67ce81 100644
--- a/src/parameterFactory.cpp
+++ b/src/parameterFactory.cpp
@@ -42,6 +42,13 @@ parameterFactory::~parameterFactory()
}
+parameterFactory* parameterFactory::getInstance()
+{
+ static parameterFactory instance;
+ return (&instance);
+}
+
+
parameter* parameterFactory::create
(const string& name, const string& value)
{
diff --git a/src/textPartFactory.cpp b/src/textPartFactory.cpp
index 0d588d9c..bfc2fa64 100644
--- a/src/textPartFactory.cpp
+++ b/src/textPartFactory.cpp
@@ -42,6 +42,13 @@ textPartFactory::~textPartFactory()
}
+textPartFactory* textPartFactory::getInstance()
+{
+ static textPartFactory instance;
+ return (&instance);
+}
+
+
textPart* textPartFactory::create(const mediaType& type)
{
NameMap::const_iterator pos = m_nameMap.find(type.generate());
diff --git a/src/utility/singleton.cpp b/src/utility/singleton.cpp
deleted file mode 100644
index 58b751e6..00000000
--- a/src/utility/singleton.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
-//
-// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#include "vmime/utility/singleton.hpp"
-
-
-namespace vmime {
-namespace utility {
-
-
-singletonManager::singletonManager()
-{
-}
-
-
-singletonManager::~singletonManager()
-{
- for (std::list <abstractSingleton*>::iterator it = m_list.begin() ; it != m_list.end() ; ++it)
- delete (*it);
-}
-
-
-singletonManager* singletonManager::getInstance()
-{
- static singletonManager inst;
- return (&inst);
-}
-
-
-void singletonManager::manage(abstractSingleton* s)
-{
- m_list.push_back(s);
-}
-
-
-} // utility
-} // vmime
diff --git a/vmime/encoderFactory.hpp b/vmime/encoderFactory.hpp
index ff8e3559..2f17e99f 100644
--- a/vmime/encoderFactory.hpp
+++ b/vmime/encoderFactory.hpp
@@ -22,7 +22,6 @@
#include "vmime/encoder.hpp"
-#include "vmime/utility/singleton.hpp"
#include "vmime/utility/stringUtils.hpp"
@@ -33,10 +32,8 @@ namespace vmime
/** A factory to create 'encoder' objects for the specified encoding.
*/
-class encoderFactory : public utility::singleton <encoderFactory>
+class encoderFactory
{
- friend class utility::singleton <encoderFactory>;
-
private:
encoderFactory();
@@ -44,6 +41,8 @@ private:
public:
+ static encoderFactory* getInstance();
+
/** Information about a registered encoder. */
class registeredEncoder
{
diff --git a/vmime/headerFieldFactory.hpp b/vmime/headerFieldFactory.hpp
index af1d0fe8..35fcae07 100644
--- a/vmime/headerFieldFactory.hpp
+++ b/vmime/headerFieldFactory.hpp
@@ -22,7 +22,6 @@
#include "vmime/headerField.hpp"
-#include "vmime/utility/singleton.hpp"
#include "vmime/utility/stringUtils.hpp"
@@ -30,10 +29,8 @@ namespace vmime
{
-class headerFieldFactory : public utility::singleton <headerFieldFactory>
+class headerFieldFactory
{
- friend class utility::singleton <headerFieldFactory>;
-
protected:
headerFieldFactory();
@@ -46,6 +43,8 @@ protected:
public:
+ static headerFieldFactory* getInstance();
+
#ifndef VMIME_BUILDING_DOC
template <class TYPE>
class registerer
diff --git a/vmime/messaging/serviceFactory.hpp b/vmime/messaging/serviceFactory.hpp
index 272ab8fc..41b3e932 100644
--- a/vmime/messaging/serviceFactory.hpp
+++ b/vmime/messaging/serviceFactory.hpp
@@ -25,7 +25,6 @@
#include "vmime/types.hpp"
#include "vmime/base.hpp"
-#include "vmime/utility/singleton.hpp"
#include "vmime/utility/stringUtils.hpp"
#include "vmime/messaging/serviceInfos.hpp"
@@ -46,10 +45,8 @@ class session;
/** A factory to create 'service' objects for a specified protocol.
*/
-class serviceFactory : public utility::singleton <serviceFactory>
+class serviceFactory
{
- friend class utility::singleton <serviceFactory>;
-
private:
serviceFactory();
@@ -57,6 +54,8 @@ private:
public:
+ static serviceFactory* getInstance();
+
/** Information about a registered service. */
class registeredService
{
diff --git a/vmime/options.hpp b/vmime/options.hpp
index d558b030..b76ec91b 100644
--- a/vmime/options.hpp
+++ b/vmime/options.hpp
@@ -22,7 +22,6 @@
#include "vmime/base.hpp"
-#include "vmime/utility/singleton.hpp"
namespace vmime
@@ -32,10 +31,8 @@ namespace vmime
/** A class to set global options for VMime.
*/
-class options : public utility::singleton <options>
+class options
{
- friend class utility::singleton <options>;
-
protected:
/** Message-related options.
@@ -83,6 +80,8 @@ protected:
public:
+ static options* getInstance();
+
multipartOptions multipart;
messageOptions message;
};
diff --git a/vmime/parameterFactory.hpp b/vmime/parameterFactory.hpp
index 9e510acd..a3ee411e 100644
--- a/vmime/parameterFactory.hpp
+++ b/vmime/parameterFactory.hpp
@@ -22,7 +22,6 @@
#include "vmime/parameter.hpp"
-#include "vmime/utility/singleton.hpp"
#include "vmime/utility/stringUtils.hpp"
@@ -30,10 +29,8 @@ namespace vmime
{
-class parameterFactory : public utility::singleton <parameterFactory>
+class parameterFactory
{
- friend class utility::singleton <parameterFactory>;
-
protected:
parameterFactory();
@@ -46,6 +43,8 @@ protected:
public:
+ static parameterFactory* getInstance();
+
#ifndef VMIME_BUILDING_DOC
template <class TYPE>
class registerer
diff --git a/vmime/textPartFactory.hpp b/vmime/textPartFactory.hpp
index bb1d6e40..39159bc2 100644
--- a/vmime/textPartFactory.hpp
+++ b/vmime/textPartFactory.hpp
@@ -23,17 +23,14 @@
#include "vmime/textPart.hpp"
#include "vmime/mediaType.hpp"
-#include "vmime/utility/singleton.hpp"
namespace vmime
{
-class textPartFactory : public utility::singleton <textPartFactory>
+class textPartFactory
{
- friend class utility::singleton <textPartFactory>;
-
protected:
textPartFactory();
@@ -60,6 +57,8 @@ protected:
public:
+ static textPartFactory* getInstance();
+
template <class T>
void registerType(const mediaType& type)
{
diff --git a/vmime/utility/singleton.hpp b/vmime/utility/singleton.hpp
deleted file mode 100644
index d2fdc6fa..00000000
--- a/vmime/utility/singleton.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// VMime library (http://vmime.sourceforge.net)
-// Copyright (C) 2002-2005 Vincent Richard <[email protected]>
-//
-// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
-
-#ifndef VMIME_UTILITY_SINGLETON_HPP_INCLUDED
-#define VMIME_UTILITY_SINGLETON_HPP_INCLUDED
-
-
-#include <list>
-
-
-namespace vmime {
-namespace utility {
-
-
-// Singleton abstract base class.
-
-class abstractSingleton
-{
- friend class singletonManager;
-
-protected:
-
- abstractSingleton() { }
- virtual ~abstractSingleton() { }
-};
-
-
-// Singleton manager
-// (for automatic clean-up of all instanciated singletons).
-
-class singletonManager
-{
-public:
-
- static singletonManager* getInstance();
-
- void manage(abstractSingleton* s);
-
-private:
-
- singletonManager();
- ~singletonManager();
-
- std::list <abstractSingleton*> m_list;
-};
-
-
-// A singleton template.
-
-template <class TYPE>
-class singleton : public abstractSingleton
-{
-protected:
-
- singleton() { }
- ~singleton() { }
-
-public:
-
- static TYPE* getInstance()
- {
- static TYPE* inst = NULL;
-
- if (!inst)
- singletonManager::getInstance()->manage(inst = new TYPE());
-
- return (inst);
- }
-};
-
-
-} // utility
-} // vmime
-
-
-#endif // VMIME_UTILITY_SINGLETON_HPP_INCLUDED