genericservices/httputils/inc/Uri16.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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 TUriC16 and 
       
    15 // CUri16. These classes provide non-modifying (TUriC16) and modifying
       
    16 // (CUri16) functionality for the components of a Uri as described in 
       
    17 // RFC2396.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file Uri16.h
       
    23  @publishedAll
       
    24  @deprecated Deprecated in 9.1
       
    25 */
       
    26 
       
    27 #ifndef __URI16_H__
       
    28 #define __URI16_H__
       
    29 
       
    30 // System includes
       
    31 //
       
    32 #include <e32base.h>
       
    33 #include <f32file.h> 
       
    34 #include <uricommon.h>
       
    35 
       
    36 
       
    37 class TUriC16
       
    38 /**
       
    39 	Dependencies : TUriComponent.
       
    40 	Comments : Provides non-modifying functionality on the components of a uri object as
       
    41 	defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
       
    42 
       
    43 The	object holds descriptor pointers to the parsed uri components and a descriptor pointer 
       
    44 to the uri. It is non-owning. It uses 16-bit descriptors.
       
    45 
       
    46 	The functionality provided by this API allows the uri components to be extracted from the 
       
    47 	parsed uri, checked for their presence in the uri and be compared with those in another 
       
    48 	TUriC16 object.
       
    49 	@publishedAll
       
    50 	@deprecated Deprecated in 9.1
       
    51 	@since 6.0
       
    52 */
       
    53 	{
       
    54 public:	// Methods
       
    55 
       
    56 	IMPORT_C HBufC* GetFileNameL() const;
       
    57 	IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const;
       
    58 	IMPORT_C const TDesC16& Extract(TUriComponent aComponent) const;
       
    59 	IMPORT_C void UriWithoutFragment(TPtrC16& aUriNoFrag) const;
       
    60 
       
    61 	IMPORT_C TBool IsPresent(TUriComponent aComponent) const;
       
    62 	IMPORT_C TBool IsSchemeValid() const;
       
    63 
       
    64 	IMPORT_C TInt Compare(const TUriC16& aUri, TUriComponent aComponent) const;
       
    65 
       
    66 	IMPORT_C const TDesC16& UriDes() const;
       
    67 
       
    68 	IMPORT_C TInt Validate() const;
       
    69 	IMPORT_C TInt Equivalent(const TUriC16& aUri) const;
       
    70 	IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const;
       
    71 
       
    72 protected:	// Methods
       
    73 
       
    74 	IMPORT_C TUriC16();
       
    75 
       
    76 	void Reset();
       
    77 	
       
    78 private:	// Methods
       
    79 	
       
    80 	TInt ValidateL() const;
       
    81 	TInt EquivalentL(const TDesC16& aUri) const;
       
    82 
       
    83 protected:	// Attributes
       
    84 
       
    85 	/** The array of descriptor pointers to the uri components.
       
    86 	 */
       
    87 	TPtrC16		iComponent[EUriMaxComponents];
       
    88 
       
    89 	/** The descriptor pointer to the uri.
       
    90 	 */
       
    91 	TPtrC16		iUriDes;
       
    92 
       
    93 /**
       
    94 	A friend class.
       
    95 	@see		CUri16 
       
    96 	@since		6.0
       
    97  */
       
    98 	friend class CUri16;
       
    99 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   100 /**
       
   101 	A friend class used for testing.
       
   102 	@see		TUriC16StateAccessor
       
   103 	@since		6.0	
       
   104  */
       
   105 #else
       
   106 /**
       
   107 	A friend class used for testing.
       
   108 	@see		TUriC16StateAccessor
       
   109 	@since		6.0
       
   110 	@internalComponent
       
   111  */
       
   112 #endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
       
   113 	friend class TUriC16StateAccessor;
       
   114 
       
   115 	};
       
   116 
       
   117 /**
       
   118 Dependencies : TUriC16
       
   119 Comments : Provides functionality to parse a descriptor into the components of a uri as 
       
   120 defined in RFC2396. There are 5 components; scheme, authority, path, query and fragment.
       
   121 
       
   122 It uses 16-bit descriptors.
       
   123 
       
   124 Format of a uri is; scheme://authority path?query\#fragment
       
   125 
       
   126 @warning The descriptor that is parsed by an object of this class will be referenced 
       
   127 by that object. If the original descriptor is no longer in scope there will be undefined 
       
   128 behaviour.
       
   129 @publishedAll
       
   130 @deprecated Deprecated in 9.1. Use UriUtils::CreateUriL() instead
       
   131 @since 6.0
       
   132 */
       
   133 class TUriParser16 : public TUriC16
       
   134 	{
       
   135 public:	// Methods
       
   136 
       
   137 	IMPORT_C TUriParser16();
       
   138 	IMPORT_C TInt Parse(const TDesC16& aUri);
       
   139 	};
       
   140 
       
   141 /**
       
   142 	Dependencies : CBase, TUriC16.
       
   143 	Comments : Provides modifying functionality on the components of a uri object, as
       
   144 	defined in RFC2396. There are 5 components; scheme. authority, path, query and fragment.
       
   145 
       
   146 	The	object holds parsed uri information. It is owning. It uses 16-bit descriptors.
       
   147 
       
   148 	The functionality provided by this API allows the uri components to be set or removed 
       
   149 	from this parsed uri. Also, it provides a reference to TUriC16 object so that the non-modifying 
       
   150 	functionality can be used.
       
   151 	@publishedAll
       
   152 	@deprecated Deprecated in 9.1
       
   153 	@since 6.0
       
   154 */
       
   155 class CUri16 : public CBase
       
   156 	{
       
   157 public: // Methods
       
   158 	IMPORT_C static CUri16* CreateFileUriL(const TDesC& aFullFileName, TUint aFlags = 0);
       
   159 	IMPORT_C static CUri16* CreatePrivateFileUriL(const TDesC& aRelativeFileName, TDriveNumber aDrive, TInt aFlags = 0);
       
   160 
       
   161 	IMPORT_C static CUri16* NewL(const TUriC16& aUri);
       
   162 	IMPORT_C static CUri16* NewLC(const TUriC16& aUri);
       
   163 	IMPORT_C static CUri16* NewL();
       
   164 	IMPORT_C static CUri16* NewLC();
       
   165 
       
   166 	IMPORT_C static CUri16* ResolveL(const TUriC16& aBaseUri, const TUriC16& aRefUri);
       
   167 
       
   168 	IMPORT_C ~CUri16();
       
   169 	IMPORT_C const TUriC16& Uri() const;
       
   170 	IMPORT_C void SetComponentL(const TDesC16& aData, TUriComponent aComponent);
       
   171 	IMPORT_C void RemoveComponentL(TUriComponent aComponent);
       
   172 
       
   173 private:	// Methods
       
   174 
       
   175 	CUri16(const TUriC16& 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 	HBufC16*	iUriBuf;
       
   185 
       
   186 	/** The parsed uri object.
       
   187 	 */
       
   188 	TUriC16	iUri;
       
   189 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
       
   190 /**
       
   191 	A friend class used for testing.
       
   192 	@see		TUri16StateAccessor
       
   193 	@since		6.0	
       
   194  */
       
   195 #else
       
   196 /**
       
   197 	A friend class used for testing.
       
   198 	@see		TUri16StateAccessor
       
   199 	@since		6.0
       
   200 	@internalComponent
       
   201  */
       
   202 #endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
       
   203 	friend class TUri16StateAccessor;
       
   204 
       
   205 	};
       
   206 
       
   207 /** 	
       
   208 Do not use. Use TUriC8 instead
       
   209 @publishedAll
       
   210 @deprecated Deprecated in 9.1 
       
   211  */
       
   212 typedef TUriC16			TUriC;
       
   213 
       
   214 /** 
       
   215 Do not use. Use TUriParser8 instead
       
   216 @publishedAll
       
   217 @deprecated Deprecated in 9.1 
       
   218  */
       
   219 typedef TUriParser16	TUriParser;
       
   220 
       
   221 /** 
       
   222 Do not use. Use CUri8 instead
       
   223 @publishedAll
       
   224 @deprecated Deprecated in 9.1 
       
   225  */
       
   226 typedef CUri16			CUri;
       
   227 
       
   228 #endif	// __URI16_H__