author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// A revised version of the CRegisteredParserDll class. This no longer uses a |
williamr@4 | 15 |
// reference to a CParserRegistrationData object. Instead a UidType is passed in |
williamr@4 | 16 |
// the constructor, or through a set method. The class is used to find the file |
williamr@4 | 17 |
// which contains a parser, to load and maintain a reference count of the number of |
williamr@4 | 18 |
// objects using the dll, so that it can be unloaded when no longer required. |
williamr@4 | 19 |
// It will also unload the dll when a new parser is required. |
williamr@4 | 20 |
// |
williamr@4 | 21 |
// |
williamr@4 | 22 |
|
williamr@4 | 23 |
|
williamr@4 | 24 |
|
williamr@4 | 25 |
#ifndef __REGPSDLL_H__ |
williamr@4 | 26 |
#define __REGPSDLL_H__ |
williamr@4 | 27 |
|
williamr@4 | 28 |
|
williamr@4 | 29 |
|
williamr@4 | 30 |
#include <e32base.h> |
williamr@4 | 31 |
|
williamr@4 | 32 |
// forward declarations |
williamr@4 | 33 |
class RWriteStream; |
williamr@4 | 34 |
class RReadStream; |
williamr@4 | 35 |
class RFs; |
williamr@4 | 36 |
|
williamr@4 | 37 |
// |
williamr@4 | 38 |
// Real non-derivable class |
williamr@4 | 39 |
// |
williamr@4 | 40 |
class CRegisteredParserDll : public CTimer |
williamr@4 | 41 |
/** Finds, loads and maintains a reference count of client processes for a BIO |
williamr@4 | 42 |
parser DLL. |
williamr@4 | 43 |
|
williamr@4 | 44 |
When the reference count falls to 0, the class is also responsible for unloading |
williamr@4 | 45 |
the DLL. The public interface for this class is used only by CBIOServerMtm. |
williamr@4 | 46 |
@publishedAll |
williamr@4 | 47 |
@released |
williamr@4 | 48 |
*/ |
williamr@4 | 49 |
{ |
williamr@4 | 50 |
public: |
williamr@4 | 51 |
IMPORT_C static CRegisteredParserDll* NewL(TDesC& aParserName); |
williamr@4 | 52 |
|
williamr@4 | 53 |
IMPORT_C ~CRegisteredParserDll(); |
williamr@4 | 54 |
|
williamr@4 | 55 |
inline TInt DllRefCount() const; |
williamr@4 | 56 |
inline TUidType UidType() const; |
williamr@4 | 57 |
inline void SetUidType(const TUidType& aUidType); |
williamr@4 | 58 |
|
williamr@4 | 59 |
IMPORT_C TInt GetLibrary(RFs& aFs,RLibrary& aDllLibrary); // Increments reference count if successful or returns error |
williamr@4 | 60 |
IMPORT_C void ReleaseLibrary(); // Decrements access count |
williamr@4 | 61 |
// Should be called from destructor of any objects created from the library |
williamr@4 | 62 |
private: |
williamr@4 | 63 |
CRegisteredParserDll(const TDesC& aParserName); |
williamr@4 | 64 |
void ConstructL(); |
williamr@4 | 65 |
|
williamr@4 | 66 |
void LoadLibraryL(RFs& aFs); |
williamr@4 | 67 |
TInt FindFullName(RFs& aFs,TDes& aFullName); |
williamr@4 | 68 |
|
williamr@4 | 69 |
private: |
williamr@4 | 70 |
TUidType iUidType; |
williamr@4 | 71 |
TPtrC iParserName; |
williamr@4 | 72 |
RLibrary iParserDllLibrary; |
williamr@4 | 73 |
TInt iDllRefCount; |
williamr@4 | 74 |
|
williamr@4 | 75 |
void RunL(); |
williamr@4 | 76 |
enum { KReleaseLibraryTimeout = 30000000 }; |
williamr@4 | 77 |
}; |
williamr@4 | 78 |
|
williamr@4 | 79 |
#include <regpsdll.inl> |
williamr@4 | 80 |
#endif |