|
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 "irdebug.h" |
|
22 #include "irlastplayedsongs.h" |
|
23 |
|
24 // ======== LOCAL FUNCTIONS ======== |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // Function : NewL |
|
30 // Function returns an instance of CIRLastPlayedSongs |
|
31 // Two phase constructor |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 EXPORT_C CIRLastPlayedSongs* CIRLastPlayedSongs::NewL() |
|
35 { |
|
36 IRLOG_DEBUG( "CIRLastPlayedSongs::NewL - Entering" ); |
|
37 CIRLastPlayedSongs *self=CIRLastPlayedSongs::NewLC(); |
|
38 CleanupStack::Pop(self); |
|
39 IRLOG_DEBUG( "CIRLastPlayedSongs::NewL - Exiting." ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 //CIRLastPlayedSongs::NewLC() |
|
46 //Static function |
|
47 //standard two phased constructor |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 EXPORT_C CIRLastPlayedSongs* CIRLastPlayedSongs::NewLC() |
|
51 { |
|
52 IRLOG_DEBUG( "CIRLastPlayedSongs::NewLC - Entering" ); |
|
53 CIRLastPlayedSongs *self=new(ELeave)CIRLastPlayedSongs; |
|
54 CleanupStack::PushL(self); |
|
55 self->ConstructL(); |
|
56 IRLOG_DEBUG( "CIRLastPlayedSongs::NewLC - Exiting." ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 //CIRLastPlayedSongs::~CIRLastPlayedSongs() |
|
63 //standard C++ destructor |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CIRLastPlayedSongs::~CIRLastPlayedSongs() |
|
67 { |
|
68 IRLOG_DEBUG( "CIRLastPlayedSongs::~CIRLastPlayedSongs - Entering" ); |
|
69 delete iSongName; |
|
70 iSongName=NULL; |
|
71 delete iArtistName; |
|
72 iArtistName=NULL; |
|
73 IRLOG_DEBUG( "CIRLastPlayedSongs::~CIRLastPlayedSongs - Exiting." ); |
|
74 } |
|
75 |
|
76 |
|
77 // --------------------------------------------------------------------------- |
|
78 //CIRLastPlayedSongs::SetSongName() |
|
79 //Function to set song name from a TDesC |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 EXPORT_C void CIRLastPlayedSongs:: SetSongName(const TDesC&aSongName) |
|
83 { |
|
84 IRLOG_DEBUG( "CIRLastPlayedSongs::SetSongName - Entering" ); |
|
85 iSongName=aSongName.Alloc(); |
|
86 IRLOG_DEBUG( "CIRLastPlayedSongs::SetSongName - Exiting." ); |
|
87 } |
|
88 |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 //CIRLastPlayedSongs::GetSongName() |
|
92 //Function to get song name from a TDesC |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C TDesC& CIRLastPlayedSongs::GetSongName() |
|
96 { |
|
97 IRLOG_DEBUG( "CIRLastPlayedSongs::GetSongName" ); |
|
98 return *iSongName; |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 //CIRLastPlayedSongs::SetArtistName() |
|
104 //Function to set artist name from a TDesC |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C void CIRLastPlayedSongs::SetArtistName(const TDesC& aArtistName) |
|
108 { |
|
109 IRLOG_DEBUG( "CIRLastPlayedSongs::SetArtistName - Entering" ); |
|
110 iArtistName=aArtistName.Alloc(); |
|
111 IRLOG_DEBUG( "CIRLastPlayedSongs::SetArtistName - Exiting." ); |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 //CIRLastPlayedSongs::GetArtistName() |
|
117 //Function to get artist name from a TDesC |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 EXPORT_C TDesC& CIRLastPlayedSongs:: GetArtistName() |
|
121 { |
|
122 IRLOG_DEBUG( "CIRLastPlayedSongs::GetArtistName" ); |
|
123 return *iArtistName; |
|
124 } |
|
125 |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 //CIRLastPlayedSongs::ExternalizeL() |
|
129 //externalizes the data |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 EXPORT_C void CIRLastPlayedSongs:: ExternalizeL(RWriteStream & aWriteStream) |
|
133 { |
|
134 IRLOG_DEBUG( "CIRLastPlayedSongs::ExternalizeL - Entering" ); |
|
135 TInt32 len; |
|
136 len=iSongName->Length(); |
|
137 TRAP_IGNORE(aWriteStream.WriteInt32L(len)) |
|
138 aWriteStream<< *iSongName; |
|
139 len=iArtistName->Length(); |
|
140 TRAP_IGNORE(aWriteStream.WriteInt32L(len)) |
|
141 aWriteStream<< *iArtistName; |
|
142 IRLOG_DEBUG( "CIRLastPlayedSongs::ExternalizeL - Exiting." ); |
|
143 } |
|
144 |
|
145 |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 //CIRLastPlayedSongs::InternalizeL() |
|
149 //internalizes the data |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 EXPORT_C void CIRLastPlayedSongs::InternalizeL(RReadStream & aReadStream) |
|
153 { |
|
154 IRLOG_DEBUG( "CIRLastPlayedSongs::InternalizeL - Entering" ); |
|
155 TInt8 len; |
|
156 len=aReadStream.ReadInt8L(); |
|
157 iSongName=HBufC::NewL(aReadStream,len); |
|
158 len=aReadStream.ReadInt8L(); |
|
159 iArtistName=HBufC::NewL(aReadStream,len); |
|
160 IRLOG_DEBUG( "CIRLastPlayedSongs::InternalizeL - Exiting." ); |
|
161 } |
|
162 |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 //CIRLastPlayedSongs::=() |
|
166 //standard C++ copy constructor(deep copy) |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C CIRLastPlayedSongs& CIRLastPlayedSongs::operator=(const |
|
170 CIRLastPlayedSongs& aSng) |
|
171 { |
|
172 IRLOG_DEBUG( "CIRLastPlayedSongs::operator= - Entering" ); |
|
173 if(&aSng == this) |
|
174 { |
|
175 return *this; |
|
176 } |
|
177 iArtistName=aSng.iArtistName; |
|
178 iSongName=aSng.iSongName; |
|
179 IRLOG_DEBUG( "CIRLastPlayedSongs::operator= - Exiting." ); |
|
180 return *this; |
|
181 } |
|
182 |
|
183 |
|
184 // --------------------------------------------------------------------------- |
|
185 //CIRLastPlayedSongs::ConstructL() |
|
186 //standard second phase constructor |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 void CIRLastPlayedSongs::ConstructL() |
|
190 { |
|
191 IRLOG_DEBUG( "CIRLastPlayedSongs::ConstructL" ); |
|
192 return; |
|
193 } |
|
194 |