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 FCnt_PlayListImpl.h
18 * @brief This is the header file for the %_PlayListImpl class.
20 * This header file contains the declarations of the %_PlayListImpl class.
23 #ifndef _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_
24 #define _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_
27 #include <unique_ptr.h>
28 #include <media_content.h>
29 #include <FBaseColAllElementsDeleter.h>
31 namespace Tizen { namespace Content
36 struct PlayListHandleDeleter
38 void operator()(media_playlist_h playListHandle)
40 media_playlist_destroy(playListHandle);
44 struct MediaHandleDeleter
46 void operator()(media_info_h mediaHandle)
48 media_info_destroy(mediaHandle);
54 void operator()(GList* pGList)
60 struct FilterHandleDeleter
62 void operator()(filter_h filterHandle)
64 media_filter_destroy(filterHandle);
69 : public Tizen::Base::Object
74 * This is the default constructor for this class.
81 * This is the destructor for this class.
85 virtual ~_PlayListImpl(void);
87 result Construct(const Tizen::Base::String& playListName, bool isAdd = true);
89 int GetPlayListItemCount(const Tizen::Base::String& playlistName) const;
91 Tizen::Base::Collection::IList* GetContentInfoListN(const Tizen::Base::String& playlistName) const;
93 result AddItem(const Tizen::Base::String& playlistName, const ContentId& contentId);
95 result AddItems(const Tizen::Base::String& playlistName, const Tizen::Base::Collection::IList& contentIdList);
97 result RemoveItem(const ContentId& contentId);
99 result RemoveItems(const Tizen::Base::Collection::IList& contentIdList);
101 result SetPlayListName(const Tizen::Base::String& oldName, const Tizen::Base::String& newName);
103 result SetPlayOrder(const ContentId& contentId, const ContentId& nextContentId);
105 int GetPlayOrder(const ContentId& contentId) const;
107 static _PlayListImpl* GetInstance(PlayList& playList);
109 static const _PlayListImpl* GetInstance(const PlayList& playList);
112 _PlayListImpl(const _PlayListImpl& rhs);
113 _PlayListImpl& operator =(const _PlayListImpl& rhs);
115 mutable std::unique_ptr<filter_s, FilterHandleDeleter> __pFilterHandle;
116 Tizen::Base::String __playListName;
118 result CreateFilterUsingContentId(const ContentId& contentId) const;
119 result CreateFilter(const Tizen::Base::String& playListName) const;
120 result GetPlayListHandle(media_playlist_h* playListHandle) const;
121 result AddItemInternal(media_playlist_h playListHandle, const ContentId& contentId);
122 result SetorGetPlayOrder(const ContentId& contentId, int& playOrder, bool isSet) const;
123 result FillPlayListInfo(int playlistId, Tizen::Base::Collection::ArrayList* pPlayListItemList) const;
124 result MapCoreErrorToNativeResult(int reason) const;
125 result MapCoreDatabaseErrorToNativeResult(int reason) const;
126 result ConvertErrorToResult(result res) const;
128 }; // class _PlayListImpl
132 #endif // _FCNT_INTERNAL_CONTENT_PLAYLIST_IMPL_H_