2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FCntAudioContentInfo.cpp
19 * @brief This is the implementation file for the %AudioContentInfo class.
21 * This file contains implementation of the %AudioContentInfo class.
24 #include <FBaseSysLog.h>
25 #include <FCntAudioContentInfo.h>
26 #include "FCnt_AudioContentInfoImpl.h"
27 #include "FCnt_ContentInfoHelper.h"
29 using namespace Tizen::Base;
31 namespace Tizen { namespace Content
34 AudioContentInfo::AudioContentInfo(void)
35 : __pAudioContentData(null)
36 , __pAudioContentInfoImpl(null)
41 AudioContentInfo::~AudioContentInfo(void)
43 delete __pAudioContentInfoImpl;
47 AudioContentInfo::Construct(const String& contentPath, const String& thumbnailPath, bool setGps)
51 SysAssertf(__pAudioContentInfoImpl == null || __pAudioContentInfoImpl->IsReconstructable(),
52 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
54 _AudioContentInfoImpl* pAudioContentInfoImpl = new (std::nothrow) _AudioContentInfoImpl();
55 SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
57 r = pAudioContentInfoImpl->Construct(contentPath, thumbnailPath, setGps);
58 SysTryCatch(NID_CNT, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
60 _ContentInfoHelper::SetContentInfoImpl(this, pAudioContentInfoImpl);
62 delete __pAudioContentInfoImpl;
63 __pAudioContentInfoImpl = pAudioContentInfoImpl;
65 if (r == E_FILE_NOT_FOUND)
67 __pAudioContentInfoImpl->SetReconstructable(true);
71 __pAudioContentInfoImpl->SetReconstructable(false);
77 delete pAudioContentInfoImpl;
83 AudioContentInfo::Construct(const String* pContentPath)
87 SysAssertf(__pAudioContentInfoImpl == null || __pAudioContentInfoImpl->IsReconstructable(),
88 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
90 _AudioContentInfoImpl* pAudioContentInfoImpl = new (std::nothrow) _AudioContentInfoImpl();
91 SysTryReturnResult(NID_CNT, pAudioContentInfoImpl != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Construct failed.");
93 r = pAudioContentInfoImpl->Construct(pContentPath);
94 SysTryCatch(NID_CNT, r == E_SUCCESS || r == E_FILE_NOT_FOUND, , r, "[%s] Propagating.", GetErrorMessage(r));
96 _ContentInfoHelper::SetContentInfoImpl(this, pAudioContentInfoImpl);
98 delete __pAudioContentInfoImpl;
99 __pAudioContentInfoImpl = pAudioContentInfoImpl;
101 if (r == E_FILE_NOT_FOUND)
103 __pAudioContentInfoImpl->SetReconstructable(true);
107 __pAudioContentInfoImpl->SetReconstructable(false);
113 delete pAudioContentInfoImpl;
119 AudioContentInfo::GetGenre(void) const
121 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
123 return __pAudioContentInfoImpl->GetGenre();
127 AudioContentInfo::GetArtist(void) const
129 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
131 return __pAudioContentInfoImpl->GetArtist();
135 AudioContentInfo::GetComposer(void) const
137 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
139 return __pAudioContentInfoImpl->GetComposer();
143 AudioContentInfo::GetAlbumName(void) const
145 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
147 return __pAudioContentInfoImpl->GetAlbumName();
151 AudioContentInfo::GetReleaseYear(void) const
153 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
155 return __pAudioContentInfoImpl->GetReleaseYear();
159 AudioContentInfo::GetBitrate(void) const
161 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
163 return __pAudioContentInfoImpl->GetBitrate();
167 AudioContentInfo::GetTitle(void) const
169 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
171 return __pAudioContentInfoImpl->GetTitle();
175 AudioContentInfo::GetCopyright(void) const
177 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
179 return __pAudioContentInfoImpl->GetCopyright();
183 AudioContentInfo::GetTrackInfo(void) const
185 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
187 return __pAudioContentInfoImpl->GetTrackInfo();
191 AudioContentInfo::GetDuration(void) const
193 SysAssertf(__pAudioContentInfoImpl != null, "Not yet constructed. Construct() should be called before use.");
195 return __pAudioContentInfoImpl->GetDuration();