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 FCntContentDirectory.h
19 * @brief This is the header file for the %ContentDirectory class.
21 * This header file contains the declarations of the %ContentDirectory class.
24 #ifndef _FCNT_CONTENT_DIRECTORY_H_
25 #define _FCNT_CONTENT_DIRECTORY_H_
27 #include <FBaseString.h>
28 #include <FBaseColIListT.h>
29 #include <FCntTypes.h>
31 namespace Tizen { namespace Base { namespace Collection
36 namespace Tizen { namespace Content
38 static const int MAX_CONTENTTYPE_LIST_COUNT = 5;
39 static const int MIN_CONTENTTYPE_LIST_COUNT = 0;
40 static const int CONTENTTYPE_LIST_COUNT_ONE = 1;
42 class _ContentDirectoryImpl;
44 * @class ContentDirectory
45 * @brief This class provides methods for the content directory.
48 * @final This class is not intended for extension.
50 * The %ContentDirectory class provides methods to access a list of content directories
51 * and information of the content (specified content type) in the content directories.
53 * For more information on the database columns and their corresponding content types,
54 * see <a href="../org.tizen.native.appprogramming/html/guide/content/content_search_device.htm">Content Search on the Device</a>.
56 * The following example demonstrates how to use the %ContentDirectory class.
59 * #include <FContent.h>
61 * using namespace Tizen::Base;
62 * using namespace Tizen::Base::Collection;
63 * using namespace Tizen::Content;
68 * // Call Construct() of ContentDirectory
69 * ContentDirectory directory;
70 * const Tizen::Base::String contentDirectoryPath = L"";
71 * result r = directory.Construct(CONTENT_TYPE_AUDIO);
74 * // Do something for an error
77 * // Call GetContentDirectoryItemListN() of ContentDirectory as the first page
79 * int countPerPage = 5;
82 * IList* pContentInfoList = directory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo, countPerPage, L"Title", SORT_ORDER_ASCENDING);
84 * if (IsFailed(GetLastResult()))
86 * // Do something for an error
90 * pContentInfoList->RemoveAll(true);
91 * delete pContentInfoList;
98 class _OSP_EXPORT_ ContentDirectory
99 : public Tizen::Base::Object
105 * The object is not fully constructed after this constructor is called. @n
106 * For full construction, the Construct() method must be called right after calling this constructor.
110 ContentDirectory(void);
113 * This destructor overrides Tizen::Base::Object::~Object().
117 virtual ~ContentDirectory(void);
120 * Initializes this instance of %ContentDirectory with the specified parameter.
124 * @return An error code
125 * @param contentType The content type
126 * @exception E_SUCCESS The method is successful.
127 * @exception E_INVALID_ARG The specified input parameter is invalid.
128 * @exception E_OUT_OF_MEMORY The memory is insufficient.
129 * @exception E_SYSTEM The method cannot connect to the database.
130 * @remarks This method is used to access only one type of content. @n
131 * If you want to access more than one type of content, use Construct(const Tizen::Base::Collection::IListT<ContentType>&).
132 * The allowed types are CONTENT_TYPE_OTHER, CONTENT_TYPE_IMAGE, CONTENT_TYPE_AUDIO, and CONTENT_TYPE_VIDEO.
134 result Construct(ContentType contentType);
137 * Initializes this instance of %ContentDirectory with the specified parameter.
141 * @return An error code
142 * @param contentTypeList The list of content types
143 * @exception E_SUCCESS The method is successful.
144 * @exception E_INVALID_ARG The specified input parameter is invalid.
145 * @exception E_OUT_OF_MEMORY The memory is insufficient.
146 * @exception E_SYSTEM The method cannot connect to the database.
147 * @remarks This method is used to access more than one type of content. @n
148 * If you want to access only one type of content, use Construct(ContentType). @n
149 * Total count of @c contentTypeList should not be greater than @c 4. @n
150 * Any combination with CONTENT_TYPE_ALL is a invalid argument. @n
151 * The allowed types are CONTENT_TYPE_OTHER, CONTENT_TYPE_IMAGE, CONTENT_TYPE_AUDIO, and CONTENT_TYPE_VIDEO.
153 result Construct(const Tizen::Base::Collection::IListT<ContentType>& contentTypeList);
156 * Gets the count of content directories that contains the content type that is passed as a parameter in Construct().
160 * @return The count of content directories
161 * @exception E_SUCCESS The method is successful.
162 * @exception E_OUT_OF_MEMORY The memory is insufficient.
163 * @exception E_SERVICE_BUSY The database is busy.
164 * @exception E_SYSTEM The method cannot access the database.
165 * @remarks The specific error code can be accessed using the GetLastResult() method.
167 int GetContentDirectoryCount(void) const;
170 * Gets the list of content directory path that contains the content type that is passed as a parameter in Construct().
174 * @return A list of Tizen::Base::String values that contains content directory path
175 * @param sortOrder The sort order
176 * @exception E_SUCCESS The method is successful.
177 * @exception E_INVALID_ARG The specified input parameter is invalid.
178 * @exception E_OUT_OF_MEMORY The memory is insufficient.
179 * @exception E_SERVICE_BUSY The database is busy.
180 * @exception E_SYSTEM The method cannot access the database.
181 * @remarks The specific error code can be accessed using the GetLastResult() method.
183 Tizen::Base::Collection::IList* GetContentDirectoryPathListN(Tizen::Base::SortOrder sortOrder) const;
187 * Gets the count of files in a directory.
191 * @return The count of files
192 * @param contentDirectoryPath The content directory path @n
193 * The allowed directory path can be obtained by using
194 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
195 * @exception E_SUCCESS The method is successful.
196 * @exception E_INVALID_ARG The specified input parameter is invalid.
197 * @exception E_OUT_OF_MEMORY The memory is insufficient.
198 * @exception E_SERVICE_BUSY The database is busy.
199 * @exception E_SYSTEM The method cannot access the database.
200 * @remarks The specific error code can be accessed using the GetLastResult() method.
201 * @see GetContentDirectoryPathListN()
203 int GetContentDirectoryItemCount(const Tizen::Base::String& contentDirectoryPath) const;
206 * Gets the list of content information in a directory.
210 * @return A list of ContentInfo classes that contains content information
211 * @param contentDirectoryPath The content directory path @n
212 * The allowed directory path can be obtained by using
213 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
214 * @param pageNo The page number @n
215 * It must be equal to or greater than @c 1.
216 * @param countPerPage The count of the search results per page @n
217 * It must be equal to or greater than @c 1.
218 * @param column The sort column name
219 * @param sortOrder The sort order
220 * @exception E_SUCCESS The method is successful.
221 * @exception E_INVALID_ARG A specified input parameter is invalid.
222 * @exception E_OUT_OF_MEMORY The memory is insufficient.
223 * @exception E_SERVICE_BUSY The database is busy.
224 * @exception E_SYSTEM The method cannot access the database.
225 * @remarks The specific error code can be accessed using the GetLastResult() method.
226 * @see GetContentDirectoryPathListN()
228 Tizen::Base::Collection::IList* GetContentDirectoryItemListN(const Tizen::Base::String& contentDirectoryPath, int pageNo, int countPerPage,
229 const Tizen::Base::String& column, Tizen::Base::SortOrder sortOrder) const;
233 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
235 ContentDirectory(const ContentDirectory& rhs);
238 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
240 ContentDirectory& operator =(const ContentDirectory& rhs);
242 _ContentDirectoryImpl* __pImpl;
244 friend class _ContentDirectoryImpl;
246 }; // class ContentDirectory
250 #endif // _FCNT_CONTENT_DIRECTORY_H_