epoc32/include/mw/sipaddress.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/sipaddress.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
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@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
#include "_sipcodecdefs.h"
williamr@2
    33
williamr@2
    34
// FORWARD DECLARATIONS
williamr@2
    35
class CURIContainer;
williamr@2
    36
williamr@2
    37
// CLASS DECLARATION
williamr@2
    38
/**
williamr@2
    39
* @publishedAll
williamr@2
    40
* @released
williamr@2
    41
*
williamr@2
    42
* Class provides functions for setting and getting parameters in SIP 
williamr@2
    43
* name-addr structure
williamr@2
    44
*
williamr@2
    45
* @lib sipcodec.lib
williamr@2
    46
*/
williamr@2
    47
class CSIPAddress : public CBase
williamr@2
    48
	{
williamr@2
    49
	public:	// Constructors and destructor
williamr@2
    50
williamr@2
    51
		/**
williamr@2
    52
		* Constructs a CSIPAddress from textual representation 
williamr@2
    53
		* @param aValue SIP name-addr as text
williamr@2
    54
		* @return a new instance of CSIPAddress
williamr@2
    55
		*/
williamr@2
    56
		IMPORT_C static CSIPAddress* DecodeL(const TDesC8& aValue);
williamr@2
    57
williamr@2
    58
		/**
williamr@2
    59
		* Creates a new instance of CSIPAddress
williamr@2
    60
		* @pre aUri != 0
williamr@2
    61
		* @param aUri the ownership is transferred.
williamr@2
    62
		* @return a new instance of CSIPAddress
williamr@2
    63
		*/
williamr@2
    64
		IMPORT_C static CSIPAddress* NewL(CUri8* aUri8);
williamr@2
    65
williamr@2
    66
		/**
williamr@2
    67
		* Creates a new instance of CSIPAddress and puts it to CleanupStack
williamr@2
    68
		* @pre aUri != 0 
williamr@2
    69
		* @param aUri the ownership is transferred.
williamr@2
    70
		* @return a new instance of CSIPAddress
williamr@2
    71
		*/
williamr@2
    72
		IMPORT_C static CSIPAddress* NewLC(CUri8* aUri8);
williamr@2
    73
williamr@2
    74
		/**
williamr@2
    75
		* Creates a new instance of CSIPAddress
williamr@2
    76
		* @pre aUri != 0
williamr@2
    77
		* @param aDisplayName a SIP token or a SIP quoted-string
williamr@2
    78
		* @param aUri the ownership is transferred.
williamr@2
    79
		* @return a new instance of CSIPAddress
williamr@2
    80
		*/
williamr@2
    81
		IMPORT_C static CSIPAddress* NewL(const TDesC8& aDisplayName, 
williamr@2
    82
		                                  CUri8* aUri8);
williamr@2
    83
williamr@2
    84
		/**
williamr@2
    85
		* Creates a new instance of CSIPAddress and puts it to CleanupStack
williamr@2
    86
		* @pre aUri != 0
williamr@2
    87
		* @param aDisplayName a SIP token or a SIP quoted-string
williamr@2
    88
		* @param aUri the ownership is transferred.
williamr@2
    89
		* @return a new instance of CSIPAddress
williamr@2
    90
		*/
williamr@2
    91
		IMPORT_C static CSIPAddress* NewLC(const TDesC8& aDisplayName,
williamr@2
    92
									       CUri8* aUri8);
williamr@2
    93
williamr@2
    94
		/**
williamr@2
    95
		* Creates a deep-copy of a CSIPAddress
williamr@2
    96
		* @param aSIPAddress the address to be copied
williamr@2
    97
		* @return a new instance of CSIPAddress
williamr@2
    98
		*/
williamr@2
    99
		IMPORT_C static CSIPAddress* NewL(const CSIPAddress& aSIPAddress);
williamr@2
   100
williamr@2
   101
		/**
williamr@2
   102
		* Creates a deep-copy of a CSIPAddress and puts it to CleanupStack
williamr@2
   103
		* @param aSIPAddress the address to be copied
williamr@2
   104
		* @return a new instance of CSIPAddress
williamr@2
   105
		*/
williamr@2
   106
		IMPORT_C static CSIPAddress* NewLC(const CSIPAddress& aSIPAddress);
williamr@2
   107
williamr@2
   108
		/**
williamr@2
   109
		* Destructor, deletes the resources of CSIPAddress.
williamr@2
   110
		*/
williamr@2
   111
		IMPORT_C ~CSIPAddress();
williamr@2
   112
williamr@2
   113
williamr@2
   114
	public: // New functions
williamr@2
   115
williamr@2
   116
		/**
williamr@2
   117
		* Compares this object to another instance of CSIPAddress
williamr@2
   118
		* @param aSIPAddress a CSIPAddress to compare to
williamr@2
   119
		* @return ETrue if the objects are equal otherwise EFalse
williamr@2
   120
		*/
williamr@2
   121
		IMPORT_C TBool operator==(const CSIPAddress& aSIPAddress) const;
williamr@2
   122
	
williamr@2
   123
		/**
williamr@2
   124
		* Gets the display name
williamr@2
   125
		* @return the display name if present, 
williamr@2
   126
		* 		   otherwise a zero-length descriptor 
williamr@2
   127
		*/
williamr@2
   128
		IMPORT_C const TDesC8& DisplayName() const;
williamr@2
   129
	
williamr@2
   130
		/**
williamr@2
   131
		* Sets the display name
williamr@2
   132
		* @param aDisplayName a SIP token or a SIP quoted-string
williamr@2
   133
		*/
williamr@2
   134
		IMPORT_C void SetDisplayNameL(const TDesC8& aDisplayName);
williamr@2
   135
williamr@2
   136
		/**
williamr@2
   137
		* Gets the URI part of the address as const
williamr@2
   138
		* @return a reference to the URI object
williamr@2
   139
		*/
williamr@2
   140
		IMPORT_C const CUri8& Uri8() const;
williamr@2
   141
	
williamr@2
   142
		/**
williamr@2
   143
		* Sets the URI part of the address
williamr@2
   144
		* @pre aUri!= 0
williamr@2
   145
		* @param aUri a pointer to the URI object, the ownership is transferred
williamr@2
   146
		*/
williamr@2
   147
		IMPORT_C void SetUri8L(CUri8* aUri8);
williamr@2
   148
williamr@2
   149
		/**
williamr@2
   150
		* Creates a textual representation and pushes it to CleanupStack
williamr@2
   151
		* @param aUseAngleBrackets if ETrue, sets the anglebrackets
williamr@2
   152
		* @return a textual representation of the object,
williamr@2
   153
		*          the ownership is transferred
williamr@2
   154
		*/
williamr@2
   155
		IMPORT_C HBufC8* ToTextLC(TBool aUseAngleBrackets=EFalse) const;
williamr@2
   156
williamr@2
   157
		/**
williamr@2
   158
		* Constructs an instance of a CSIPAddress from a RReadStream
williamr@2
   159
		* @param aReadStream a stream containing the externalized object
williamr@2
   160
		* @return an instance of a CSIPAddress
williamr@2
   161
		*/
williamr@2
   162
		IMPORT_C static CSIPAddress* InternalizeL(RReadStream& aReadStream);
williamr@2
   163
	
williamr@2
   164
		/**
williamr@2
   165
		* Writes the object to a RWriteStream
williamr@2
   166
		* @param aWriteStream a stream where the object is to be externalized
williamr@2
   167
		*/
williamr@2
   168
		IMPORT_C void ExternalizeL(RWriteStream& aWriteStream);
williamr@2
   169
williamr@2
   170
williamr@2
   171
	public: // For internal use:
williamr@2
   172
williamr@2
   173
		IMPORT_C CURIContainer& URI();
williamr@2
   174
		IMPORT_C const CURIContainer& URI() const;
williamr@2
   175
		static CSIPAddress* NewLC(CURIContainer* aURI);
williamr@2
   176
		
williamr@2
   177
williamr@2
   178
	private: // Constructors
williamr@2
   179
	
williamr@2
   180
		CSIPAddress();
williamr@2
   181
		void ConstructL();
williamr@2
   182
		void ConstructL(CUri8* aUri);
williamr@2
   183
		void ConstructL(const TDesC8& aDisplayName, CUri8* aUri);
williamr@2
   184
		void ConstructL(const CSIPAddress& aSIPAddress);
williamr@2
   185
		void ConstructL(CURIContainer* aURI);
williamr@2
   186
williamr@2
   187
	private: // New functions
williamr@2
   188
williamr@2
   189
		void DoInternalizeL(RReadStream& aReadStream);
williamr@2
   190
		TInt QuotedStringLength(const TDesC8& aValue);
williamr@2
   191
		TBool CheckDisplayName(const TDesC8& aValue);
williamr@2
   192
		void ParseURIInAngleBracketsL(const TDesC8& aValue);
williamr@2
   193
		void ParseURIL(const TDesC8& aValue);
williamr@2
   194
		TBool ContainsSeparators(const TDesC8& aValue) const;
williamr@2
   195
		TBool HasDisplayName() const;
williamr@2
   196
williamr@2
   197
	private: // Data
williamr@2
   198
williamr@2
   199
		HBufC8* iDisplayName;
williamr@2
   200
		CURIContainer* iURI;
williamr@2
   201
williamr@2
   202
	private: // For testing purposes
williamr@2
   203
	
williamr@2
   204
		UNIT_TEST(CSIPAddressTest)
williamr@2
   205
    };
williamr@2
   206
williamr@2
   207
#endif // end of __SIP_ADDRESS_H__
williamr@2
   208
williamr@2
   209
// End of File