|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <s32strm.h> |
|
19 |
|
20 #include "irchannelserverurl.h" |
|
21 #include "irdebug.h" |
|
22 |
|
23 // ======== LOCAL FUNCTIONS ======== |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // CIRChannelServerUrl::NewL() |
|
29 // Static function |
|
30 // standard two phased constructor |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 EXPORT_C CIRChannelServerUrl* CIRChannelServerUrl::NewL() |
|
34 { |
|
35 IRLOG_DEBUG( "CIRChannelServerUrl::NewL - Entering" ); |
|
36 CIRChannelServerUrl* self = CIRChannelServerUrl::NewLC(); |
|
37 CleanupStack::Pop( self ); |
|
38 IRLOG_DEBUG( "CIRChannelServerUrl::NewL - Exiting." ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CIRChannelServerUrl::NewLC() |
|
45 // Static function |
|
46 // standard two phased constructor |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CIRChannelServerUrl* CIRChannelServerUrl::NewLC() |
|
50 { |
|
51 IRLOG_DEBUG( "CIRChannelServerUrl::NewLC - Entering" ); |
|
52 CIRChannelServerUrl* self = new( ELeave )CIRChannelServerUrl; |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL(); |
|
55 IRLOG_DEBUG( "CIRChannelServerUrl::NewLC - Exiting." ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CIRChannelServerUrl::SetServerName() |
|
62 // sets server name |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C void CIRChannelServerUrl::SetServerName( const TDesC& aServerName ) |
|
66 { |
|
67 IRLOG_DEBUG( "CIRChannelServerUrl::SetServerName - Entering" ); |
|
68 iServerName = aServerName.Alloc(); |
|
69 IRLOG_DEBUG( "CIRChannelServerUrl::SetServerName - Exiting." ); |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CIRChannelServerUrl::SetServerUrl() |
|
75 // sets server url |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void CIRChannelServerUrl::SetServerUrl( const TDesC& aServerUrl ) |
|
79 { |
|
80 IRLOG_DEBUG( "CIRChannelServerUrl::SetServerUrl - Entering" ); |
|
81 iURL = aServerUrl.Alloc(); |
|
82 IRLOG_DEBUG( "CIRChannelServerUrl::SetServerUrl - Exiting." ); |
|
83 } |
|
84 |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // CIRChannelServerUrl::SetBitRate() |
|
88 // sets server bitrate |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 EXPORT_C void CIRChannelServerUrl::SetBitRate( TInt aBitrate ) |
|
92 { |
|
93 IRLOG_DEBUG( "CIRChannelServerUrl::SetBitRate - Entering" ); |
|
94 iBitrate = aBitrate; |
|
95 //if a negative value comes,set the bitrate to 0,so that it is accessable |
|
96 //to all the setting combination |
|
97 if ( iBitrate < 0 ) |
|
98 { |
|
99 iBitrate = 0; |
|
100 } |
|
101 IRLOG_DEBUG( "CIRChannelServerUrl::SetBitRate - Exiting." ); |
|
102 } |
|
103 |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // CIRChannelServerUrl::GetServerName() |
|
107 // gets server name |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C const TDesC& CIRChannelServerUrl::GetServerName() const |
|
111 { |
|
112 IRLOG_DEBUG( "CIRChannelServerUrl::GetServerName" ); |
|
113 if ( NULL == iServerName ) |
|
114 { |
|
115 CIRChannelServerUrl *tempUrl = const_cast<CIRChannelServerUrl*>( this ); |
|
116 tempUrl->iServerName = HBufC::New(0); |
|
117 } |
|
118 return *iServerName; |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CIRChannelServerUrl::GetServerUrl() |
|
124 // gets server url |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C const TDesC& CIRChannelServerUrl::GetServerUrl() const |
|
128 { |
|
129 IRLOG_DEBUG( "CIRChannelServerUrl::GetServerUrl" ); |
|
130 if ( NULL == iURL ) |
|
131 { |
|
132 CIRChannelServerUrl *tempUrl = const_cast<CIRChannelServerUrl*>( this ); |
|
133 tempUrl->iURL = HBufC::New(0); |
|
134 } |
|
135 return *iURL; |
|
136 } |
|
137 |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 //CIRChannelServerUrl::GetBitRate() |
|
141 //gets server bitrate |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C TInt CIRChannelServerUrl::GetBitRate() const |
|
145 { |
|
146 IRLOG_DEBUG( "CIRChannelServerUrl::GetBitRate" ); |
|
147 return iBitrate; |
|
148 } |
|
149 |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 //CIRChannelServerUrl::~CIRChannelServerUrl() |
|
153 //standard C++ destructor |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 CIRChannelServerUrl::~CIRChannelServerUrl() |
|
157 { |
|
158 IRLOG_DEBUG( "CIRChannelServerUrl::~CIRChannelServerUrl - Entering" ); |
|
159 delete iServerName; |
|
160 iServerName=NULL; |
|
161 delete iURL; |
|
162 iURL=NULL; |
|
163 IRLOG_DEBUG( "CIRChannelServerUrl::~CIRChannelServerUrl - Exiting." ); |
|
164 } |
|
165 |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // CIRChannelServerUrl::=() |
|
169 // standard C++ copy constructor( deep copy ) |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 EXPORT_C CIRChannelServerUrl& CIRChannelServerUrl::operator = ( |
|
173 const CIRChannelServerUrl& churl ) |
|
174 { |
|
175 IRLOG_DEBUG( "CIRChannelServerUrl::operator= - Entering" ); |
|
176 if ( &churl == this ) |
|
177 { |
|
178 return *this; |
|
179 } |
|
180 |
|
181 if ( iServerName ) |
|
182 { |
|
183 delete iServerName; |
|
184 iServerName = NULL; |
|
185 } |
|
186 |
|
187 if ( churl.iServerName ) |
|
188 { |
|
189 iServerName = churl.iServerName->Alloc(); |
|
190 } |
|
191 |
|
192 if ( iURL ) |
|
193 { |
|
194 delete iURL; |
|
195 iURL = NULL; |
|
196 } |
|
197 |
|
198 if ( churl.iBitrate ) |
|
199 { |
|
200 iURL = churl.iURL->Alloc(); |
|
201 } |
|
202 |
|
203 iBitrate = churl.iBitrate; |
|
204 IRLOG_DEBUG( "CIRChannelServerUrl::operator= - Exiting." ); |
|
205 return *this; |
|
206 } |
|
207 |
|
208 |
|
209 // --------------------------------------------------------------------------- |
|
210 // CIRChannelServerUrl::ExternalizeL() |
|
211 // function to externalize url data |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 EXPORT_C void CIRChannelServerUrl::ExternalizeL( RWriteStream& aWriteStream ) |
|
215 { |
|
216 IRLOG_DEBUG( "CIRChannelServerUrl::ExternalizeL - Entering" ); |
|
217 TInt len; |
|
218 if ( !iServerName ) |
|
219 { |
|
220 len = 0; |
|
221 aWriteStream.WriteInt32L( len ); |
|
222 } |
|
223 else |
|
224 { |
|
225 len = iServerName->Length(); |
|
226 aWriteStream.WriteInt32L( len ); |
|
227 aWriteStream << *iServerName; |
|
228 } |
|
229 |
|
230 if ( !iURL ) |
|
231 { |
|
232 len = 0; |
|
233 aWriteStream.WriteInt32L( len ); |
|
234 } |
|
235 else |
|
236 { |
|
237 len = iURL->Length(); |
|
238 aWriteStream.WriteInt32L( len ); |
|
239 aWriteStream << *iURL; |
|
240 } |
|
241 |
|
242 aWriteStream.WriteInt32L( iBitrate ); |
|
243 IRLOG_DEBUG( "CIRChannelServerUrl::ExternalizeL - Exiting." ); |
|
244 } |
|
245 |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // CIRChannelServerUrl::InternalizeL() |
|
249 // function to internalize url data |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 EXPORT_C void CIRChannelServerUrl::InternalizeL( RReadStream& aReadStream ) |
|
253 { |
|
254 IRLOG_DEBUG( "CIRChannelServerUrl::InternalizeL - Entering" ); |
|
255 TInt len; |
|
256 len = aReadStream.ReadInt32L(); |
|
257 if ( len != 0 ) |
|
258 { |
|
259 iServerName=HBufC::NewL( aReadStream, len ); |
|
260 } |
|
261 |
|
262 len = aReadStream.ReadInt32L(); |
|
263 if ( len != 0 ) |
|
264 { |
|
265 iURL = HBufC::NewL( aReadStream, len ); |
|
266 } |
|
267 iBitrate = aReadStream.ReadInt32L(); |
|
268 IRLOG_DEBUG( "CIRChannelServerUrl::InternalizeL - Exiting." ); |
|
269 } |
|
270 |
|
271 |
|
272 // --------------------------------------------------------------------------- |
|
273 // CIRChannelServerUrl::ConstructL() |
|
274 // standard second phase construction |
|
275 // --------------------------------------------------------------------------- |
|
276 // |
|
277 void CIRChannelServerUrl::ConstructL() const |
|
278 { |
|
279 IRLOG_DEBUG( "CIRChannelServerUrl::ConstructL" ); |
|
280 return; |
|
281 } |