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_ContentManagerImpl.h
19 * @brief This is the header file for the %_ContentManagerImpl class.
21 * This header file contains the declarations of the %_ContentManagerImpl class.
24 #ifndef _FCNT_INTERNAL_CONTENT_MANAGER_IMPL_H_
25 #define _FCNT_INTERNAL_CONTENT_MANAGER_IMPL_H_
27 #include <unique_ptr.h>
28 #include <media_content.h>
29 #include <FCntContentInfo.h>
31 namespace Tizen { namespace Content
35 class IContentScanListener;
36 class IContentUpdateEventListener;
38 typedef struct media_info_s* media_info_h;
40 struct MediaInfoDeleter
42 void operator()(media_info_h* pMediaInfo)
44 int val = media_info_destroy(*pMediaInfo);
45 SysLog(NID_CNT, "media_info_destroy result[%d].", val);
49 struct ImageMetaDeleter
51 void operator()(image_meta_h* pImageMeta)
53 int val = image_meta_destroy(*pImageMeta);
54 SysLog(NID_CNT, "image_meta_destroy result[%d].", val);
58 struct AudioMetaDeleter
60 void operator()(audio_meta_h* pAudioMeta)
62 int val = audio_meta_destroy(*pAudioMeta);
63 SysLog(NID_CNT, "audio_meta_destroy result[%d].", val);
67 struct VideoMetaDeleter
69 void operator()(video_meta_h* pVideoMeta)
71 int val = video_meta_destroy(*pVideoMeta);
72 SysLog(NID_CNT, "video_meta_destroy result[%d].", val);
79 IContentScanListener* pScanListener;
83 class _ContentManagerImpl
84 : public Tizen::Base::Object
88 * This is the default constructor for this class.
92 _ContentManagerImpl(void);
95 * This is the destructor for this class.
99 virtual ~_ContentManagerImpl(void);
102 * @see @ref Tizen::Content::ContentManager::Construct()
104 result Construct(void);
107 * @see @ref Tizen::Content::ContentManager::CreateContent(const ContentInfo&)
109 ContentId CreateContent(const ContentInfo& contentInfo);
112 * @see @ref Tizen::Content::ContentManager::CreateContent(const Tizen::Base::ByteBuffer&, const Tizen::Base::String&, const ContentInfo*)
114 ContentId CreateContent(const Tizen::Base::ByteBuffer& byteBuffer, const Tizen::Base::String& destinationPath, const ContentInfo* pContentInfo = null);
117 * @see @ref Tizen::Content::ContentManager::CreateContent(const Tizen::Base::String&, const Tizen::Base::String&, bool, const ContentInfo*)
119 ContentId CreateContent(const Tizen::Base::String& sourcePath, const Tizen::Base::String& destinationPath, bool deleteSource, const ContentInfo* pContentInfo = null);
122 * @see @ref Tizen::Content::ContentManager::GetContentInfoN()
124 ContentInfo* GetContentInfoN(const ContentId& contentId) const;
127 * @see @ref Tizen::Content::ContentManager::UpdateContent()
129 result UpdateContent(const ContentInfo& contentInfo);
132 * @see @ref Tizen::Content::ContentManager::DeleteContent()
134 result DeleteContent(const ContentId& contentId);
137 * @see @ref Tizen::Content::ContentManager::AddContentUpdateEventListener()
139 result AddContentUpdateEventListener(IContentUpdateEventListener& listener);
142 * @see @ref Tizen::Content::ContentManager::RemoveContentUpdateEventListener()
144 result RemoveContentUpdateEventListener(IContentUpdateEventListener& listener);
147 * @see @ref Tizen::Content::ContentManager::ScanFile()
149 static result ScanFile(const Tizen::Base::String& contentPath);
152 * @see @ref Tizen::Content::ContentManager::ScanDirectory()
154 static result ScanDirectory(const Tizen::Base::String& directoryPath, bool recursive, IContentScanListener* pListener, RequestId& reqId);
157 * Gets the Impl instance.
160 * @return The pointer to _ContentManagerImpl
161 * @param[in] contentManager An instance of ContentManager
163 static _ContentManagerImpl* GetInstance(ContentManager& contentManager);
166 * Gets the Impl instance.
169 * @return The pointer to _ContentManagerImpl
170 * @param[in] contentManager An instance of ContentManager
172 static const _ContentManagerImpl* GetInstance(const ContentManager& contentManager);
174 void SetListener(IContentUpdateEventListener* pListener);
176 IContentUpdateEventListener* GetListener(void) const;
179 _ContentManagerImpl(const _ContentManagerImpl& rhs);
180 ContentId SaveDataToDatabase(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData) const;
181 result UpdateDataToDatabase(const ContentInfo::_ContentData* pContentData) const;
182 result MakeContentInfo(const media_info_h pMediaInfo, ContentInfo::_ContentData* pContentData, int systemType, void* pMetadata) const;
183 bool VerifyMediaFilePathCompatibility(const Tizen::Base::String& contentPath, bool checkVersion) const;
184 bool VerifyHomeFilePathCompatibility(const Tizen::Base::String& contentPath) const;
185 _ContentManagerImpl& operator =(const _ContentManagerImpl& rhs);
189 IContentUpdateEventListener* __pListener;
190 friend class _ContentDownloadHandler;
192 }; // class _ContentManagerImpl
196 #endif // _FCNT_INTERNAL_CONTENT_MANAGER_IMPL_H_