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 set 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.
64 * #include <FContent.h>
65 * #include <FSystem.h>
67 * using namespace Tizen::Content;
70 * MyClass::TestContentInfo(void)
72 * ContentManager contentManager;
73 * result r = contentManager.Construct();
75 * ImageContentInfo imageContentInfo;
76 * r = imageContentInfo.Construct(null);
78 * Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
79 * Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
81 * ContentId contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
82 * r = GetLastResult();
88 class _OSP_EXPORT_ ContentInfo
89 : public Tizen::Base::Object
93 * This destructor overrides Tizen::Base::Object::~Object().
97 virtual ~ContentInfo(void);
101 * Initializes this instance of %ContentInfo with the specified parameters.
103 * @brief <i> [Deprecated] </i>
104 * @deprecated This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates.
107 * @return An error code
108 * @param[in] contentPath The content path
109 * @param[in] thumbnailPath The thumbnail path
110 * @param[in] setGps Set to @c true to save the device's last known coordinates of the %ContentInfo instance, @n
114 virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false) = 0;
117 * Gets the content ID.
121 * @return The content ID
123 ContentId GetContentId(void) const;
126 * Gets the content type.
130 * @return The content type
132 ContentType GetContentType(void) const;
135 * Gets the MIME type.
139 * @return The MIME type
141 Tizen::Base::String GetMimeType(void) const;
144 * Gets the date and time of the added content.
148 * @return The added time to database (GMT)
150 Tizen::Base::DateTime GetDateTime(void) const;
153 * Gets the file size of the content.
157 * @return The file size of the content
159 unsigned long GetContentSize(void) const;
162 * Gets the content name.
166 * @return The content name
167 * @remarks The content name is not a file name.
169 Tizen::Base::String GetContentName(void) const;
172 * Gets the file path of the content.
176 * @return The file path of the content
178 Tizen::Base::String GetContentPath(void) const;
181 * Gets the coordinates of the location.
185 * @return A reference to the Tizen::Locations::Coordinates instance
187 const Tizen::Locations::Coordinates& GetCoordinates(void) const;
190 * Sets the coordinates of the location.
194 * @return An error code
195 * @param[in] coordinates The user-defined coordinates
196 * @exception E_SUCCESS The method is successful.
198 result SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
201 * Sets the location tag.
205 * @return An error code
206 * @param[in] locationTag The new location tag
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
210 result SetLocationTag(const Tizen::Base::String& locationTag);
213 * Gets the location tag.
217 * @return The location tag
219 Tizen::Base::String GetLocationTag(void) const;
226 * @return An error code
227 * @param[in] rating The new rating
228 * @exception E_SUCCESS The method is successful.
229 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
231 result SetRating(const Tizen::Base::String& rating);
240 Tizen::Base::String GetRating(void) const;
247 * @return An error code
248 * @param[in] category The new category
249 * @exception E_SUCCESS The method is successful.
250 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
252 result SetCategory(const Tizen::Base::String& category);
259 * @return The category
261 Tizen::Base::String GetCategory(void) const;
264 * Sets the description.
268 * @return An error code
269 * @param[in] description The new description
270 * @exception E_SUCCESS The method is successful.
271 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 140 characters.
273 result SetDescription(const Tizen::Base::String& description);
276 * Gets the description.
280 * @return The description
282 Tizen::Base::String GetDescription(void) const;
285 * Gets the thumbnail image.
288 * @brief <i> [Compatibility] </i>
292 * @compatibility This method has compatibility issues with OSP compatible applications. @n
293 * For more information, see @ref CompContentInfoGetThumbnailNPage "here".
296 * @return A pointer to the thumbnail image
297 * @exception E_SUCCESS The method is successful.
298 * @exception E_DATA_NOT_FOUND The thumbnail image does not exist.
299 * @remarks The specific error code can be accessed using the GetLastResult() method.
301 Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
305 * @page CompContentInfoGetThumbnailNPage Compatibility for GetThumbnailN().
306 * @section CompContentInfoGetThumbnailNPageIssueSection Issue
307 * The thumbnail size of this method in OSP compatible applications has the following issues: @n
308 * <DIV> The size is changed from 80x60 pixels to the size of the image which is returned from the platform since %Tizen API 2.1.</DIV>
314 * Checks whether the content is DRM protected.
318 * @return @c true if this content has DRM, @n
321 bool IsDrmProtected(void) const;
328 * @return The keyword
330 Tizen::Base::String GetKeyword(void) const;
333 * Sets the content name.
337 * @return An error code
338 * @param[in] contentName The new content name
339 * @exception E_SUCCESS The method is successful.
340 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
342 result SetContentName(const Tizen::Base::String& contentName);
349 * @return An error code
350 * @param[in] keyword The new keyword
351 * @exception E_SUCCESS The method is successful.
352 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
354 result SetKeyword(const Tizen::Base::String& keyword);
361 * @return An error code
362 * @param[in] author The new author
363 * @exception E_SUCCESS The method is successful.
364 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
366 result SetAuthor(const Tizen::Base::String& author);
375 Tizen::Base::String GetAuthor(void) const;
382 * @return An error code
383 * @param[in] provider The new content provider
384 * @exception E_SUCCESS The method is successful.
385 * @exception E_INVALID_ARG The length of the input data exceeds the maximum limit of 45 characters.
387 result SetProvider(const Tizen::Base::String& provider);
394 * @return The content provider
396 Tizen::Base::String GetProvider(void) const;
399 * Gets the media format.
403 * @return The media format
405 Tizen::Base::String GetMediaFormat(void) const;
410 // This class is for internal use only.
411 // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
417 : contentId(Tizen::Base::UuId::GetInvalidUuId())
419 , contentType(CONTENT_TYPE_UNKNOWN)
425 , pThumbnailPath(null)
437 ContentType contentType;
438 unsigned long contentSize;
439 Tizen::Base::DateTime dateTime;
444 Tizen::Base::String contentPath;
445 Tizen::Base::String mimeType;
446 Tizen::Base::String* pThumbnailPath;
447 Tizen::Base::String* pAuthor;
448 Tizen::Base::String* pCategory;
449 Tizen::Base::String* pContentName;
450 Tizen::Base::String* pDescription;
451 Tizen::Base::String* pKeyword;
452 Tizen::Base::String* pLocationTag;
453 Tizen::Base::String* pProvider;
454 Tizen::Base::String* pRating;
458 * This is the default constructor for this class.
465 // This method is for internal use only.
466 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
468 // Sets the content data.
472 // @return An error code
473 // @param[in] pContentData The content data
474 // @exception E_SUCCESS The method is successful.
475 // @exception E_INVALID_ARG The specified input parameter is invalid.
476 // @exception E_OUT_OF_MEMORY The memory is insufficient.
478 result SetContentData(const _ContentData* pContentData);
483 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
485 ContentInfo(const ContentInfo& rhs);
488 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
490 ContentInfo& operator =(const ContentInfo& rhs);
493 _ContentInfoImpl* __pContentInfoImpl;
494 mutable Tizen::Locations::Coordinates __coordinates;
496 friend class _ContentInfoImpl;
497 friend class _ContentInfoHelper;
503 #endif // _FCNT_CONTENT_INFO_H_