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.h
18 * @brief This is the header file for the %ContentInfo class.
20 * This header file contains the declarations of the %ContentInfo class.
23 #ifndef _FCNT_CONTENT_INFO_H_
24 #define _FCNT_CONTENT_INFO_H_
26 #include <FBaseUuId.h>
27 #include <FBaseDateTime.h>
28 #include <FCntTypes.h>
29 #include <FLocCoordinates.h>
31 namespace Tizen { namespace Locations
36 namespace Tizen { namespace Graphics
41 namespace Tizen { namespace Content
44 class _ContentInfoImpl;
48 * @brief This class provides methods to manage the content information.
52 * @final This class is not intended for extension.
54 * The %ContentInfo class is an abstract base class. @n
55 * ImageContentInfo, AudioContentInfo, VideoContentInfo, and OtherContentInfo are derived from the %ContentInfo class.
57 * When a user creates content, its content information is created as a new pair. @n
58 * When a user deletes content, its content information is deleted from the content database. @n
59 * This class provides methods to get or to set the specific content information. @n
60 * The physical file is not updated even if the set methods are called.
62 * 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>.
64 * The following example demonstrates how to use the %ContentInfo class.
68 * MyClass::TestContentInfo(void)
70 * result r = E_SUCCESS;
72 * ContentId contentId;
73 * ContentManager contentManager;
74 * r = contentManager.Construct();
75 * TryReturn(!IsFailed(r), r, "Construct failed.");
77 * ImageContentInfo imageContentInfo;
78 * r = imageContentInfo.Construct(null);
79 * TryReturn(!IsFailed(r), r, "Construct failed.");
81 * Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
82 * Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
84 * contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
85 * TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
91 class _OSP_EXPORT_ ContentInfo
92 : public Tizen::Base::Object
96 * This destructor overrides Tizen::Base::Object::~Object().
100 virtual ~ContentInfo(void);
104 * Initializes this instance of %ContentInfo with the specified parameters.
106 * @brief <i> [Deprecated] </i>
107 * @deprecated This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates.
110 * @return An error code
111 * @param[in] contentPath The content path
112 * @param[in] thumbnailPath The thumbnail path
113 * @param[in] setGps Set to @c true to save the device's last known coordinates in the %ContentInfo instance, @n
117 virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false) = 0;
120 * Gets the content ID.
124 * @return The content ID
126 ContentId GetContentId(void) const;
129 * Gets the content type.
133 * @return The content type
135 ContentType GetContentType(void) const;
138 * Gets the mime type.
142 * @return The mime type
144 Tizen::Base::String GetMimeType(void) const;
147 * Gets the date and time of the created content.
151 * @return The content's creation time (GMT)
153 Tizen::Base::DateTime GetDateTime(void) const;
156 * Gets the file size of the content.
160 * @return The file size of the content
162 unsigned long GetContentSize(void) const;
165 * Gets the content name.
169 * @return The content name
171 Tizen::Base::String GetContentName(void) const;
174 * Gets the file path of the content.
178 * @return The file path of the content
180 Tizen::Base::String GetContentPath(void) const;
183 * Gets the coordinates of the location.
187 * @return A reference to the coordinates
189 const Tizen::Locations::Coordinates& GetCoordinates(void) const;
192 * Sets the coordinates of the location.
196 * @return An error code
197 * @param[in] coordinates The user-defined coordinates
198 * @exception E_SUCCESS The method is successful.
200 result SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
203 * Sets the location tag.
207 * @return An error code
208 * @param[in] locationTag The new location tag
209 * @exception E_SUCCESS The method is successful.
210 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
211 * @exception E_OUT_OF_MEMORY The memory is insufficient.
213 result SetLocationTag(const Tizen::Base::String& locationTag);
216 * Gets the location tag.
220 * @return The location tag
222 Tizen::Base::String GetLocationTag(void) const;
229 * @return An error code
230 * @param[in] rating The new rating
231 * @exception E_SUCCESS The method is successful.
232 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
233 * @exception E_OUT_OF_MEMORY The memory is insufficient.
235 result SetRating(const Tizen::Base::String& rating);
244 Tizen::Base::String GetRating(void) const;
251 * @return An error code
252 * @param[in] category The new category
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
255 * @exception E_OUT_OF_MEMORY The memory is insufficient.
257 result SetCategory(const Tizen::Base::String& category);
264 * @return The category
266 Tizen::Base::String GetCategory(void) const;
269 * Sets the description.
273 * @return An error code
274 * @param[in] description The new description
275 * @exception E_SUCCESS The method is successful.
276 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 140 characters.
277 * @exception E_OUT_OF_MEMORY The memory is insufficient.
279 result SetDescription(const Tizen::Base::String& description);
282 * Gets the description.
286 * @return The description
288 Tizen::Base::String GetDescription(void) const;
291 * Gets the thumbnail image.
294 * @brief <i> [Compatibility] </i>
298 * @compatibility This method has compatibility issues with OSP compatible applications. @n
299 * For more information, see @ref CompContentInfoGetThumbnailNPage "here".
302 * @return A pointer to the thumbnail image
303 * @exception E_SUCCESS The method is successful.
304 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
305 * @exception E_OUT_OF_MEMORY The memory is insufficient.
306 * @remarks The specific error code can be accessed using the GetLastResult() method.
308 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
312 * @page CompContentInfoGetThumbnailNPage Compatibility for GetThumbnailN().
313 * @section CompContentInfoGetThumbnailNPageIssueSection Issue
314 * The thumbnail size of this method in OSP compatible applications has the following issues: @n
315 * <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>
321 * Checks whether the content is DRM protected.
325 * @return @c true if this content has DRM, @n
328 bool IsDrmProtected(void) const;
335 * @return The keyword
337 Tizen::Base::String GetKeyword(void) const;
340 * Sets the content name.
344 * @return An error code
345 * @param[in] contentName The new content name
346 * @exception E_SUCCESS The method is successful.
347 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
348 * @exception E_OUT_OF_MEMORY The memory is insufficient.
350 result SetContentName(const Tizen::Base::String& contentName);
357 * @return An error code
358 * @param[in] keyword The new keyword
359 * @exception E_SUCCESS The method is successful.
360 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
361 * @exception E_OUT_OF_MEMORY The memory is insufficient.
363 result SetKeyword(const Tizen::Base::String& keyword);
370 * @return An error code
371 * @param[in] author The new author
372 * @exception E_SUCCESS The method is successful.
373 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
374 * @exception E_OUT_OF_MEMORY The memory is insufficient.
376 result SetAuthor(const Tizen::Base::String& author);
385 Tizen::Base::String GetAuthor(void) const;
392 * @return An error code
393 * @param[in] provider The new content provider
394 * @exception E_SUCCESS The method is successful.
395 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
396 * @exception E_OUT_OF_MEMORY The memory is insufficient.
398 result SetProvider(const Tizen::Base::String& provider);
405 * @return The content provider
407 Tizen::Base::String GetProvider(void) const;
410 * Gets the media format.
414 * @return The media format
416 Tizen::Base::String GetMediaFormat(void) const;
420 // This class is for internal use only.
421 // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
427 : contentId(Tizen::Base::UuId::GetInvalidUuId())
429 , contentType(CONTENT_TYPE_UNKNOWN)
435 , pThumbnailPath(null)
447 ContentType contentType;
448 unsigned long contentSize;
449 Tizen::Base::DateTime dateTime;
454 Tizen::Base::String contentPath;
455 Tizen::Base::String mimeType;
456 Tizen::Base::String* pThumbnailPath;
457 Tizen::Base::String* pAuthor;
458 Tizen::Base::String* pCategory;
459 Tizen::Base::String* pContentName;
460 Tizen::Base::String* pDescription;
461 Tizen::Base::String* pKeyword;
462 Tizen::Base::String* pLocationTag;
463 Tizen::Base::String* pProvider;
464 Tizen::Base::String* pRating;
468 * This is the default constructor for this class.
475 // This method is for internal use only.
476 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
478 // Sets the content data.
482 // @return An error code
483 // @param[in] pContentData The content data
484 // @exception E_SUCCESS The method is successful.
485 // @exception E_INVALID_ARG The specified input parameter is invalid.
486 // @exception E_OUT_OF_MEMORY The memory is insufficient.
488 result SetContentData(const _ContentData* pContentData);
492 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
494 ContentInfo(const ContentInfo& rhs);
497 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
499 ContentInfo& operator =(const ContentInfo& rhs);
501 _ContentData* GetContentData(void);
504 _ContentData* __pContentData;
505 mutable Tizen::Locations::Coordinates coordinates;
507 friend class _ContentManagerImpl;
508 friend class _ContentSearchImpl;
509 friend class _ContentDirectoryImpl;
510 friend class _ContentUtility;
511 friend class _PlayListManagerImpl;
512 friend class _PlayListImpl;
514 friend class _ContentInfoImpl;
515 _ContentInfoImpl* __pImpl;
517 }; // class ContentInfo
521 #endif // _FCNT_CONTENT_INFO_H_