epoc32/include/uri8.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/uri8.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/uri8.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,195 @@
     1.4 -uri8.h
     1.5 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// 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
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +// This file contains the API definition for the classes TUriC8 and 
    1.19 +// CUri8. These classes provide non-modifying (TUriC8) and modifying
    1.20 +// (CUri8) functionality for the components of a Uri as described in 
    1.21 +// RFC2396.
    1.22 +// 
    1.23 +//
    1.24 +
    1.25 +
    1.26 +
    1.27 +/**
    1.28 + @file Uri8.h
    1.29 + @publishedAll
    1.30 + @released
    1.31 +*/
    1.32 +
    1.33 +#ifndef __URI8_H__
    1.34 +#define __URI8_H__
    1.35 +
    1.36 +// System includes
    1.37 +//
    1.38 +#include <e32base.h>
    1.39 +#include <f32fsys.h>
    1.40 +#include <uricommon.h>
    1.41 +
    1.42 +
    1.43 +/**
    1.44 +Dependencies : TUriComponent.
    1.45 +Comments : Provides non-modifying functionality on the components of a uri object as
    1.46 +defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
    1.47 +
    1.48 +The	object holds descriptor pointers to the parsed uri components and a descriptor pointer 
    1.49 +to the uri. It is non-owning. It uses 8-bit descriptors.
    1.50 +
    1.51 +The functionality provided by this API allows the uri components to be extracted from the 
    1.52 +parsed uri, checked for their presence in the uri and be compared with those in another 
    1.53 +TUriC8 object.
    1.54 +@publishedAll
    1.55 +@released
    1.56 +@since 6.0
    1.57 +*/
    1.58 +class TUriC8
    1.59 +	{
    1.60 +public:	// Methods
    1.61 +
    1.62 +	IMPORT_C HBufC* GetFileNameL() const;
    1.63 +	IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const;
    1.64 +
    1.65 +	IMPORT_C const TDesC8& Extract(TUriComponent aComponent) const;
    1.66 +	IMPORT_C void UriWithoutFragment(TPtrC8& aUriNoFrag) const;
    1.67 +
    1.68 +	IMPORT_C TBool IsPresent(TUriComponent aComponent) const;
    1.69 +	IMPORT_C TBool IsSchemeValid() const;
    1.70 +	IMPORT_C TInt Compare(const TUriC8& aUri, TUriComponent aComponent) const;
    1.71 +
    1.72 +	IMPORT_C const TDesC8& UriDes() const;
    1.73 +
    1.74 +	IMPORT_C TInt Validate() const;
    1.75 +	IMPORT_C TInt Equivalent(const TUriC8& aUri) const;
    1.76 +	IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const;
    1.77 +
    1.78 +protected:	// Methods
    1.79 +
    1.80 +	IMPORT_C TUriC8();
    1.81 +	void Reset();
    1.82 +
    1.83 +protected:	// Attributes
    1.84 +
    1.85 +	/** The array of descriptor pointers to the uri components.
    1.86 +	*/
    1.87 +	TPtrC8		iComponent[EUriMaxComponents];
    1.88 +
    1.89 +	/** The descriptor pointer to the uri.
    1.90 +	*/
    1.91 +	TPtrC8		iUriDes;
    1.92 +
    1.93 +/**
    1.94 +	A friend class.
    1.95 +	@see		CUri8 
    1.96 +	@since		6.0
    1.97 + */
    1.98 +	friend class CUri8;
    1.99 +
   1.100 +/**
   1.101 +	A friend class used for testing.
   1.102 +	@see		TUriC8StateAccessor
   1.103 +	@since		6.0
   1.104 +	@internalComponent
   1.105 + */
   1.106 +	friend class TUriC8StateAccessor;
   1.107 +
   1.108 +	};
   1.109 +
   1.110 +/**
   1.111 +Dependencies : TUriC8
   1.112 +Comments : Provides functionality to parse a descriptor into the components of a uri as 
   1.113 +defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
   1.114 +
   1.115 +It uses 8-bit descriptors.
   1.116 +
   1.117 +Format of a uri is; scheme://authority path?query\#fragment
   1.118 +
   1.119 +@warning The descriptor that is parsed by an object of this class will be referenced 
   1.120 +by that object. If the original descriptor is no longer in scope there will be undefined 
   1.121 +behaviour.
   1.122 +@publishedAll
   1.123 +@released
   1.124 +@since 6.0
   1.125 +*/
   1.126 +class TUriParser8 : public TUriC8
   1.127 +	{
   1.128 +public:	// Methods
   1.129 +
   1.130 +	IMPORT_C TUriParser8();
   1.131 +
   1.132 +	IMPORT_C TInt Parse(const TDesC8& aUri);
   1.133 +
   1.134 +private:	// Methods	
   1.135 +	void RetrieveScheme(const TPtrC8& aUri, TPtrC8& aScheme);
   1.136 +	};
   1.137 +
   1.138 +class CUri8 : public CBase
   1.139 +/**
   1.140 +Dependencies : CBase, TUriC8.
   1.141 +Comments : Provides modifying functionality on the components of a uri object, as
   1.142 +defined in RFC2396. There are 5 components; scheme. authority, path, query and fragment.
   1.143 +
   1.144 +The	object holds parsed uri information. It is owning. It uses 8-bit descriptors.
   1.145 +
   1.146 +The functionality provided by this API allows the uri components to be set or removed 
   1.147 +from this parsed uri. Also, it provides a reference to TUriC8 object so that the non-modifying 
   1.148 +functionality can be used.
   1.149 +@publishedAll
   1.150 +@released
   1.151 +@since 6.0
   1.152 +*/
   1.153 +	{
   1.154 +public: // Methods
   1.155 +
   1.156 +	IMPORT_C static CUri8* CreateFileUriL(const TDesC& aFullFileName, TUint aFlags = 0); 
   1.157 +	IMPORT_C static CUri8* CreatePrivateFileUriL(const TDesC& aRelativeFileName, TDriveNumber aDrive, TInt aFlags = 0);
   1.158 +	
   1.159 +	IMPORT_C static CUri8* NewL(const TUriC8& aUri);
   1.160 +	IMPORT_C static CUri8* NewLC(const TUriC8& aUri);
   1.161 +	IMPORT_C static CUri8* NewL();
   1.162 +	IMPORT_C static CUri8* NewLC();
   1.163 +
   1.164 +	IMPORT_C static CUri8* ResolveL(const TUriC8& aBaseUri, const TUriC8& aRefUri);
   1.165 +
   1.166 +	IMPORT_C ~CUri8();
   1.167 +
   1.168 +	IMPORT_C const TUriC8& Uri() const;
   1.169 +	IMPORT_C void SetComponentL(const TDesC8& aData, TUriComponent aComponent);
   1.170 +	IMPORT_C void RemoveComponentL(TUriComponent aComponent);
   1.171 +
   1.172 +private:	// Methods
   1.173 +
   1.174 +	CUri8(const TUriC8& aNewUri);
   1.175 +	void ConstructL();
   1.176 +	void FormUriL();
   1.177 +	void InitializeFileUriComponentsL(const TDesC& aFileName, TDriveNumber aDrive, TUint aFlags);
   1.178 +
   1.179 +private:	// Attributes
   1.180 +
   1.181 +	/** The descriptor buffer that contains the uri.
   1.182 +	 */
   1.183 +	HBufC8*	iUriBuf;
   1.184 +
   1.185 +	/** The parsed uri object.
   1.186 +	 */
   1.187 +	TUriC8	iUri;
   1.188 +
   1.189 +/**
   1.190 +	A friend class used for testing.
   1.191 +	@see		TUri8StateAccessor
   1.192 +	@since		6.0
   1.193 +	@internalComponent
   1.194 + */
   1.195 +	friend class TUri8StateAccessor;
   1.196 +
   1.197 +	};
   1.198 +
   1.199 +#endif	// __URI8_H__