1 apmstd.h |
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 (__APMSTD_H__) |
|
17 #define __APMSTD_H__ |
|
18 |
|
19 #if !defined(__E32STD_H__) |
|
20 #include <e32std.h> |
|
21 #endif |
|
22 |
|
23 /** |
|
24 @publishedAll |
|
25 @released |
|
26 */ |
|
27 const TInt KMaxDataTypeLength=256; |
|
28 |
|
29 // classes referenced |
|
30 class RReadStream; |
|
31 class RWriteStream; |
|
32 |
|
33 /** Defines the priority associated with a data type. |
|
34 |
|
35 The priority is used by a device to resolve the current preferred handler |
|
36 of a data type, in the absence of any user preferences. |
|
37 |
|
38 @publishedAll |
|
39 @released |
|
40 @see TDataTypeWithPriority */ |
|
41 typedef TInt32 TDataTypePriority; |
|
42 |
|
43 /** Reserved for future use. |
|
44 |
|
45 @publishedAll |
|
46 @released */ |
|
47 const TInt32 KDataTypePriorityUserSpecified=KMaxTInt16; |
|
48 |
|
49 /** This is a special priority that overrides any user settings. Applications must |
|
50 have EWriteDeviceData to use this priority. If they have not then they will be |
|
51 downgraded to KDataTypePriorityNormal. |
|
52 |
|
53 @publishedPartner |
|
54 @released |
|
55 @see TDataTypeWithPriority */ |
|
56 const TInt32 KDataTypePrioritySystem = 0xFFF9; |
|
57 |
|
58 /** Trusted applications may use this priority value to ensure |
|
59 their MIME type associations cannot be overridden by |
|
60 self signed (untrusted) applications. |
|
61 |
|
62 @publishedAll |
|
63 @released |
|
64 @see TDataTypeWithPriority */ |
|
65 const TInt32 KDataTypePriorityTrustedHigh = 0xC000; |
|
66 |
|
67 /** This is Threshold priority for Un-Trusted apps i.e., for the applications which reside |
|
68 in \\private\\10003a3f\\import\\apps and have a SID which is in the unprotected range. This is to avoid Un-Trusted app's claiming for priority higher |
|
69 than the threshold, if they claim for priority higher than the Threshold then it would be |
|
70 reduced to KDataTypeUnTrustedPriorityThreshold. |
|
71 |
|
72 @publishedAll |
|
73 @released */ |
|
74 const TInt32 KDataTypeUnTrustedPriorityThreshold=KMaxTInt16; |
|
75 |
|
76 /** A priority value associated with a data (MIME) type. Associating an application |
|
77 with a data type at this priority means that this application, and no other, |
|
78 should ever handle the data type. Use sparingly. |
|
79 |
|
80 @publishedAll |
|
81 @released |
|
82 @see TDataTypeWithPriority */ |
|
83 const TInt32 KDataTypePriorityHigh=10000; |
|
84 |
|
85 /** A priority value associated with a data (MIME) type. Associating an application |
|
86 with a data type at this priority means that the data type is the primary |
|
87 type for that application. For example, "text/plain" files for a text editor. |
|
88 |
|
89 @publishedAll |
|
90 @released |
|
91 @see TDataTypeWithPriority */ |
|
92 const TInt32 KDataTypePriorityNormal=0; |
|
93 |
|
94 /** A priority value associated with a data (MIME) type. Associating an application |
|
95 with a data type at this priority means that the data type is a secondary |
|
96 type for that application. For example, "text/plain" files for a web browser. |
|
97 |
|
98 @publishedAll |
|
99 @released |
|
100 @see TDataTypeWithPriority */ |
|
101 const TInt32 KDataTypePriorityLow=-10000; |
|
102 |
|
103 /** A priority value associated with a data (MIME) type. Associating an application |
|
104 with a data type at this priority means that the data type is a last resort |
|
105 for that application. Use sparingly. |
|
106 |
|
107 @publishedAll |
|
108 @released |
|
109 @see TDataTypeWithPriority */ |
|
110 const TInt32 KDataTypePriorityLastResort=-20000; |
|
111 |
|
112 /** Reserved for future use. |
|
113 |
|
114 @publishedAll |
|
115 @released */ |
|
116 const TInt32 KDataTypePriorityNotSupported=KMinTInt16; |
|
117 |
|
118 |
|
119 class TDataType |
|
120 /** A data type. |
|
121 |
|
122 The class maintains a string that describes the data type and an associated |
|
123 UID. |
|
124 |
|
125 A data type is also referred to as a MIME type. |
|
126 |
|
127 @publishedAll |
|
128 @released */ |
|
129 { |
|
130 public: |
|
131 IMPORT_C TDataType(); |
|
132 IMPORT_C TDataType(const TDataType& aDataType); |
|
133 IMPORT_C TDataType(const TDesC8& aDataType); |
|
134 IMPORT_C TDataType(TUid aUid); |
|
135 // enquiry |
|
136 IMPORT_C TInt operator==(const TDataType& aDataType) const; |
|
137 IMPORT_C TInt operator!=(const TDataType& aDataType) const; |
|
138 IMPORT_C TBool IsNative() const; |
|
139 // |
|
140 IMPORT_C TBuf<KMaxDataTypeLength> Des() const; |
|
141 IMPORT_C TPtrC8 Des8() const; |
|
142 IMPORT_C TUid Uid() const; |
|
143 // |
|
144 IMPORT_C void InternalizeL(RReadStream& aReadStream); |
|
145 IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; |
|
146 private: |
|
147 void ParseDes(); |
|
148 private: |
|
149 TBuf8<KMaxDataTypeLength> iDataType; |
|
150 TUid iUid; |
|
151 }; |
|
152 |
|
153 /** |
|
154 @internalComponent |
|
155 */ |
|
156 #define KApaAppTypeDes _L8("x-epoc/x-app") |
|
157 |
|
158 /** |
|
159 @internalComponent |
|
160 */ |
|
161 _LIT8(KEpocUrlDataTypeHeader, "X-Epoc-Url/"); |
|
162 |
|
163 |
|
164 |
|
165 class TDataTypeWithPriority |
|
166 /** A data (MIME) type and a priority value for that data type. |
|
167 |
|
168 The priority is used to resolve the current preferred handler of a data type, |
|
169 in the absence of any user preferences. An AIF file can associate an application |
|
170 with a data (MIME) type that is not native to Symbian OS. A priority value |
|
171 can be specified that allows the device to choose the highest priority application |
|
172 that can handle that data type. |
|
173 |
|
174 @publishedAll |
|
175 @released |
|
176 @see TDataType |
|
177 @see TDataTypePriority */ |
|
178 { |
|
179 public: |
|
180 IMPORT_C TDataTypeWithPriority(); |
|
181 IMPORT_C TDataTypeWithPriority(const TDataType& aDataType, TDataTypePriority aPriority); |
|
182 // |
|
183 IMPORT_C void InternalizeL(RReadStream& aReadStream); |
|
184 IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const; |
|
185 public: |
|
186 /** The data type. */ |
|
187 TDataType iDataType; |
|
188 /** The priority value. */ |
|
189 TDataTypePriority iPriority; |
|
190 }; |
|
191 |
|
192 #endif |