NativeTestFactory.h

00001 /*
00002  * @(#)NativeTestFactory.h  0.2.0 / 2007-09-07
00003  *
00004  * Copyright (c) 2007, ETF and contributors. All rights reserved.
00005  *
00006  * This software is licensed under the LGPL, version 2.1, license.
00007  * A copy of the license is included in the file LICENSE-LGPL.txt.
00008  */
00009 #ifndef NATIVETESTFACTORY_H
00010 #define NATIVETESTFACTORY_H
00011 
00012 #ifdef JAVAQX_TEST
00013 
00014 #include "NativeTest.h"
00015 
00016 /*^**************************************************************************^*/
00017 /*- AbstractNativeTestFactory Class.                                         -*/
00018 /*^**************************************************************************^*/
00019 
00026 class JAVAQX_EXPORT AbstractNativeTestFactory
00027 {
00028 protected:
00029   inline AbstractNativeTestFactory(const QString &name);
00030 public:
00031   inline QString name() const;
00032 public:
00033   virtual NativeTest *createNativeTest() = 0;
00034 private:
00035   QString m_name;
00036 };
00037 
00038 /*^**************************************************************************^*/
00039 /*- AbstractNativeTestFactory :: Protected Inline Constructor.               -*/
00040 /*^**************************************************************************^*/
00041 
00047 inline AbstractNativeTestFactory::AbstractNativeTestFactory(const QString &name)
00048   : m_name(name)
00049 {
00050   // empty constructor body
00051 }
00052 
00053 /*^**************************************************************************^*/
00054 /*- AbstractNativeTestFactory :: Public Inline Member Function.              -*/
00055 /*^**************************************************************************^*/
00056 
00062 inline QString AbstractNativeTestFactory::name() const
00063 {
00064   return m_name;
00065 }
00066 
00073 template<class T>
00074 class JAVAQX_EXPORT NativeTestFactory : public AbstractNativeTestFactory
00075 {
00076 public:
00077   NativeTestFactory(const QString &name) : AbstractNativeTestFactory(name) {
00078     // empty constructor body
00079   }
00080 public:
00081   virtual NativeTest *createNativeTest() {
00082     return new T();
00083   }
00084 };
00085 
00086 #endif // JAVAQX_TEST
00087 
00088 #endif // NATIVETESTFACTORY_H
00089 
00090 /*^*****************************************************************************
00091   File History:
00092 
00093  - 2007-09-07 18:25:20 Slobodan
00094    Initial version
00095 
00096 *****************************************************************************^*/

Copyright © 2007 ETF and contributors. All Rights Reserved.