1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipaddress.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,209 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Name : sipaddress.h
1.19 +* Part of : SIP Codec
1.20 +* Interface : SDK API, SIP Codec API
1.21 +* Version : SIP/4.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +
1.28 +#ifndef CSIPADDRESS_H
1.29 +#define CSIPADDRESS_H
1.30 +
1.31 +// INCLUDES
1.32 +#include <e32base.h>
1.33 +#include <s32mem.h>
1.34 +#include <uri8.h>
1.35 +#include "_sipcodecdefs.h"
1.36 +
1.37 +// FORWARD DECLARATIONS
1.38 +class CURIContainer;
1.39 +
1.40 +// CLASS DECLARATION
1.41 +/**
1.42 +* @publishedAll
1.43 +* @released
1.44 +*
1.45 +* Class provides functions for setting and getting parameters in SIP
1.46 +* name-addr structure
1.47 +*
1.48 +* @lib sipcodec.lib
1.49 +*/
1.50 +class CSIPAddress : public CBase
1.51 + {
1.52 + public: // Constructors and destructor
1.53 +
1.54 + /**
1.55 + * Constructs a CSIPAddress from textual representation
1.56 + * @param aValue SIP name-addr as text
1.57 + * @return a new instance of CSIPAddress
1.58 + */
1.59 + IMPORT_C static CSIPAddress* DecodeL(const TDesC8& aValue);
1.60 +
1.61 + /**
1.62 + * Creates a new instance of CSIPAddress
1.63 + * @pre aUri != 0
1.64 + * @param aUri the ownership is transferred.
1.65 + * @return a new instance of CSIPAddress
1.66 + */
1.67 + IMPORT_C static CSIPAddress* NewL(CUri8* aUri8);
1.68 +
1.69 + /**
1.70 + * Creates a new instance of CSIPAddress and puts it to CleanupStack
1.71 + * @pre aUri != 0
1.72 + * @param aUri the ownership is transferred.
1.73 + * @return a new instance of CSIPAddress
1.74 + */
1.75 + IMPORT_C static CSIPAddress* NewLC(CUri8* aUri8);
1.76 +
1.77 + /**
1.78 + * Creates a new instance of CSIPAddress
1.79 + * @pre aUri != 0
1.80 + * @param aDisplayName a SIP token or a SIP quoted-string
1.81 + * @param aUri the ownership is transferred.
1.82 + * @return a new instance of CSIPAddress
1.83 + */
1.84 + IMPORT_C static CSIPAddress* NewL(const TDesC8& aDisplayName,
1.85 + CUri8* aUri8);
1.86 +
1.87 + /**
1.88 + * Creates a new instance of CSIPAddress and puts it to CleanupStack
1.89 + * @pre aUri != 0
1.90 + * @param aDisplayName a SIP token or a SIP quoted-string
1.91 + * @param aUri the ownership is transferred.
1.92 + * @return a new instance of CSIPAddress
1.93 + */
1.94 + IMPORT_C static CSIPAddress* NewLC(const TDesC8& aDisplayName,
1.95 + CUri8* aUri8);
1.96 +
1.97 + /**
1.98 + * Creates a deep-copy of a CSIPAddress
1.99 + * @param aSIPAddress the address to be copied
1.100 + * @return a new instance of CSIPAddress
1.101 + */
1.102 + IMPORT_C static CSIPAddress* NewL(const CSIPAddress& aSIPAddress);
1.103 +
1.104 + /**
1.105 + * Creates a deep-copy of a CSIPAddress and puts it to CleanupStack
1.106 + * @param aSIPAddress the address to be copied
1.107 + * @return a new instance of CSIPAddress
1.108 + */
1.109 + IMPORT_C static CSIPAddress* NewLC(const CSIPAddress& aSIPAddress);
1.110 +
1.111 + /**
1.112 + * Destructor, deletes the resources of CSIPAddress.
1.113 + */
1.114 + IMPORT_C ~CSIPAddress();
1.115 +
1.116 +
1.117 + public: // New functions
1.118 +
1.119 + /**
1.120 + * Compares this object to another instance of CSIPAddress
1.121 + * @param aSIPAddress a CSIPAddress to compare to
1.122 + * @return ETrue if the objects are equal otherwise EFalse
1.123 + */
1.124 + IMPORT_C TBool operator==(const CSIPAddress& aSIPAddress) const;
1.125 +
1.126 + /**
1.127 + * Gets the display name
1.128 + * @return the display name if present,
1.129 + * otherwise a zero-length descriptor
1.130 + */
1.131 + IMPORT_C const TDesC8& DisplayName() const;
1.132 +
1.133 + /**
1.134 + * Sets the display name
1.135 + * @param aDisplayName a SIP token or a SIP quoted-string
1.136 + */
1.137 + IMPORT_C void SetDisplayNameL(const TDesC8& aDisplayName);
1.138 +
1.139 + /**
1.140 + * Gets the URI part of the address as const
1.141 + * @return a reference to the URI object
1.142 + */
1.143 + IMPORT_C const CUri8& Uri8() const;
1.144 +
1.145 + /**
1.146 + * Sets the URI part of the address
1.147 + * @pre aUri!= 0
1.148 + * @param aUri a pointer to the URI object, the ownership is transferred
1.149 + */
1.150 + IMPORT_C void SetUri8L(CUri8* aUri8);
1.151 +
1.152 + /**
1.153 + * Creates a textual representation and pushes it to CleanupStack
1.154 + * @param aUseAngleBrackets if ETrue, sets the anglebrackets
1.155 + * @return a textual representation of the object,
1.156 + * the ownership is transferred
1.157 + */
1.158 + IMPORT_C HBufC8* ToTextLC(TBool aUseAngleBrackets=EFalse) const;
1.159 +
1.160 + /**
1.161 + * Constructs an instance of a CSIPAddress from a RReadStream
1.162 + * @param aReadStream a stream containing the externalized object
1.163 + * @return an instance of a CSIPAddress
1.164 + */
1.165 + IMPORT_C static CSIPAddress* InternalizeL(RReadStream& aReadStream);
1.166 +
1.167 + /**
1.168 + * Writes the object to a RWriteStream
1.169 + * @param aWriteStream a stream where the object is to be externalized
1.170 + */
1.171 + IMPORT_C void ExternalizeL(RWriteStream& aWriteStream);
1.172 +
1.173 +
1.174 + public: // For internal use:
1.175 +
1.176 + IMPORT_C CURIContainer& URI();
1.177 + IMPORT_C const CURIContainer& URI() const;
1.178 + static CSIPAddress* NewLC(CURIContainer* aURI);
1.179 +
1.180 +
1.181 + private: // Constructors
1.182 +
1.183 + CSIPAddress();
1.184 + void ConstructL();
1.185 + void ConstructL(CUri8* aUri);
1.186 + void ConstructL(const TDesC8& aDisplayName, CUri8* aUri);
1.187 + void ConstructL(const CSIPAddress& aSIPAddress);
1.188 + void ConstructL(CURIContainer* aURI);
1.189 +
1.190 + private: // New functions
1.191 +
1.192 + void DoInternalizeL(RReadStream& aReadStream);
1.193 + TInt QuotedStringLength(const TDesC8& aValue);
1.194 + TBool CheckDisplayName(const TDesC8& aValue);
1.195 + void ParseURIInAngleBracketsL(const TDesC8& aValue);
1.196 + void ParseURIL(const TDesC8& aValue);
1.197 + TBool ContainsSeparators(const TDesC8& aValue) const;
1.198 + TBool HasDisplayName() const;
1.199 +
1.200 + private: // Data
1.201 +
1.202 + HBufC8* iDisplayName;
1.203 + CURIContainer* iURI;
1.204 +
1.205 + private: // For testing purposes
1.206 +
1.207 + UNIT_TEST(CSIPAddressTest)
1.208 + };
1.209 +
1.210 +#endif // end of __SIP_ADDRESS_H__
1.211 +
1.212 +// End of File