First public contribution.
1 // Copyright (c) 2001-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.
16 #ifndef __URIANDAUTHORITYTESTCOMMON_H__
17 #define __URIANDAUTHORITYTESTCOMMON_H__
23 template<class TUriParserType, class TDesCType>
24 TInt DoUriComponentExtraction(const TDesCType& aUri, const TDesCType& aScheme,
25 const TDesCType& aUserinfo, const TDesCType& aHost,
26 const TDesCType& aPort, const TDesCType& aPath,
27 const TDesCType& aQuery, const TDesCType& aFragment);
29 void DoUriComponentExtractionL(const TDesC& aUri, const TDesC& aScheme,
30 const TDesC& aUserinfo, const TDesC& aHost,
31 const TDesC& aPort, const TDesC& aPath,
32 const TDesC& aQuery, const TDesC& aFragment);
34 template<class TAuthorityParserType, class TDesCType>
35 TInt DoAuthorityComponentExtraction(const TDesCType& aAuthority, const TDesCType& aUserInfo,
36 const TDesCType& aHost, const TDesCType& aPort);
38 void DoAuthorityComponentExtractionL(const TDesC& aAuthority, const TDesC& aUserInfo,
39 const TDesC& aHost, const TDesC& aPort);
42 template<class TUriParserType, class CUriType, class TDesCType>
43 TInt DoTestResolve(const TDesCType& aBase, const TDesCType& aReference, const TDesCType& aExpected);
45 template<class TUriParserType, class TDesCType>
46 TInt DoUriCompare(const TDesCType& aUri1, const TDesCType& aUri2, TInt aMatchFlags);
48 // Compares the specific component against what is expected. The parser object is
49 // assumed to the been parsed already, otherwise it panics.
52 // aParser - parsed parser object
53 // aExpected - the expected component value
54 // aComponent - the specific component
56 // Rtn: the result of the comparision - 0 is a match, non-zero is not a match.
58 template<class TParserType, class TDesCType, class TComponentType>
59 TInt TestComponent(const TParserType& aParser, const TDesCType& aExpected, TComponentType aComponent);
61 template<class TParserType, class TComponentType>
62 TInt TestCompare(const TParserType& aFull, const TParserType& aPartial, TComponentType aComponent);
64 template<class TAuthorityParserType, class TDesCType>
65 TInt DoAuthorityCompare(const TDesCType& aAuthority1, const TDesCType& aAuthority2, TInt aMatchFlags);
67 template<class TUriParserType, class TDesCType>
68 TInt DoUriComponentPresence(const TDesCType& aUri, TInt aPresenceFlags);
70 template<class TAuthorityParserType, class TDesCType>
71 TInt DoAuthorityComponentPresence(const TDesCType& aAuthority, TInt aPresenceFlags);
73 template<class TParserType, class TComponentType>
74 TInt TestPresence(const TParserType& aData, TComponentType aComponent, TBool aExpectedPresence);
76 template<class TUriParserType, class TDesCType>
77 TInt DoUriDes(const TDesCType& aUri);
79 void DoUriDesL(const TDesC& aUri);
81 template<class TUriParserType, class TDesCType>
82 TInt DoCompareUriDes(const TUriParserType& aParser, const TDesCType& aExpected);
84 template<class TAuthorityParserType, class TDesCType>
85 TInt DoAuthorityDes(const TDesCType& aAuthority);
87 void DoAuthorityDesL(const TDesC& aAuthority);
89 template<class TUriParserType, class TDesCType>
90 TInt DoUriSchemeValidation(const TDesCType& aUri, TBool aValidScheme);
92 template<class TUriParserType, class TPtrCType, class TDesCType>
93 TInt DoUriWithoutFragment(const TDesCType& aUri, const TDesCType& aExpected);
95 template<class CUriType, class TDesCType>
96 TInt DoUriConstruction(const TDesCType& aUri_Scheme, const TDesCType& aUri_Host, const TDesCType& aUri_Userinfo,
97 const TDesCType& aUri_Port, const TDesCType& aUri_Path, const TDesCType& aUri_Query,
98 const TDesCType& aUri_Fragment, const TDesCType& aScheme, const TDesCType& aHost,
99 const TDesCType& aUserinfo, const TDesCType& aPort, const TDesCType& aPath,
100 const TDesCType& aQuery, const TDesCType& aFragment);
102 template<class CUriType, class TDesCType>
103 TInt DoUriSetAndCompareComponent(CUriType aUri, TUriComponent aComponent, const TDesCType& aData, const TDesCType& aExpected);
105 template<class CUriType, class TUriParserType, class TDesCType>
106 TInt DoUriDestruction(const TDesCType& aUri_NoScheme, const TDesCType& aUri_NoHost, const TDesCType& aUri_NoUserinfo,
107 const TDesCType& aUri_NoPort, const TDesCType& aUri_NoPath, const TDesCType& aUri_NoQuery,
108 const TDesCType& aUri_NoFragment, const TDesCType& aUri_Whole);
110 template<class CUriType, class TDesCType>
111 TInt DoUriRemoveAndCompareComponent(CUriType* aUri, TUriComponent aComponent, const TDesCType& aExpected);
113 template<class CAuthorityType, class TDesCType>
114 TInt DoAuthorityConstruction(const TDesCType& aAuthority_Host, const TDesCType& aAuthority_Userinfo, const TDesCType& aAuthority_Port,
115 const TDesCType& aHost, const TDesCType& aUserinfo, const TDesCType& aPort);
117 template<class CAuthorityType, class TDesCType>
118 TInt DoAuthoritySetAndCompareComponent(CAuthorityType* aUri, TAuthorityComponent aComponent, const TDesCType& aData, const TDesCType& aExpected);
120 template<class CAuthorityType, class TDesCType>
121 TInt DoAuthorityEscapedConstruction(const TDesCType& aAuthority_Host, const TDesCType& aAuthority_Userinfo, const TDesCType& aAuthority_Port,
122 const TDesCType& aHost, const TDesCType& aUserinfo, const TDesCType& aPort);
124 template<class CAuthorityType, class TDesCType>
125 TInt DoAuthoritySetAndEscapeAndCompareComponent(CAuthorityType* aAuthority, TAuthorityComponent aComponent, const TDesCType& aData, const TDesCType& aExpected);
127 template<class CAuthorityType, class TAuthorityParserType, class TDesCType>
128 TInt DoAuthorityDestruction(const TDesCType& aAuthority_NoHost, const TDesCType& aAuthority_NoUserinfo,
129 const TDesCType& aAuthority_NoPort, const TDesCType& aAuthority_Whole);
131 template<class CAuthorityType, class TDesCType>
132 TInt DoAuthorityRemoveAndCompareComponent(CAuthorityType* aAuthority, TAuthorityComponent aComponent, const TDesCType& aExpected);
134 #endif // __URIANDAUTHORITYTESTCOMMON_H__