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