epoc32/include/uri8.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     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".
     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 
    23 /**
    24  @file Uri8.h
    25  @publishedAll
    26  @released
    27 */
    28 
    29 #ifndef __URI8_H__
    30 #define __URI8_H__
    31 
    32 // System includes
    33 //
    34 #include <e32base.h>
    35 #include <f32fsys.h>
    36 #include <uricommon.h>
    37 
    38 
    39 /**
    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.
    43 
    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.
    46 
    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 
    49 TUriC8 object.
    50 @publishedAll
    51 @released
    52 @since 6.0
    53 */
    54 class TUriC8
    55 	{
    56 public:	// Methods
    57 
    58 	IMPORT_C HBufC* GetFileNameL() const;
    59 	IMPORT_C HBufC* GetFileNameL(TUriFileName aType) const;
    60 
    61 	IMPORT_C const TDesC8& Extract(TUriComponent aComponent) const;
    62 	IMPORT_C void UriWithoutFragment(TPtrC8& aUriNoFrag) const;
    63 
    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;
    67 
    68 	IMPORT_C const TDesC8& UriDes() const;
    69 
    70 	IMPORT_C TInt Validate() const;
    71 	IMPORT_C TInt Equivalent(const TUriC8& aUri) const;
    72 	IMPORT_C HBufC* DisplayFormL(TUriComponent aComponent = EUriComplete) const;
    73 
    74 protected:	// Methods
    75 
    76 	IMPORT_C TUriC8();
    77 	void Reset();
    78 
    79 protected:	// Attributes
    80 
    81 	/** The array of descriptor pointers to the uri components.
    82 	*/
    83 	TPtrC8		iComponent[EUriMaxComponents];
    84 
    85 	/** The descriptor pointer to the uri.
    86 	*/
    87 	TPtrC8		iUriDes;
    88 
    89 /**
    90 	A friend class.
    91 	@see		CUri8 
    92 	@since		6.0
    93  */
    94 	friend class CUri8;
    95 
    96 /**
    97 	A friend class used for testing.
    98 	@see		TUriC8StateAccessor
    99 	@since		6.0
   100 	@internalComponent
   101  */
   102 	friend class TUriC8StateAccessor;
   103 
   104 	};
   105 
   106 /**
   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.
   110 
   111 It uses 8-bit descriptors.
   112 
   113 Format of a uri is; scheme://authority path?query\#fragment
   114 
   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 
   117 behaviour.
   118 @publishedAll
   119 @released
   120 @since 6.0
   121 */
   122 class TUriParser8 : public TUriC8
   123 	{
   124 public:	// Methods
   125 
   126 	IMPORT_C TUriParser8();
   127 
   128 	IMPORT_C TInt Parse(const TDesC8& aUri);
   129 
   130 private:	// Methods	
   131 	void RetrieveScheme(const TPtrC8& aUri, TPtrC8& aScheme);
   132 	};
   133 
   134 class CUri8 : public CBase
   135 /**
   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.
   139 
   140 The	object holds parsed uri information. It is owning. It uses 8-bit descriptors.
   141 
   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.
   145 @publishedAll
   146 @released
   147 @since 6.0
   148 */
   149 	{
   150 public: // Methods
   151 
   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);
   154 	
   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();
   159 
   160 	IMPORT_C static CUri8* ResolveL(const TUriC8& aBaseUri, const TUriC8& aRefUri);
   161 
   162 	IMPORT_C ~CUri8();
   163 
   164 	IMPORT_C const TUriC8& Uri() const;
   165 	IMPORT_C void SetComponentL(const TDesC8& aData, TUriComponent aComponent);
   166 	IMPORT_C void RemoveComponentL(TUriComponent aComponent);
   167 
   168 private:	// Methods
   169 
   170 	CUri8(const TUriC8& aNewUri);
   171 	void ConstructL();
   172 	void FormUriL();
   173 	void InitializeFileUriComponentsL(const TDesC& aFileName, TDriveNumber aDrive, TUint aFlags);
   174 
   175 private:	// Attributes
   176 
   177 	/** The descriptor buffer that contains the uri.
   178 	 */
   179 	HBufC8*	iUriBuf;
   180 
   181 	/** The parsed uri object.
   182 	 */
   183 	TUriC8	iUri;
   184 
   185 /**
   186 	A friend class used for testing.
   187 	@see		TUri8StateAccessor
   188 	@since		6.0
   189 	@internalComponent
   190  */
   191 	friend class TUri8StateAccessor;
   192 
   193 	};
   194 
   195 #endif	// __URI8_H__