Tizen 2.1 base
[platform/framework/native/content.git] / src / inc / FCnt_ContentManagerUtilImpl.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                FCnt_ContentManagerUtilImpl.h
19  * @brief               This is the header file for the %_ContentManagerUtilImpl class.
20  *
21  * This header file contains the declarations of the %_ContentManagerUtilImpl class.
22  */
23
24 #ifndef _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_
25 #define _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_
26
27 #include <unique_ptr.h>
28 #include <libexif/exif-data.h>
29 #include <metadata_extractor.h>
30
31 namespace Tizen { namespace Content
32 {
33
34 class ImageMetadata;
35 class AudioMetadata;
36 class VideoMetadata;
37
38 struct ExifDataDeleter
39 {
40         void operator()(ExifData* pExifData)
41         {
42                 exif_data_unref(pExifData);
43         }
44 };
45
46 struct ExtractorDeleter
47 {
48         void operator()(metadata_extractor_h* pMetadataExtractor)
49         {
50                 metadata_extractor_destroy(*pMetadataExtractor);
51         }
52 };
53
54 struct CharDeleter
55 {
56         void operator()(char* pChar)
57         {
58                 free(pChar);
59                 pChar = null;
60         }
61 };
62
63 struct VoidDeleter
64 {
65         void operator()(void* pVoid)
66         {
67                 free(pVoid);
68                 pVoid = null;
69         }
70 };
71
72 class _ContentManagerUtilImpl
73 {
74 public:
75         /**
76          * @see @ref Tizen::Content::ContentManagerUtil::GetImageMetaN()
77          */
78         static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::String& contentPath, bool internal = false);
79
80         /**
81          * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN()
82          */
83         static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::String& contentPath);
84
85         /**
86          * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN()
87          */
88         static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::String& contentPath);
89
90         /**
91          * @see @ref Tizen::Content::ContentManagerUtil::CheckContentType()
92          */
93         static Tizen::Content::ContentType CheckContentType(const Tizen::Base::String& contentPath, bool internal = false);
94
95         /**
96          * @see @ref Tizen::Content::ContentManagerUtil::CopyToMediaDirectory()
97          */
98         static result CopyToMediaDirectory(const Tizen::Base::String& srcContentPath, const Tizen::Base::String& destContentPath);
99
100         /**
101          * @see @ref Tizen::Content::ContentManagerUtil::MoveToMediaDirectory()
102          */
103         static result MoveToMediaDirectory(const Tizen::Base::String& srcContentPath, const Tizen::Base::String& destContentPath);
104
105 private:
106         _ContentManagerUtilImpl(void);
107         _ContentManagerUtilImpl(const _ContentManagerUtilImpl& rhs);
108         virtual ~_ContentManagerUtilImpl(void);
109         static void ParseBuffer(char* pBuffer, int& count);
110         static bool VerifyFilePathCompatibility(const Tizen::Base::String& contentPath);
111         _ContentManagerUtilImpl& operator =(const _ContentManagerUtilImpl& rhs);
112         static result ErrorMapToRetVal(int retVal);
113         static ContentType GetDrmFileType(const Tizen::Base::String& fileExt);
114
115 };  // class _ContentManagerUtilImpl
116
117 }}  // Tizen::Content
118
119 #endif  // _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_