2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FCntContentDirectory.h
18 * @brief This is the header file for the %ContentDirectory class.
20 * This header file contains the declarations of the %ContentDirectory class.
23 #ifndef _FCNT_CONTENT_DIRECTORY_H_
24 #define _FCNT_CONTENT_DIRECTORY_H_
26 #include <FBaseString.h>
27 #include <FBaseColIListT.h>
28 #include <FCntTypes.h>
30 namespace Tizen { namespace Base { namespace Collection
35 namespace Tizen { namespace Content
37 static const int MAX_CONTENTTYPE_LIST_COUNT = 5;
38 static const int MIN_CONTENTTYPE_LIST_COUNT = 0;
39 static const int CONTENTTYPE_LIST_COUNT_ONE = 1;
41 class _ContentDirectoryImpl;
43 * @class ContentDirectory
44 * @brief This class provides methods for the content directory.
47 * @final This class is not intended for extension.
49 * The %ContentDirectory class provides methods to access a list of content directories
50 * and the information of the content (specified content type) in the content directories.
52 * For more information on the database columns and their corresponding content types,
53 * see <a href="../org.tizen.native.appprogramming/html/guide/content/content_search_device.htm">Content Search on the Device</a>.
55 * The following example demonstrates how to use the %ContentDirectory class.
58 * #include <FContent.h>
60 * using namespace Tizen::Base;
61 * using namespace Tizen::Base::Collection;
62 * using namespace Tizen::Content;
67 * // Call Construct() of ContentDirectory
68 * ContentDirectory directory;
69 * const Tizen::Base::String contentDirectoryPath = L"";
70 * result r = directory.Construct(CONTENT_TYPE_AUDIO);
73 * // Do something for an error
76 * // Call GetContentDirectoryItemListN() of ContentDirectory as the first page
78 * int countPerPage = 5;
81 * IList* pContentInfoList = directory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo, countPerPage, L"Title", SORT_ORDER_ASCENDING);
83 * if (IsFailed(GetLastResult()))
85 * // Do something for an error
89 * pContentInfoList->RemoveAll(true);
90 * delete pContentInfoList;
97 class _OSP_EXPORT_ ContentDirectory
98 : public Tizen::Base::Object
104 * The object is not fully constructed after this constructor is called. @n
105 * For full construction, the Construct() method must be called right after calling this constructor.
109 ContentDirectory(void);
112 * This destructor overrides Tizen::Base::Object::~Object().
116 virtual ~ContentDirectory(void);
119 * Initializes this instance of %ContentDirectory with the specified parameter.
123 * @return An error code
124 * @param contentType The content type @n
125 * This method is used to access only one type of content @n
126 * The allowed types are @c CONTENT_TYPE_OTHER, @c CONTENT_TYPE_IMAGE, @c CONTENT_TYPE_AUDIO,
127 * and @c CONTENT_TYPE_VIDEO @n
128 * If you want to access more than one type of content, use Construct(const Tizen::Base::Collection::IListT<ContentType>&)
129 * instead of this method.
130 * @exception E_SUCCESS The method is successful.
131 * @exception E_INVALID_ARG The specified input parameter is invalid.
132 * @exception E_OUT_OF_MEMORY The memory is insufficient.
133 * @exception E_SYSTEM The method cannot connect to the database.
135 result Construct(ContentType contentType);
138 * Initializes this instance of %ContentDirectory with the specified parameter.
142 * @return An error code
143 * @param contentTypeList The list of content types @n
144 * This method is used to access more than one type of content, but the total count should not be greater than @c 4 @n
145 * The allowed types are @c CONTENT_TYPE_OTHER, @c CONTENT_TYPE_IMAGE, @c CONTENT_TYPE_AUDIO,
146 * and @c CONTENT_TYPE_VIDEO @n
147 * Any combination with @c CONTENT_TYPE_ALL is a invalid argument @n
148 * If you want to access only one type of content, use Construct(ContentType) instead of this method.
149 * @exception E_SUCCESS The method is successful.
150 * @exception E_INVALID_ARG The specified input parameter is invalid.
151 * @exception E_OUT_OF_MEMORY The memory is insufficient.
152 * @exception E_SYSTEM The method cannot connect to the database.
154 result Construct(const Tizen::Base::Collection::IListT<ContentType>& contentTypeList);
157 * Gets the count of the content directories that contain the content type that is passed as a parameter to Construct().
161 * @return The count of the content directories
162 * @exception E_SUCCESS The method is successful.
163 * @exception E_OUT_OF_MEMORY The memory is insufficient.
164 * @exception E_SERVICE_BUSY The database is busy.
165 * @exception E_SYSTEM The method cannot access the database.
166 * @remarks The specific error code can be accessed using the GetLastResult() method.
168 int GetContentDirectoryCount(void) const;
171 * Gets the list of content directory paths that contain the content type that is passed as a parameter to Construct().
175 * @return The list of Tizen::Base::String values that contain the content directory paths
176 * @param sortOrder The sort order
177 * @exception E_SUCCESS The method is successful.
178 * @exception E_INVALID_ARG The specified input parameter is invalid.
179 * @exception E_OUT_OF_MEMORY The memory is insufficient.
180 * @exception E_SERVICE_BUSY The database is busy.
181 * @exception E_SYSTEM The method cannot access the database.
182 * @remarks The specific error code can be accessed using the GetLastResult() method.
184 Tizen::Base::Collection::IList* GetContentDirectoryPathListN(Tizen::Base::SortOrder sortOrder) const;
188 * Gets the file count in the directory.
192 * @return The file count
193 * @param contentDirectoryPath The content directory path @n
194 * The allowed directory path can be obtained by using
195 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
196 * @exception E_SUCCESS The method is successful.
197 * @exception E_INVALID_ARG The specified input parameter is invalid.
198 * @exception E_OUT_OF_MEMORY The memory is insufficient.
199 * @exception E_SERVICE_BUSY The database is busy.
200 * @exception E_SYSTEM The method cannot access the database.
201 * @remarks The specific error code can be accessed using the GetLastResult() method.
202 * @see GetContentDirectoryPathListN()
204 int GetContentDirectoryItemCount(const Tizen::Base::String& contentDirectoryPath) const;
207 * Gets the list of content information in the directory.
211 * @return The list of ContentInfo classes that contain the content information
212 * @param contentDirectoryPath The content directory path @n
213 * The allowed directory path can be obtained by using
214 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
215 * @param pageNo The page number @n
216 * It must be either greater than or equal to @c 1.
217 * @param countPerPage The count of the search results per page @n
218 * It must be either greater than or equal to @c 1.
219 * @param column The sort column name
220 * @param sortOrder The sort order
221 * @exception E_SUCCESS The method is successful.
222 * @exception E_INVALID_ARG A specified input parameter is invalid.
223 * @exception E_OUT_OF_MEMORY The memory is insufficient.
224 * @exception E_SERVICE_BUSY The database is busy.
225 * @exception E_SYSTEM The method cannot access the database.
226 * @remarks The specific error code can be accessed using the GetLastResult() method.
227 * @see GetContentDirectoryPathListN()
229 Tizen::Base::Collection::IList* GetContentDirectoryItemListN(const Tizen::Base::String& contentDirectoryPath, int pageNo, int countPerPage,
230 const Tizen::Base::String& column, Tizen::Base::SortOrder sortOrder) const;
234 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
236 ContentDirectory(const ContentDirectory& rhs);
239 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
241 ContentDirectory& operator =(const ContentDirectory& rhs);
243 _ContentDirectoryImpl* __pImpl;
245 friend class _ContentDirectoryImpl;
247 }; // class ContentDirectory
251 #endif // _FCNT_CONTENT_DIRECTORY_H_