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.
59 * #include <FContent.h>
61 * using namespace Tizen::Content;
66 * ContentDirectory contentDirectory;
67 * const Tizen::Base::String contentDirectoryPath = L"";
68 * result r = contentDirectory.Construct(CONTENT_TYPE_AUDIO);
71 * int countPerPage = 5;
74 * Tizen::Base::Collection::IList* pContentInfoList = contentDirectory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo, countPerPage, L"Title", SORT_ORDER_ASCENDING);
75 * r = GetLastResult();
77 * pContentInfoList->RemoveAll(true);
78 * delete pContentInfoList;
85 class _OSP_EXPORT_ ContentDirectory
86 : public Tizen::Base::Object
92 * The object is not fully constructed after this constructor is called. @n
93 * For full construction, the Construct() method must be called right after calling this constructor.
97 ContentDirectory(void);
100 * This destructor overrides Tizen::Base::Object::~Object().
104 virtual ~ContentDirectory(void);
107 * Initializes this instance of %ContentDirectory with the specified parameter.
111 * @return An error code
112 * @param contentType The content type @n
113 * This method is used to access only one type of content @n
114 * The allowed types are @c CONTENT_TYPE_OTHER, @c CONTENT_TYPE_IMAGE, @c CONTENT_TYPE_AUDIO,
115 * and @c CONTENT_TYPE_VIDEO @n
116 * If you want to access more than one type of content, use Construct(const Tizen::Base::Collection::IListT<ContentType>&)
117 * instead of this method.
118 * @exception E_SUCCESS The method is successful.
119 * @exception E_INVALID_ARG The specified input parameter is invalid.
120 * @exception E_OUT_OF_MEMORY The memory is insufficient.
121 * @exception E_SYSTEM The method cannot connect to the database.
123 result Construct(ContentType contentType);
126 * Initializes this instance of %ContentDirectory with the specified parameter.
130 * @return An error code
131 * @param contentTypeList The list of content types @n
132 * This method is used to access more than one type of content, but the total count should not be greater than @c 4 @n
133 * The allowed types are @c CONTENT_TYPE_OTHER, @c CONTENT_TYPE_IMAGE, @c CONTENT_TYPE_AUDIO,
134 * and @c CONTENT_TYPE_VIDEO @n
135 * Any combination with @c CONTENT_TYPE_ALL is a invalid argument @n
136 * If you want to access only one type of content, use Construct(ContentType) instead of this method.
137 * @exception E_SUCCESS The method is successful.
138 * @exception E_INVALID_ARG The specified input parameter is invalid.
139 * @exception E_OUT_OF_MEMORY The memory is insufficient.
140 * @exception E_SYSTEM The method cannot connect to the database.
142 result Construct(const Tizen::Base::Collection::IListT<ContentType>& contentTypeList);
145 * Gets the count of the content directories that contain the content type that is passed as a parameter to Construct().
149 * @return The count of the content directories
150 * @exception E_SUCCESS The method is successful.
151 * @exception E_OUT_OF_MEMORY The memory is insufficient.
152 * @exception E_SERVICE_BUSY The database is busy.
153 * @exception E_SYSTEM The method cannot access the database.
154 * @remarks The specific error code can be accessed using the GetLastResult() method.
156 int GetContentDirectoryCount(void) const;
159 * Gets the list of content directory paths that contain the content type that is passed as a parameter to Construct().
163 * @return The list of Tizen::Base::String values that contain the content directory paths
164 * @param sortOrder The sort order
165 * @exception E_SUCCESS The method is successful.
166 * @exception E_INVALID_ARG The specified input parameter is invalid.
167 * @exception E_OUT_OF_MEMORY The memory is insufficient.
168 * @exception E_SERVICE_BUSY The database is busy.
169 * @exception E_SYSTEM The method cannot access the database.
170 * @remarks The specific error code can be accessed using the GetLastResult() method.
172 Tizen::Base::Collection::IList* GetContentDirectoryPathListN(Tizen::Base::SortOrder sortOrder) const;
176 * Gets the file count in the directory.
180 * @return The file count
181 * @param contentDirectoryPath The content directory path @n
182 * The allowed directory path can be obtained by using
183 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
184 * @exception E_SUCCESS The method is successful.
185 * @exception E_INVALID_ARG The specified input parameter is invalid.
186 * @exception E_OUT_OF_MEMORY The memory is insufficient.
187 * @exception E_SERVICE_BUSY The database is busy.
188 * @exception E_SYSTEM The method cannot access the database.
189 * @remarks The specific error code can be accessed using the GetLastResult() method.
190 * @see GetContentDirectoryPathListN()
192 int GetContentDirectoryItemCount(const Tizen::Base::String& contentDirectoryPath) const;
195 * Gets the list of content information in the directory.
199 * @return The list of ContentInfo classes that contain the content information
200 * @param contentDirectoryPath The content directory path @n
201 * The allowed directory path can be obtained by using
202 * Tizen::System::Environment::GetMediaPath() and Tizen::System::Environment::GetExternalStoragePath().
203 * @param pageNo The page number @n
204 * It must be either greater than or equal to @c 1.
205 * @param countPerPage The count of the search results per page @n
206 * It must be either greater than or equal to @c 1.
207 * @param column The sort column name
208 * @param sortOrder The sort order
209 * @exception E_SUCCESS The method is successful.
210 * @exception E_INVALID_ARG A specified input parameter is invalid.
211 * @exception E_OUT_OF_MEMORY The memory is insufficient.
212 * @exception E_SERVICE_BUSY The database is busy.
213 * @exception E_SYSTEM The method cannot access the database.
214 * @remarks The specific error code can be accessed using the GetLastResult() method.
215 * @see GetContentDirectoryPathListN()
217 Tizen::Base::Collection::IList* GetContentDirectoryItemListN(const Tizen::Base::String& contentDirectoryPath, int pageNo, int countPerPage,
218 const Tizen::Base::String& column, Tizen::Base::SortOrder sortOrder) const;
222 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
224 ContentDirectory(const ContentDirectory& rhs);
227 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
229 ContentDirectory& operator =(const ContentDirectory& rhs);
231 _ContentDirectoryImpl* __pImpl;
233 friend class _ContentDirectoryImpl;
235 }; // class ContentDirectory
239 #endif // _FCNT_CONTENT_DIRECTORY_H_