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 FCnt_PlayListImpl.h
19 * @brief This is the header file for the %_PlayListImpl class.
21 * This header file contains the declarations of the %_PlayListImpl class.
24 #ifndef _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_
25 #define _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_
28 #include <unique_ptr.h>
29 #include <media_content.h>
30 #include <FBaseColAllElementsDeleter.h>
32 namespace Tizen { namespace Content
37 struct PlayListHandleDeleter
39 void operator()(media_playlist_h playListHandle)
41 media_playlist_destroy(playListHandle);
42 playListHandle = NULL;
46 struct MediaHandleDeleter
48 void operator()(media_info_h mediaHandle)
50 media_info_destroy(mediaHandle);
57 void operator()(GList* pGList)
64 struct FilterHandleDeleter
66 void operator()(filter_h* pFilterHandle)
68 media_filter_destroy(*pFilterHandle);
73 : public Tizen::Base::Object
78 * This is the default constructor for this class.
85 * This is the destructor for this class.
89 virtual ~_PlayListImpl(void);
91 result Construct(const Tizen::Base::String& playListName, bool isAdd = true);
93 int GetPlayListItemCount(const Tizen::Base::String& playlistName) const;
95 Tizen::Base::Collection::IList* GetContentInfoListN(const Tizen::Base::String& playlistName) const;
97 result AddItem(const Tizen::Base::String& playlistName, const ContentId& contentId);
99 result AddItems(const Tizen::Base::String& playlistName, const Tizen::Base::Collection::IList& contentIdList);
101 result RemoveItem(const ContentId& contentId);
103 result RemoveItems(const Tizen::Base::Collection::IList& contentIdList);
105 result SetPlayListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName);
107 result SetPlayOrder(const ContentId& contentId, const ContentId& nextContentId);
109 int GetPlayOrder(const ContentId& contentId) const;
111 static _PlayListImpl* GetInstance(PlayList& playList);
113 static const _PlayListImpl* GetInstance(const PlayList& playList);
116 _PlayListImpl(const _PlayListImpl& rhs);
117 _PlayListImpl& operator =(const _PlayListImpl& rhs);
119 mutable std::unique_ptr<filter_h, FilterHandleDeleter> __pFilterHandle;
121 result CreateFilterUsingContentId(const ContentId& contentId) const;
122 result CreateFilter(const Tizen::Base::String& playListName) const;
123 result GetPlayListHandle(media_playlist_h* playListHandle) const;
124 result AddItemInternal(media_playlist_h playListHandle, const ContentId& contentId);
125 result SetorGetPlayOrder(const ContentId& contentId, int& playOrder, bool isSet) const;
126 result FillPlayListInfo(int playlistId, Tizen::Base::Collection::ArrayList* pPlayListItemList) const;
127 result MapCoreErrorToNativeResult(int reason) const;
128 result MapCoreDatabaseErrorToNativeResult(int reason) const;
130 }; // class _PlayListImpl
134 #endif // _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_