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 Graphics
36 namespace Tizen { namespace Content
39 class _ContentInfoImpl;
43 * @brief This class provides methods to manage the content information.
47 * @final This class is not intended for extension.
49 * The %ContentInfo class is an abstract base class. @n
50 * ImageContentInfo, AudioContentInfo, VideoContentInfo, and OtherContentInfo are derived from the %ContentInfo class.
52 * When a user creates content, its content information is created as a new pair. @n
53 * When a user deletes content, its content information is deleted from the content database. @n
54 * This class provides methods to get or to set the specific content information. @n
55 * The physical file is not updated even if the set methods are called.
57 * 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>.
59 * The following example demonstrates how to use the %ContentInfo class.
63 * MyClass::TestContentInfo(void)
65 * result r = E_SUCCESS;
67 * ContentId contentId;
68 * ContentManager contentManager;
69 * r = contentManager.Construct();
70 * TryReturn(!IsFailed(r), r, "Construct failed.");
72 * ImageContentInfo imageContentInfo;
73 * r = imageContentInfo.Construct(null);
74 * TryReturn(!IsFailed(r), r, "Construct failed.");
76 * Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
77 * Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
79 * contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
80 * TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
86 class _OSP_EXPORT_ ContentInfo
87 : public Tizen::Base::Object
91 * This destructor overrides Tizen::Base::Object::~Object().
95 virtual ~ContentInfo(void);
99 * Initializes this instance of %ContentInfo with the specified parameters.
101 * @brief <i> [Deprecated] </i>
102 * @deprecated This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates.
105 * @return An error code
106 * @param[in] contentPath The content path
107 * @param[in] thumbnailPath The thumbnail path
108 * @param[in] setGps Set to @c true to save the device's last known coordinates in the %ContentInfo instance, @n
112 virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false) = 0;
115 * Gets the content ID.
119 * @return The content ID
121 ContentId GetContentId(void) const;
124 * Gets the content type.
128 * @return The content type
130 ContentType GetContentType(void) const;
133 * Gets the mime type.
137 * @return The mime type
139 Tizen::Base::String GetMimeType(void) const;
142 * Gets the date and time of the created content.
146 * @return The content's creation time (GMT)
148 Tizen::Base::DateTime GetDateTime(void) const;
151 * Gets the file size of the content.
155 * @return The file size of the content
157 unsigned long GetContentSize(void) const;
160 * Gets the content name.
164 * @return The content name
165 * @remarks The content name is not a file name.
167 Tizen::Base::String GetContentName(void) const;
170 * Gets the file path of the content.
174 * @return The file path of the content
176 Tizen::Base::String GetContentPath(void) const;
179 * Gets the coordinates of the location.
183 * @return A reference to the coordinates
185 const Tizen::Locations::Coordinates& GetCoordinates(void) const;
188 * Sets the coordinates of the location.
192 * @return An error code
193 * @param[in] coordinates The user-defined coordinates
194 * @exception E_SUCCESS The method is successful.
196 result SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
199 * Sets the location tag.
203 * @return An error code
204 * @param[in] locationTag The new location tag
205 * @exception E_SUCCESS The method is successful.
206 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
208 result SetLocationTag(const Tizen::Base::String& locationTag);
211 * Gets the location tag.
215 * @return The location tag
217 Tizen::Base::String GetLocationTag(void) const;
224 * @return An error code
225 * @param[in] rating The new rating
226 * @exception E_SUCCESS The method is successful.
227 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
229 result SetRating(const Tizen::Base::String& rating);
238 Tizen::Base::String GetRating(void) const;
245 * @return An error code
246 * @param[in] category The new category
247 * @exception E_SUCCESS The method is successful.
248 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
250 result SetCategory(const Tizen::Base::String& category);
257 * @return The category
259 Tizen::Base::String GetCategory(void) const;
262 * Sets the description.
266 * @return An error code
267 * @param[in] description The new description
268 * @exception E_SUCCESS The method is successful.
269 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 140 characters.
271 result SetDescription(const Tizen::Base::String& description);
274 * Gets the description.
278 * @return The description
280 Tizen::Base::String GetDescription(void) const;
283 * Gets the thumbnail image.
286 * @brief <i> [Compatibility] </i>
290 * @compatibility This method has compatibility issues with OSP compatible applications. @n
291 * For more information, see @ref CompContentInfoGetThumbnailNPage "here".
294 * @return A pointer to the thumbnail image
295 * @exception E_SUCCESS The method is successful.
296 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
297 * @remarks The specific error code can be accessed using the GetLastResult() method.
299 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
303 * @page CompContentInfoGetThumbnailNPage Compatibility for GetThumbnailN().
304 * @section CompContentInfoGetThumbnailNPageIssueSection Issue
305 * The thumbnail size of this method in OSP compatible applications has the following issues: @n
306 * <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>
312 * Checks whether the content is DRM protected.
316 * @return @c true if this content has DRM, @n
319 bool IsDrmProtected(void) const;
326 * @return The keyword
328 Tizen::Base::String GetKeyword(void) const;
331 * Sets the content name.
335 * @return An error code
336 * @param[in] contentName The new content name
337 * @exception E_SUCCESS The method is successful.
338 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
340 result SetContentName(const Tizen::Base::String& contentName);
347 * @return An error code
348 * @param[in] keyword The new keyword
349 * @exception E_SUCCESS The method is successful.
350 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
352 result SetKeyword(const Tizen::Base::String& keyword);
359 * @return An error code
360 * @param[in] author The new author
361 * @exception E_SUCCESS The method is successful.
362 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
364 result SetAuthor(const Tizen::Base::String& author);
373 Tizen::Base::String GetAuthor(void) const;
380 * @return An error code
381 * @param[in] provider The new content provider
382 * @exception E_SUCCESS The method is successful.
383 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
385 result SetProvider(const Tizen::Base::String& provider);
392 * @return The content provider
394 Tizen::Base::String GetProvider(void) const;
397 * Gets the media format.
401 * @return The media format
403 Tizen::Base::String GetMediaFormat(void) const;
408 // This class is for internal use only.
409 // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
415 : contentId(Tizen::Base::UuId::GetInvalidUuId())
417 , contentType(CONTENT_TYPE_UNKNOWN)
423 , pThumbnailPath(null)
435 ContentType contentType;
436 unsigned long contentSize;
437 Tizen::Base::DateTime dateTime;
442 Tizen::Base::String contentPath;
443 Tizen::Base::String mimeType;
444 Tizen::Base::String* pThumbnailPath;
445 Tizen::Base::String* pAuthor;
446 Tizen::Base::String* pCategory;
447 Tizen::Base::String* pContentName;
448 Tizen::Base::String* pDescription;
449 Tizen::Base::String* pKeyword;
450 Tizen::Base::String* pLocationTag;
451 Tizen::Base::String* pProvider;
452 Tizen::Base::String* pRating;
456 * This is the default constructor for this class.
463 // This method is for internal use only.
464 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
466 // Sets the content data.
470 // @return An error code
471 // @param[in] pContentData The content data
472 // @exception E_SUCCESS The method is successful.
473 // @exception E_INVALID_ARG The specified input parameter is invalid.
474 // @exception E_OUT_OF_MEMORY The memory is insufficient.
476 result SetContentData(const _ContentData* pContentData);
481 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
483 ContentInfo(const ContentInfo& rhs);
486 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
488 ContentInfo& operator =(const ContentInfo& rhs);
491 _ContentInfoImpl* __pContentInfoImpl;
492 mutable Tizen::Locations::Coordinates __coordinates;
494 friend class _ContentInfoImpl;
495 friend class _ContentInfoHelper;
501 #endif // _FCNT_CONTENT_INFO_H_