aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mux_qt
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 19:02:02 +0000
committerlloyd <[email protected]>2006-05-18 19:02:02 +0000
commit3285e451e096d16c69ee906ab46f936b20dc2eaa (patch)
tree5ecc2cfcd1bf1c6300b14fe850e732e633b3470e /modules/mux_qt
parentc3ae40d21245315a5bfb913820c20d0d2896522c (diff)
Change the Qt mutex to use the new Mutex_Factory abstraction
Diffstat (limited to 'modules/mux_qt')
-rw-r--r--modules/mux_qt/modinfo.txt1
-rw-r--r--modules/mux_qt/mux_qt.cpp44
-rw-r--r--modules/mux_qt/mux_qt.h13
-rw-r--r--modules/mux_qt/types.h28
4 files changed, 17 insertions, 69 deletions
diff --git a/modules/mux_qt/modinfo.txt b/modules/mux_qt/modinfo.txt
index ee91ef735..6a6f70e5b 100644
--- a/modules/mux_qt/modinfo.txt
+++ b/modules/mux_qt/modinfo.txt
@@ -8,7 +8,6 @@ replace_file types.h
uses_external_libs
-replace_file types.h
add_file mux_qt.cpp
add_file mux_qt.h
diff --git a/modules/mux_qt/mux_qt.cpp b/modules/mux_qt/mux_qt.cpp
index 0d419d38a..e5c6d96ff 100644
--- a/modules/mux_qt/mux_qt.cpp
+++ b/modules/mux_qt/mux_qt.cpp
@@ -4,7 +4,6 @@
*************************************************/
#include <botan/mux_qt.h>
-#include <botan/exceptn.h>
#include <qmutex.h>
#if !defined(QT_THREAD_SUPPORT)
@@ -13,44 +12,29 @@
namespace Botan {
-/*************************************************
-* Wrapper Type for Qt Thread Mutex *
-*************************************************/
-struct mutex_wrapper
- {
- QMutex m;
- };
-
-/*************************************************
-* Constructor *
-*************************************************/
-Qt_Mutex::Qt_Mutex()
- {
- mutex = new mutex_wrapper;
- }
+namespace {
/*************************************************
-* Destructor *
+* Qt Mutex *
*************************************************/
-Qt_Mutex::~Qt_Mutex()
+class Qt_Mutex : public Mutex
{
- delete mutex;
- }
+ public:
+ void lock() { mutex.lock(); }
+ void unlock() { mutex.unlock(); }
+ private:
+ QMutex mutex;
+ };
-/*************************************************
-* Lock the Mutex *
-*************************************************/
-void Qt_Mutex::lock()
- {
- mutex->m.lock();
- }
+}
/*************************************************
-* Unlock the Mutex *
+* Qt Mutex Factory *
*************************************************/
-void Qt_Mutex::unlock()
+Mutex* Qt_Mutex_Factory::make()
{
- mutex->m.unlock();
+ return new Qt_Mutex();
}
}
+
diff --git a/modules/mux_qt/mux_qt.h b/modules/mux_qt/mux_qt.h
index 1535b3d36..5eb6f4987 100644
--- a/modules/mux_qt/mux_qt.h
+++ b/modules/mux_qt/mux_qt.h
@@ -1,5 +1,5 @@
/*************************************************
-* Qt Thread Mutex Header File *
+* Qt Mutex Header File *
* (C) 1999-2006 The Botan Project *
*************************************************/
@@ -13,17 +13,10 @@ namespace Botan {
/*************************************************
* Qt Mutex *
*************************************************/
-class Qt_Mutex : public Mutex
+class Qt_Mutex_Factory : public Mutex_Factory
{
public:
- void lock();
- void unlock();
- Mutex* clone() const { return new Qt_Mutex; }
-
- Qt_Mutex();
- ~Qt_Mutex();
- private:
- struct mutex_wrapper* mutex;
+ Mutex* make();
};
}
diff --git a/modules/mux_qt/types.h b/modules/mux_qt/types.h
deleted file mode 100644
index 9f1b40666..000000000
--- a/modules/mux_qt/types.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*************************************************
-* Low Level Types Header File *
-* (C) 1999-2006 The Botan Project *
-*************************************************/
-
-#ifndef BOTAN_TYPES_H__
-#define BOTAN_TYPES_H__
-
-#include <qglobal.h>
-
-namespace Botan {
-
-typedef Q_UINT8 byte;
-typedef Q_UINT16 u16bit;
-typedef Q_UINT32 u32bit;
-typedef Q_UINT64 u64bit;
-
-typedef Q_INT32 s32bit;
-}
-
-namespace Botan_types {
-
-typedef Botan::byte byte;
-typedef Botan::u32bit u32bit;
-
-}
-
-#endif