diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/plugin_8h_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/plugin_8h_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,69 @@ + + +
+ +00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +00002 // All rights reserved. +00003 // This component and the accompanying materials are made available +00004 // under the terms of "Eclipse Public License v1.0" +00005 // which accompanies this distribution, and is available +00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". +00007 // +00008 // Initial Contributors: +00009 // Nokia Corporation - initial contribution. +00010 // +00011 // Contributors: +00012 // +00013 // Description: +00014 // Transient server example - plugin class +00015 // +00016 +00017 #ifndef __PLUGIN_H__ +00018 #define __PLUGIN_H__ +00019 +00020 #include <e32std.h> +00021 +00022 template <class T> class CPlugIn +00023 { +00024 typedef T* (*TFactoryL)(); +00025 public: +00026 static T* NewL(const TDesC& aDllName); +00027 void Close(); +00028 protected: +00029 inline virtual ~CPlugIn() {} +00030 private: +00031 RLibrary iLibrary; +00032 }; +00033 +00034 template <class T> T* CPlugIn<T>::NewL(const TDesC& aDllName) +00035 { +00036 RLibrary l; +00037 User::LeaveIfError(l.Load(aDllName)); +00038 CleanupClosePushL(l); +00039 T* plugin=TFactoryL(l.Lookup(1))(); +00040 static_cast<CPlugIn<T>*>(plugin)->iLibrary=l; +00041 CleanupStack::Pop(); +00042 return plugin; +00043 } +00044 +00045 template <class T> void CPlugIn<T>::Close() +00046 { +00047 RLibrary l(iLibrary); +00048 delete this; +00049 l.Close(); +00050 } +00051 +00052 #endif +00053 +