2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Class implements (web) service credential functionality
25 #ifndef SEN_CREDENTIAL_H
26 #define SEN_CREDENTIAL_H
31 #include <SenBaseFragment.h>
34 _LIT8(KCredentialsName, "Credentials");
35 _LIT8(KEndpointName, "Endpoint");
36 _LIT8(KSecurityMechIdName, "SecurityMechID");
37 _LIT8(KNotOnOrAfterName, "NotOnOrAfter");
38 _LIT8(KConditionsName, "Conditions");
40 // FORWARD DECLARATIONS
46 * Class implements (web) service credential functionality
47 * @lib SenServDesc.lib
50 class CSenCredential : public CSenBaseFragment
52 public: // Constructors and destructor
55 * Two-phase constructor.
57 * @param aNsUri The namespace URI of the new element
58 * @param aLocalName The local name of the new element
59 * @param aQName The qualified name of the new element
60 * @param aAttributes The attributes of the new element
61 * @return new CSenCredential instance pointer
63 * KErrSenInvalidCharacters if aLocalName or aQName contains
65 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
67 IMPORT_C static CSenCredential* NewL(const TDesC8& aNsUri,
68 const TDesC8& aLocalName,
70 const RAttributeArray& aAttributes);
73 * Two-phase constructor.
75 * @param aNsUri The namespace URI of the new element
76 * @param aLocalName The local name of the new element
77 * @param aQName The qualified name of the new element
78 * @param aAttributes The attributes of the new element
79 * @return new CSenCredential instance pointer, which is left on
82 * KErrSenInvalidCharacters if aLocalName or aQName contains
84 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
86 IMPORT_C static CSenCredential* NewLC(const TDesC8& aNsUri,
87 const TDesC8& aLocalName,
89 const RAttributeArray& aAttributes);
92 * Constructor with a possibility to set a parent.
94 * @param aNsUri The namespace URI of the new element
95 * @param aLocalName The local name of the new element
96 * @param aQName The qualified name of the new element
97 * @param aAttributes The attributes of the new element
98 * @param aParent The parent element of the new element
99 * @return new CSenCredential instance pointer
101 * KErrSenInvalidCharacters if aLocalName or aQName contains
102 * illegal characters.
103 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
105 IMPORT_C static CSenCredential* NewL(const TDesC8& aNsUri,
106 const TDesC8& aLocalName,
107 const TDesC8& aQName,
108 const RAttributeArray& aAttributes,
109 CSenElement& aParent);
112 * Constructor with a possibility to set a parent.
113 * @since Series60 3.0
114 * @param aNsUri The namespace URI of the new element
115 * @param aLocalName The local name of the new element
116 * @param aQName The qualified name of the new element
117 * @param aAttributes The attributes of the new element
118 * @param aParent The parent element of the new element
119 * @return new CSenCredential instance pointer, which is left on
122 * KErrSenInvalidCharacters if aLocalName or aQName contains
123 * illegal characters.
124 * KErrSenZeroLengthDescriptor if aLocalName or aQName is zero length.
126 IMPORT_C static CSenCredential* NewLC(const TDesC8& aNsUri,
127 const TDesC8& aLocalName,
128 const TDesC8& aQName,
129 const RAttributeArray& aAttributes,
130 CSenElement& aParent);
133 * Constructor which copies itself from another credential.
134 * @since Series60 3.0
135 * @param aCredential credential to copy from.
136 * @return new CSenCredential instance pointer
138 IMPORT_C static CSenCredential* NewL(const CSenCredential& aCredential);
141 * Constructor which copies itself from another credential.
142 * @since Series60 3.0
143 * @param aCredential credential to copy from.
144 * @return new CSenCredential instance pointer, which is left on
147 IMPORT_C static CSenCredential* NewLC(const CSenCredential& aCredential);
152 IMPORT_C virtual ~CSenCredential();
157 * Getter for the credential ID.
158 * @since Series60 3.0
161 IMPORT_C const TDesC8& Id();
164 * Getter for the credential expiration time.
165 * @since Series60 3.0
166 * @return the the expiration time
168 IMPORT_C TTime& ValidUntil();
171 * Setter for the credential expiration time.
172 * @since Series60 3.0
173 * @param aTime The new expiration time
175 IMPORT_C void SetValidUntil(TTime& aTime);
177 protected: // Functions from base classes
180 * From CSenDomFragment Callback function which implement the XML content handler interface.
181 * @since Series60 3.0
182 * @param aNsUri The namespace URI of the new element
183 * @param aLocalName The local name of the new element
184 * @param aQName The qualified name of the new element
185 * @param aAttributes The attributes of the new element
187 IMPORT_C virtual void StartElementL(const TDesC8& aNsUri,
188 const TDesC8& aLocalName,
189 const TDesC8& aQName,
190 const RAttributeArray& aAttributes);
195 * C++ default constructor.
197 IMPORT_C CSenCredential();
200 * By default Symbian 2nd phase constructor is private.
201 * @since Series60 3.0
202 * @param aNsUri is the XML namespace as UTF-8 descriptor
203 * @param aLocalName is the XML localname as UTF-8 descriptor
204 * @param aQName is the XML qualifiedname as UTF-8 descriptor
205 * @param aAttributes is the list of XML attributes
207 IMPORT_C void ConstructL(const TDesC8& aNsUri,
208 const TDesC8& aLocalName,
209 const TDesC8& aQName,
210 const RAttributeArray& aAttributes);
213 * By default Symbian 2nd phase constructor is private.
214 * @since Series60 3.0
215 * @param aNsUri is the XML namespace as UTF-8 descriptor
216 * @param aLocalName is the XML localname as UTF-8 descriptor
217 * @param aQName is the XML qualifiedname as UTF-8 descriptor
218 * @param aAttributes is the list of XML attributes
219 * @param aParent is the parent element, which may declare other
222 IMPORT_C void ConstructL(const TDesC8& aNsUri,
223 const TDesC8& aLocalName,
224 const TDesC8& aQName,
225 const RAttributeArray& aAttributes,
226 CSenElement& aParent);
229 * By default Symbian 2nd phase constructor is private.
230 * @since Series60 3.0
231 * @param aCredential is the source credential to be copied.
233 IMPORT_C void ConstructL(CSenCredential& aCredential);
238 * Setter for Credential ID
239 * @since Series60 3.0
240 * @param aId is the unique ID for this Credential
242 void SetIdL(const TDesC8& aId);
245 // Unique ID for this credential. Owned.
247 // One may use SenDateUtils to convert from XML date descrtor to TTime
251 #endif // SEN_CREDENTIAL_H