2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FCntContentInfo.h
19 * @brief This is the header file for the %ContentInfo class.
21 * This header file contains the declarations of the %ContentInfo class.
24 #ifndef _FCNT_CONTENT_INFO_H_
25 #define _FCNT_CONTENT_INFO_H_
27 #include <FBaseUuId.h>
28 #include <FBaseDateTime.h>
29 #include <FCntTypes.h>
30 #include <FLocCoordinates.h>
32 namespace Tizen { namespace Locations
37 namespace Tizen { namespace Graphics
42 namespace Tizen { namespace Content
45 class _ContentInfoImpl;
49 * @brief This class provides methods to manage the content information.
53 * @final This class is not intended for extension.
55 * The %ContentInfo class is an abstract base class. @n
56 * ImageContentInfo, AudioContentInfo, VideoContentInfo, and OtherContentInfo are derived from the %ContentInfo class.
58 * When a user creates content, its content information is created as a new pair. @n
59 * When a user deletes content, its content information is deleted from the content database. @n
60 * This class provides methods to get or to set the specific content information. @n
61 * The physical file is not updated even if the set methods are called.
63 * For more information on the different types of content information, see <a href="../org.tizen.native.appprogramming/html/guide/content/device_content_mgmt.htm">Device Content Management</a>.
65 * The following example demonstrates how to use the %ContentInfo class.
69 * MyClass::TestContentInfo(void)
71 * result r = E_SUCCESS;
73 * ContentId contentId;
74 * ContentManager contentManager;
75 * r = contentManager.Construct();
76 * TryReturn(!IsFailed(r), r, "Construct failed.");
78 * ImageContentInfo imageContentInfo;
79 * r = imageContentInfo.Construct(null);
80 * TryReturn(!IsFailed(r), r, "Construct failed.");
82 * Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
83 * Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
85 * contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
86 * TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
92 class _OSP_EXPORT_ ContentInfo
93 : public Tizen::Base::Object
97 * This destructor overrides Tizen::Base::Object::~Object().
101 virtual ~ContentInfo(void);
105 * Initializes this instance of %ContentInfo with the specified parameters.
107 * @brief <i> [Deprecated] </i>
108 * @deprecated This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates.
111 * @return An error code
112 * @param[in] contentPath The content path
113 * @param[in] thumbnailPath The thumbnail path
114 * @param[in] setGps Set to @c true to save the device's last known coordinates in the %ContentInfo instance, @n
118 virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false) = 0;
121 * Gets the content ID.
125 * @return The content ID
127 ContentId GetContentId(void) const;
130 * Gets the content type.
134 * @return The content type
136 ContentType GetContentType(void) const;
139 * Gets the mime type.
143 * @return The mime type
145 Tizen::Base::String GetMimeType(void) const;
148 * Gets the date and time of the created content.
152 * @return The content's creation time (GMT)
154 Tizen::Base::DateTime GetDateTime(void) const;
157 * Gets the file size of the content.
161 * @return The file size of the content
163 unsigned long GetContentSize(void) const;
166 * Gets the content name.
170 * @return The content name
172 Tizen::Base::String GetContentName(void) const;
175 * Gets the file path of the content.
179 * @return The file path of the content
181 Tizen::Base::String GetContentPath(void) const;
184 * Gets the coordinates of the location.
188 * @return A reference to the coordinates
190 const Tizen::Locations::Coordinates& GetCoordinates(void) const;
193 * Sets the coordinates of the location.
197 * @return An error code
198 * @param[in] coordinates The user-defined coordinates
199 * @exception E_SUCCESS The method is successful.
201 result SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
204 * Sets the location tag.
208 * @return An error code
209 * @param[in] locationTag The new location tag
210 * @exception E_SUCCESS The method is successful.
211 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
212 * @exception E_OUT_OF_MEMORY The memory is insufficient.
214 result SetLocationTag(const Tizen::Base::String& locationTag);
217 * Gets the location tag.
221 * @return The location tag
223 Tizen::Base::String GetLocationTag(void) const;
230 * @return An error code
231 * @param[in] rating The new rating
232 * @exception E_SUCCESS The method is successful.
233 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
234 * @exception E_OUT_OF_MEMORY The memory is insufficient.
236 result SetRating(const Tizen::Base::String& rating);
245 Tizen::Base::String GetRating(void) const;
252 * @return An error code
253 * @param[in] category The new category
254 * @exception E_SUCCESS The method is successful.
255 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
256 * @exception E_OUT_OF_MEMORY The memory is insufficient.
258 result SetCategory(const Tizen::Base::String& category);
265 * @return The category
267 Tizen::Base::String GetCategory(void) const;
270 * Sets the description.
274 * @return An error code
275 * @param[in] description The new description
276 * @exception E_SUCCESS The method is successful.
277 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 140 characters.
278 * @exception E_OUT_OF_MEMORY The memory is insufficient.
280 result SetDescription(const Tizen::Base::String& description);
283 * Gets the description.
287 * @return The description
289 Tizen::Base::String GetDescription(void) const;
292 * Gets the thumbnail image.
295 * @brief <i> [Compatibility] </i>
299 * @compatibility This method has compatibility issues with OSP compatible applications. @n
300 * For more information, see @ref CompContentInfoGetThumbnailNPage "here".
303 * @return A pointer to the thumbnail image
304 * @exception E_SUCCESS The method is successful.
305 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
306 * @exception E_OUT_OF_MEMORY The memory is insufficient.
307 * @remarks The specific error code can be accessed using the GetLastResult() method.
309 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
313 * @page CompContentInfoGetThumbnailNPage Compatibility for GetThumbnailN().
314 * @section CompContentInfoGetThumbnailNPageIssueSection Issue
315 * The thumbnail size of this method in OSP compatible applications has the following issues: @n
316 * <DIV> The size is changed from 80x60 pixels to the size of image which is returned from the platform since %Tizen API 2.1.</DIV>
322 * Checks whether the content is DRM protected.
326 * @return @c true if this content has DRM, @n
329 bool IsDrmProtected(void) const;
336 * @return The keyword
338 Tizen::Base::String GetKeyword(void) const;
341 * Sets the content name.
345 * @return An error code
346 * @param[in] contentName The new content name
347 * @exception E_SUCCESS The method is successful.
348 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
349 * @exception E_OUT_OF_MEMORY The memory is insufficient.
351 result SetContentName(const Tizen::Base::String& contentName);
358 * @return An error code
359 * @param[in] keyword The new keyword
360 * @exception E_SUCCESS The method is successful.
361 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
362 * @exception E_OUT_OF_MEMORY The memory is insufficient.
364 result SetKeyword(const Tizen::Base::String& keyword);
371 * @return An error code
372 * @param[in] author The new author
373 * @exception E_SUCCESS The method is successful.
374 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
375 * @exception E_OUT_OF_MEMORY The memory is insufficient.
377 result SetAuthor(const Tizen::Base::String& author);
386 Tizen::Base::String GetAuthor(void) const;
393 * @return An error code
394 * @param[in] provider The new content provider
395 * @exception E_SUCCESS The method is successful.
396 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
397 * @exception E_OUT_OF_MEMORY The memory is insufficient.
399 result SetProvider(const Tizen::Base::String& provider);
406 * @return The content provider
408 Tizen::Base::String GetProvider(void) const;
411 * Gets the media format.
415 * @return The media format
417 Tizen::Base::String GetMediaFormat(void) const;
421 // This class is for internal use only.
422 // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
428 : contentId(Tizen::Base::UuId::GetInvalidUuId())
430 , contentType(CONTENT_TYPE_UNKNOWN)
436 , pThumbnailPath(null)
448 ContentType contentType;
449 unsigned long contentSize;
450 Tizen::Base::DateTime dateTime;
455 Tizen::Base::String contentPath;
456 Tizen::Base::String mimeType;
457 Tizen::Base::String* pThumbnailPath;
458 Tizen::Base::String* pAuthor;
459 Tizen::Base::String* pCategory;
460 Tizen::Base::String* pContentName;
461 Tizen::Base::String* pDescription;
462 Tizen::Base::String* pKeyword;
463 Tizen::Base::String* pLocationTag;
464 Tizen::Base::String* pProvider;
465 Tizen::Base::String* pRating;
469 * This is the default constructor for this class.
476 // This method is for internal use only.
477 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
479 // Sets the content data.
483 // @return An error code
484 // @param[in] pContentData The content data
485 // @exception E_SUCCESS The method is successful.
486 // @exception E_INVALID_ARG The specified input parameter is invalid.
487 // @exception E_OUT_OF_MEMORY The memory is insufficient.
489 result SetContentData(const _ContentData* pContentData);
493 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
495 ContentInfo(const ContentInfo& rhs);
498 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
500 ContentInfo& operator =(const ContentInfo& rhs);
502 _ContentData* GetContentData(void);
505 _ContentData* __pContentData;
506 mutable Tizen::Locations::Coordinates coordinates;
508 friend class _ContentManagerImpl;
509 friend class _ContentSearchImpl;
510 friend class _ContentDirectoryImpl;
511 friend class _ContentUtility;
512 friend class _PlayListManagerImpl;
513 friend class _PlayListImpl;
515 friend class _ContentInfoImpl;
516 _ContentInfoImpl* __pImpl;
518 }; // class ContentInfo
522 #endif // _FCNT_CONTENT_INFO_H_