Fix : Remove exception handling codes at the sample code
[platform/framework/native/content.git] / inc / FCntPlayList.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17  * @file                FCntPlayList.h
18  * @brief               This is the header file for the %PlayList class.
19  *
20  * This header file contains the declarations of the %PlayList class.
21  */
22
23 #ifndef _FCNT_CONTENT_PLAYLIST_H_
24 #define _FCNT_CONTENT_PLAYLIST_H_
25
26 #include <FBaseString.h>
27 #include <FCntTypes.h>
28
29 namespace Tizen { namespace Base { namespace Collection
30 {
31 class IList;
32 }}}
33
34 namespace Tizen { namespace Content
35 {
36
37 class _PlayListImpl;
38
39 /**
40  * @class          PlayList
41  * @brief          This class provides methods to access the playlist information.
42  *
43  * @since          2.0
44  *
45  * @final          This class is not intended for extension.
46  *
47  * The %PlayList class provides methods to access the playlist information.
48  * The methods of this class help to immediately access the database and update it.
49  *
50  * The following example demonstrates how to use the %PlayList class.
51  *
52  * @code
53  * #include <FBase.h>
54  * #include <FContent.h>
55  *
56  * using namespace Tizen::Content;
57  *
58  * void
59  * MyClass::Test(void)
60  * {
61  *              PlayList playList;
62  *              result r = playList.Construct("my_playlist_1");
63  *
64  *              Tizen::Base::Collection::IList* pList = playList.GetContentInfoListN();
65  *              r = GetLastResult();
66  *
67  *              pList->RemoveAll(true);
68  *              delete pList;
69  * }
70  *
71  * @endcode
72  *
73  */
74 class _OSP_EXPORT_ PlayList
75         : public Tizen::Base::Object
76 {
77
78 public:
79
80         /**
81          * The object is not fully constructed after this constructor is called. @n
82          * For full construction, the Construct() method must be called right after calling this constructor.
83          *
84          * @since               2.0
85          */
86         PlayList(void);
87
88         /**
89          * This destructor overrides Tizen::Base::Object::~Object().
90          *
91          * @since               2.0
92          */
93         virtual ~PlayList(void);
94
95         /**
96          * Initializes this instance of %PlayList with the specified parameter.
97          *
98          * @since               2.0
99          *
100          * @return      An error code
101          * @param[in]   playListName                    The playlist name
102          * @exception   E_SUCCESS               The method is successful.
103          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
104          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
105          * @exception   E_SERVICE_BUSY          The database is busy.
106          * @exception   E_DATABASE                      The method cannot access the database.
107          */
108         result Construct(const Tizen::Base::String& playListName);
109
110         /**
111          * Gets the count of the playlist items.
112          *
113          * @since               2.0
114          *
115          * @return      The item count
116          * @exception   E_SUCCESS               The method is successful.
117          * @exception   E_SERVICE_BUSY          The database is busy.
118          * @exception   E_DATABASE              The method cannot access the database.
119          * @remarks     The specific error code can be accessed using the GetLastResult() method.
120          */
121         int GetPlayListItemCount(void) const;
122
123         /**
124          * Gets the list of playlist items.
125          *
126          * @since               2.0
127          *
128          * @return      The list that contains the playlist items as ContentInfo
129          * @exception   E_SUCCESS               The method is successful.
130          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
131          * @exception   E_SERVICE_BUSY          The database is busy.
132          * @exception   E_DATABASE              The method cannot access the database.
133          * @remarks     The specific error code can be accessed using the GetLastResult() method.
134          */
135         Tizen::Base::Collection::IList* GetContentInfoListN(void) const;
136
137         /**
138          * Adds an item to the playlist.
139          *
140          * @since               2.0
141          *
142          * @return      An error code
143          * @param[in]   contentId                               The content ID
144          * @exception   E_SUCCESS                       The method is successful.
145          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
146          * @exception   E_SERVICE_BUSY                  The database is busy.
147          * @exception   E_DATABASE              The method cannot access the database.
148          * @see                 AddItems(const Tizen::Base::Collection::IList&)
149          */
150         result AddItem(const ContentId& contentId);
151
152         /**
153          * Adds items to the playlist.
154          *
155          * @since               2.0
156          *
157          * @return      An error code
158          * @param[in]   contentIdList                   The list that contains content IDs
159          * @exception   E_SUCCESS                       The method is successful.
160          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
161          * @exception   E_SERVICE_BUSY                  The database is busy.
162          * @exception   E_DATABASE              The method cannot access the database.
163          * @see                 AddItem(const ContentId&)
164          */
165         result AddItems(const Tizen::Base::Collection::IList& contentIdList);
166
167         /**
168          * Removes an item from the playlist.
169          *
170          * @since               2.0
171          *
172          * @return      An error code
173          * @param[in]   contentId                               The content ID
174          * @exception   E_SUCCESS               The method is successful.
175          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
176          * @exception   E_OBJ_NOT_FOUND                 The specified @c contentId is not found.
177          * @exception   E_SERVICE_BUSY                  The database is busy.
178          * @exception   E_DATABASE              The method cannot access the database.
179          * @see                 RemoveItems(const Tizen::Base::Collection::IList&)
180          */
181         result RemoveItem(const ContentId& contentId);
182
183         /**
184          * Removes items from the playlist.
185          *
186          * @since               2.0
187          *
188          * @return      An error code
189          * @param[in]   contentIdList                   The list that contains content IDs
190          * @exception   E_SUCCESS               The method is successful.
191          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
192          * @exception   E_OBJ_NOT_FOUND                 The specified @c contentId is not found.
193          * @exception   E_SERVICE_BUSY          The database is busy.
194          * @exception   E_DATABASE              The method cannot access the database.
195          * @see                 RemoveItem(const ContentId&)
196          */
197         result RemoveItems(const Tizen::Base::Collection::IList& contentIdList);  
198
199         /**
200          * Gets the playlist name.
201          *
202          * @since               2.0
203          *
204          * @return      The playlist name
205          */
206         Tizen::Base::String GetPlayListName(void) const;   
207
208         /**
209          * Sets the playlist name.
210          *
211          * @since               2.0
212          *
213          * @return      An error code
214          * @param[in]   playListName            The playlist name
215          * @exception   E_SUCCESS                       The method is successful.
216          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
217          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
218          * @exception   E_SERVICE_BUSY                  The database is busy.
219          * @exception   E_DATABASE              The method cannot access the database.
220          */
221         result SetPlayListName(const Tizen::Base::String& playListName);
222
223         /**
224          * Gets the play order.
225          *
226          * @since               2.0
227          *
228          * @return      The play order
229          * @param[in]   contentId                               The content ID
230          * @exception   E_SUCCESS               The method is successful.
231          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
232          * @exception   E_OBJ_NOT_FOUND                 The specified @c contentId is not found.
233          * @exception   E_SERVICE_BUSY          The database is busy.
234          * @exception   E_DATABASE              The method cannot access the database.
235          * @remarks     The specific error code can be accessed using the GetLastResult() method.
236          */
237         int GetPlayOrder(const ContentId& contentId) const;
238
239 private:
240
241         /**
242          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
243          */
244         PlayList(const PlayList& rhs);
245
246         /**
247          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
248          */
249         PlayList& operator =(const PlayList& rhs);
250
251         friend class _PlayListImpl;
252         _PlayListImpl* __pImpl;
253
254         Tizen::Base::String __playListName;
255
256         friend class _PlayListManagerImpl;
257
258         result ConstructPlayList(const Tizen::Base::String& playListName);
259
260 };  // class PlayList
261
262 }}  // Tizen::Content
263
264 #endif  // _FCNT_CONTENT_PLAYLIST_H_