c228f6b1f15a949b453bfcda383f5045bc400975
[platform/framework/native/content.git] / src / inc / FCnt_ContentUtility.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_ContentUtility.h
19  * @brief               This is the header file for the %_ContentUtility class.
20  *
21  * This header file contains the declarations of the %_ContentUtility class.
22  */
23
24 #ifndef _FCNT_INTERNAL_CONTENT_UTILITY_H_
25 #define _FCNT_INTERNAL_CONTENT_UTILITY_H_
26
27
28 #include <media_content.h>
29 #include <FCntContentInfo.h>
30 #include <FCntImageContentInfo.h>
31 #include <FCntAudioContentInfo.h>
32 #include <FCntVideoContentInfo.h>
33 #include <FCntOtherContentInfo.h>
34
35 namespace Tizen { namespace Content
36 {
37
38 struct UtilCharDeleter
39 {
40         void operator()(char* pChar)
41         {
42                 free(pChar);
43                 pChar = null;
44         }
45 };
46 struct ImageMetaHandleDeleter
47 {
48         void operator()(image_meta_h* pImageHandle)
49         {
50                 image_meta_destroy(*pImageHandle);
51                 pImageHandle = NULL;
52         }
53 };
54 struct AudioMetaHandleDeleter
55 {
56         void operator()(audio_meta_h* pAudioHandle)
57         {
58                 audio_meta_destroy(*pAudioHandle);
59                 pAudioHandle = NULL;
60         }
61 };
62 struct VideoMetaHandleDeleter
63 {
64         void operator()(video_meta_h* pVideoHandle)
65         {
66                 video_meta_destroy(*pVideoHandle);
67                 pVideoHandle = NULL;
68         }
69 };
70
71 class _ContentUtility
72         : public Tizen::Base::Object
73 {
74 public:
75
76         /**
77          * This is the default constructor for this class.
78          *
79          * @since 2.1
80          */
81         _ContentUtility(void);
82
83         /**
84          * This is the destructor for this class.
85          *
86          * @since 2.1
87          */
88         virtual ~_ContentUtility(void);
89
90         static void DoSafeFree(char* pSrc);
91
92         static void DoSafeDelete(Tizen::Base::String* pSrc);
93
94         static result FillContentData(media_info_h mediaHandle, ContentInfo::_ContentData* pContentData);
95
96         static result FillImageContentData(media_info_h media_handle, ImageContentInfo::_ImageContentData* pImageContentData);
97
98         static result FillAudioContentData(media_info_h media_handle, AudioContentInfo::_AudioContentData* pAudioContentData);
99
100         static result FillVideoContentData(media_info_h media_handle, VideoContentInfo::_VideoContentData* pVideoContentData);
101
102         static result MapCoreErrorToNativeResult(int reason);
103
104 private:
105         _ContentUtility(const _ContentUtility& rhs);
106         _ContentUtility& operator =(const _ContentUtility& rhs);
107
108 };      // class ContentUtility
109
110 }}      // Tizen::Content
111
112 #endif  // _FCNT_INTERNAL_CONTENT_UTILITY_H_