[content] Fix a description for ContentManager
[platform/framework/native/content.git] / inc / FCntContentDirectory.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                FCntContentDirectory.h
19  * @brief               This is the header file for the %ContentDirectory class.
20  *
21  * This header file contains the declarations of the %ContentDirectory class.
22  */
23
24 #ifndef _FCNT_CONTENT_DIRECTORY_H_
25 #define _FCNT_CONTENT_DIRECTORY_H_
26
27 #include <FBaseString.h>
28 #include <FBaseColIListT.h>
29 #include <FCntTypes.h>
30
31 namespace Tizen { namespace Base { namespace Collection
32 {
33 class IList;
34 }}}
35
36 namespace Tizen { namespace Content
37 {
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;
41
42 class _ContentDirectoryImpl;
43 /**
44  * @class       ContentDirectory
45  * @brief       This class provides methods for the content directory.
46  * @since       2.0
47  *
48  * @final       This class is not intended for extension.
49  *
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.
52  *
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>.
55  *
56  * The following example demonstrates how to use the %ContentDirectory class.
57  *
58  * @code
59  * #include <FContent.h>
60  *
61  * using namespace Tizen::Base;
62  * using namespace Tizen::Base::Collection;
63  * using namespace Tizen::Content;
64  *
65  * void
66  * MyClass::Test(void)
67  * {
68  *      // Call Construct() of ContentDirectory
69  *      ContentDirectory directory;
70  *      const Tizen::Base::String contentDirectoryPath = L"";
71  *      result r = directory.Construct(CONTENT_TYPE_AUDIO);
72  *      if (IsFailed(r))
73  *      {
74  *              // Do something for an error
75  *      }
76  *
77  *      // Call GetContentDirectoryItemListN() of ContentDirectory as the first page
78  *      int pageNo = 1;
79  *      int countPerPage = 5;
80  *      int totalPage = 0;
81  *      int totalCount = 0;
82  *      IList* pContentInfoList = directory.GetContentDirectoryItemListN(contentDirectoryPath, pageNo, countPerPage, L"Title", SORT_ORDER_ASCENDING);
83  *                               
84  *      if (IsFailed(GetLastResult()))
85  *      {
86  *              // Do something for an error
87  *      }
88  *
89  *      // Delete resource
90  *      pContentInfoList->RemoveAll(true);
91  *      delete pContentInfoList;
92  * }
93  *
94  * @endcode
95  *
96  */
97
98 class _OSP_EXPORT_ ContentDirectory
99         : public Tizen::Base::Object
100 {
101
102 public:
103
104         /**
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.
107          *
108          * @since 2.0
109          */
110         ContentDirectory(void);
111
112         /**
113          * This destructor overrides Tizen::Base::Object::~Object().
114          *
115          * @since 2.0
116          */
117         virtual ~ContentDirectory(void);
118
119         /**
120          * Initializes this instance of %ContentDirectory with the specified parameter.
121          *
122          * @since 2.0
123          *
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.
133          */
134         result Construct(ContentType contentType);
135
136         /**
137          * Initializes this instance of %ContentDirectory with the specified parameter.
138          *
139          * @since 2.0
140          *
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.
152          */
153         result Construct(const Tizen::Base::Collection::IListT<ContentType>& contentTypeList);
154
155         /**
156          * Gets the count of content directories that contains the content type that is passed as a parameter in Construct().
157          *
158          * @since 2.0
159          *
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.
166          */
167         int GetContentDirectoryCount(void) const;
168
169         /**
170          * Gets the list of content directory path that contains the content type that is passed as a parameter in Construct().
171          *
172          * @since 2.0
173          *
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.
182          */
183         Tizen::Base::Collection::IList* GetContentDirectoryPathListN(Tizen::Base::SortOrder sortOrder) const;
184
185         
186         /**
187          * Gets the count of files in a directory.
188          *
189          * @since 2.0
190          *
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()
202          */
203         int GetContentDirectoryItemCount(const Tizen::Base::String& contentDirectoryPath) const;
204
205         /**
206          * Gets the list of content information in a directory.
207          *
208          * @since 2.0
209          *
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()
227          */
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;
230
231 private:
232         /**
233          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
234          */
235         ContentDirectory(const ContentDirectory& rhs);
236
237         /**
238          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
239          */
240         ContentDirectory& operator =(const ContentDirectory& rhs);
241
242         _ContentDirectoryImpl* __pImpl;
243
244         friend class _ContentDirectoryImpl;
245
246 };  // class ContentDirectory
247
248 }}  // Tizen::Content
249
250 #endif  // _FCNT_CONTENT_DIRECTORY_H_