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 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
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
36 #include <uricommon.h>
40 Dependencies : TUriComponent.
41 Comments : Provides non-modifying functionality on the components of a uri object as
42 defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
44 The object holds descriptor pointers to the parsed uri components and a descriptor pointer
45 to the uri. It is non-owning. It uses 8-bit descriptors.
47 The functionality provided by this API allows the uri components to be extracted from the
48 parsed uri, checked for their presence in the uri and be compared with those in another
58 IMPORT_C HBufC* GetFileNameL() const;
59 IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const;
61 IMPORT_C const TDesC8& Extract(TUriComponent aComponent) const;
62 IMPORT_C void UriWithoutFragment(TPtrC8& aUriNoFrag) const;
64 IMPORT_C TBool IsPresent(TUriComponent aComponent) const;
65 IMPORT_C TBool IsSchemeValid() const;
66 IMPORT_C TInt Compare(const TUriC8& aUri, TUriComponent aComponent) const;
68 IMPORT_C const TDesC8& UriDes() const;
70 IMPORT_C TInt Validate() const;
71 IMPORT_C TInt Equivalent(const TUriC8& aUri) const;
72 IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const;
79 protected: // Attributes
81 /** The array of descriptor pointers to the uri components.
83 TPtrC8 iComponent[EUriMaxComponents];
85 /** The descriptor pointer to the uri.
97 A friend class used for testing.
98 @see TUriC8StateAccessor
102 friend class TUriC8StateAccessor;
107 Dependencies : TUriC8
108 Comments : Provides functionality to parse a descriptor into the components of a uri as
109 defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
111 It uses 8-bit descriptors.
113 Format of a uri is; scheme://authority path?query\#fragment
115 @warning The descriptor that is parsed by an object of this class will be referenced
116 by that object. If the original descriptor is no longer in scope there will be undefined
122 class TUriParser8 : public TUriC8
126 IMPORT_C TUriParser8();
128 IMPORT_C TInt Parse(const TDesC8& aUri);
131 void RetrieveScheme(const TPtrC8& aUri, TPtrC8& aScheme);
134 class CUri8 : public CBase
136 Dependencies : CBase, TUriC8.
137 Comments : Provides modifying functionality on the components of a uri object, as
138 defined in RFC2396. There are 5 components; scheme. authority, path, query and fragment.
140 The object holds parsed uri information. It is owning. It uses 8-bit descriptors.
142 The functionality provided by this API allows the uri components to be set or removed
143 from this parsed uri. Also, it provides a reference to TUriC8 object so that the non-modifying
144 functionality can be used.
152 IMPORT_C static CUri8* CreateFileUriL(const TDesC& aFullFileName, TUint aFlags = 0);
153 IMPORT_C static CUri8* CreatePrivateFileUriL(const TDesC& aRelativeFileName, TDriveNumber aDrive, TInt aFlags = 0);
155 IMPORT_C static CUri8* NewL(const TUriC8& aUri);
156 IMPORT_C static CUri8* NewLC(const TUriC8& aUri);
157 IMPORT_C static CUri8* NewL();
158 IMPORT_C static CUri8* NewLC();
160 IMPORT_C static CUri8* ResolveL(const TUriC8& aBaseUri, const TUriC8& aRefUri);
164 IMPORT_C const TUriC8& Uri() const;
165 IMPORT_C void SetComponentL(const TDesC8& aData, TUriComponent aComponent);
166 IMPORT_C void RemoveComponentL(TUriComponent aComponent);
170 CUri8(const TUriC8& aNewUri);
173 void InitializeFileUriComponentsL(const TDesC& aFileName, TDriveNumber aDrive, TUint aFlags);
175 private: // Attributes
177 /** The descriptor buffer that contains the uri.
181 /** The parsed uri object.
186 A friend class used for testing.
187 @see TUri8StateAccessor
191 friend class TUri8StateAccessor;