|
1 // Copyright (c) 2001-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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file contains the API definition for the classes TUriC8 and |
|
15 // CUri8. These classes provide non-modifying (TUriC8) and modifying |
|
16 // (CUri8) functionality for the components of a Uri as described in |
|
17 // RFC2396. |
|
18 // |
|
19 // |
|
20 |
|
21 /** |
|
22 @file Uri8.h |
|
23 @publishedAll |
|
24 @released |
|
25 */ |
|
26 |
|
27 #ifndef __URI8_H__ |
|
28 #define __URI8_H__ |
|
29 |
|
30 // System includes |
|
31 // |
|
32 #include <e32base.h> |
|
33 #include <f32file.h> |
|
34 #include <uricommon.h> |
|
35 |
|
36 |
|
37 /** |
|
38 Dependencies : TUriComponent. |
|
39 Comments : Provides non-modifying functionality on the components of a uri object as |
|
40 defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment. |
|
41 |
|
42 The object holds descriptor pointers to the parsed uri components and a descriptor pointer |
|
43 to the uri. It is non-owning. It uses 8-bit descriptors. |
|
44 |
|
45 The functionality provided by this API allows the uri components to be extracted from the |
|
46 parsed uri, checked for their presence in the uri and be compared with those in another |
|
47 TUriC8 object. |
|
48 @publishedAll |
|
49 @released |
|
50 @since 6.0 |
|
51 */ |
|
52 class TUriC8 |
|
53 { |
|
54 public: // Methods |
|
55 |
|
56 IMPORT_C HBufC* GetFileNameL() const; |
|
57 IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const; |
|
58 |
|
59 IMPORT_C const TDesC8& Extract(TUriComponent aComponent) const; |
|
60 IMPORT_C void UriWithoutFragment(TPtrC8& aUriNoFrag) const; |
|
61 |
|
62 IMPORT_C TBool IsPresent(TUriComponent aComponent) const; |
|
63 IMPORT_C TBool IsSchemeValid() const; |
|
64 IMPORT_C TInt Compare(const TUriC8& aUri, TUriComponent aComponent) const; |
|
65 |
|
66 IMPORT_C const TDesC8& UriDes() const; |
|
67 |
|
68 IMPORT_C TInt Validate() const; |
|
69 IMPORT_C TInt Equivalent(const TUriC8& aUri) const; |
|
70 IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const; |
|
71 |
|
72 protected: // Methods |
|
73 |
|
74 IMPORT_C TUriC8(); |
|
75 void Reset(); |
|
76 |
|
77 protected: // Attributes |
|
78 |
|
79 /** The array of descriptor pointers to the uri components. |
|
80 */ |
|
81 TPtrC8 iComponent[EUriMaxComponents]; |
|
82 |
|
83 /** The descriptor pointer to the uri. |
|
84 */ |
|
85 TPtrC8 iUriDes; |
|
86 |
|
87 /** |
|
88 A friend class. |
|
89 @see CUri8 |
|
90 @since 6.0 |
|
91 */ |
|
92 friend class CUri8; |
|
93 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
94 /** |
|
95 A friend class used for testing. |
|
96 @see TUriC8StateAccessor |
|
97 @since 6.0 |
|
98 */ |
|
99 #else |
|
100 /** |
|
101 A friend class used for testing. |
|
102 @see TUriC8StateAccessor |
|
103 @since 6.0 |
|
104 @internalComponent |
|
105 */ |
|
106 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
107 friend class TUriC8StateAccessor; |
|
108 |
|
109 }; |
|
110 |
|
111 /** |
|
112 Dependencies : TUriC8 |
|
113 Comments : Provides functionality to parse a descriptor into the components of a uri as |
|
114 defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment. |
|
115 |
|
116 It uses 8-bit descriptors. |
|
117 |
|
118 Format of a uri is; scheme://authority path?query\#fragment |
|
119 |
|
120 @warning The descriptor that is parsed by an object of this class will be referenced |
|
121 by that object. If the original descriptor is no longer in scope there will be undefined |
|
122 behaviour. |
|
123 @publishedAll |
|
124 @released |
|
125 @since 6.0 |
|
126 */ |
|
127 class TUriParser8 : public TUriC8 |
|
128 { |
|
129 public: // Methods |
|
130 |
|
131 IMPORT_C TUriParser8(); |
|
132 |
|
133 IMPORT_C TInt Parse(const TDesC8& aUri); |
|
134 |
|
135 private: // Methods |
|
136 void RetrieveScheme(const TPtrC8& aUri, TPtrC8& aScheme); |
|
137 }; |
|
138 |
|
139 class CUri8 : public CBase |
|
140 /** |
|
141 Dependencies : CBase, TUriC8. |
|
142 Comments : Provides modifying functionality on the components of a uri object, as |
|
143 defined in RFC2396. There are 5 components; scheme. authority, path, query and fragment. |
|
144 |
|
145 The object holds parsed uri information. It is owning. It uses 8-bit descriptors. |
|
146 |
|
147 The functionality provided by this API allows the uri components to be set or removed |
|
148 from this parsed uri. Also, it provides a reference to TUriC8 object so that the non-modifying |
|
149 functionality can be used. |
|
150 @publishedAll |
|
151 @released |
|
152 @since 6.0 |
|
153 */ |
|
154 { |
|
155 public: // Methods |
|
156 |
|
157 IMPORT_C static CUri8* CreateFileUriL(const TDesC& aFullFileName, TUint aFlags = 0); |
|
158 IMPORT_C static CUri8* CreatePrivateFileUriL(const TDesC& aRelativeFileName, TDriveNumber aDrive, TInt aFlags = 0); |
|
159 |
|
160 IMPORT_C static CUri8* NewL(const TUriC8& aUri); |
|
161 IMPORT_C static CUri8* NewLC(const TUriC8& aUri); |
|
162 IMPORT_C static CUri8* NewL(); |
|
163 IMPORT_C static CUri8* NewLC(); |
|
164 |
|
165 IMPORT_C static CUri8* ResolveL(const TUriC8& aBaseUri, const TUriC8& aRefUri); |
|
166 |
|
167 IMPORT_C ~CUri8(); |
|
168 |
|
169 IMPORT_C const TUriC8& Uri() const; |
|
170 IMPORT_C void SetComponentL(const TDesC8& aData, TUriComponent aComponent); |
|
171 IMPORT_C void RemoveComponentL(TUriComponent aComponent); |
|
172 |
|
173 private: // Methods |
|
174 |
|
175 CUri8(const TUriC8& aNewUri); |
|
176 void ConstructL(); |
|
177 void FormUriL(); |
|
178 void InitializeFileUriComponentsL(const TDesC& aFileName, TDriveNumber aDrive, TUint aFlags); |
|
179 |
|
180 private: // Attributes |
|
181 |
|
182 /** The descriptor buffer that contains the uri. |
|
183 */ |
|
184 HBufC8* iUriBuf; |
|
185 |
|
186 /** The parsed uri object. |
|
187 */ |
|
188 TUriC8 iUri; |
|
189 |
|
190 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
191 /** |
|
192 A friend class used for testing. |
|
193 @see TUri8StateAccessor |
|
194 @since 6.0 |
|
195 */ |
|
196 #else |
|
197 /** |
|
198 A friend class used for testing. |
|
199 @see TUri8StateAccessor |
|
200 @since 6.0 |
|
201 @internalComponent |
|
202 */ |
|
203 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
204 friend class TUri8StateAccessor; |
|
205 |
|
206 }; |
|
207 |
|
208 #endif // __URI8_H__ |