[content] Remove Open Service Platform words
[platform/framework/native/content.git] / src / inc / FCnt_AudioMetadataImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 /**
17  * @file                FCnt_AudioMetadataImpl.h
18  * @brief               This is the header file for the %_AudioMetadataImpl class.
19  *
20  * This header file contains the declarations of the %_AudioMetadataImpl class.
21  */
22
23 #ifndef _FCNT_INTERNAL_AUDIO_METADATA_IMPL_H_
24 #define _FCNT_INTERNAL_AUDIO_METADATA_IMPL_H_
25
26 #include <unique_ptr.h>
27 #include <FBaseString.h>
28 #include <FGrpBitmap.h>
29
30 namespace Tizen { namespace Content
31 {
32
33 class AudioMetadata;
34
35 struct AudioMeta
36 {
37         AudioMeta()
38                 : bitrate(0)
39                 , channelCount(0)
40                 , duration(0)
41                 , frequency(0)
42                 , trackNum(0)
43                 , year(0)
44                 , contentPath(L"")
45                 , pAlbumName(null)
46                 , pArtist(null)
47                 , pComment(null)
48                 , pDescription(null)
49                 , pComposer(null)
50                 , pCopyright(null)
51                 , pGenre(null)
52                 , pRecordingDate(null)
53                 , pTitle(null)
54                 , pTrackInfo(null)
55                 , pThumbnail(null)
56                 , pAlbumArt(null)  {}
57
58         int bitrate;
59         int channelCount;
60         long duration;
61         int frequency;
62         int trackNum;
63         int year;
64         Tizen::Base::String contentPath;
65         Tizen::Base::String* pAlbumName;
66         Tizen::Base::String* pArtist;
67         Tizen::Base::String* pComment;
68         Tizen::Base::String* pDescription;
69         Tizen::Base::String* pComposer;
70         Tizen::Base::String* pCopyright;
71         Tizen::Base::String* pGenre;
72         Tizen::Base::String* pRecordingDate;
73         Tizen::Base::String* pTitle;
74         Tizen::Base::String* pTrackInfo;
75         Tizen::Graphics::Bitmap* pThumbnail;
76         Tizen::Graphics::Bitmap* pAlbumArt;
77 };
78
79 struct AudioMetaDeleter
80 {
81         void operator()(AudioMeta* pAudioMeta)
82         {
83                 if (pAudioMeta != null)
84                 {
85                         if (pAudioMeta->pAlbumName)
86                         {
87                                 delete pAudioMeta->pAlbumName;
88                                 pAudioMeta->pAlbumName = null;
89                         }
90                         if (pAudioMeta->pArtist)
91                         {
92                                 delete pAudioMeta->pArtist;
93                                 pAudioMeta->pArtist = null;
94                         }
95                         if (pAudioMeta->pComment)
96                         {
97                                 delete pAudioMeta->pComment;
98                                 pAudioMeta->pComment = null;
99                         }
100                         if (pAudioMeta->pDescription)
101                         {
102                                 delete pAudioMeta->pDescription;
103                                 pAudioMeta->pDescription = null;
104                         }
105                         if (pAudioMeta->pComposer)
106                         {
107                                 delete pAudioMeta->pComposer;
108                                 pAudioMeta->pComposer = null;
109                         }
110                         if (pAudioMeta->pCopyright)
111                         {
112                                 delete pAudioMeta->pCopyright;
113                                 pAudioMeta->pCopyright = null;
114                         }
115                         if (pAudioMeta->pGenre)
116                         {
117                                 delete pAudioMeta->pGenre;
118                                 pAudioMeta->pGenre = null;
119                         }
120                         if (pAudioMeta->pRecordingDate)
121                         {
122                                 delete pAudioMeta->pRecordingDate;
123                                 pAudioMeta->pRecordingDate = null;
124                         }
125                         if (pAudioMeta->pTitle)
126                         {
127                                 delete pAudioMeta->pTitle;
128                                 pAudioMeta->pTitle = null;
129                         }
130                         if (pAudioMeta->pTrackInfo)
131                         {
132                                 delete pAudioMeta->pTrackInfo;
133                                 pAudioMeta->pTrackInfo = null;
134                         }
135                         if (pAudioMeta->pThumbnail)
136                         {
137                                 delete pAudioMeta->pThumbnail;
138                                 pAudioMeta->pThumbnail = null;
139                         }
140                         if (pAudioMeta->pAlbumArt)
141                         {
142                                 delete pAudioMeta->pAlbumArt;
143                                 pAudioMeta->pAlbumArt = null;
144                         }
145
146                         delete pAudioMeta;
147                         pAudioMeta = null;
148                 }
149         }
150 };
151
152 class _AudioMetadataImpl
153         : public Tizen::Base::Object
154 {
155 public:
156         /**
157          * This is the default constructor for this class.
158          *
159          * @since 2.1
160          */
161         _AudioMetadataImpl(void);
162
163         /**
164          * This is the copy constructor for this class.
165          *
166          * @since 2.1
167          */
168         _AudioMetadataImpl(const _AudioMetadataImpl& rhs);
169
170         /**
171          * This is the destructor for this class.
172          *
173          * @since 2.1
174          */
175         virtual ~_AudioMetadataImpl(void);
176
177         /**
178          * @see @ref Tizen::Content::AudioMetadata::GetTitle()
179          */
180         Tizen::Base::String GetTitle(void) const;
181
182         /**
183          * @see @ref Tizen::Content::AudioMetadata::GetBitrate()
184          */
185         int GetBitrate(void) const;
186
187         /**
188          * @see @ref Tizen::Content::AudioMetadata::GetFrequency()
189          */
190         int GetFrequency(void) const;
191
192         /**
193          * @see @ref Tizen::Content::AudioMetadata::GetArtist()
194          */
195         Tizen::Base::String GetArtist(void) const;
196
197         /**
198          * @see @ref Tizen::Content::AudioMetadata::GetAlbumName()
199          */
200         Tizen::Base::String GetAlbumName(void) const;
201
202         /**
203          * @see @ref Tizen::Content::AudioMetadata::GetComment()
204          */
205         Tizen::Base::String GetComment(void) const;
206
207         /**
208          * @see @ref Tizen::Content::AudioMetadata::GetDescription()
209          */
210         Tizen::Base::String GetDescription(void) const;
211
212         /**
213          * @see @ref Tizen::Content::AudioMetadata::GetTrack()
214          */
215         int GetTrack(void) const;
216
217         /**
218          * @see @ref Tizen::Content::AudioMetadata::GetGenre()
219          */
220         Tizen::Base::String GetGenre(void) const;
221
222         /**
223          * @see @ref Tizen::Content::AudioMetadata::GetComposer()
224          */
225         Tizen::Base::String GetComposer(void) const;
226
227         /**
228          * @see @ref Tizen::Content::AudioMetadata::GetCopyright()
229          */
230         Tizen::Base::String GetCopyright(void) const;
231
232         /**
233          * @see @ref Tizen::Content::AudioMetadata::GetDuration()
234          */
235         long GetDuration(void) const;
236
237         /**
238          * @see @ref Tizen::Content::AudioMetadata::GetYear()
239          */
240         int GetYear(void) const;
241
242         /**
243          * @see @ref Tizen::Content::AudioMetadata::GetTrackInfo()
244          */
245         Tizen::Base::String GetTrackInfo(void) const;
246
247         /**
248          * @see @ref Tizen::Content::AudioMetadata::GetRecordingDate()
249          */
250         Tizen::Base::String GetRecordingDate(void) const;
251
252         /**
253          * @see @ref Tizen::Content::AudioMetadata::GetChannelCount()
254          */
255         int GetChannelCount(void) const;
256
257         /**
258          * @see @ref Tizen::Content::AudioMetadata::GetThumbnailN()
259          */
260         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
261
262         /**
263          * @see @ref Tizen::Content::AudioMetadata::GetAlbumArtN()
264          */
265         Tizen::Graphics::Bitmap* GetAlbumArtN(void) const;
266
267         /**
268          * Gets the Impl instance.
269          *
270          * @since 2.1
271          * @return      The pointer to _AudioMetadataImpl
272          * @param[in] audioMetadata             An instance of AudioMetadata
273          */
274         static _AudioMetadataImpl* GetInstance(AudioMetadata& audioMetadata);
275
276         /**
277          * Gets the Impl instance.
278          *
279          * @since 2.1
280          * @return      The pointer to _AudioMetadataImpl
281          * @param[in] audioMetadata             An instance of AudioMetadata
282          */
283         static const _AudioMetadataImpl* GetInstance(const AudioMetadata& audioMetadata);
284
285         /**
286          * @see @ref Tizen::Content::AudioMetadata::Equals()
287          */
288         virtual bool Equals(const Tizen::Base::Object& rhs) const;
289
290         /**
291          * @see @ref Tizen::Content::AudioMetadata::GetHashCode()
292          */
293         virtual int GetHashCode(void) const;
294
295         /**
296          * @see @ref Tizen::Content::AudioMetadata::operator =()
297          */
298         _AudioMetadataImpl& operator =(const _AudioMetadataImpl& rhs);
299
300 private:
301         result SetAudioMetadata(const AudioMeta* pAudioMeta);
302         AudioMeta* GetAudioMetadata(void) const;
303
304 private:
305         std::unique_ptr<AudioMeta, AudioMetaDeleter> __pAudioMeta;
306
307         friend class _ContentManagerUtilImpl;
308
309 };  // class _AudioMetadataImpl
310
311 }}  // Tizen::Content
312
313 #endif  // _FCNT_INTERNAL_AUDIO_METADATA_IMPL_H_