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.
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.
27 #ifndef __AUTHORITY8_H__
28 #define __AUTHORITY8_H__
33 #include <authoritycommon.h>
37 Dependencies : TAuthorityComponent.
38 Comments : Provides non-modifying functionality on the components of an authority
39 object as defined in RFC2396. There are 3 components; userinfo, host and port.
41 The object holds descriptor pointers to the parsed authority components and a descriptor
42 pointer to the authority. It is non-owning. It uses 8-bit descriptors.
44 The functionality provided by this API allows the authority components to be extracted
45 from the parsed authority, checked for their presence in the authority and be compared
46 with those in another TAuthorityC8 object.
55 IMPORT_C const TDesC8& Extract(TAuthorityComponent aComponent) const;
56 IMPORT_C TBool IsPresent(TAuthorityComponent aComponent) const;
57 IMPORT_C TInt Compare(const TAuthorityC8& aAuthority, TAuthorityComponent aComponent) const;
58 IMPORT_C const TDesC8& AuthorityDes() const;
59 IMPORT_C HBufC* DisplayFormL(TAuthorityComponent aComponent = EAuthorityComplete ) const;
63 IMPORT_C TAuthorityC8();
66 protected: // Attributes
69 The array of descriptor pointers to the authority components.
71 TPtrC8 iComponent[EAuthorityMaxComponents];
74 The descriptor pointer to the authority.
83 friend class CAuthority8;
86 A friend class used for testing.
87 @see TAuthorityC8StateAccessor
90 friend class TAuthorityC8StateAccessor;
95 Dependencies : TAuthorityC8
96 Comments : Provides functionality to parse a descriptor into the components of an
97 authority as defined in RFC2396. There are 3 components; userinfo, host and port.
99 This uses 8-bit descriptors.
102 Format of an authority is; [userinfo@]host[:port]
104 @warning The descriptor that is parsed by an object of this class will be referenced
105 by that object. If the original descriptor is no longer in scope there will be undefined
111 class TAuthorityParser8 : public TAuthorityC8
115 IMPORT_C TAuthorityParser8();
116 IMPORT_C TInt Parse(const TDesC8& aAuthority);
121 Dependencies : CBase, TAuthorityC8.
122 Comments : Provides modifying functionality on the components of an authority object, as
123 defined in RFC2396. There are 3 components; userinfo, host and port.
125 The object holds parsed authority information. It is owning. It uses 8-bit descriptors.
127 The functionality provided by this API allows the authority components to be set or removed
128 from this parsed authority. Also, it provides a reference to TAuthorityC8 object so that
129 the non-modifying functionality can be used.
134 class CAuthority8 : public CBase
138 IMPORT_C static CAuthority8* NewL(const TAuthorityC8& aAuthority);
139 IMPORT_C static CAuthority8* NewLC(const TAuthorityC8& aAuthority);
140 IMPORT_C static CAuthority8* NewL();
141 IMPORT_C static CAuthority8* NewLC();
142 IMPORT_C ~CAuthority8();
144 IMPORT_C const TAuthorityC8& Authority() const;
145 IMPORT_C void SetComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
146 IMPORT_C void SetAndEscapeComponentL(const TDesC8& aData, TAuthorityComponent aComponent);
147 IMPORT_C void RemoveComponentL(TAuthorityComponent aComponent);
151 CAuthority8(const TAuthorityC8& aAuthority);
153 void FormAuthorityL();
155 private: // Attributes
158 The descriptor buffer that contains the authority.
160 HBufC8* iAuthorityBuf;
163 The parsed authority object.
165 TAuthorityC8 iAuthority;
168 A friend class used for testing.
169 @see TAuthority8StateAccessor
172 friend class TAuthority8StateAccessor;
176 #endif // __AUTHORITY8_H__