update header for Doxygen
[platform/framework/native/content.git] / inc / FCntImageContentInfo.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                        FCntImageContentInfo.h
18  * @brief               This is the header file for the %ImageContentInfo class.
19  *
20  * This header file contains the declarations of the %ImageContentInfo class.
21  */
22
23 #ifndef _FCNT_IMAGE_CONTENT_INFO_H_
24 #define _FCNT_IMAGE_CONTENT_INFO_H_
25
26 #include <FCntContentInfo.h>
27
28 namespace Tizen { namespace Content
29 {
30
31 class _ImageContentInfoImpl;
32
33 /**
34  * @class       ImageContentInfo
35  * @brief       This class provides methods to access the image content information.
36  *
37  * @since       2.0
38  *
39  * @final       This class is not intended for extension.
40  *
41  * The %ImageContentInfo class provides methods to access the image content information that is extracted from a physical file. @n
42  * Before getting the image content information, ContentManager must be used to create the content.
43  *
44  * 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>.
45  *
46  * The following example demonstrates how to use the %ImageContentInfo class.
47  *
48  * @code
49  * result
50  * MyClass::TestImageContentInfo(void)
51  * {
52  *              result r = E_SUCCESS;
53  *
54  *              ContentId contentId;
55  *              ContentManager contentManager;
56  *              r = contentManager.Construct();
57  *              TryReturn(!IsFailed(r), r, "Construct failed.");
58  *
59  *              ImageContentInfo imageContentInfo;
60  *              r = imageContentInfo.Construct(null);
61  *              TryReturn(!IsFailed(r), r, "Construct failed.");
62  *
63  *              Tizen::Base::String sourcePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/flower.jpg";
64  *              Tizen::Base::String destPath = Tizen::System::Environment::GetMediaPath() + L"Images/flower.jpg";
65  *
66  *              contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
67  *              TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
68  *
69  *              return r;
70  * }
71  * @endcode
72  */
73 class _OSP_EXPORT_ ImageContentInfo
74         : public Tizen::Content::ContentInfo
75 {
76 public:
77         /**
78          * The object is not fully constructed after this constructor is called. @n
79          * For full construction, the Construct() method must be called right after calling this constructor.
80          *
81          * @since               2.0
82          */
83         ImageContentInfo(void);
84
85         /**
86          * This destructor overrides Tizen::Base::Object::~Object().
87          *
88          * @since               2.0
89          */
90         virtual ~ImageContentInfo(void);
91
92         /**
93          * Initializes this instance of %ImageContentInfo with the specified parameter.
94          *
95          * @if OSPCOMPAT
96          * @brief <i> [Compatibility] </i>
97          * @endif
98          * @since                       2.0
99          * @if OSPCOMPAT
100          * @compatibility This method has compatibility issues with OSP compatible applications. @n
101          *                       For more information, see @ref CompImageContentInfoConstructPage "here".
102          * @endif
103          *
104          * @return                      An error code
105          * @param[in]   pContentPath                                    The content path
106          * @exception   E_SUCCESS                                       The method is successful.
107          * @exception   E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
108          * @exception   E_INVALID_ARG                           The specified input parameter is invalid.
109          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
110          * @exception   E_IO                                                            An I/O error has occurred.
111          * @exception   E_SYSTEM                                                An internal error has occurred.
112          * @remarks
113          *                              - The @c pContentPath should start with directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
114          *                                      If @c pContentPath is @c null, use ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*) @n
115          *                                      or ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
116          *                              - If the content has coordinates as metadata, they are automatically set.
117          */
118         result Construct(const Tizen::Base::String* pContentPath);
119
120         /**
121          * @if OSPCOMPAT
122          * @page        CompImageContentInfoConstructPage Compatibility for the file path.
123          * @section     CompImageContentInfoConstructPageIssueSection Issues
124          *                 The content path argument of this method in OSP compatible applications has the following issues: @n
125          *                 <UL><li> The content path should be a path that begins with an allowed path prefix.
126          *                     For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg". </UL></li>
127          *
128          * @section     CompImageContentInfoConstructPageSolutionSection Resolutions
129          *                 This issue has been resolved in Tizen. @n
130          *                 <UL><li> The content path can be a path without a specific allowed path prefix.
131          *                 Application do not need to know the specific allowed path prefixes.
132          *                 To get the directory path, use the following methods:  </UL></li>
133          *                 - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
134          *                 - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
135          *
136          * @endif
137          */
138
139         /**
140          * @if OSPDEPREC
141          * Initializes this instance of %ImageContentInfo with the specified parameters.
142          *
143          * @brief       <i> [Deprecated] </i>
144          * @deprecated   This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates. @n
145          *                       Instead of using this method, use Construct(const Tizen::Base::String*). @n
146          *                       To set the coordinates in the ContentInfo instance, use ContentInfo::SetCoordinates(const Tizen::Locations::Coordinates&).
147          * @since                       2.0
148          *
149          * @return                      An error code
150          * @param[in]           contentPath                                     The content path
151          * @param[in]           thumbnailPath                           The thumbnail path
152          * @param[in]           setGps                                                  Set to @c true to save the device's last known coordinates in the ContentInfo instance, @n
153          *                                                           else @c false @n
154          *                                                                                                                      The coordinate information may be incorrect if it is outdated or has never been updated.
155          *                                                           To update the coordinate information or to get the exact value,
156          *                                                           use Tizen::Locations::LocationProvider::RequestLocationUpdates() before calling this method.
157          * @exception           E_SUCCESS                                       The method is successful.
158          * @exception           E_FILE_NOT_FOUND                The specified file cannot be found or accessed.
159          * @exception           E_INVALID_ARG                           The specified input parameter is invalid.
160          * @exception           E_OUT_OF_MEMORY         The memory is insufficient.
161          * @exception           E_IO                                                            An I/O error has occurred.
162          * @remarks
163          *                                      - The content path must start with @c '/Media' or @c '/Storagecard/Media'.
164          *                                      - The thumbnail path must start with @c '/Home', @c '/Media', or @c '/Storagecard/Media'. @n
165          *                                              The permitted format for a thumbnail image is Bitmap (bmp).
166          * @endif
167          */
168         virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
169
170         /**
171          * Gets the width of the image file.
172          *
173          * @since               2.0
174          *
175          * @return              The width of the image file
176          */
177         int GetWidth(void) const;
178
179         /**
180          * Gets the height of the image file.
181          *
182          * @since               2.0
183          *
184          * @return              The height of the image file
185          */
186         int GetHeight(void) const;
187
188         /**
189          * Gets the title of the image file.
190          *
191          * @since               2.0
192          *
193          * @return              The title of the image file, @n
194          *              else @c Unknown if the value is empty
195          */
196         Tizen::Base::String GetTitle(void) const;
197
198         /**
199          * Gets the orientation of the image file.
200          *
201          * @since               2.0
202          *
203          * @return         The orientation of the image file
204          */
205         ImageOrientationType GetOrientation(void) const;
206
207 private:
208         class _ImageContentData
209         {
210         public:
211                 _ImageContentData()
212                         : width(0)
213                         , height(0)
214                         , orientationType(IMAGE_ORIENTATION_TYPE_UNKNOWN)
215                         , title(L"") {}
216
217                 int width;
218                 int height;
219                 ImageOrientationType orientationType;
220                 Tizen::Base::String title;
221         };
222
223         /**
224          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
225          */
226         ImageContentInfo(const ImageContentInfo& rhs);
227
228         /**
229          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
230          */
231         ImageContentInfo& operator =(const ImageContentInfo& rhs);
232
233         result SetImageContentData(const _ImageContentData* pImageContentData);
234
235         _ImageContentData* GetImageContentData(void);
236
237 private:
238         _ImageContentData* __pImageContentData;
239
240         friend class _ContentManagerImpl;
241         friend class _ContentSearchImpl;
242         friend class _ContentDirectoryImpl;
243         friend class _ContentUtility;
244         friend class _PlayListManagerImpl;
245         friend class _PlayListImpl;
246
247         friend class _ImageContentInfoImpl;
248         _ImageContentInfoImpl* __pImpl;
249
250 };  // Class ImageContentInfo
251
252 }}  // Tizen::Content
253
254 #endif  // _FCNT_IMAGE_CONTENT_INFO_H_