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