sl@0: // Copyright (c) 2007-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: // This file contains the Parsing functionality for Generic URIs as sl@0: // specified in RFC 2396. sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file GenericUriParser.h sl@0: */ sl@0: #ifndef __GENERICURIPARSER_H__ sl@0: #define __GENERICURIPARSER_H__ sl@0: sl@0: // System includes sl@0: #include sl@0: #include sl@0: sl@0: // Local includes sl@0: #include "TUriParserInternal.h" sl@0: #include "UriUtilsInternal.h" sl@0: sl@0: /** sl@0: Dependencies : CUriParserBase. sl@0: Comments : Provides Parsing functionality for the Uri objects. sl@0: This is implemented as per RFC2396 for Parsing the Generic Uris. sl@0: It uses 8-bit descriptors. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CGenericUriParser: public CBase sl@0: { sl@0: public: sl@0: sl@0: static CGenericUriParser* NewL(); sl@0: virtual ~CGenericUriParser(); sl@0: inline void DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[]); sl@0: sl@0: protected: sl@0: sl@0: CGenericUriParser(); sl@0: void ConstructL(); sl@0: sl@0: virtual TInt ParseScheme(const TPtrC8& aUri, TPtrC8& aScheme); sl@0: virtual TInt ParseAuthority(const TPtrC8& aUri, TPtrC8& aUserinfo, TPtrC8& aHost, TPtrC8& aPort, TBool aUseNetworkDelimiter); sl@0: virtual TInt ParsePath(const TPtrC8& aUri, TPtrC8& aPath); sl@0: virtual TInt ParseQuery(const TPtrC8& aUri, TPtrC8& aQuery); sl@0: virtual TInt ParseFragment(const TPtrC8& aUri, TPtrC8& aFragment); sl@0: sl@0: //Internal Supporting method for Parsing sl@0: virtual TInt FindFirstUriDelimiter(const TPtrC8& aString, TDelimiterSearchFlag aSearchFlag); sl@0: }; sl@0: sl@0: inline void CGenericUriParser::DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[]) sl@0: { sl@0: // Parse the components sl@0: TPtrC8 uri(aUri); sl@0: TInt consumed = 0; sl@0: TPtrC8& scheme = aComponent[EUriScheme]; sl@0: if( (consumed = ParseScheme(uri, scheme)) > 0 ) sl@0: { sl@0: uri.Set(uri.Mid(consumed)); sl@0: } sl@0: if( (consumed = ParseAuthority(uri, aComponent[EUriUserinfo], sl@0: aComponent[EUriHost], aComponent[EUriPort], IsNetworkScheme(scheme) )) > 0 ) sl@0: { sl@0: uri.Set(uri.Mid(consumed)); sl@0: } sl@0: if( (consumed = ParsePath(uri, aComponent[EUriPath])) > 0 ) sl@0: { sl@0: uri.Set(uri.Mid(consumed)); sl@0: } sl@0: if( (consumed = ParseQuery(uri, aComponent[EUriQuery])) > 0 ) sl@0: { sl@0: uri.Set(uri.Mid(consumed)); sl@0: } sl@0: if( (consumed = ParseFragment(uri, aComponent[EUriFragment])) > 0 ) sl@0: { sl@0: uri.Set(uri.Mid(consumed)); sl@0: } sl@0: } sl@0: sl@0: #endif // __GENERICURIPARSER_H__ sl@0: