Update contrib.
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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined (__APMFNDR_H__)
19 #if !defined(__E32BASE_H__)
22 #if !defined(__F32FILE_H__)
25 #if !defined(__APMREC_H__)
36 class CApaRecognizerDll;
38 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
39 /** This is a special priority that overrides any user settings. Applications must
40 have EWriteDeviceData to use this priority. If they have not then they will be
41 downgraded to KDataTypePriorityNormal.
45 @see TDataTypeWithPriority */
46 const TInt32 KDataTypePrioritySystem = 0xFFF9;
49 class CApaDataRecognizer : public CBase
55 IMPORT_C TDataRecognitionResult RecognizeL(const TDesC& aName, const TDesC8& aBuffer);
56 IMPORT_C TDataRecognitionResult RecognizeL(RFile& aFile, TInt aPreferredBufSize);
57 IMPORT_C TBool RecognizeL(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType);
58 IMPORT_C TBool RecognizeL(RFile& aFile, TInt aPreferredBufSize, const TDataType& aDataType);
59 IMPORT_C ~CApaDataRecognizer();
60 IMPORT_C TInt PreferredBufSize() const;
61 IMPORT_C void DataTypeL(CDataTypeArray& aArray);
62 IMPORT_C void UpdateDataTypesL();
63 IMPORT_C TInt AcceptedConfidence() const;
64 IMPORT_C void SetAcceptedConfidence(TInt aConfidence);
65 inline void SetFilePassedByHandle(RFile* aFilePassedByHandle) {iFilePassedByHandle=aFilePassedByHandle;}
66 inline RFile* FilePassedByHandle() {return iFilePassedByHandle;}
68 IMPORT_C CApaDataRecognizer(RFs& aFs);
69 IMPORT_C void AddDataRecognizerTypeL(CApaDataRecognizerType* aDataRecognizerType);
70 inline void AddDataRecognizerType(CApaDataRecognizerType* aDataRecognizerType);
71 IMPORT_C TInt RemoveDataRecognizerType(const CApaDataRecognizerType* aDataRecognizerType);
72 IMPORT_C void DestroyRecognizerList();
74 void AddDataTypeL(const TDataType& aDataType);
75 TDataRecognitionResult RecognizeL(TDataToRecognize& aDataToRecognize);
76 TBool RecognizeL(TDataToRecognize& aDataToRecognize, const TDataType& aDataType);
77 TBool DoRecognize(CApaDataRecognizerType* aDataRecognizerType, TDataToRecognize& aDataToRecognize, const TDataType& aDataType, TInt& aError);
80 // iMaxBufferSize is mutable to allow modification by PreferredBufSize() which is const.
81 mutable TInt iMaxBufferSize;
83 IMPORT_C virtual void CApaDataRecognizer_Reserved_1(); // shouldn't be necessary as the class is @internalTechnology
85 RPointerArray<CApaDataRecognizerType> iDataRecognizerList;
86 RArray<TDataType> iDataArray;
87 TInt iAcceptedConfidence;
88 TDataRecognitionResult iResult;
89 RFile* iFilePassedByHandle;
92 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS
94 class CApaScanningDataRecognizer : public CApaDataRecognizer
103 friend class CApaRecognizerDll;
104 friend class CT_MimeStep;
106 TRecognizer(HBufC* aName);
107 inline const TDesC& Name() const;
113 inline TRecognizer();
114 TRecognizer(const TRecognizer&);
115 TRecognizer operator=(const TRecognizer&);
119 typedef CArrayFixFlat<TRecognizer> CRecognizerArray;
122 class CApaBackupOperationObserver : public CBase, public MBackupOperationObserver
125 CApaBackupOperationObserver(CApaScanningDataRecognizer& aRecognizer);
126 ~CApaBackupOperationObserver();
127 void RegisterObserverL();
129 virtual void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes);
130 TInt UpdateCounter() const;
131 void SetUpdateCounter( TInt aValue );
133 CBaBackupSessionWrapper* iSession;
134 CApaScanningDataRecognizer& iRecognizer;
137 friend class CApaScanningDataRecognizer::CApaBackupOperationObserver;
139 class CApaScanningDataRecognizerExtra : public CBase
142 CApaBackupOperationObserver* iObserver;
143 TBool iRecognizersLoaded;
144 friend class CApaScanningDataRecognizer;
145 friend class CApaBackupOperationObserver;
150 IMPORT_C static CApaScanningDataRecognizer* NewL(RFs& aFs);
151 IMPORT_C static CApaScanningDataRecognizer* NewL(RFs& aFs, TBool aLoadDataRecognizers);
152 IMPORT_C ~CApaScanningDataRecognizer();
153 IMPORT_C void ScanForRecognizersL();
154 IMPORT_C TInt RecognizerCount();
155 IMPORT_C CRecognizerArray* RecognizerListLC()const;
156 IMPORT_C const TRecognizer& operator[](TInt aIndex)const;
157 IMPORT_C TInt UpdateCounter()const;
158 IMPORT_C void LoadRecognizersL();
159 IMPORT_C void UnloadRecognizers();
162 IMPORT_C CApaScanningDataRecognizer(RFs& aFs);
163 IMPORT_C void ConstructL();
165 void ConstructL(TBool aLoadDataRecognizers);
166 void ScanDriveL(TInt aDriveNum);
167 void LoadRecognizerL(const TDesC& aFullName,TUid aUid, const TTime& aTime);
168 TInt RemoveRecognizer(CApaRecognizerDll* aDll);
169 void LoadEcomRecognizerL(TDriveUnit& aDrive,TUid aUid);
170 void ScanForEcomRecognizersL();
172 IMPORT_C void SetEcomRecognizersFromListL(const CRecognizerArray& aList);
173 IMPORT_C void SetEcomRecognizerL(const TRecognizer& aRecognizer);
175 friend class CApaBackupObserver;
176 RPointerArray<CApaRecognizerDll> iRecognizerLib;
177 CApaScanningDataRecognizerExtra* iExtra;
180 //gmahe. This is not moved. Because it is not possible to forward declare
181 //the nested class used here - CApaScanningDataRecognizer::TRecognizer.
183 class CApaRecognizerDll : public CBase
189 CApaRecognizerDll(HBufC* aName);
190 ~CApaRecognizerDll(); // closes lib and deletes next
192 enum TPresence { ENotPresent, EIsPresent, ESuperseded };
195 CApaRecognizerDll* iNext;
196 CApaScanningDataRecognizer::TRecognizer iId; // cached so that this data can be accessed from other threads (RLibrary cant be used in this case)
197 CApaDataRecognizerType* iRec; // not ownership
206 inline const TDesC& CApaScanningDataRecognizer::TRecognizer::Name() const
211 inline CApaScanningDataRecognizer::TRecognizer::TRecognizer()
215 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
216 // Deprecated - Use CApaDataRecognizer::AddDataRecognizerTypeL instead
217 // as adding a concrete recognizer into the list could leave.
221 inline void CApaDataRecognizer::AddDataRecognizerType(CApaDataRecognizerType* aDataRecognizerType)
223 AddDataRecognizerTypeL(aDataRecognizerType);
225 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS