applayerpluginsandutils/httpprotocolplugins/httpheadercodec/chttpheaderreader.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2002-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 #ifndef __CHTTPHEADERREADER_H__
       
    17 #define __CHTTPHEADERREADER_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <stringpool.h>
       
    21 #include <http/framework/cheadercodec.h>
       
    22 
       
    23 
       
    24 class CHeaderFieldParam;
       
    25 
       
    26 /** CHTTPHeaderReader is used by its owning codec to do conversion of header data from the
       
    27 	plain-text raw representation to the generic format (of parts and parameters).
       
    28 */
       
    29 class CHttpHeaderReader : public CHeaderReader
       
    30 	{
       
    31 protected: // methods
       
    32 
       
    33 	CHttpHeaderReader(RStringPool aStrPool);
       
    34 
       
    35 
       
    36 	/** Splits generic type headers into strings based on position of the seprarator char, given as list of separators */
       
    37 	void DecodeGenericL(RHeaderField& aHeader, const TDesC8& aSeparator) const;
       
    38 	
       
    39 	void DecodeTokenListHeaderL(RHeaderField& aHeader, const TDesC8& aSep) const;
       
    40 
       
    41 	/** Decodes a generic numerical header. That is a header with one part that is a number */
       
    42 	void DecodeGenericNumberL(RHeaderField& aHeader) const;
       
    43     void DecodeDateL(RHeaderField& aHeader) const; 
       
    44 
       
    45 
       
    46 	/** Set in the specified header field a new part containing the supplied integer data.
       
    47 	    This will override any raw data or any existing part at the stated index.  Returns
       
    48 	    the new part that is created.
       
    49 	*/
       
    50 	CHeaderFieldPart* SetNewIntegerPartL(RHeaderField& aHeader, TInt aPartIndex, TInt aValue) const;
       
    51 
       
    52 	/** Set in the specified header field a new part containing the supplied date/time.  This
       
    53 	    will override any raw data or any existing part at the stated index, Returns the new
       
    54 	    part that is created.
       
    55 	*/
       
    56 	CHeaderFieldPart* SetNewDatePartL(RHeaderField& aHeader, TInt aPartIndex, TDateTime& date) const;
       
    57 
       
    58 	/** Set in the specified header field a new part containing the supplied string data. This
       
    59 	    will override any raw data or any existing part at the stated index, Returns the new
       
    60 	    part that is created.
       
    61 	*/
       
    62 	CHeaderFieldPart* SetNewFStringPartL(RHeaderField& aHeader, TInt aPartIndex, TPtrC8 aValue) const;
       
    63 
       
    64 	CHeaderFieldPart* SetNewStringPartL(RHeaderField& aHeader, TInt aPartIndex, TPtrC8 aValue) const;
       
    65 
       
    66 	/** Helper method for SetNewIntegerPartL(), SetNewDatePartL() and SetNewFStringPartL(),
       
    67 	    based on a supplied general HTTP header value. Returns the new part that is created.
       
    68 	*/
       
    69 	CHeaderFieldPart* SetNewPartL(RHeaderField& aHeader, TInt aPartIndex, THTTPHdrVal& aValue) const;
       
    70 
       
    71 	/** Set in the specified header field part a new parameter with the supplied name and
       
    72 	    string value.  Returns  the new parameter created.
       
    73 	*/
       
    74 	CHeaderFieldParam* SetNewFStringParamL(CHeaderFieldPart& aHeaderPart, TPtrC8 aParamName, TPtrC8 aParamValue) const;
       
    75 	CHeaderFieldParam* SetNewStringParamL(CHeaderFieldPart& aHeaderPart, TPtrC8 aParamName, TPtrC8 aParamValue) const;
       
    76 	CHeaderFieldParam* SetNewIntegerParamL(CHeaderFieldPart& aHeaderPart, TPtrC8 aParamName, TPtrC8 aParamValue) const;
       
    77 	
       
    78 	/** Set in the specified header field part parameter name.
       
    79 	*/
       
    80     void SetParamNameAndValueL(CHeaderFieldPart& aHeaderPart, const TDesC8& aParam, TBool aQuotedValueAllowed) const;
       
    81 
       
    82 	/** Parses name value pairs e.g. xx=yy
       
    83 	*/
       
    84 	TInt GetParamNameAndValueL(TPtrC8& aBuffer, TPtrC8& aName, TPtrC8& aValue, TInt aErrorCode) const;
       
    85 	
       
    86 
       
    87 protected: // attributes
       
    88 
       
    89 	RStringPool iStrPool;
       
    90 
       
    91 	RStringF iFieldName;
       
    92 
       
    93 	const TStringTable& iStringTable;
       
    94 	};
       
    95 
       
    96 #endif	// __CHTTPHEADERREADER_H__