[content] Fix a TC fail
[platform/framework/native/content.git] / src / FCntContentManagerUtil.cpp
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                FCntContentManagerUtil.cpp
18  * @brief               This is the implementation file for the %ContentManagerUtil class.
19  *
20  * This file contains implementation of the %ContentManagerUtil class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FCntContentManagerUtil.h>
25 #include <FCntImageMetadata.h>
26 #include <FCntAudioMetadata.h>
27 #include <FCntVideoMetadata.h>
28 #include <FCnt_ContentManagerUtilImpl.h>
29
30 using namespace Tizen::Base;
31
32 namespace Tizen { namespace Content
33 {
34
35 ImageMetadata*
36 ContentManagerUtil::GetImageMetaN(const String& filePath)
37 {
38         ClearLastResult();
39
40         result r = E_SUCCESS;
41         ImageMetadata* pImageMetadata = null;
42
43         pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(filePath);
44         r = GetLastResult();
45         SysTryReturn(NID_CNT, pImageMetadata != null, null, r, "[%s] GetImageMetaN failed.", GetErrorMessage(r));
46
47         return pImageMetadata;
48 }
49
50 AudioMetadata*
51 ContentManagerUtil::GetAudioMetaN(const String& filePath)
52 {
53         ClearLastResult();
54
55         result r = E_SUCCESS;
56         AudioMetadata* pAudioMetadata = null;
57
58         pAudioMetadata = _ContentManagerUtilImpl::GetAudioMetaN(filePath);
59         r = GetLastResult();
60         SysTryReturn(NID_CNT, pAudioMetadata != null, null, r, "[%s] GetAudioMetaN failed.", GetErrorMessage(r));
61
62         return pAudioMetadata;
63 }
64
65 VideoMetadata*
66 ContentManagerUtil::GetVideoMetaN(const String& filePath)
67 {
68         ClearLastResult();
69
70         result r = E_SUCCESS;
71         VideoMetadata* pVideoMetadata = null;
72
73         pVideoMetadata = _ContentManagerUtilImpl::GetVideoMetaN(filePath);
74         r = GetLastResult();
75         SysTryReturn(NID_CNT, pVideoMetadata != null, null, r, "[%s] GetVideoMetaN failed.", GetErrorMessage(r));
76
77         return pVideoMetadata;
78 }
79
80 ImageMetadata*
81 ContentManagerUtil::GetImageMetaN(const ByteBuffer& byteBuffer)
82 {
83         ClearLastResult();
84
85         result r = E_SUCCESS;
86         ImageMetadata* pImageMetadata = null;
87
88         pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(byteBuffer);
89         r = GetLastResult();
90         SysTryReturn(NID_CNT, pImageMetadata != null, null, r, "[%s] GetImageMetaN failed.", GetErrorMessage(r));
91
92         return pImageMetadata;
93 }
94
95 AudioMetadata*
96 ContentManagerUtil::GetAudioMetaN(const ByteBuffer& byteBuffer)
97 {
98         ClearLastResult();
99
100         result r = E_SUCCESS;
101         AudioMetadata* pAudioMetadata = null;
102
103         pAudioMetadata = _ContentManagerUtilImpl::GetAudioMetaN(byteBuffer);
104         r = GetLastResult();
105         SysTryReturn(NID_CNT, pAudioMetadata != null, null, r, "[%s] GetAudioMetaN failed.", GetErrorMessage(r));
106
107         return pAudioMetadata;
108 }
109
110 VideoMetadata*
111 ContentManagerUtil::GetVideoMetaN(const ByteBuffer& byteBuffer)
112 {
113         ClearLastResult();
114
115         result r = E_SUCCESS;
116         VideoMetadata* pVideoMetadata = null;
117
118         pVideoMetadata = _ContentManagerUtilImpl::GetVideoMetaN(byteBuffer);
119         r = GetLastResult();
120         SysTryReturn(NID_CNT, pVideoMetadata != null, null, r, "[%s] GetVideoMetaN failed.", GetErrorMessage(r));
121
122         return pVideoMetadata;
123 }
124
125 ContentType
126 ContentManagerUtil::CheckContentType(const String& filePath)
127 {
128         ClearLastResult();
129
130         result r = E_SUCCESS;
131         ContentType contentType = CONTENT_TYPE_UNKNOWN;
132
133         contentType = _ContentManagerUtilImpl::CheckContentType(filePath);
134         r = GetLastResult();
135         SysTryReturn(NID_CNT, contentType != CONTENT_TYPE_UNKNOWN, CONTENT_TYPE_UNKNOWN, r,
136                            "[%s] CheckContentType failed.", GetErrorMessage(r));
137
138         return contentType;
139 }
140
141 result
142 ContentManagerUtil::CopyToMediaDirectory(const String& srcFilePath, const String& destFilePath)
143 {
144         ClearLastResult();
145
146         result r = E_SUCCESS;
147
148         r = _ContentManagerUtilImpl::CopyToMediaDirectory(srcFilePath, destFilePath);
149         SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] CopyToMediaDirectory failed.", GetErrorMessage(r));
150
151         return r;
152 }
153
154 result
155 ContentManagerUtil::MoveToMediaDirectory(const String& srcFilePath, const String& destFilePath)
156 {
157         ClearLastResult();
158
159         result r = E_SUCCESS;
160
161         r = _ContentManagerUtilImpl::MoveToMediaDirectory(srcFilePath, destFilePath);
162         SysTryReturn(NID_CNT, !IsFailed(r), r, r, "[%s] MoveToMediaDirectory failed.", GetErrorMessage(r));
163
164         return r;
165 }
166 }}