[content] Fix a description for ContentManager
[platform/framework/native/content.git] / inc / FCntContentInfo.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                        FCntContentInfo.h
19  * @brief               This is the header file for the %ContentInfo class.
20  *
21  * This header file contains the declarations of the %ContentInfo class.
22  */
23
24 #ifndef _FCNT_CONTENT_INFO_H_
25 #define _FCNT_CONTENT_INFO_H_
26
27 #include <FBaseUuId.h>
28 #include <FBaseDateTime.h>
29 #include <FCntTypes.h>
30 #include <FLocCoordinates.h>
31
32 namespace Tizen { namespace Locations
33 {
34 class Coordinates;
35 }}
36
37 namespace Tizen { namespace Graphics
38 {
39 class Bitmap;
40 }}
41
42 namespace Tizen { namespace Content
43 {
44
45 class _ContentInfoImpl;
46
47 /**
48  * @class       ContentInfo
49  * @brief       This class provides methods to manage the content information.
50  *
51  * @since       2.0
52  *
53  * @final       This class is not intended for extension.
54  *
55  * The %ContentInfo class is an abstract base class. @n
56  * ImageContentInfo, AudioContentInfo, VideoContentInfo, and OtherContentInfo are derived from the %ContentInfo class.
57  *
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.
62  *
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>.
64  *
65  * The following example demonstrates how to use the %ContentInfo class.
66  *
67  * @code
68  * result
69  * MyClass::TestContentInfo(void)
70  * {
71  *              result r = E_SUCCESS;
72  *
73  *              ContentId contentId;
74  *              ContentManager contentManager;
75  *              r = contentManager.Construct();
76  *              TryReturn(!IsFailed(r), r, "Construct failed.");
77  *
78  *              ImageContentInfo imageContentInfo;
79  *              r = imageContentInfo.Construct(null);
80  *              TryReturn(!IsFailed(r), r, "Construct failed.");
81  *
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";
84  *
85  *              contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
86  *              TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
87  *
88  *              return r;
89  * }
90  * @endcode
91  */
92 class _OSP_EXPORT_ ContentInfo
93         : public Tizen::Base::Object
94 {
95 public:
96         /**
97          * This destructor overrides Tizen::Base::Object::~Object().
98          *
99          * @since               2.0
100          */
101         virtual ~ContentInfo(void);
102
103         /**
104          * @if OSPDEPREC
105          * Initializes this instance of %ContentInfo with the specified parameters.
106          *
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.
109          * @since                       2.0
110          *
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
115          *                                                else @c false
116          * @endif
117          */
118         virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false) = 0;
119
120         /**
121          * Gets the content ID.
122          *
123          * @since               2.0
124          *
125          * @return              The content ID
126          */
127         ContentId GetContentId(void) const;
128
129         /**
130          * Gets the content type.
131          *
132          * @since               2.0
133          *
134          * @return              The content type
135          */
136         ContentType GetContentType(void) const;
137
138         /**
139          * Gets the mime type.
140          *
141          * @since               2.0
142          *
143          * @return              The mime type
144          */
145         Tizen::Base::String GetMimeType(void) const;
146
147         /**
148          * Gets the date and time of the created content.
149          *
150          * @since               2.0
151          *
152          * @return              The content's creation time (GMT)
153          */
154         Tizen::Base::DateTime GetDateTime(void) const;
155
156         /**
157          * Gets the file size of the content.
158          *
159          * @since               2.0
160          *
161          * @return              The file size of the content
162          */
163         unsigned long GetContentSize(void) const;
164
165         /**
166          * Gets the content name.
167          *
168          * @since               2.0
169          *
170          * @return              The content name
171          */
172         Tizen::Base::String GetContentName(void) const;
173
174         /**
175          * Gets the file path of the content.
176          *
177          * @since               2.0
178          *
179          * @return              The file path of the content
180          */
181         Tizen::Base::String GetContentPath(void) const;
182
183         /**
184          * Gets the coordinates of the location.
185          *
186          * @since               2.0
187          *
188          * @return              A reference to the coordinates
189          */
190         const Tizen::Locations::Coordinates& GetCoordinates(void) const;
191
192         /**
193          * Sets the coordinates of the location.
194          *
195          * @since                       2.0
196          *
197          * @return                      An error code
198          * @param[in]   coordinates                     The user-defined coordinates
199          * @exception   E_SUCCESS                       The method is successful.
200          */
201         result SetCoordinates(const Tizen::Locations::Coordinates& coordinates);
202
203         /**
204          * Sets the location tag.
205          *
206          * @since                       2.0
207          *
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.
213          */
214         result SetLocationTag(const Tizen::Base::String& locationTag);
215
216         /**
217          * Gets the location tag.
218          *
219          * @since               2.0
220          *
221          * @return              The location tag
222          */
223         Tizen::Base::String GetLocationTag(void) const;
224
225         /**
226          * Sets the rating.
227          *
228          * @since                       2.0
229          *
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.
235          */
236         result SetRating(const Tizen::Base::String& rating);
237
238         /**
239          * Gets the rating.
240          *
241          * @since               2.0
242          *
243          * @return              The rating
244          */
245         Tizen::Base::String GetRating(void) const;
246
247         /**
248          * Sets the category.
249          *
250          * @since                       2.0
251          *
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.
257          */
258         result SetCategory(const Tizen::Base::String& category);
259
260         /**
261          * Gets the category.
262          *
263          * @since               2.0
264          *
265          * @return              The category
266          */
267         Tizen::Base::String GetCategory(void) const;
268
269         /**
270          * Sets the description.
271          *
272          * @since                       2.0
273          *
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.
279          */
280         result SetDescription(const Tizen::Base::String& description);
281
282         /**
283          * Gets the description.
284          *
285          * @since               2.0
286          *
287          * @return              The description
288          */
289         Tizen::Base::String GetDescription(void) const;
290
291         /**
292          * Gets the thumbnail image.
293          *
294          * @if OSPCOMPAT
295          * @brief       <i> [Compatibility] </i>
296          * @endif
297          * @since                       2.0
298          * @if OSPCOMPAT
299          * @compatibility This method has compatibility issues with OSP compatible applications. @n
300          *                                       For more information, see @ref CompContentInfoGetThumbnailNPage "here".
301          * @endif
302          *
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.
308          */
309         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
310
311         /**
312          * @if OSPCOMPAT
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>
317          *
318          * @endif
319          */
320
321         /**
322          * Checks whether the content is DRM protected.
323          *
324          * @since               2.0
325          *
326          * @return              @c true if this content has DRM, @n
327          *                                      else @c false
328          */
329         bool IsDrmProtected(void) const;
330
331         /**
332          * Gets the keyword.
333          *
334          * @since               2.0
335          *
336          * @return              The keyword
337          */
338         Tizen::Base::String GetKeyword(void) const;
339
340         /**
341          * Sets the content name.
342          *
343          * @since                       2.0
344          *
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.
350          */
351         result SetContentName(const Tizen::Base::String& contentName);
352
353         /**
354          * Sets the keyword.
355          *
356          * @since                       2.0
357          *
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.
363          */
364         result SetKeyword(const Tizen::Base::String& keyword);
365
366         /**
367          * Sets the author.
368          *
369          * @since                       2.0
370          *
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.
376          */
377         result SetAuthor(const Tizen::Base::String& author);
378
379         /**
380          * Gets the author.
381          *
382          * @since               2.0
383          *
384          * @return              The author
385          */
386         Tizen::Base::String GetAuthor(void) const;
387
388         /**
389          * Sets the provider.
390          *
391          * @since                       2.0
392          *
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.
398          */
399         result SetProvider(const Tizen::Base::String& provider);
400
401         /**
402          * Gets the provider.
403          *
404          * @since               2.0
405          *
406          * @return              The content provider
407          */
408         Tizen::Base::String GetProvider(void) const;
409
410         /**
411          * Gets the media format.
412          *
413          * @since               2.0
414          *
415          * @return              The media format
416          */
417         Tizen::Base::String GetMediaFormat(void) const;
418
419 protected:
420         //
421         // This class is for internal use only.
422         // Using this class can cause behavioral, security-related, and consistency-related issues in the application.
423         //
424         class _ContentData
425         {
426         public:
427                 _ContentData()
428                         : contentId(Tizen::Base::UuId::GetInvalidUuId())
429                         , storageType(0)
430                         , contentType(CONTENT_TYPE_UNKNOWN)
431                         , contentSize(0)
432                         , latitude(-200.0)
433                         , longitude(-200.0)
434                         , altitude(-200.0)
435                         , isDrm(false)
436                         , pThumbnailPath(null)
437                         , pAuthor(null)
438                         , pCategory(null)
439                         , pContentName(null)
440                         , pDescription(null)
441                         , pKeyword(null)
442                         , pLocationTag(null)
443                         , pProvider(null)
444                         , pRating(null) {}
445
446                 ContentId contentId;
447                 int storageType;
448                 ContentType contentType;
449                 unsigned long contentSize;
450                 Tizen::Base::DateTime dateTime;
451                 double latitude;
452                 double longitude;
453                 double altitude;
454                 bool isDrm;
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;
466         };
467
468         /**
469          * This is the default constructor for this class.
470          *
471          * @since               2.0
472          */
473         ContentInfo(void);
474
475         //
476         // This method is for internal use only.
477         // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
478         //
479         // Sets the content data.
480         //
481         // @since           2.0
482         //
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.
488         //
489         result SetContentData(const _ContentData* pContentData);
490
491 private:
492         /**
493          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
494          */
495         ContentInfo(const ContentInfo& rhs);
496
497         /**
498          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
499          */
500         ContentInfo& operator =(const ContentInfo& rhs);
501
502         _ContentData* GetContentData(void);
503
504 private:
505         _ContentData* __pContentData;
506         mutable Tizen::Locations::Coordinates coordinates;
507
508         friend class _ContentManagerImpl;
509         friend class _ContentSearchImpl;
510         friend class _ContentDirectoryImpl;
511         friend class _ContentUtility;
512         friend class _PlayListManagerImpl;
513         friend class _PlayListImpl;
514
515         friend class _ContentInfoImpl;
516         _ContentInfoImpl* __pImpl;
517
518 };  // class ContentInfo
519
520 }}  // Tizen::Content
521
522 #endif  // _FCNT_CONTENT_INFO_H_