os/ossrv/genericservices/httputils/UriParser/TEquiv.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// File contains internal classes for comparing two URIs to determine
sl@0
    15
// if they identify the same resource
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file TEquiv.h
sl@0
    21
 @see Uri8.h
sl@0
    22
*/
sl@0
    23
sl@0
    24
#ifndef __TEQUIV_H__
sl@0
    25
#define __TEQUIV_H__
sl@0
    26
sl@0
    27
#include <uri8.h>
sl@0
    28
#include <delimitedparser8.h>
sl@0
    29
sl@0
    30
/**
sl@0
    31
	Comments : 
sl@0
    32
	
sl@0
    33
	@internalComponent
sl@0
    34
	@released
sl@0
    35
*/
sl@0
    36
class TEquiv
sl@0
    37
	{
sl@0
    38
public:
sl@0
    39
	enum THeaderType
sl@0
    40
		{
sl@0
    41
		EHeaderNormal,
sl@0
    42
		EHeaderId,
sl@0
    43
		EHeaderContact,
sl@0
    44
		EHeaderEncoding,
sl@0
    45
		EHeaderLength,
sl@0
    46
		EHeaderType,
sl@0
    47
		EHeaderFrom,
sl@0
    48
		EHeaderSubject,
sl@0
    49
		EHeaderTo
sl@0
    50
		};
sl@0
    51
sl@0
    52
public:
sl@0
    53
	TEquiv(const TUriC8& aLhs, const TUriC8& aRhs);
sl@0
    54
	TInt EquivalentL() const;
sl@0
    55
sl@0
    56
protected:
sl@0
    57
	// Default implementation is for network schemes
sl@0
    58
	// Overide the following methods where appropriate for other schemes
sl@0
    59
	virtual TBool IsMatchSchemeL() const;
sl@0
    60
	virtual TBool IsMatchUserInfoL() const;
sl@0
    61
	virtual TBool IsMatchHostL() const;
sl@0
    62
	virtual TBool IsMatchPortL() const;
sl@0
    63
	virtual TBool IsMatchPathL() const;
sl@0
    64
	virtual TBool IsMatchQueryL() const;
sl@0
    65
	virtual TBool IsMatchFragmentL() const;
sl@0
    66
sl@0
    67
	// general utility methods
sl@0
    68
	HBufC8* DecodedSegmentLC(const TUriC8& aUri, TUriComponent aSegmentType) const;
sl@0
    69
	inline TBool IsMatchCaseless(const TDesC8& aLhs, const TDesC8& aRhs) const;
sl@0
    70
	inline TBool IsMatchCaseSensitive(const TDesC8& aLhs, const TDesC8& aRhs) const;
sl@0
    71
sl@0
    72
protected:
sl@0
    73
	const TUriC8& iLhs;
sl@0
    74
	const TUriC8& iRhs;
sl@0
    75
	};
sl@0
    76
sl@0
    77
/**
sl@0
    78
	Comments : This class provides the functionality for Comparing SIP URIs.
sl@0
    79
	
sl@0
    80
	@internalComponent
sl@0
    81
	@released
sl@0
    82
*/
sl@0
    83
class TEquivSip: public TEquiv
sl@0
    84
	{
sl@0
    85
public:
sl@0
    86
	TEquivSip(const TUriC8& aLhs, const TUriC8& aRhs);
sl@0
    87
	// from TEquiv
sl@0
    88
private:
sl@0
    89
	virtual TBool IsMatchHostL() const;
sl@0
    90
	virtual TBool IsMatchPathL() const;
sl@0
    91
	virtual TBool IsMatchQueryL() const;
sl@0
    92
	virtual TBool IsMatchFragmentL() const;
sl@0
    93
sl@0
    94
	// supporting methods
sl@0
    95
	void RemoveLeadingZeros(TPtr8 aHost) const;
sl@0
    96
	TBool IsMatchHostL(const TDesC8& aLhs, const TDesC8& aRhs) const;
sl@0
    97
	TBool IsParamCompatibleL(const TDesC8& aLhsName, const TDesC8& aLhsValue, const TDesC8& aRhsName, const TDesC8& aRhsValue) const;
sl@0
    98
	TBool IsParamListCompatibleL(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const;
sl@0
    99
	TInt ListLength(const TDelimitedParserBase8& aParser) const;
sl@0
   100
	TBool HasMoreParameters(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const;
sl@0
   101
	THeaderType HeaderType(const TDesC8& aHeaderName) const;
sl@0
   102
	TBool IsMatchHeader(const TDesC8& aLhs, const TDesC8& aRhs) const;
sl@0
   103
	TBool IsQueryListCompatible(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const;
sl@0
   104
};
sl@0
   105
sl@0
   106
inline TBool TEquiv::IsMatchCaseless(const TDesC8& aLhs, const TDesC8& aRhs) const
sl@0
   107
	{
sl@0
   108
	return (aLhs.CompareF(aRhs) == 0);
sl@0
   109
	}
sl@0
   110
sl@0
   111
inline TBool TEquiv::IsMatchCaseSensitive(const TDesC8& aLhs, const TDesC8& aRhs) const
sl@0
   112
	{
sl@0
   113
	return (aLhs.Compare(aRhs) == 0);
sl@0
   114
	}
sl@0
   115
sl@0
   116
#endif	// __TEQUIV_H__