epoc32/include/mw/http/framework/cheadercodec.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 //
    15 
    16 /**
    17  @file CHeaderCodec.h
    18  @warning : This file contains Rose Model ID comments - please do not delete
    19 */
    20 
    21 #ifndef __CHEADERCODEC_H__
    22 #define __CHEADERCODEC_H__
    23 
    24 // System includes
    25 #include <e32base.h>
    26 #include <http/framework/rheaderfield.h>
    27 
    28 // Forward declarations
    29 class CHeaderWriter;
    30 class CHeaderReader;
    31 
    32 
    33 //##ModelId=3C4C18850126
    34 class CHeaderCodec : public CBase
    35 /**
    36 An abstract HTTP header codec.  
    37 
    38 Each instance of a concrete subclass of CHeaderCodec is associated with, and owned
    39 by, a specific	CProtocolHandler.  It provides on-demand encoding/decoding of
    40 HTTP header data, between the generic format used by clients/filters to formulate
    41 requests and interpret responses, and the raw format used by
    42 the transport handlers (and origin servers/gateways/etc.)
    43 
    44 The CHeaderCodec has an associated instance of a sub-class of each of
    45 CHeaderReader and CHeaderWriter.  It delegates the actual encoding and
    46 decoding function to these instances.
    47 
    48 Header codecs provide a mechanism for extensibility whereby if one codec can't
    49 decode (or encode) a given header, it locates a codec that can, and then delegates
    50 the task to that codec instead.
    51 @publishedAll
    52 @released
    53 */
    54 	{
    55 public: // methods
    56 
    57 /** 
    58 	Intended Usage:	Destructor - cleans up and releases resources to the system.
    59 */
    60 	//##ModelId=3C4C18850194
    61 	IMPORT_C virtual ~CHeaderCodec();
    62 
    63 /**
    64 	Encode the supplied header field.  This method uses the associated
    65 	concrete CHeaderWriter object to do a conversion of the field into
    66 	raw form from the generic internal representation.
    67 
    68 	@param aHeader (in) A proxy for the header field to be encoded
    69 	@leave KErrNotSupported if a codec that supports encoding this header
    70 		   cannot be found
    71 */
    72 	//##ModelId=3C4C1885018C
    73 	IMPORT_C void EncodeHeaderL(RHeaderField& aHeader) const;
    74 
    75 /**
    76 	Decode the supplied header field.  This method uses the associated
    77 	concrete CHeaderReader object to do a conversion of the field into
    78 	the generic internal representation from the raw form.
    79 
    80 	@param aHeader (in) A proxy for the header field to be decoded
    81 	
    82 	@leave KErrNotSupported if a codec that supports decoding this header
    83    		   cannot be found
    84 
    85 */
    86 	//##ModelId=3C4C1885018A
    87 	IMPORT_C void DecodeHeaderL(RHeaderField& aHeader) const;
    88 
    89 /**
    90 	Intended Usage: Concrete header codec classes must implement this method to
    91 	indicate to the framework whether their concrete CHeaderWriter is
    92 	capable of encoding the named header field.
    93 	@param aHeaderField	(in) A proxy for the header field to be encoded
    94 	@return A flag indicating ETrue if the field can be encoded.
    95 */
    96 	//##ModelId=3C4C18850181
    97 	virtual TBool CanEncode(RStringF aHeaderField) const = 0;
    98 
    99 /**
   100 	Intended Usage: Concrete header codec classes must implement this method to
   101 					indicate to the framework whether their concrete CHeaderReader is
   102 					capable of decoding the named header field.
   103 	@param			aHeaderField		(in) A proxy for the header field to be encoded
   104 	@return			A flag indicating ETrue if the field can be decoded.
   105  */
   106 	//##ModelId=3C4C18850178
   107 	virtual TBool CanDecode(RStringF aHeaderField) const = 0;
   108 
   109 /**
   110 	Intended Usage: Concrete header codecs must be implement this method if they wish to
   111 					delegate the encoding/decoding of particular header fields to a
   112 					different codec.  
   113 					This would be done if the codec doesn't have the ability itself to
   114 					do the encode/decode but can locate an alternative that does. This 
   115 					function may leave with a Standard Symbian OS error code. eg. KErrNoMemory
   116 
   117 					The caller takes ownership of the returned codec.
   118 	@param aHeaderField (in) A proxy for the header field to be encoded
   119 	@return A pointer to the new CHeaderCodec, or NULL if one couldn't be found.
   120 	@leave KErrNoMemory, Not enough memory to create object.	
   121 */
   122 	//##ModelId=3C4C18850176
   123 	virtual CHeaderCodec* FindDelegateCodecL(RStringF aHeaderField) const = 0;
   124 
   125 protected: // methods
   126 
   127 /**
   128 	Default constructor.
   129  */
   130 	//##ModelId=3A914DF20273
   131 	IMPORT_C CHeaderCodec();
   132 
   133 /**
   134 	Second phase construction in which any necessary allocation is done
   135 	Implementations of this interface may leave with standard erros like KErrNoMemory if there is
   136 	insufficient memory for allocation in the second phase.
   137  */
   138 	//##ModelId=3C4C1885016E
   139 	IMPORT_C void ConstructL();
   140 
   141 protected: // attributes
   142 
   143 	/** The owned header writer object that does actual encoding of header fields.
   144 	*/
   145 	//##ModelId=3C4C18850164
   146 	CHeaderWriter* iWriter;
   147 
   148 	/** The owned header reader object that does actual decoding of header fields.
   149 	*/
   150 	//##ModelId=3C4C1885015A
   151 	CHeaderReader* iReader;
   152 
   153 private: // methods
   154 
   155 /**	
   156 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   157  */
   158 	//##ModelId=3C4C1885016D
   159 	inline virtual void Reserved1();
   160 
   161 /**	
   162 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   163  */
   164 	//##ModelId=3C4C1885016C
   165 	inline virtual void Reserved2();
   166 
   167 private: // attributes
   168 
   169 	/** The most recently-obtained delegate codec
   170 	*/
   171 	//##ModelId=3C4C18850150
   172 	mutable CHeaderCodec* iDelegateCodec;
   173 	};
   174 
   175 
   176 //##ModelId=3C4C188601D1
   177 class CHeaderWriter : public CBase
   178 /**
   179 An abstract HTTP header encoder.  CHeaderWriter provides an interface used by its
   180 owning codec to do conversion of header data from the generic internal header
   181 representation to the raw representation used for a particular protocol/transport.
   182 Specific sub-classes of CHeaderWriter are associated with specific protocol handlers.
   183 @publishedAll
   184 @released
   185 */
   186 	{
   187 public: // methods
   188 
   189 /** 
   190 	Intended Usage:	Destructor - cleans up and release resources to the system.
   191 */
   192 	//##ModelId=3C4C188601FC
   193 	IMPORT_C virtual ~CHeaderWriter();
   194 
   195 /**
   196 	Intended Usage:	Encodes the supplied header field.  This method does a conversion
   197 					of the field into raw form from the generic internal representation.
   198 
   199 					Implementations of this interface may leave with any of KErrNotSupported, KErrHttpEncodeDoWWWAuthenticate,
   200 					KErrHttpEncodeAuthorization, KErrHttpEncodeDoAge, KErrHttpEncodeDoVary, KErrHttpEncodeDoContentLanguage.
   201 
   202 					Specific header writer sub-classes must implement this method.
   203 	@param			aHeader		(in) A proxy for the header field to be encoded
   204  */
   205 	//##ModelId=3C4C188601FA
   206 	virtual void EncodeHeaderL(RHeaderField& aHeader) = 0;
   207 
   208 protected: // methods
   209 
   210 /**
   211 	Default constructor.
   212  */
   213 	IMPORT_C CHeaderWriter();
   214 
   215 /**
   216 	Second phase construction in which any necessary allocation is done
   217 	Implementations of this interface may leave with standard errors like KErrNoMemory.
   218  */
   219 	//##ModelId=3C4C188601F9
   220 	IMPORT_C void ConstructL();
   221 
   222 private: // methods
   223 
   224 /**	
   225 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   226  */
   227 	//##ModelId=3C4C188601F1
   228 	inline virtual void Reserved1();
   229 
   230 /**	
   231 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   232  */
   233 	//##ModelId=3C4C188601F0
   234 	inline virtual void Reserved2();
   235 	};
   236 
   237 
   238 //##ModelId=3C4C188602FE
   239 class CHeaderReader : public CBase
   240 /**
   241 An abstract HTTP header decoder.  CHeaderReader provides an interface used by its
   242 owning codec to do conversion of header data from the raw representation used for
   243 a particular protocol/transport to the generic internal header representation.
   244 Specific sub-classes of CHeaderWriter are associated with specific protocol
   245 handlers.
   246 @publishedAll
   247 @released
   248 */
   249 	{
   250 public: // methods
   251 
   252 /** 
   253 	Intended Usage:	Destructor - cleans up and release resources to the system.
   254 */
   255 	//##ModelId=3C4C1886031E
   256 	IMPORT_C virtual ~CHeaderReader();
   257 
   258 /**
   259 	Intended Usage:	Decodes the supplied header field.  This method does a conversion
   260 	of the field from the generic internal representation into raw form.
   261 
   262 	Specific header reader sub-classes must implement this method.
   263 
   264 	Implementations of this interface may leave with any of KErrHttpDecodeAccept, KErrHttpDecodeAcceptCharset, 
   265 	KErrHttpDecodeAcceptLanguage, KErrHttpDecodeAcceptEncoding, KErrNotSupported.
   266 
   267 	@param aHeader (in) A proxy for the header field to be decoded
   268 	
   269 */
   270 	//##ModelId=3C4C1886031C
   271 	virtual void DecodeHeaderL(RHeaderField& aHeader) = 0;
   272 
   273 protected: // methods
   274 
   275 /**
   276 	Default constructor.
   277  */
   278 	IMPORT_C CHeaderReader();
   279 
   280 /**
   281 	Second phase construction in which any necessary allocation is done
   282 	Implementations of this interface may leave with standard errors like KErrNoMemory.
   283  */
   284 	//##ModelId=3C4C18860315
   285 	IMPORT_C void ConstructL();
   286 
   287 private: // methods
   288 
   289 /**	
   290 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   291  */
   292 	//##ModelId=3C4C18860314
   293 	inline virtual void Reserved1();
   294 
   295 /**	
   296 	Intended Usage:	Reserve a slot in the v-table to preserve future BC
   297  */
   298 	//##ModelId=3C4C18860313
   299 	inline virtual void Reserved2();
   300 	};
   301 
   302 
   303 inline void CHeaderCodec::Reserved1()
   304 	{}
   305 inline void CHeaderCodec::Reserved2()
   306 	{}
   307 inline void CHeaderWriter::Reserved1()
   308 	{}
   309 inline void CHeaderWriter::Reserved2()
   310 	{}
   311 inline void CHeaderReader::Reserved1()
   312 	{}
   313 inline void CHeaderReader::Reserved2()
   314 	{}
   315 
   316 #endif /* __CHEADERCODEC_H__ */
   317