sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // File contains internal classes for comparing two URIs to determine sl@0: // if they identify the same resource sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file TEquiv.h sl@0: @see Uri8.h sl@0: */ sl@0: sl@0: #ifndef __TEQUIV_H__ sl@0: #define __TEQUIV_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: Comments : sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class TEquiv sl@0: { sl@0: public: sl@0: enum THeaderType sl@0: { sl@0: EHeaderNormal, sl@0: EHeaderId, sl@0: EHeaderContact, sl@0: EHeaderEncoding, sl@0: EHeaderLength, sl@0: EHeaderType, sl@0: EHeaderFrom, sl@0: EHeaderSubject, sl@0: EHeaderTo sl@0: }; sl@0: sl@0: public: sl@0: TEquiv(const TUriC8& aLhs, const TUriC8& aRhs); sl@0: TInt EquivalentL() const; sl@0: sl@0: protected: sl@0: // Default implementation is for network schemes sl@0: // Overide the following methods where appropriate for other schemes sl@0: virtual TBool IsMatchSchemeL() const; sl@0: virtual TBool IsMatchUserInfoL() const; sl@0: virtual TBool IsMatchHostL() const; sl@0: virtual TBool IsMatchPortL() const; sl@0: virtual TBool IsMatchPathL() const; sl@0: virtual TBool IsMatchQueryL() const; sl@0: virtual TBool IsMatchFragmentL() const; sl@0: sl@0: // general utility methods sl@0: HBufC8* DecodedSegmentLC(const TUriC8& aUri, TUriComponent aSegmentType) const; sl@0: inline TBool IsMatchCaseless(const TDesC8& aLhs, const TDesC8& aRhs) const; sl@0: inline TBool IsMatchCaseSensitive(const TDesC8& aLhs, const TDesC8& aRhs) const; sl@0: sl@0: protected: sl@0: const TUriC8& iLhs; sl@0: const TUriC8& iRhs; sl@0: }; sl@0: sl@0: /** sl@0: Comments : This class provides the functionality for Comparing SIP URIs. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class TEquivSip: public TEquiv sl@0: { sl@0: public: sl@0: TEquivSip(const TUriC8& aLhs, const TUriC8& aRhs); sl@0: // from TEquiv sl@0: private: sl@0: virtual TBool IsMatchHostL() const; sl@0: virtual TBool IsMatchPathL() const; sl@0: virtual TBool IsMatchQueryL() const; sl@0: virtual TBool IsMatchFragmentL() const; sl@0: sl@0: // supporting methods sl@0: void RemoveLeadingZeros(TPtr8 aHost) const; sl@0: TBool IsMatchHostL(const TDesC8& aLhs, const TDesC8& aRhs) const; sl@0: TBool IsParamCompatibleL(const TDesC8& aLhsName, const TDesC8& aLhsValue, const TDesC8& aRhsName, const TDesC8& aRhsValue) const; sl@0: TBool IsParamListCompatibleL(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const; sl@0: TInt ListLength(const TDelimitedParserBase8& aParser) const; sl@0: TBool HasMoreParameters(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const; sl@0: THeaderType HeaderType(const TDesC8& aHeaderName) const; sl@0: TBool IsMatchHeader(const TDesC8& aLhs, const TDesC8& aRhs) const; sl@0: TBool IsQueryListCompatible(const TDelimitedParserBase8& aLhsParser, const TDelimitedParserBase8& aRhsParser) const; sl@0: }; sl@0: sl@0: inline TBool TEquiv::IsMatchCaseless(const TDesC8& aLhs, const TDesC8& aRhs) const sl@0: { sl@0: return (aLhs.CompareF(aRhs) == 0); sl@0: } sl@0: sl@0: inline TBool TEquiv::IsMatchCaseSensitive(const TDesC8& aLhs, const TDesC8& aRhs) const sl@0: { sl@0: return (aLhs.Compare(aRhs) == 0); sl@0: } sl@0: sl@0: #endif // __TEQUIV_H__