|
1 /* |
|
2 ============================================================================ |
|
3 Name : NPRStation.h |
|
4 Author : Symsource |
|
5 |
|
6 Copyright (c) 2009 Symbian Foundation Ltd |
|
7 This component and the accompanying materials are made available |
|
8 under the terms of the License "Eclipse Public License v1.0" |
|
9 which accompanies this distribution, and is available |
|
10 at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
11 |
|
12 Initial Contributors: |
|
13 - Symsource |
|
14 |
|
15 Contributors: |
|
16 - Symsource |
|
17 |
|
18 Description : Class to wrap all the Station fields |
|
19 ============================================================================ |
|
20 */ |
|
21 |
|
22 #include "NPRStation.h" |
|
23 |
|
24 |
|
25 CNPRStation* CNPRStation::NewLC() |
|
26 { |
|
27 CNPRStation* self = new (ELeave) CNPRStation(); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 return self; |
|
31 } |
|
32 |
|
33 CNPRStation* CNPRStation::NewL() |
|
34 { |
|
35 CNPRStation* self = CNPRStation::NewLC(); |
|
36 CleanupStack::Pop(); // self; |
|
37 return self; |
|
38 } |
|
39 |
|
40 CNPRStation::~CNPRStation() |
|
41 { |
|
42 iName.Close(); |
|
43 iFrequency.Close(); |
|
44 iMarketCity.Close(); |
|
45 } |
|
46 |
|
47 void CNPRStation::ConstructL() |
|
48 { |
|
49 } |
|
50 |
|
51 void CNPRStation::SetNameL(const TDesC8& aName) |
|
52 { |
|
53 HBufC* temp = HBufC::NewLC(aName.Length()); |
|
54 // copy from 8 to 16 bit descriptor. |
|
55 temp->Des().Copy(aName); |
|
56 |
|
57 if(iName.MaxLength() < temp->Length()) |
|
58 { |
|
59 iName.ReAlloc(temp->Length()); |
|
60 } |
|
61 iName.Copy(temp->Des()); |
|
62 CleanupStack::PopAndDestroy(); |
|
63 } |
|
64 |
|
65 void CNPRStation::SetFrequencyL(const TDesC8& aFrequency) |
|
66 { |
|
67 HBufC* temp = HBufC::NewLC(aFrequency.Length()); |
|
68 // copy from 8 to 16 bit descriptor. |
|
69 temp->Des().Copy(aFrequency); |
|
70 |
|
71 if(iFrequency.MaxLength() < temp->Length()) |
|
72 { |
|
73 iFrequency.ReAlloc(temp->Length()); |
|
74 } |
|
75 iFrequency.Copy(temp->Des()); |
|
76 CleanupStack::PopAndDestroy(); |
|
77 } |
|
78 |
|
79 void CNPRStation::SetMarketCityL(const TDesC8& aMarketCity) |
|
80 { |
|
81 HBufC* temp = HBufC::NewLC(aMarketCity.Length()); |
|
82 // copy from 8 to 16 bit descriptor. |
|
83 temp->Des().Copy(aMarketCity); |
|
84 |
|
85 if(iMarketCity.MaxLength() < temp->Length()) |
|
86 { |
|
87 iMarketCity.ReAlloc(temp->Length()); |
|
88 } |
|
89 iMarketCity.Copy(temp->Des()); |
|
90 CleanupStack::PopAndDestroy(); |
|
91 } |
|
92 |
|
93 |