00001 /* 00002 * ============================================================================= 00003 * Name : sipaddress.h 00004 * Part of : SIP Codec 00005 * Interface : SDK API, SIP Codec API 00006 * Description : 00007 * Version : SIP/4.0 00008 * 00009 * Copyright (c) 2004 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================= 00019 */ 00020 00021 00022 #ifndef CSIPADDRESS_H 00023 #define CSIPADDRESS_H 00024 00025 // INCLUDES 00026 #include <e32base.h> 00027 #include <s32mem.h> 00028 #include <uri8.h> 00029 #include "_sipcodecdefs.h" 00030 00031 // FORWARD DECLARATIONS 00032 class CURIContainer; 00033 00034 // CLASS DECLARATION 00044 class CSIPAddress : public CBase 00045 { 00046 public: // Constructors and destructor 00047 00053 IMPORT_C static CSIPAddress* DecodeL(const TDesC8& aValue); 00054 00061 IMPORT_C static CSIPAddress* NewL(CUri8* aUri8); 00062 00069 IMPORT_C static CSIPAddress* NewLC(CUri8* aUri8); 00070 00078 IMPORT_C static CSIPAddress* NewL(const TDesC8& aDisplayName, 00079 CUri8* aUri8); 00080 00088 IMPORT_C static CSIPAddress* NewLC(const TDesC8& aDisplayName, 00089 CUri8* aUri8); 00090 00096 IMPORT_C static CSIPAddress* NewL(const CSIPAddress& aSIPAddress); 00097 00103 IMPORT_C static CSIPAddress* NewLC(const CSIPAddress& aSIPAddress); 00104 00108 IMPORT_C ~CSIPAddress(); 00109 00110 00111 public: // New functions 00112 00118 IMPORT_C TBool operator==(const CSIPAddress& aSIPAddress) const; 00119 00125 IMPORT_C const TDesC8& DisplayName() const; 00126 00131 IMPORT_C void SetDisplayNameL(const TDesC8& aDisplayName); 00132 00137 IMPORT_C const CUri8& Uri8() const; 00138 00144 IMPORT_C void SetUri8L(CUri8* aUri8); 00145 00152 IMPORT_C HBufC8* ToTextLC(TBool aUseAngleBrackets=EFalse) const; 00153 00159 IMPORT_C static CSIPAddress* InternalizeL(RReadStream& aReadStream); 00160 00165 IMPORT_C void ExternalizeL(RWriteStream& aWriteStream); 00166 00167 00168 public: // For internal use: 00169 00170 IMPORT_C CURIContainer& URI(); 00171 IMPORT_C const CURIContainer& URI() const; 00172 static CSIPAddress* NewLC(CURIContainer* aURI); 00173 00174 00175 private: // Constructors 00176 00177 CSIPAddress(); 00178 void ConstructL(); 00179 void ConstructL(CUri8* aUri); 00180 void ConstructL(const TDesC8& aDisplayName, CUri8* aUri); 00181 void ConstructL(const CSIPAddress& aSIPAddress); 00182 void ConstructL(CURIContainer* aURI); 00183 00184 private: // New functions 00185 00186 void DoInternalizeL(RReadStream& aReadStream); 00187 TInt QuotedStringLength(const TDesC8& aValue); 00188 TBool CheckDisplayName(const TDesC8& aValue); 00189 void ParseURIInAngleBracketsL(const TDesC8& aValue); 00190 void ParseURIL(const TDesC8& aValue); 00191 TBool ContainsSeparators(const TDesC8& aValue) const; 00192 TBool HasDisplayName() const; 00193 00194 private: // Data 00195 00196 HBufC8* iDisplayName; 00197 CURIContainer* iURI; 00198 00199 private: // For testing purposes 00200 00201 UNIT_TEST(CSIPAddressTest) 00202 }; 00203 00204 // end of __SIP_ADDRESS_H__ 00205 #endif 00206 00207 // End of File