2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FCntImageContentInfo.h
19 * @brief This is the header file for the %ImageContentInfo class.
21 * This header file contains the declarations of the %ImageContentInfo class.
24 #ifndef _FCNT_IMAGE_CONTENT_INFO_H_
25 #define _FCNT_IMAGE_CONTENT_INFO_H_
27 #include <FCntContentInfo.h>
29 namespace Tizen { namespace Content
32 class _ImageContentInfoImpl;
35 * @class ImageContentInfo
36 * @brief This class provides methods to access the image content information.
40 * @final This class is not intended for extension.
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.
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>.
47 * The following example demonstrates how to use the %ImageContentInfo class.
51 * MyClass::TestImageContentInfo(void)
53 * result r = E_SUCCESS;
55 * ContentId contentId;
56 * ContentManager contentManager;
57 * r = contentManager.Construct();
58 * TryReturn(!IsFailed(r), r, "Construct failed.");
60 * ImageContentInfo imageContentInfo;
61 * r = imageContentInfo.Construct(null);
62 * TryReturn(!IsFailed(r), r, "Construct failed.");
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";
67 * contentId = contentManager.CreateContent(sourcePath, destPath, false, &imageContentInfo);
68 * TryReturn(Tizen::Base::UuId::GetInvalidUuId() != contentId, GetLastResult(), "CreateContent failed.");
74 class _OSP_EXPORT_ ImageContentInfo
75 : public Tizen::Content::ContentInfo
79 * The object is not fully constructed after this constructor is called. @n
80 * For full construction, the Construct() method must be called right after calling this constructor.
84 ImageContentInfo(void);
87 * This destructor overrides Tizen::Base::Object::~Object().
91 virtual ~ImageContentInfo(void);
94 * Initializes this instance of %ImageContentInfo with the specified parameter.
97 * @brief <i> [Compatibility] </i>
101 * @compatibility This method has compatibility issues with OSP compatible applications. @n
102 * For more information, see @ref CompImageContentInfoConstructPage "here".
105 * @return An error code
106 * @param[in] pContentPath The content path
107 * @exception E_SUCCESS The method is successful.
108 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
109 * @exception E_INVALID_ARG The specified input parameter is invalid.
110 * @exception E_OUT_OF_MEMORY The memory is insufficient.
111 * @exception E_IO An I/O error has occurred.
112 * @exception E_SYSTEM An internal error has occurred.
114 * - The @c pContentPath should start with directory path returned by either Tizen::System::Environment::GetMediaPath() or Tizen::System::Environment::GetExternalStoragePath(). @n
115 * If @c pContentPath is @c null, use ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*) @n
116 * or ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*).
117 * - If the content has coordinates as metadata, they are automatically set.
119 result Construct(const Tizen::Base::String* pContentPath);
123 * @page CompImageContentInfoConstructPage Compatibility for the file path.
124 * @section CompImageContentInfoConstructPageIssueSection Issues
125 * The content path argument of this method in OSP compatible applications has the following issues: @n
126 * <UL><li> The content path should be a path that begins with an allowed path prefix.
127 * For example, L"/Media/Images/flower.jpg", L"/Storagecard/Media/Images/flower.jpg". </UL></li>
129 * @section CompImageContentInfoConstructPageSolutionSection Resolutions
130 * This issue has been resolved in Tizen. @n
131 * <UL><li> The content path can be a path without a specific allowed path prefix.
132 * Application do not need to know the specific allowed path prefixes.
133 * To get the directory path, use the following methods: </UL></li>
134 * - For accessing the media directory, use Tizen::System::Environment::GetMediaPath().
135 * - For accessing the external storage, use Tizen::System::Environment::GetExternalStoragePath().
142 * Initializes this instance of %ImageContentInfo with the specified parameters.
144 * @brief <i> [Deprecated] </i>
145 * @deprecated This method is deprecated as there is a problem in managing the user-defined thumbnail and device coordinates. @n
146 * Instead of using this method, use Construct(const Tizen::Base::String*). @n
147 * To set the coordinates in the ContentInfo instance, use ContentInfo::SetCoordinates(const Tizen::Locations::Coordinates&).
150 * @return An error code
151 * @param[in] contentPath The content path
152 * @param[in] thumbnailPath The thumbnail path
153 * @param[in] setGps Set to @c true to save the device's last known coordinates in the ContentInfo instance, @n
155 * The coordinate information may be incorrect if it is outdated or has never been updated.
156 * To update the coordinate information or to get the exact value,
157 * use Tizen::Locations::LocationProvider::RequestLocationUpdates() before calling this method.
158 * @exception E_SUCCESS The method is successful.
159 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
160 * @exception E_INVALID_ARG The specified input parameter is invalid.
161 * @exception E_OUT_OF_MEMORY The memory is insufficient.
162 * @exception E_IO An I/O error has occurred.
164 * - The content path must start with @c '/Media' or @c '/Storagecard/Media'.
165 * - The thumbnail path must start with @c '/Home', @c '/Media', or @c '/Storagecard/Media'. @n
166 * The permitted format for a thumbnail image is Bitmap (bmp).
169 virtual result Construct(const Tizen::Base::String& contentPath, const Tizen::Base::String& thumbnailPath = L"", bool setGps = false);
172 * Gets the width of the image file.
176 * @return The width of the image file
178 int GetWidth(void) const;
181 * Gets the height of the image file.
185 * @return The height of the image file
187 int GetHeight(void) const;
190 * Gets the title of the image file.
194 * @return The title of the image file, @n
195 * else @c Unknown if the value is empty
197 Tizen::Base::String GetTitle(void) const;
200 * Gets the orientation of the image file.
204 * @return The orientation of the image file
206 ImageOrientationType GetOrientation(void) const;
209 class _ImageContentData
215 , orientationType(IMAGE_ORIENTATION_TYPE_UNKNOWN)
220 ImageOrientationType orientationType;
221 Tizen::Base::String title;
225 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
227 ImageContentInfo(const ImageContentInfo& rhs);
230 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
232 ImageContentInfo& operator =(const ImageContentInfo& rhs);
234 result SetImageContentData(const _ImageContentData* pImageContentData);
236 _ImageContentData* GetImageContentData(void);
239 _ImageContentData* __pImageContentData;
241 friend class _ContentManagerImpl;
242 friend class _ContentSearchImpl;
243 friend class _ContentDirectoryImpl;
244 friend class _ContentUtility;
245 friend class _PlayListManagerImpl;
246 friend class _PlayListImpl;
248 friend class _ImageContentInfoImpl;
249 _ImageContentInfoImpl* __pImpl;
251 }; // Class ImageContentInfo
255 #endif // _FCNT_IMAGE_CONTENT_INFO_H_