epoc32/include/apmfndr.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined (__APMFNDR_H__)
       
    17 #define __APMFNDR_H__
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 #if !defined(__F32FILE_H__)
       
    23 #include <f32file.h>
       
    24 #endif
       
    25 #if !defined(__APMREC_H__)
       
    26 #include <apmrec.h>
       
    27 #endif
       
    28 
       
    29 #include <babackup.h>
       
    30 
       
    31 /**
       
    32 @internalComponent
       
    33 */
       
    34 
       
    35 // classes defined
       
    36 class CApaRecognizerDll;
       
    37 
       
    38 
       
    39 class CApaScanningDataRecognizer : public CApaDataRecognizer
       
    40 /**
       
    41 @publishedPartner 
       
    42 @released 
       
    43 */
       
    44 	{
       
    45 public:
       
    46 	class TRecognizer
       
    47 		{
       
    48 	friend class CApaRecognizerDll;
       
    49 	friend class CT_MimeStep;
       
    50 	public:
       
    51 		TRecognizer(HBufC* aName);
       
    52 		inline const TDesC& Name() const;
       
    53 	public:
       
    54 		TUid iUid;
       
    55 		TInt iDrive;
       
    56 		TTime iModified;
       
    57 	private:
       
    58 		inline TRecognizer();
       
    59 		TRecognizer(const TRecognizer&);
       
    60 		TRecognizer operator=(const TRecognizer&);
       
    61 	private:
       
    62 		HBufC* iName;
       
    63 		};
       
    64 	typedef CArrayFixFlat<TRecognizer> CRecognizerArray;
       
    65 
       
    66 private:
       
    67 	class CApaBackupOperationObserver : public CBase, public MBackupOperationObserver
       
    68 		{
       
    69 	public:
       
    70 		CApaBackupOperationObserver(CApaScanningDataRecognizer& aRecognizer);
       
    71 		~CApaBackupOperationObserver();
       
    72 		void RegisterObserverL();
       
    73 
       
    74 		virtual void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes);
       
    75 		TInt UpdateCounter() const;
       
    76 		void SetUpdateCounter( TInt aValue );
       
    77 	private:
       
    78 		CBaBackupSessionWrapper* iSession;
       
    79 		CApaScanningDataRecognizer& iRecognizer;
       
    80 		TInt iUpdateCounter;
       
    81 		};
       
    82 	friend class CApaScanningDataRecognizer::CApaBackupOperationObserver;
       
    83 
       
    84 	class CApaScanningDataRecognizerExtra : public CBase
       
    85 		{
       
    86 	private:
       
    87 		CApaBackupOperationObserver* iObserver;
       
    88 		TBool iRecognizersLoaded;
       
    89 		friend class CApaScanningDataRecognizer;
       
    90 		friend class CApaBackupOperationObserver;
       
    91 		};
       
    92 
       
    93 	//
       
    94 public:
       
    95 	IMPORT_C static CApaScanningDataRecognizer* NewL(RFs& aFs);
       
    96 	IMPORT_C static CApaScanningDataRecognizer* NewL(RFs& aFs, TBool aLoadDataRecognizers);
       
    97 	IMPORT_C ~CApaScanningDataRecognizer();
       
    98 	IMPORT_C void ScanForRecognizersL();
       
    99 	IMPORT_C TInt RecognizerCount();
       
   100 	IMPORT_C CRecognizerArray* RecognizerListLC()const;
       
   101 	IMPORT_C const TRecognizer& operator[](TInt aIndex)const;
       
   102 	IMPORT_C TInt UpdateCounter()const;
       
   103 	IMPORT_C void LoadRecognizersL();
       
   104 	IMPORT_C void UnloadRecognizers();
       
   105 
       
   106 protected:
       
   107 	IMPORT_C CApaScanningDataRecognizer(RFs& aFs);
       
   108 	IMPORT_C void ConstructL();
       
   109 private:
       
   110 	void ConstructL(TBool aLoadDataRecognizers);
       
   111 	void ScanDriveL(TInt aDriveNum);
       
   112 	void LoadRecognizerL(const TDesC& aFullName,TUid aUid, const TTime& aTime);
       
   113 	TInt RemoveRecognizer(CApaRecognizerDll* aDll);
       
   114 	void LoadEcomRecognizerL(TDriveUnit& aDrive,TUid aUid);
       
   115 	void ScanForEcomRecognizersL();
       
   116 public:
       
   117 	IMPORT_C void SetEcomRecognizersFromListL(const CRecognizerArray& aList);
       
   118 	IMPORT_C void SetEcomRecognizerL(const TRecognizer& aRecognizer); 
       
   119 private:
       
   120 	friend class CApaBackupObserver;
       
   121 	RPointerArray<CApaRecognizerDll> iRecognizerLib;
       
   122 	CApaScanningDataRecognizerExtra* iExtra;
       
   123 	};
       
   124 
       
   125 
       
   126 class CApaRecognizerDll : public CBase
       
   127 /**
       
   128 @internalTechnology
       
   129 */
       
   130 	{
       
   131 public:
       
   132 	CApaRecognizerDll(HBufC* aName);
       
   133 	~CApaRecognizerDll(); // closes lib and deletes next
       
   134 public:
       
   135 	enum TPresence { ENotPresent, EIsPresent, ESuperseded };
       
   136 public:
       
   137 	RLibrary iLibrary;
       
   138 	CApaRecognizerDll* iNext;
       
   139 	CApaScanningDataRecognizer::TRecognizer iId; // cached so that this data can be accessed from other threads (RLibrary cant be used in this case)
       
   140 	CApaDataRecognizerType* iRec; // not ownership
       
   141 	TPresence iPresent;
       
   142 	};
       
   143 
       
   144 //
       
   145 // inlines
       
   146 //
       
   147 
       
   148 inline const TDesC& CApaScanningDataRecognizer::TRecognizer::Name() const
       
   149 	{
       
   150 	return *iName;
       
   151 	}
       
   152 
       
   153 inline CApaScanningDataRecognizer::TRecognizer::TRecognizer()
       
   154 	{
       
   155 	}
       
   156 
       
   157 #endif