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