sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: // This file contains the API definition for the classes TUriC16 and 
sl@0: // CUri16. These classes provide non-modifying (TUriC16) and modifying
sl@0: // (CUri16) functionality for the components of a Uri as described in 
sl@0: // RFC2396.
sl@0: // 
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file Uri16.h
sl@0:  @publishedAll
sl@0:  @deprecated Deprecated in 9.1
sl@0: */
sl@0: 
sl@0: #ifndef __URI16_H__
sl@0: #define __URI16_H__
sl@0: 
sl@0: // System includes
sl@0: //
sl@0: #include <e32base.h>
sl@0: #include <f32file.h> 
sl@0: #include <uricommon.h>
sl@0: 
sl@0: 
sl@0: class TUriC16
sl@0: /**
sl@0: 	Dependencies : TUriComponent.
sl@0: 	Comments : Provides non-modifying functionality on the components of a uri object as
sl@0: 	defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
sl@0: 
sl@0: The	object holds descriptor pointers to the parsed uri components and a descriptor pointer 
sl@0: to the uri. It is non-owning. It uses 16-bit descriptors.
sl@0: 
sl@0: 	The functionality provided by this API allows the uri components to be extracted from the 
sl@0: 	parsed uri, checked for their presence in the uri and be compared with those in another 
sl@0: 	TUriC16 object.
sl@0: 	@publishedAll
sl@0: 	@deprecated Deprecated in 9.1
sl@0: 	@since 6.0
sl@0: */
sl@0: 	{
sl@0: public:	// Methods
sl@0: 
sl@0: 	IMPORT_C HBufC* GetFileNameL() const;
sl@0: 	IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const;
sl@0: 	IMPORT_C const TDesC16& Extract(TUriComponent aComponent) const;
sl@0: 	IMPORT_C void UriWithoutFragment(TPtrC16& aUriNoFrag) const;
sl@0: 
sl@0: 	IMPORT_C TBool IsPresent(TUriComponent aComponent) const;
sl@0: 	IMPORT_C TBool IsSchemeValid() const;
sl@0: 
sl@0: 	IMPORT_C TInt Compare(const TUriC16& aUri, TUriComponent aComponent) const;
sl@0: 
sl@0: 	IMPORT_C const TDesC16& UriDes() const;
sl@0: 
sl@0: 	IMPORT_C TInt Validate() const;
sl@0: 	IMPORT_C TInt Equivalent(const TUriC16& aUri) const;
sl@0: 	IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const;
sl@0: 
sl@0: protected:	// Methods
sl@0: 
sl@0: 	IMPORT_C TUriC16();
sl@0: 
sl@0: 	void Reset();
sl@0: 	
sl@0: private:	// Methods
sl@0: 	
sl@0: 	TInt ValidateL() const;
sl@0: 	TInt EquivalentL(const TDesC16& aUri) const;
sl@0: 
sl@0: protected:	// Attributes
sl@0: 
sl@0: 	/** The array of descriptor pointers to the uri components.
sl@0: 	 */
sl@0: 	TPtrC16		iComponent[EUriMaxComponents];
sl@0: 
sl@0: 	/** The descriptor pointer to the uri.
sl@0: 	 */
sl@0: 	TPtrC16		iUriDes;
sl@0: 
sl@0: /**
sl@0: 	A friend class.
sl@0: 	@see		CUri16 
sl@0: 	@since		6.0
sl@0:  */
sl@0: 	friend class CUri16;
sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: /**
sl@0: 	A friend class used for testing.
sl@0: 	@see		TUriC16StateAccessor
sl@0: 	@since		6.0	
sl@0:  */
sl@0: #else
sl@0: /**
sl@0: 	A friend class used for testing.
sl@0: 	@see		TUriC16StateAccessor
sl@0: 	@since		6.0
sl@0: 	@internalComponent
sl@0:  */
sl@0: #endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: 	friend class TUriC16StateAccessor;
sl@0: 
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: Dependencies : TUriC16
sl@0: Comments : Provides functionality to parse a descriptor into the components of a uri as 
sl@0: defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
sl@0: 
sl@0: It uses 16-bit descriptors.
sl@0: 
sl@0: Format of a uri is; scheme://authority path?query\#fragment
sl@0: 
sl@0: @warning The descriptor that is parsed by an object of this class will be referenced 
sl@0: by that object. If the original descriptor is no longer in scope there will be undefined 
sl@0: behaviour.
sl@0: @publishedAll
sl@0: @deprecated Deprecated in 9.1. Use UriUtils::CreateUriL() instead
sl@0: @since 6.0
sl@0: */
sl@0: class TUriParser16 : public TUriC16
sl@0: 	{
sl@0: public:	// Methods
sl@0: 
sl@0: 	IMPORT_C TUriParser16();
sl@0: 	IMPORT_C TInt Parse(const TDesC16& aUri);
sl@0: 	};
sl@0: 
sl@0: /**
sl@0: 	Dependencies : CBase, TUriC16.
sl@0: 	Comments : Provides modifying functionality on the components of a uri object, as
sl@0: 	defined in RFC2396. There are 5 components; scheme. authority, path, query and fragment.
sl@0: 
sl@0: 	The	object holds parsed uri information. It is owning. It uses 16-bit descriptors.
sl@0: 
sl@0: 	The functionality provided by this API allows the uri components to be set or removed 
sl@0: 	from this parsed uri. Also, it provides a reference to TUriC16 object so that the non-modifying 
sl@0: 	functionality can be used.
sl@0: 	@publishedAll
sl@0: 	@deprecated Deprecated in 9.1
sl@0: 	@since 6.0
sl@0: */
sl@0: class CUri16 : public CBase
sl@0: 	{
sl@0: public: // Methods
sl@0: 	IMPORT_C static CUri16* CreateFileUriL(const TDesC& aFullFileName, TUint aFlags = 0);
sl@0: 	IMPORT_C static CUri16* CreatePrivateFileUriL(const TDesC& aRelativeFileName, TDriveNumber aDrive, TInt aFlags = 0);
sl@0: 
sl@0: 	IMPORT_C static CUri16* NewL(const TUriC16& aUri);
sl@0: 	IMPORT_C static CUri16* NewLC(const TUriC16& aUri);
sl@0: 	IMPORT_C static CUri16* NewL();
sl@0: 	IMPORT_C static CUri16* NewLC();
sl@0: 
sl@0: 	IMPORT_C static CUri16* ResolveL(const TUriC16& aBaseUri, const TUriC16& aRefUri);
sl@0: 
sl@0: 	IMPORT_C ~CUri16();
sl@0: 	IMPORT_C const TUriC16& Uri() const;
sl@0: 	IMPORT_C void SetComponentL(const TDesC16& aData, TUriComponent aComponent);
sl@0: 	IMPORT_C void RemoveComponentL(TUriComponent aComponent);
sl@0: 
sl@0: private:	// Methods
sl@0: 
sl@0: 	CUri16(const TUriC16& aNewUri);
sl@0: 	void ConstructL();
sl@0: 	void FormUriL();
sl@0: 	void InitializeFileUriComponentsL(const TDesC& aFileName, TDriveNumber aDrive, TUint aFlags);
sl@0: 
sl@0: private:	// Attributes
sl@0: 
sl@0: 	/** The descriptor buffer that contains the uri.
sl@0: 	 */
sl@0: 	HBufC16*	iUriBuf;
sl@0: 
sl@0: 	/** The parsed uri object.
sl@0: 	 */
sl@0: 	TUriC16	iUri;
sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: /**
sl@0: 	A friend class used for testing.
sl@0: 	@see		TUri16StateAccessor
sl@0: 	@since		6.0	
sl@0:  */
sl@0: #else
sl@0: /**
sl@0: 	A friend class used for testing.
sl@0: 	@see		TUri16StateAccessor
sl@0: 	@since		6.0
sl@0: 	@internalComponent
sl@0:  */
sl@0: #endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: 	friend class TUri16StateAccessor;
sl@0: 
sl@0: 	};
sl@0: 
sl@0: /** 	
sl@0: Do not use. Use TUriC8 instead
sl@0: @publishedAll
sl@0: @deprecated Deprecated in 9.1 
sl@0:  */
sl@0: typedef TUriC16			TUriC;
sl@0: 
sl@0: /** 
sl@0: Do not use. Use TUriParser8 instead
sl@0: @publishedAll
sl@0: @deprecated Deprecated in 9.1 
sl@0:  */
sl@0: typedef TUriParser16	TUriParser;
sl@0: 
sl@0: /** 
sl@0: Do not use. Use CUri8 instead
sl@0: @publishedAll
sl@0: @deprecated Deprecated in 9.1 
sl@0:  */
sl@0: typedef CUri16			CUri;
sl@0: 
sl@0: #endif	// __URI16_H__