merge with master
[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(const Tizen::Base::String&)
77          */
78         static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::String& contentPath, bool internal = false);
79
80         /**
81          * @see @ref Tizen::Content::ContentManagerUtil::GetImageMetaN(const Tizen::Base::ByteBuffer&)
82          */
83         static Tizen::Content::ImageMetadata* GetImageMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
84
85         /**
86          * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN(const Tizen::Base::String&)
87          */
88         static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::String& contentPath);
89
90         /**
91          * @see @ref Tizen::Content::ContentManagerUtil::GetAudioMetaN(const Tizen::Base::ByteBuffer&)
92          */
93         static Tizen::Content::AudioMetadata* GetAudioMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
94
95         /**
96          * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN(const Tizen::Base::String&)
97          */
98         static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::String& contentPath);
99
100         /**
101          * @see @ref Tizen::Content::ContentManagerUtil::GetVideoMetaN(const Tizen::Base::ByteBuffer&)
102          */
103         static Tizen::Content::VideoMetadata* GetVideoMetaN(const Tizen::Base::ByteBuffer& byteBuffer);
104
105         /**
106          * @see @ref Tizen::Content::ContentManagerUtil::CheckContentType(const Tizen::Base::String&)
107          */
108         static Tizen::Content::ContentType CheckContentType(const Tizen::Base::String& contentPath, bool internal = false);
109
110         /**
111          * @see @ref Tizen::Content::ContentManagerUtil::CopyToMediaDirectory()
112          */
113         static result CopyToMediaDirectory(const Tizen::Base::String& srcContentPath, const Tizen::Base::String& destContentPath);
114
115         /**
116          * @see @ref Tizen::Content::ContentManagerUtil::MoveToMediaDirectory()
117          */
118         static result MoveToMediaDirectory(const Tizen::Base::String& srcContentPath, const Tizen::Base::String& destContentPath);
119
120 private:
121         _ContentManagerUtilImpl(void);
122         _ContentManagerUtilImpl(const _ContentManagerUtilImpl& rhs);
123         virtual ~_ContentManagerUtilImpl(void);
124         static void ParseBuffer(char* pBuffer, int& count);
125         static bool VerifyFilePathCompatibility(const Tizen::Base::String& contentPath);
126         _ContentManagerUtilImpl& operator =(const _ContentManagerUtilImpl& rhs);
127         static result ErrorMapToRetVal(int retVal);
128         static ContentType CheckStream(const Tizen::Base::String& contentPath);
129
130 };  // class _ContentManagerUtilImpl
131
132 }}  // Tizen::Content
133
134 #endif  // _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_