|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : SdpOriginFieldPtrs.cpp |
|
15 // Part of : Local SDP Codec |
|
16 // Version : 1.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "sdporiginfieldptrs.h" |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // CSdpOriginFieldPtrs::NewL |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 CSdpOriginFieldPtrs* CSdpOriginFieldPtrs::NewL( TInt64 aSessionId, |
|
28 TInt64 aSessionVersion ) |
|
29 { |
|
30 CSdpOriginFieldPtrs* self = new ( ELeave ) CSdpOriginFieldPtrs; |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL( aSessionId, aSessionVersion ); |
|
33 CleanupStack::Pop( self ); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ---------------------------------------------------------------------------- |
|
38 // CSdpOriginFieldPtrs::CSdpOriginFieldPtrs |
|
39 // ---------------------------------------------------------------------------- |
|
40 // |
|
41 CSdpOriginFieldPtrs::CSdpOriginFieldPtrs() |
|
42 { |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // CSdpOriginFieldPtrs::ConstructL |
|
47 // ---------------------------------------------------------------------------- |
|
48 // |
|
49 void CSdpOriginFieldPtrs::ConstructL( TInt64 aSessionId, |
|
50 TInt64 aSessionVersion ) |
|
51 { |
|
52 iUserName = KNullDesC8().AllocL(); |
|
53 SetSessionIdL( aSessionId ); |
|
54 SetSessionVersionL( aSessionVersion ); |
|
55 } |
|
56 |
|
57 // ---------------------------------------------------------------------------- |
|
58 // CSdpOriginFieldPtrs::~CSdpOriginFieldPtrs |
|
59 // ---------------------------------------------------------------------------- |
|
60 // |
|
61 CSdpOriginFieldPtrs::~CSdpOriginFieldPtrs() |
|
62 { |
|
63 delete iUserName; |
|
64 delete iSessionId; |
|
65 delete iSessionVersion; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSdpOriginFieldPtrs::SetUserNameL |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CSdpOriginFieldPtrs::SetUserNameL( const TDesC8& aUserName ) |
|
73 { |
|
74 HBufC8* tmp = aUserName.AllocL(); |
|
75 delete iUserName; |
|
76 iUserName = tmp; |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CSdpOriginFieldPtrs::UserName |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 const TDesC8& CSdpOriginFieldPtrs::UserName() const |
|
84 { |
|
85 return *iUserName; |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CSdpOriginFieldPtrs::SetSessionIdL |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void CSdpOriginFieldPtrs::SetSessionIdL( const TDesC8& aSessionId ) |
|
93 { |
|
94 HBufC8* tmp = aSessionId.AllocL(); |
|
95 delete iSessionId; |
|
96 iSessionId = tmp; |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CSdpOriginFieldPtrs::SetSessionIdL |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CSdpOriginFieldPtrs::SetSessionIdL( TInt64 aSessionId ) |
|
104 { |
|
105 TBuf8< KMaxTInt64Digits > number; |
|
106 number.AppendNum( aSessionId ); |
|
107 HBufC8* tmp = number.AllocL(); |
|
108 delete iSessionId; |
|
109 iSessionId = tmp; |
|
110 } |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CSdpOriginFieldPtrs::SessionId |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 const TDesC8& CSdpOriginFieldPtrs::SessionId() const |
|
117 { |
|
118 return *iSessionId; |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CSdpOriginFieldPtrs::SetSessionVersionL |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CSdpOriginFieldPtrs::SetSessionVersionL( const TDesC8& aSessionVersion ) |
|
126 { |
|
127 HBufC8* tmp = aSessionVersion.AllocL(); |
|
128 delete iSessionVersion; |
|
129 iSessionVersion = tmp; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CSdpOriginFieldPtrs::SetSessionVersionL |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CSdpOriginFieldPtrs::SetSessionVersionL( TInt64 aSessionVersion ) |
|
137 { |
|
138 TBuf8< KMaxTInt64Digits > number; |
|
139 number.AppendNum( aSessionVersion ); |
|
140 HBufC8* tmp = number.AllocL(); |
|
141 delete iSessionVersion; |
|
142 iSessionVersion = tmp; |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSdpOriginFieldPtrs::SessionVersion |
|
147 // ----------------------------------------------------------------------------- |
|
148 // |
|
149 const TDesC8& CSdpOriginFieldPtrs::SessionVersion() const |
|
150 { |
|
151 return *iSessionVersion; |
|
152 } |