williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Name : sipaddress.h
|
williamr@2
|
16 |
* Part of : SIP Codec
|
williamr@2
|
17 |
* Interface : SDK API, SIP Codec API
|
williamr@2
|
18 |
* Version : SIP/4.0
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef CSIPADDRESS_H
|
williamr@2
|
26 |
#define CSIPADDRESS_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// INCLUDES
|
williamr@2
|
29 |
#include <e32base.h>
|
williamr@2
|
30 |
#include <s32mem.h>
|
williamr@2
|
31 |
#include <uri8.h>
|
williamr@2
|
32 |
|
williamr@2
|
33 |
// FORWARD DECLARATIONS
|
williamr@2
|
34 |
class CURIContainer;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// CLASS DECLARATION
|
williamr@2
|
37 |
/**
|
williamr@2
|
38 |
* @publishedAll
|
williamr@2
|
39 |
* @released
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* Class provides functions for setting and getting parameters in SIP
|
williamr@2
|
42 |
* name-addr structure
|
williamr@2
|
43 |
*
|
williamr@2
|
44 |
* @lib sipcodec.lib
|
williamr@2
|
45 |
*/
|
williamr@2
|
46 |
class CSIPAddress : public CBase
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
public: // Constructors and destructor
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/**
|
williamr@2
|
51 |
* Constructs a CSIPAddress from textual representation
|
williamr@2
|
52 |
* @param aValue SIP name-addr as text
|
williamr@2
|
53 |
* @return a new instance of CSIPAddress
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
IMPORT_C static CSIPAddress* DecodeL(const TDesC8& aValue);
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Creates a new instance of CSIPAddress
|
williamr@2
|
59 |
* @pre aUri != 0
|
williamr@2
|
60 |
* @param aUri the ownership is transferred.
|
williamr@2
|
61 |
* @return a new instance of CSIPAddress
|
williamr@2
|
62 |
*/
|
williamr@2
|
63 |
IMPORT_C static CSIPAddress* NewL(CUri8* aUri8);
|
williamr@2
|
64 |
|
williamr@2
|
65 |
/**
|
williamr@2
|
66 |
* Creates a new instance of CSIPAddress and puts it to CleanupStack
|
williamr@2
|
67 |
* @pre aUri != 0
|
williamr@2
|
68 |
* @param aUri the ownership is transferred.
|
williamr@2
|
69 |
* @return a new instance of CSIPAddress
|
williamr@2
|
70 |
*/
|
williamr@2
|
71 |
IMPORT_C static CSIPAddress* NewLC(CUri8* aUri8);
|
williamr@2
|
72 |
|
williamr@2
|
73 |
/**
|
williamr@2
|
74 |
* Creates a new instance of CSIPAddress
|
williamr@2
|
75 |
* @pre aUri != 0
|
williamr@2
|
76 |
* @param aDisplayName a SIP token or a SIP quoted-string
|
williamr@2
|
77 |
* @param aUri the ownership is transferred.
|
williamr@2
|
78 |
* @return a new instance of CSIPAddress
|
williamr@2
|
79 |
*/
|
williamr@2
|
80 |
IMPORT_C static CSIPAddress* NewL(const TDesC8& aDisplayName,
|
williamr@2
|
81 |
CUri8* aUri8);
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
* Creates a new instance of CSIPAddress and puts it to CleanupStack
|
williamr@2
|
85 |
* @pre aUri != 0
|
williamr@2
|
86 |
* @param aDisplayName a SIP token or a SIP quoted-string
|
williamr@2
|
87 |
* @param aUri the ownership is transferred.
|
williamr@2
|
88 |
* @return a new instance of CSIPAddress
|
williamr@2
|
89 |
*/
|
williamr@2
|
90 |
IMPORT_C static CSIPAddress* NewLC(const TDesC8& aDisplayName,
|
williamr@2
|
91 |
CUri8* aUri8);
|
williamr@2
|
92 |
|
williamr@2
|
93 |
/**
|
williamr@2
|
94 |
* Creates a deep-copy of a CSIPAddress
|
williamr@2
|
95 |
* @param aSIPAddress the address to be copied
|
williamr@2
|
96 |
* @return a new instance of CSIPAddress
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
IMPORT_C static CSIPAddress* NewL(const CSIPAddress& aSIPAddress);
|
williamr@2
|
99 |
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
* Creates a deep-copy of a CSIPAddress and puts it to CleanupStack
|
williamr@2
|
102 |
* @param aSIPAddress the address to be copied
|
williamr@2
|
103 |
* @return a new instance of CSIPAddress
|
williamr@2
|
104 |
*/
|
williamr@2
|
105 |
IMPORT_C static CSIPAddress* NewLC(const CSIPAddress& aSIPAddress);
|
williamr@2
|
106 |
|
williamr@2
|
107 |
/**
|
williamr@2
|
108 |
* Destructor, deletes the resources of CSIPAddress.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
IMPORT_C ~CSIPAddress();
|
williamr@2
|
111 |
|
williamr@2
|
112 |
|
williamr@2
|
113 |
public: // New functions
|
williamr@2
|
114 |
|
williamr@2
|
115 |
/**
|
williamr@2
|
116 |
* Compares this object to another instance of CSIPAddress
|
williamr@2
|
117 |
* @param aSIPAddress a CSIPAddress to compare to
|
williamr@2
|
118 |
* @return ETrue if the objects are equal otherwise EFalse
|
williamr@2
|
119 |
*/
|
williamr@2
|
120 |
IMPORT_C TBool operator==(const CSIPAddress& aSIPAddress) const;
|
williamr@2
|
121 |
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
* Gets the display name
|
williamr@2
|
124 |
* @return the display name if present,
|
williamr@2
|
125 |
* otherwise a zero-length descriptor
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
IMPORT_C const TDesC8& DisplayName() const;
|
williamr@2
|
128 |
|
williamr@2
|
129 |
/**
|
williamr@2
|
130 |
* Sets the display name
|
williamr@2
|
131 |
* @param aDisplayName a SIP token or a SIP quoted-string
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
IMPORT_C void SetDisplayNameL(const TDesC8& aDisplayName);
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/**
|
williamr@2
|
136 |
* Gets the URI part of the address as const
|
williamr@2
|
137 |
* @return a reference to the URI object
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
IMPORT_C const CUri8& Uri8() const;
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Sets the URI part of the address
|
williamr@2
|
143 |
* @pre aUri!= 0
|
williamr@2
|
144 |
* @param aUri a pointer to the URI object, the ownership is transferred
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
IMPORT_C void SetUri8L(CUri8* aUri8);
|
williamr@2
|
147 |
|
williamr@2
|
148 |
/**
|
williamr@2
|
149 |
* Creates a textual representation and pushes it to CleanupStack
|
williamr@2
|
150 |
* @param aUseAngleBrackets if ETrue, sets the anglebrackets
|
williamr@2
|
151 |
* @return a textual representation of the object,
|
williamr@2
|
152 |
* the ownership is transferred
|
williamr@2
|
153 |
*/
|
williamr@2
|
154 |
IMPORT_C HBufC8* ToTextLC(TBool aUseAngleBrackets=EFalse) const;
|
williamr@2
|
155 |
|
williamr@2
|
156 |
/**
|
williamr@2
|
157 |
* Constructs an instance of a CSIPAddress from a RReadStream
|
williamr@2
|
158 |
* @param aReadStream a stream containing the externalized object
|
williamr@2
|
159 |
* @return an instance of a CSIPAddress
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
IMPORT_C static CSIPAddress* InternalizeL(RReadStream& aReadStream);
|
williamr@2
|
162 |
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* Writes the object to a RWriteStream
|
williamr@2
|
165 |
* @param aWriteStream a stream where the object is to be externalized
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
IMPORT_C void ExternalizeL(RWriteStream& aWriteStream);
|
williamr@2
|
168 |
|
williamr@2
|
169 |
|
williamr@2
|
170 |
public: // For internal use:
|
williamr@2
|
171 |
|
williamr@2
|
172 |
IMPORT_C CURIContainer& URI();
|
williamr@2
|
173 |
IMPORT_C const CURIContainer& URI() const;
|
williamr@2
|
174 |
static CSIPAddress* NewLC(CURIContainer* aURI);
|
williamr@2
|
175 |
|
williamr@2
|
176 |
|
williamr@2
|
177 |
private: // Constructors
|
williamr@2
|
178 |
|
williamr@2
|
179 |
CSIPAddress();
|
williamr@2
|
180 |
void ConstructL();
|
williamr@2
|
181 |
void ConstructL(CUri8* aUri);
|
williamr@2
|
182 |
void ConstructL(const TDesC8& aDisplayName, CUri8* aUri);
|
williamr@2
|
183 |
void ConstructL(const CSIPAddress& aSIPAddress);
|
williamr@2
|
184 |
void ConstructL(CURIContainer* aURI);
|
williamr@2
|
185 |
|
williamr@2
|
186 |
private: // New functions
|
williamr@2
|
187 |
|
williamr@2
|
188 |
void DoInternalizeL(RReadStream& aReadStream);
|
williamr@2
|
189 |
TInt QuotedStringLength(const TDesC8& aValue);
|
williamr@2
|
190 |
TBool CheckDisplayName(const TDesC8& aValue);
|
williamr@2
|
191 |
void ParseURIInAngleBracketsL(const TDesC8& aValue);
|
williamr@2
|
192 |
void ParseURIL(const TDesC8& aValue);
|
williamr@2
|
193 |
TBool ContainsSeparators(const TDesC8& aValue) const;
|
williamr@2
|
194 |
TBool HasDisplayName() const;
|
williamr@2
|
195 |
|
williamr@2
|
196 |
private: // Data
|
williamr@2
|
197 |
|
williamr@2
|
198 |
HBufC8* iDisplayName;
|
williamr@2
|
199 |
CURIContainer* iURI;
|
williamr@2
|
200 |
|
williamr@2
|
201 |
private: // For testing purposes
|
williamr@4
|
202 |
#ifdef CPPUNIT_TEST
|
williamr@4
|
203 |
friend class CSIPAddressTest;
|
williamr@4
|
204 |
#endif
|
williamr@2
|
205 |
};
|
williamr@2
|
206 |
|
williamr@2
|
207 |
#endif // end of __SIP_ADDRESS_H__
|
williamr@2
|
208 |
|
williamr@2
|
209 |
// End of File
|