cdf3c25bd886742ce86d23f495513c9f2b4aa029
[platform/framework/native/content.git] / src / inc / FCnt_ContentManagerUtilImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16 /**
17  * @file                FCnt_ContentManagerUtilImpl.h
18  * @brief               This is the header file for the %_ContentManagerUtilImpl class.
19  *
20  * This header file contains the declarations of the %_ContentManagerUtilImpl class.
21  */
22
23 #ifndef _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_
24 #define _FCNT_INTERNAL_CONTENT_MANAGER_UTIL_IMPL_H_
25
26 #include <unique_ptr.h>
27 #include <libexif/exif-data.h>
28 #include <metadata_extractor.h>
29
30 namespace Tizen { namespace Content
31 {
32
33 class ImageMetadata;
34 class AudioMetadata;
35 class VideoMetadata;
36
37 struct ExifDataDeleter
38 {
39         void operator()(ExifData* pExifData)
40         {
41                 exif_data_unref(pExifData);
42         }
43 };
44
45 struct ExtractorDeleter
46 {
47         void operator()(metadata_extractor_h metadataExtractor)
48         {
49                 metadata_extractor_destroy(metadataExtractor);
50                 metadataExtractor = NULL;
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_