|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The SmfLyrics class represents an instance of a music track's lyrics |
|
17 * |
|
18 */ |
|
19 |
|
20 #include <smflyrics.h> |
|
21 #include <smflyrics_p.h> |
|
22 |
|
23 /** |
|
24 * Constructor with default argument |
|
25 */ |
|
26 SmfLyrics::SmfLyrics( ) |
|
27 { |
|
28 } |
|
29 |
|
30 /** |
|
31 * Copy Constructor |
|
32 * @param aOther The reference object |
|
33 */ |
|
34 SmfLyrics::SmfLyrics( const SmfLyrics &aOther ) |
|
35 :d ( aOther.d ) |
|
36 { |
|
37 } |
|
38 |
|
39 /** |
|
40 * Overloaded = operator |
|
41 * @param aOther The reference object |
|
42 * @return The target reference value |
|
43 */ |
|
44 SmfLyrics& SmfLyrics::operator=( const SmfLyrics &aOther ) |
|
45 { |
|
46 d->m_lyrics = aOther.d->m_lyrics; |
|
47 d->m_language = aOther.d->m_language; |
|
48 d->m_releaseYr = aOther.d->m_releaseYr; |
|
49 d->m_lyricsId = aOther.d->m_lyricsId; |
|
50 return *this; |
|
51 } |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 SmfLyrics::~SmfLyrics( ) |
|
57 { |
|
58 } |
|
59 |
|
60 /** |
|
61 * Method to get the lyrics |
|
62 * @return The lyrics data |
|
63 */ |
|
64 QByteArray SmfLyrics::lyrics( ) const |
|
65 { |
|
66 return d->m_lyrics; |
|
67 } |
|
68 |
|
69 /** |
|
70 * Method to get the language |
|
71 * @return The language |
|
72 */ |
|
73 QString SmfLyrics::language( ) const |
|
74 { |
|
75 return d->m_language; |
|
76 } |
|
77 |
|
78 /** |
|
79 * Method to get the release year |
|
80 * @return The release year |
|
81 */ |
|
82 QDateTime SmfLyrics::releaseYear( ) const |
|
83 { |
|
84 return d->m_releaseYr; |
|
85 } |
|
86 |
|
87 /** |
|
88 * Method to get the id of the lyrics |
|
89 * @return The ID value |
|
90 */ |
|
91 QString SmfLyrics::id( ) const |
|
92 { |
|
93 return d->m_lyricsId; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Method to set the lyrics |
|
98 * @param aLyrics The lyrics data |
|
99 */ |
|
100 void SmfLyrics::setLyrics( const QByteArray &aLyrics ) |
|
101 { |
|
102 d->m_lyrics = aLyrics; |
|
103 } |
|
104 |
|
105 /** |
|
106 * Method to set the language |
|
107 * @param aLang The language |
|
108 */ |
|
109 void SmfLyrics::setLanguage( const QString &aLang ) |
|
110 { |
|
111 d->m_language = aLang; |
|
112 } |
|
113 |
|
114 /** |
|
115 * Method to set the release year |
|
116 * @param aRelYear The release year |
|
117 */ |
|
118 void SmfLyrics::setReleaseYear( const QDateTime &aRelYear ) |
|
119 { |
|
120 d->m_releaseYr = aRelYear; |
|
121 } |
|
122 |
|
123 /** |
|
124 * Method to set the id of the lyrics |
|
125 * @param aId The ID value |
|
126 */ |
|
127 void SmfLyrics::setId( const QString &aId ) |
|
128 { |
|
129 d->m_lyricsId = aId; |
|
130 } |
|
131 |
|
132 |
|
133 /** |
|
134 * Method for Externalization. Writes the SmfLyrics object to |
|
135 * the stream and returns a reference to the stream. |
|
136 * @param aDataStream Stream to be written |
|
137 * @param aLyrics The SmfLyrics object to be externalized |
|
138 * @return reference to the written stream |
|
139 */ |
|
140 QDataStream &operator<<( QDataStream &aDataStream, |
|
141 const SmfLyrics &aLyrics ) |
|
142 { |
|
143 // Serialize d->m_lyrics |
|
144 aDataStream<<aLyrics.d->m_lyrics; |
|
145 |
|
146 // Serialize d->m_language |
|
147 aDataStream<<aLyrics.d->m_language; |
|
148 |
|
149 // Serialize d->m_releaseYr |
|
150 aDataStream<<aLyrics.d->m_releaseYr; |
|
151 |
|
152 // Serialize d->m_lyricsId |
|
153 aDataStream<<aLyrics.d->m_lyricsId; |
|
154 |
|
155 return aDataStream; |
|
156 } |
|
157 |
|
158 /** |
|
159 * Method for Internalization. Reads a SmfLyrics object from |
|
160 * the stream and returns a reference to the stream. |
|
161 * @param aDataStream Stream to be read |
|
162 * @param aLyrics The SmfLyrics object to be internalized |
|
163 * @return reference to the stream |
|
164 */ |
|
165 QDataStream &operator>>( QDataStream &aDataStream, |
|
166 SmfLyrics &aLyrics) |
|
167 { |
|
168 // Deserialize d->m_lyrics |
|
169 aDataStream>>aLyrics.d->m_lyrics; |
|
170 |
|
171 // Deserialize d->m_language |
|
172 aDataStream>>aLyrics.d->m_language; |
|
173 |
|
174 // Deserialize d->m_releaseYr |
|
175 aDataStream>>aLyrics.d->m_releaseYr; |
|
176 |
|
177 // Deserialize d->m_lyricsId |
|
178 aDataStream>>aLyrics.d->m_lyricsId; |
|
179 |
|
180 return aDataStream; |
|
181 } |
|
182 |