|
1 /* |
|
2 * Copyright (c) 2009 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 * |
|
15 * Description: |
|
16 * The header file of the file type recognizer |
|
17 */ |
|
18 |
|
19 #ifndef FMFILERECOGNIZER_H |
|
20 #define FMFILERECOGNIZER_H |
|
21 |
|
22 #include <QString> |
|
23 #include <QList> |
|
24 #include <QStringList> |
|
25 #include <QMap> |
|
26 |
|
27 /*! |
|
28 \class FmFileTypeRecognizer |
|
29 \brief The class FmFileTypeRecognizer used to recognize file type by path. |
|
30 */ |
|
31 class FmFileTypeRecognizer |
|
32 { |
|
33 public: |
|
34 enum FileType{ |
|
35 FileTypeDrive, |
|
36 FileTypeFolder, |
|
37 FileTypeImage, |
|
38 FileTypeVideo, |
|
39 FileTypeTone, |
|
40 FileTypePlaylist, |
|
41 FileTypeText, |
|
42 FileTypeSisx, |
|
43 FileTypeJava, |
|
44 FileTypeFlash, |
|
45 FileTypeWidget, |
|
46 FileTypeWebLink, |
|
47 FileTypeUnKnown |
|
48 }; |
|
49 |
|
50 |
|
51 public: |
|
52 FmFileTypeRecognizer(); |
|
53 virtual ~FmFileTypeRecognizer(); |
|
54 |
|
55 /*! |
|
56 Recognize file type, currently only judge file by its extension name. |
|
57 */ |
|
58 FmFileTypeRecognizer::FileType getType( const QString& path ) const ; |
|
59 |
|
60 /*! |
|
61 Profide a list of extension name by designate the FileType. |
|
62 */ |
|
63 const QStringList getFileListFromFileType( const FmFileTypeRecognizer::FileType fileType ) const; |
|
64 |
|
65 private: |
|
66 // used to store FileType, extension name list pare. |
|
67 QMap<FileType, QStringList> mFileTypeMap; |
|
68 |
|
69 // used to store single extension name, FileType pare. |
|
70 // this map comes from mFileTypeMap |
|
71 QMap<QString, FileType> mFileExtensionMap; |
|
72 }; |
|
73 |
|
74 #endif /* FMDRIVEDETAILSTYPE_H */ |
|
75 |