sl@0
|
1 |
// Copyright (c) 2007-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 |
// This file contains the Parsing functionality for Generic URIs as
|
sl@0
|
15 |
// specified in RFC 2396.
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file GenericUriParser.h
|
sl@0
|
21 |
*/
|
sl@0
|
22 |
#ifndef __GENERICURIPARSER_H__
|
sl@0
|
23 |
#define __GENERICURIPARSER_H__
|
sl@0
|
24 |
|
sl@0
|
25 |
// System includes
|
sl@0
|
26 |
#include <e32base.h>
|
sl@0
|
27 |
#include <uriutilscommon.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
// Local includes
|
sl@0
|
30 |
#include "TUriParserInternal.h"
|
sl@0
|
31 |
#include "UriUtilsInternal.h"
|
sl@0
|
32 |
|
sl@0
|
33 |
/**
|
sl@0
|
34 |
Dependencies : CUriParserBase.
|
sl@0
|
35 |
Comments : Provides Parsing functionality for the Uri objects.
|
sl@0
|
36 |
This is implemented as per RFC2396 for Parsing the Generic Uris.
|
sl@0
|
37 |
It uses 8-bit descriptors.
|
sl@0
|
38 |
|
sl@0
|
39 |
@internalComponent
|
sl@0
|
40 |
@released
|
sl@0
|
41 |
*/
|
sl@0
|
42 |
class CGenericUriParser: public CBase
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
|
sl@0
|
46 |
static CGenericUriParser* NewL();
|
sl@0
|
47 |
virtual ~CGenericUriParser();
|
sl@0
|
48 |
inline void DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[]);
|
sl@0
|
49 |
|
sl@0
|
50 |
protected:
|
sl@0
|
51 |
|
sl@0
|
52 |
CGenericUriParser();
|
sl@0
|
53 |
void ConstructL();
|
sl@0
|
54 |
|
sl@0
|
55 |
virtual TInt ParseScheme(const TPtrC8& aUri, TPtrC8& aScheme);
|
sl@0
|
56 |
virtual TInt ParseAuthority(const TPtrC8& aUri, TPtrC8& aUserinfo, TPtrC8& aHost, TPtrC8& aPort, TBool aUseNetworkDelimiter);
|
sl@0
|
57 |
virtual TInt ParsePath(const TPtrC8& aUri, TPtrC8& aPath);
|
sl@0
|
58 |
virtual TInt ParseQuery(const TPtrC8& aUri, TPtrC8& aQuery);
|
sl@0
|
59 |
virtual TInt ParseFragment(const TPtrC8& aUri, TPtrC8& aFragment);
|
sl@0
|
60 |
|
sl@0
|
61 |
//Internal Supporting method for Parsing
|
sl@0
|
62 |
virtual TInt FindFirstUriDelimiter(const TPtrC8& aString, TDelimiterSearchFlag aSearchFlag);
|
sl@0
|
63 |
};
|
sl@0
|
64 |
|
sl@0
|
65 |
inline void CGenericUriParser::DoParseUri(const TPtrC8& aUri, TPtrC8 aComponent[])
|
sl@0
|
66 |
{
|
sl@0
|
67 |
// Parse the components
|
sl@0
|
68 |
TPtrC8 uri(aUri);
|
sl@0
|
69 |
TInt consumed = 0;
|
sl@0
|
70 |
TPtrC8& scheme = aComponent[EUriScheme];
|
sl@0
|
71 |
if( (consumed = ParseScheme(uri, scheme)) > 0 )
|
sl@0
|
72 |
{
|
sl@0
|
73 |
uri.Set(uri.Mid(consumed));
|
sl@0
|
74 |
}
|
sl@0
|
75 |
if( (consumed = ParseAuthority(uri, aComponent[EUriUserinfo],
|
sl@0
|
76 |
aComponent[EUriHost], aComponent[EUriPort], IsNetworkScheme(scheme) )) > 0 )
|
sl@0
|
77 |
{
|
sl@0
|
78 |
uri.Set(uri.Mid(consumed));
|
sl@0
|
79 |
}
|
sl@0
|
80 |
if( (consumed = ParsePath(uri, aComponent[EUriPath])) > 0 )
|
sl@0
|
81 |
{
|
sl@0
|
82 |
uri.Set(uri.Mid(consumed));
|
sl@0
|
83 |
}
|
sl@0
|
84 |
if( (consumed = ParseQuery(uri, aComponent[EUriQuery])) > 0 )
|
sl@0
|
85 |
{
|
sl@0
|
86 |
uri.Set(uri.Mid(consumed));
|
sl@0
|
87 |
}
|
sl@0
|
88 |
if( (consumed = ParseFragment(uri, aComponent[EUriFragment])) > 0 )
|
sl@0
|
89 |
{
|
sl@0
|
90 |
uri.Set(uri.Mid(consumed));
|
sl@0
|
91 |
}
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
#endif // __GENERICURIPARSER_H__
|
sl@0
|
95 |
|