Update contrib.
1 // Copyright (c) 2007-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains the Parsing functionality for Generic URIs as
15 // specified in RFC 2396.
20 @file GenericUriParser.h
22 #ifndef __GENERICURIPARSER_H__
23 #define __GENERICURIPARSER_H__
27 #include <uriutilscommon.h>
30 #include "TUriParserInternal.h"
31 #include "UriUtilsInternal.h"
34 Dependencies : CUriParserBase.
35 Comments : Provides Parsing functionality for the Uri objects.
36 This is implemented as per RFC2396 for Parsing the Generic Uris.
37 It uses 8-bit descriptors.
42 class CGenericUriParser: public CBase
46 static CGenericUriParser* NewL();
47 virtual ~CGenericUriParser();
48 inline void DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[]);
55 virtual TInt ParseScheme(const TPtrC8& aUri, TPtrC8& aScheme);
56 virtual TInt ParseAuthority(const TPtrC8& aUri, TPtrC8& aUserinfo, TPtrC8& aHost, TPtrC8& aPort, TBool aUseNetworkDelimiter);
57 virtual TInt ParsePath(const TPtrC8& aUri, TPtrC8& aPath);
58 virtual TInt ParseQuery(const TPtrC8& aUri, TPtrC8& aQuery);
59 virtual TInt ParseFragment(const TPtrC8& aUri, TPtrC8& aFragment);
61 //Internal Supporting method for Parsing
62 virtual TInt FindFirstUriDelimiter(const TPtrC8& aString, TDelimiterSearchFlag aSearchFlag);
65 inline void CGenericUriParser::DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[])
67 // Parse the components
70 TPtrC8& scheme = aComponent[EUriScheme];
71 if( (consumed = ParseScheme(uri, scheme)) > 0 )
73 uri.Set(uri.Mid(consumed));
75 if( (consumed = ParseAuthority(uri, aComponent[EUriUserinfo],
76 aComponent[EUriHost], aComponent[EUriPort], IsNetworkScheme(scheme) )) > 0 )
78 uri.Set(uri.Mid(consumed));
80 if( (consumed = ParsePath(uri, aComponent[EUriPath])) > 0 )
82 uri.Set(uri.Mid(consumed));
84 if( (consumed = ParseQuery(uri, aComponent[EUriQuery])) > 0 )
86 uri.Set(uri.Mid(consumed));
88 if( (consumed = ParseFragment(uri, aComponent[EUriFragment])) > 0 )
90 uri.Set(uri.Mid(consumed));
94 #endif // __GENERICURIPARSER_H__