|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declarations of text recognizer class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TXTRECOG_H |
|
20 #define TXTRECOG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <apmrec.h> |
|
24 |
|
25 // CLASS DECLARATION |
|
26 /** |
|
27 * Series 60 "text/plain" recognizer. |
|
28 * Mime recognizer for "text/plain". |
|
29 * |
|
30 */ |
|
31 const TInt KTxtRecognizerImplementationUid = 0x100059ab; |
|
32 class CKthreeTextRecognizer : public CApaDataRecognizerType |
|
33 { |
|
34 public: // Constructor |
|
35 |
|
36 /** |
|
37 * Constructor. |
|
38 */ |
|
39 CKthreeTextRecognizer(); |
|
40 |
|
41 ~CKthreeTextRecognizer(); |
|
42 |
|
43 static CKthreeTextRecognizer* NewL( ); |
|
44 |
|
45 |
|
46 public: // Functions from base classes |
|
47 |
|
48 /** |
|
49 * From CApaDataRecognizerType. |
|
50 * Preferred byte size of sample content. |
|
51 */ |
|
52 TUint PreferredBufSize(); |
|
53 |
|
54 /** |
|
55 * From CApaDataRecognizerType. |
|
56 * Return mime type which this class supports to recognize. |
|
57 * |
|
58 * @param aIndex index. |
|
59 * @return always text/plain. |
|
60 */ |
|
61 TDataType SupportedDataTypeL(TInt aIndex) const; |
|
62 /** |
|
63 ** From CApaDataRecognizerType. |
|
64 */ |
|
65 |
|
66 static CApaDataRecognizerType* CreateRecognizerL(); |
|
67 |
|
68 private: // Functions from base classes |
|
69 |
|
70 /* |
|
71 // Two phase contructor |
|
72 // |
|
73 */ |
|
74 void ConstructL(); |
|
75 |
|
76 /** |
|
77 * From CApaDataRecognizerType. |
|
78 * This is a main part of recognization. |
|
79 * |
|
80 * @param aName file name. |
|
81 * @param aBuffer sample content. |
|
82 */ |
|
83 void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer); |
|
84 |
|
85 private: // New function |
|
86 |
|
87 /** |
|
88 * Check whether a byte is unlikely to be used in text file. |
|
89 * |
|
90 * @param aByte a byte to check. |
|
91 * @return ETrue if aByte is invalid as a text character. |
|
92 */ |
|
93 static TBool IsInvalidChar( const TUint8& aByte); |
|
94 |
|
95 TBool IsInBlackListL(TPtrC aExt); |
|
96 private: // Data |
|
97 |
|
98 TInt iResOffset; |
|
99 RPointerArray<HBufC> iResListData; |
|
100 }; |
|
101 |
|
102 #endif // TXTRECOG_H |
|
103 |
|
104 // End of File |