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.
17 * @file FCntContentInfo.cpp
18 * @brief This is the implementation file for the %ContentInfo class.
20 * This file contains implementation of the %ContentInfo class.
24 #include <FBaseSysLog.h>
25 #include <FCntContentInfo.h>
26 #include <FGrpBitmap.h>
27 #include <FApp_AppInfo.h>
28 #include "FCnt_ContentInfoImpl.h"
29 #include "FCnt_ImageContentInfoImpl.h"
30 #include "FCnt_AudioContentInfoImpl.h"
31 #include "FCnt_VideoContentInfoImpl.h"
32 #include "FCnt_OtherContentInfoImpl.h"
35 using namespace Tizen::Base;
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Locations;
39 namespace Tizen { namespace Content
42 static const int _MAX_CUSTOM_FIELD_COMMON = 45;
43 static const int _MAX_CUSTOM_FIELD_DESCRIPTION = 140;
45 ContentInfo::ContentInfo(void)
46 : __pContentInfoImpl(null)
51 ContentInfo::~ContentInfo(void)
57 ContentInfo::GetContentId(void) const
59 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
61 return __pContentInfoImpl->GetContentId();
65 ContentInfo::GetContentType(void) const
67 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
69 return __pContentInfoImpl->GetContentType();
73 ContentInfo::GetDateTime(void) const
75 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
77 return __pContentInfoImpl->GetDateTime();
81 ContentInfo::GetMimeType(void) const
83 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
85 return __pContentInfoImpl->GetMimeType();
89 ContentInfo::GetContentSize(void) const
91 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
93 return __pContentInfoImpl->GetContentSize();
97 ContentInfo::GetContentName(void) const
99 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
101 return __pContentInfoImpl->GetContentName();
105 ContentInfo::GetContentPath(void) const
107 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
109 return __pContentInfoImpl->GetContentPath();
113 ContentInfo::GetCoordinates(void) const
115 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
117 __coordinates = __pContentInfoImpl->GetCoordinates();
119 return __coordinates;
123 ContentInfo::SetCoordinates(const Coordinates& coordinates)
125 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
127 __pContentInfoImpl->SetCoordinates(coordinates);
133 ContentInfo::SetLocationTag(const String& locationTag)
135 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
137 SysTryReturnResult(NID_CNT, locationTag.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
138 "The max input length is 45 characters.");
140 __pContentInfoImpl->SetLocationTag(locationTag);
146 ContentInfo::GetLocationTag(void) const
148 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
150 return __pContentInfoImpl->GetLocationTag();
154 ContentInfo::SetRating(const String& rating)
156 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
158 SysTryReturnResult(NID_CNT, rating.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
159 "The max input length is 45 characters.");
161 __pContentInfoImpl->SetRating(rating);
167 ContentInfo::GetRating(void) const
169 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
171 return __pContentInfoImpl->GetRating();
175 ContentInfo::SetCategory(const String& category)
177 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
179 SysTryReturnResult(NID_CNT, category.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
180 "The max input length is 45 characters.");
182 __pContentInfoImpl->SetCategory(category);
188 ContentInfo::GetCategory(void) const
190 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
192 return __pContentInfoImpl->GetCategory();
196 ContentInfo::SetDescription(const String& description)
198 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
200 SysTryReturnResult(NID_CNT, description.GetLength() <= _MAX_CUSTOM_FIELD_DESCRIPTION, E_INVALID_ARG,
201 "The max input length is 140 characters.");
203 __pContentInfoImpl->SetDescription(description);
209 ContentInfo::GetDescription(void) const
211 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
213 return __pContentInfoImpl->GetDescription();
217 ContentInfo::GetThumbnailN(void) const
219 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
223 Bitmap* pBitmap = __pContentInfoImpl->GetThumbnailN();
224 result r = GetLastResult();
225 SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] GetThumbnailN() failed.", GetErrorMessage(r));
231 ContentInfo::IsDrmProtected(void) const
233 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
235 return __pContentInfoImpl->IsDrmProtected();
239 ContentInfo::GetKeyword(void) const
241 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
243 return __pContentInfoImpl->GetKeyword();
247 ContentInfo::SetContentName(const String& contentName)
249 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
251 SysTryReturnResult(NID_CNT, contentName.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
252 "The max input length is 45 characters.");
254 __pContentInfoImpl->SetContentName(contentName);
260 ContentInfo::SetKeyword(const String& keyword)
262 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
264 SysTryReturnResult(NID_CNT, keyword.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
265 "The max input length is 45 characters.");
267 __pContentInfoImpl->SetKeyword(keyword);
273 ContentInfo::SetAuthor(const String& author)
275 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
277 SysTryReturnResult(NID_CNT, author.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
278 "The max input length is 45 characters.");
280 __pContentInfoImpl->SetAuthor(author);
286 ContentInfo::GetAuthor(void) const
288 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
290 return __pContentInfoImpl->GetAuthor();
294 ContentInfo::SetProvider(const String& provider)
296 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
298 SysTryReturnResult(NID_CNT, provider.GetLength() <= _MAX_CUSTOM_FIELD_COMMON, E_INVALID_ARG,
299 "The max input length is 45 characters.");
301 __pContentInfoImpl->SetProvider(provider);
307 ContentInfo::GetProvider(void) const
309 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
311 return __pContentInfoImpl->GetProvider();
315 ContentInfo::GetMediaFormat(void) const
317 SysAssertf(__pContentInfoImpl != null, "Not yet constructed.");
319 return __pContentInfoImpl->GetMediaFormat();