genericservices/httputils/inc/Authority8.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 TAuthorityC8 and
       
    15 // CAuthority8. These classes provide non-modifying (TAuthorityC8) and 
       
    16 // modifying (CAuthority8) functionality for the components of an
       
    17 // Authority as described in RFC2396.
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file Authority8.h
       
    23  @publishedAll
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef __AUTHORITY8_H__
       
    28 #define __AUTHORITY8_H__
       
    29 
       
    30 // System includes
       
    31 //
       
    32 #include <e32base.h>
       
    33 #include <authoritycommon.h>
       
    34 
       
    35 
       
    36 /**
       
    37 Dependencies : TAuthorityComponent.
       
    38 Comments : Provides non-modifying functionality on the components of an authority 
       
    39 object as defined in RFC2396. There are 3 components; userinfo, host and port.
       
    40 
       
    41 The	object holds descriptor pointers to the parsed authority components and a descriptor 
       
    42 pointer to the authority. It is non-owning. It uses 8-bit descriptors.
       
    43 
       
    44 The functionality provided by this API allows the authority components to be extracted
       
    45 from the parsed authority, checked for their presence in the authority and be compared 
       
    46 with those in another TAuthorityC8 object.
       
    47 @publishedAll
       
    48 @released
       
    49 @since 6.0
       
    50 */
       
    51 class TAuthorityC8
       
    52 	{
       
    53 public:	// Methods
       
    54 
       
    55 	IMPORT_C const TDesC8& Extract(TAuthorityComponent aComponent) const;
       
    56 	IMPORT_C TBool IsPresent(TAuthorityComponent aComponent) const;
       
    57 	IMPORT_C TInt Compare(const TAuthorityC8& aAuthority, TAuthorityComponent aComponent) const;
       
    58 	IMPORT_C const TDesC8& AuthorityDes() const;
       
    59 	IMPORT_C HBufC* DisplayFormL(TAuthorityComponent aComponent = EAuthorityComplete ) const;
       
    60 
       
    61 protected:	// Methods
       
    62 
       
    63 	IMPORT_C TAuthorityC8();
       
    64 	void Reset();
       
    65 
       
    66 protected:	// Attributes
       
    67 
       
    68 	/** 
       
    69 		The array of descriptor pointers to the authority components.
       
    70 	 */
       
    71 	TPtrC8	iComponent[EAuthorityMaxComponents];
       
    72 
       
    73 	/** 
       
    74 		The descriptor pointer to the authority.
       
    75 	 */
       
    76 	TPtrC8	iAuthorityDes;
       
    77 
       
    78 /**
       
    79 	A friend class.
       
    80 	@see		CAuthority8
       
    81 	@since		6.0
       
    82  */
       
    83 	friend class CAuthority8;
       
    84 
       
    85 /**
       
    86 	A friend class used for testing.
       
    87 	@see		TAuthorityC8StateAccessor
       
    88 	@since		6.0
       
    89  */
       
    90 	friend class TAuthorityC8StateAccessor;	
       
    91 
       
    92 	};
       
    93 
       
    94 /**
       
    95 Dependencies : TAuthorityC8
       
    96 Comments : Provides functionality to parse a descriptor into the components of an 
       
    97 authority as defined in RFC2396. There are 3 components; userinfo, host and port.
       
    98 
       
    99 This uses 8-bit descriptors.
       
   100 
       
   101 
       
   102 Format of an authority is; [userinfo@]host[:port]
       
   103 
       
   104 @warning The descriptor that is parsed by an object of this class will be referenced 
       
   105 by that object. If the original descriptor is no longer in scope there will be undefined 
       
   106 behaviour.
       
   107 @publishedAll
       
   108 @released
       
   109 @since 6.0
       
   110 */
       
   111 class TAuthorityParser8 : public TAuthorityC8
       
   112 	{
       
   113 public:	// Methods
       
   114 
       
   115 	IMPORT_C TAuthorityParser8();
       
   116 	IMPORT_C TInt Parse(const TDesC8& aAuthority);
       
   117 
       
   118 	};
       
   119 
       
   120 /**
       
   121 Dependencies : CBase, TAuthorityC8.
       
   122 Comments : Provides modifying functionality on the components of an authority object, as
       
   123 defined in RFC2396. There are 3 components; userinfo, host and port.
       
   124 
       
   125 The	object holds parsed authority information. It is owning. It uses 8-bit descriptors.
       
   126 
       
   127 The functionality provided by this API allows the authority components to be set or removed 
       
   128 from this parsed authority. Also, it provides a reference to TAuthorityC8 object so that 
       
   129 the non-modifying functionality can be used.
       
   130 @publishedAll
       
   131 @released
       
   132 @since 6.0
       
   133 */
       
   134 class CAuthority8 : public CBase
       
   135 	{
       
   136 public: // Methods
       
   137 
       
   138 	IMPORT_C static CAuthority8* NewL(const TAuthorityC8& aAuthority);
       
   139 	IMPORT_C static CAuthority8* NewLC(const TAuthorityC8& aAuthority);
       
   140 	IMPORT_C static CAuthority8* NewL();
       
   141 	IMPORT_C static CAuthority8* NewLC();
       
   142 	IMPORT_C ~CAuthority8();
       
   143 
       
   144 	IMPORT_C const TAuthorityC8& Authority() const;
       
   145 	IMPORT_C void SetComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
       
   146 	IMPORT_C void SetAndEscapeComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
       
   147 	IMPORT_C void RemoveComponentL(TAuthorityComponent aComponent);
       
   148 
       
   149 private:	// Methods
       
   150 
       
   151 	CAuthority8(const TAuthorityC8& aAuthority);
       
   152 	void ConstructL();
       
   153 	void FormAuthorityL();
       
   154 
       
   155 private:	// Attributes
       
   156 
       
   157 	/** 
       
   158 		The descriptor buffer that contains the authority.
       
   159 	 */
       
   160 	HBufC8*			iAuthorityBuf;
       
   161 
       
   162 	/** 
       
   163 		The parsed authority object.
       
   164 	 */
       
   165 	TAuthorityC8	iAuthority;
       
   166 
       
   167 /**
       
   168 	A friend class used for testing.
       
   169 	@see		TAuthority8StateAccessor
       
   170 	@since		6.0
       
   171  */
       
   172 	friend class TAuthority8StateAccessor;
       
   173 
       
   174 	};
       
   175 
       
   176 #endif	// __AUTHORITY8_H__