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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains the API definition for the classes TAuthorityC8 and
15 // CAuthority8. These classes provide non-modifying (TAuthorityC8) and
16 // modifying (CAuthority8) functionality for the components of an
17 // Authority as described in RFC2396.
29 #ifndef __AUTHORITY8_H__
30 #define __AUTHORITY8_H__
35 #include <authoritycommon.h>
39 Dependencies : TAuthorityComponent.
40 Comments : Provides non-modifying functionality on the components of an authority
41 object as defined in RFC2396. There are 3 components; userinfo, host and port.
43 The object holds descriptor pointers to the parsed authority components and a descriptor
44 pointer to the authority. It is non-owning. It uses 8-bit descriptors.
46 The functionality provided by this API allows the authority components to be extracted
47 from the parsed authority, checked for their presence in the authority and be compared
48 with those in another TAuthorityC8 object.
57 IMPORT_C const TDesC8& Extract(TAuthorityComponent aComponent) const;
58 IMPORT_C TBool IsPresent(TAuthorityComponent aComponent) const;
59 IMPORT_C TInt Compare(const TAuthorityC8& aAuthority, TAuthorityComponent aComponent) const;
60 IMPORT_C const TDesC8& AuthorityDes() const;
61 IMPORT_C HBufC* DisplayFormL(TAuthorityComponent aComponent = EAuthorityComplete ) const;
65 IMPORT_C TAuthorityC8();
68 protected: // Attributes
71 The array of descriptor pointers to the authority components.
73 TPtrC8 iComponent[EAuthorityMaxComponents];
76 The descriptor pointer to the authority.
85 friend class CAuthority8;
88 A friend class used for testing.
89 @see TAuthorityC8StateAccessor
92 friend class TAuthorityC8StateAccessor;
97 Dependencies : TAuthorityC8
98 Comments : Provides functionality to parse a descriptor into the components of an
99 authority as defined in RFC2396. There are 3 components; userinfo, host and port.
101 This uses 8-bit descriptors.
104 Format of an authority is; [userinfo@]host[:port]
106 @warning The descriptor that is parsed by an object of this class will be referenced
107 by that object. If the original descriptor is no longer in scope there will be undefined
113 class TAuthorityParser8 : public TAuthorityC8
117 IMPORT_C TAuthorityParser8();
118 IMPORT_C TInt Parse(const TDesC8& aAuthority);
123 Dependencies : CBase, TAuthorityC8.
124 Comments : Provides modifying functionality on the components of an authority object, as
125 defined in RFC2396. There are 3 components; userinfo, host and port.
127 The object holds parsed authority information. It is owning. It uses 8-bit descriptors.
129 The functionality provided by this API allows the authority components to be set or removed
130 from this parsed authority. Also, it provides a reference to TAuthorityC8 object so that
131 the non-modifying functionality can be used.
136 class CAuthority8 : public CBase
140 IMPORT_C static CAuthority8* NewL(const TAuthorityC8& aAuthority);
141 IMPORT_C static CAuthority8* NewLC(const TAuthorityC8& aAuthority);
142 IMPORT_C static CAuthority8* NewL();
143 IMPORT_C static CAuthority8* NewLC();
144 IMPORT_C ~CAuthority8();
146 IMPORT_C const TAuthorityC8& Authority() const;
147 IMPORT_C void SetComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
148 IMPORT_C void SetAndEscapeComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
149 IMPORT_C void RemoveComponentL(TAuthorityComponent aComponent);
153 CAuthority8(const TAuthorityC8& aAuthority);
155 void FormAuthorityL();
157 private: // Attributes
160 The descriptor buffer that contains the authority.
162 HBufC8* iAuthorityBuf;
165 The parsed authority object.
167 TAuthorityC8 iAuthority;
170 A friend class used for testing.
171 @see TAuthority8StateAccessor
174 friend class TAuthority8StateAccessor;
178 #endif // __AUTHORITY8_H__