|
1 /* |
|
2 * Copyright (c) 2007 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: Descriptor data handler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCDCONTENTDESCRIPTOR_H |
|
20 #define C_NCDCONTENTDESCRIPTOR_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 /** |
|
25 * Class for storing and handling descriptor data. |
|
26 */ |
|
27 class CNcdContentDescriptor : public CBase |
|
28 { |
|
29 public: |
|
30 /** |
|
31 * Constructor |
|
32 */ |
|
33 static CNcdContentDescriptor* NewL(); |
|
34 /** |
|
35 * Constructor |
|
36 */ |
|
37 static CNcdContentDescriptor* NewLC(); |
|
38 |
|
39 /** |
|
40 * Destructor |
|
41 */ |
|
42 ~CNcdContentDescriptor(); |
|
43 |
|
44 public: |
|
45 /** |
|
46 * Set descriptor and descriptor type |
|
47 * @param aDescriptorType Type of the descriptor |
|
48 * @param aDescriptor Descriptor |
|
49 */ |
|
50 void SetDescriptorL( const TDesC& aDescriptorType, |
|
51 const TDesC16& aDescriptor ); |
|
52 |
|
53 |
|
54 /** |
|
55 * Set descriptor and descriptor type |
|
56 * @param aDescriptorType Type of the descriptor |
|
57 * @param aDescriptor Descriptor |
|
58 */ |
|
59 void SetDescriptorL( const TDesC& aDescriptorType, |
|
60 const TDesC8& aDescriptor ); |
|
61 |
|
62 /** |
|
63 * Gets the data URI. |
|
64 * Data URI will be extracted from the descriptor only when this |
|
65 * function is called for the first time after SetDescriptorL(). |
|
66 * @return Data URI |
|
67 */ |
|
68 const TDesC& DataUriL(); |
|
69 |
|
70 /** |
|
71 * Gets the install notification URI. |
|
72 * Install notification URI will be extracted from the descriptor |
|
73 * only when this function is called for the first time after |
|
74 * SetDescriptorL(). |
|
75 * @return Install notification URI |
|
76 */ |
|
77 const TDesC& InstallNotificationUri(); |
|
78 |
|
79 /** |
|
80 * Gets the file name. |
|
81 * File name will be extracted from the descriptor only when this |
|
82 * function is called for the first time after SetDescriptorL(). |
|
83 * @return File name |
|
84 */ |
|
85 const TDesC& FileName(); |
|
86 |
|
87 /** |
|
88 * Gets the mime type. |
|
89 * Mime type will be extracted from the descriptor only when this |
|
90 * function is called for the first time after SetDescriptorL(). |
|
91 * @return Mime type |
|
92 */ |
|
93 const TDesC& MimeType(); |
|
94 |
|
95 /** |
|
96 * Gets the type of the descriptor. |
|
97 * @return Type of the descriptor |
|
98 */ |
|
99 const TDesC& DescriptorType() const; |
|
100 |
|
101 /** |
|
102 * Gets the descriptor. |
|
103 * @return Descriptor |
|
104 */ |
|
105 const TDesC& Descriptor() const; |
|
106 |
|
107 private: |
|
108 /** |
|
109 * Private constructor |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 /** |
|
114 * Extracts data from the descriptor. |
|
115 * If end tag is KNullDesC, extractor will get data from the |
|
116 * start tag to the end of line. If aMatch is given, next tag |
|
117 * with same name is extracted. If next tag not found, match |
|
118 * type is returned. |
|
119 * @param aStartTag Start tag of the extracted data |
|
120 * @param aEndTag End tag of the extracted data |
|
121 * @param aPattern Mime type pattern |
|
122 * @return Extracted mime type |
|
123 */ |
|
124 HBufC* ExtractDataL( const TDesC& aStartTag, const TDesC& aEndTag, |
|
125 const TDesC& aPattern = KNullDesC ); |
|
126 |
|
127 /** |
|
128 * Clears all member variables |
|
129 */ |
|
130 void ClearAllData(); |
|
131 |
|
132 private: |
|
133 // Type of the descriptor |
|
134 HBufC* iDescriptorType; |
|
135 // Descriptor |
|
136 HBufC* iDescriptor; |
|
137 |
|
138 // Data URI |
|
139 HBufC* iDataUri; |
|
140 // Install notification URI |
|
141 HBufC* iInstallNotificationUri; |
|
142 // File name |
|
143 HBufC* iFileName; |
|
144 // Mime name |
|
145 HBufC* iMimeType; |
|
146 }; |
|
147 |
|
148 #endif // C_NCDCONTENTDESCRIPTOR_H |