1 authority8.h |
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
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. |
|
18 // |
|
19 // |
|
20 |
|
21 |
|
22 |
|
23 /** |
|
24 @file Authority8.h |
|
25 @publishedAll |
|
26 @released |
|
27 */ |
|
28 |
|
29 #ifndef __AUTHORITY8_H__ |
|
30 #define __AUTHORITY8_H__ |
|
31 |
|
32 // System includes |
|
33 // |
|
34 #include <e32base.h> |
|
35 #include <authoritycommon.h> |
|
36 |
|
37 |
|
38 /** |
|
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. |
|
42 |
|
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. |
|
45 |
|
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. |
|
49 @publishedAll |
|
50 @released |
|
51 @since 6.0 |
|
52 */ |
|
53 class TAuthorityC8 |
|
54 { |
|
55 public: // Methods |
|
56 |
|
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; |
|
62 |
|
63 protected: // Methods |
|
64 |
|
65 IMPORT_C TAuthorityC8(); |
|
66 void Reset(); |
|
67 |
|
68 protected: // Attributes |
|
69 |
|
70 /** |
|
71 The array of descriptor pointers to the authority components. |
|
72 */ |
|
73 TPtrC8 iComponent[EAuthorityMaxComponents]; |
|
74 |
|
75 /** |
|
76 The descriptor pointer to the authority. |
|
77 */ |
|
78 TPtrC8 iAuthorityDes; |
|
79 |
|
80 /** |
|
81 A friend class. |
|
82 @see CAuthority8 |
|
83 @since 6.0 |
|
84 */ |
|
85 friend class CAuthority8; |
|
86 |
|
87 /** |
|
88 A friend class used for testing. |
|
89 @see TAuthorityC8StateAccessor |
|
90 @since 6.0 |
|
91 */ |
|
92 friend class TAuthorityC8StateAccessor; |
|
93 |
|
94 }; |
|
95 |
|
96 /** |
|
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. |
|
100 |
|
101 This uses 8-bit descriptors. |
|
102 |
|
103 |
|
104 Format of an authority is; [userinfo@]host[:port] |
|
105 |
|
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 |
|
108 behaviour. |
|
109 @publishedAll |
|
110 @released |
|
111 @since 6.0 |
|
112 */ |
|
113 class TAuthorityParser8 : public TAuthorityC8 |
|
114 { |
|
115 public: // Methods |
|
116 |
|
117 IMPORT_C TAuthorityParser8(); |
|
118 IMPORT_C TInt Parse(const TDesC8& aAuthority); |
|
119 |
|
120 }; |
|
121 |
|
122 /** |
|
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. |
|
126 |
|
127 The object holds parsed authority information. It is owning. It uses 8-bit descriptors. |
|
128 |
|
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. |
|
132 @publishedAll |
|
133 @released |
|
134 @since 6.0 |
|
135 */ |
|
136 class CAuthority8 : public CBase |
|
137 { |
|
138 public: // Methods |
|
139 |
|
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(); |
|
145 |
|
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); |
|
150 |
|
151 private: // Methods |
|
152 |
|
153 CAuthority8(const TAuthorityC8& aAuthority); |
|
154 void ConstructL(); |
|
155 void FormAuthorityL(); |
|
156 |
|
157 private: // Attributes |
|
158 |
|
159 /** |
|
160 The descriptor buffer that contains the authority. |
|
161 */ |
|
162 HBufC8* iAuthorityBuf; |
|
163 |
|
164 /** |
|
165 The parsed authority object. |
|
166 */ |
|
167 TAuthorityC8 iAuthority; |
|
168 |
|
169 /** |
|
170 A friend class used for testing. |
|
171 @see TAuthority8StateAccessor |
|
172 @since 6.0 |
|
173 */ |
|
174 friend class TAuthority8StateAccessor; |
|
175 |
|
176 }; |
|
177 |
|
178 #endif // __AUTHORITY8_H__ |