Fix : Search APIs don't return exception despite the content in DB doesn't match...
[platform/framework/native/content.git] / src / FCntImageMetadata.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                FCntImageMetadata.cpp
18  * @brief               This is the implementation file for the %ImageMetadata class.
19  *
20  * This file contains implementation of the %ImageMetadata class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FCntImageMetadata.h>
25 #include <FCnt_ImageMetadataImpl.h>
26
27 using namespace Tizen::Base;
28 using namespace Tizen::Graphics;
29
30 namespace Tizen { namespace Content
31 {
32
33 ImageMetadata::ImageMetadata(void)
34         : Object()
35         , __pImpl(new (std::nothrow) _ImageMetadataImpl())
36 {
37
38 }
39
40 ImageMetadata::~ImageMetadata(void)
41 {
42         if (__pImpl != null)
43         {
44                 delete __pImpl;
45                 __pImpl = null;
46         }
47 }
48
49 ImageMetadata::ImageMetadata(const ImageMetadata& rhs)
50         : Tizen::Base::Object()
51         , __pImpl(new (std::nothrow) _ImageMetadataImpl(*rhs.__pImpl))
52 {
53
54 }
55
56 ImageMetadata&
57 ImageMetadata::operator =(const ImageMetadata& rhs)
58 {
59         // check for self-assignment
60         if (this == &rhs)
61         {
62                 return *this;
63         }
64
65         *__pImpl = *rhs.__pImpl;
66
67         return *this;
68 }
69
70 int
71 ImageMetadata::GetHashCode(void) const
72 {
73         return __pImpl->GetHashCode();
74 }
75
76 bool
77 ImageMetadata::Equals(const Object& rhs) const
78 {
79         const ImageMetadata* pRhs = dynamic_cast <const ImageMetadata*>(&rhs);
80         if (pRhs == null)
81         {
82                 return false;
83         }
84
85         return __pImpl->Equals(*pRhs->__pImpl);
86 }
87
88 int
89 ImageMetadata::GetWidth(void) const
90 {
91         if (__pImpl == null)
92         {
93                 return 0;
94         }
95         return __pImpl->GetWidth();
96 }
97
98 int
99 ImageMetadata::GetHeight(void) const
100 {
101         if (__pImpl == null)
102         {
103                 return 0;
104         }
105         return __pImpl->GetHeight();
106 }
107
108 String
109 ImageMetadata::GetCameraManufacturer(void) const
110 {
111         if (__pImpl == null)
112         {
113                 return String();
114         }
115         return __pImpl->GetCameraManufacturer();
116 }
117
118 String
119 ImageMetadata::GetCameraModel(void) const
120 {
121         if (__pImpl == null)
122         {
123                 return String();
124         }
125         return __pImpl->GetCameraModel();
126 }
127
128 String
129 ImageMetadata::GetSoftware(void) const
130 {
131         if (__pImpl == null)
132         {
133                 return String();
134         }
135         return __pImpl->GetSoftware();
136 }
137
138 String
139 ImageMetadata::GetDateTime(void) const
140 {
141         if (__pImpl == null)
142         {
143                 return String();
144         }
145         return __pImpl->GetDateTime();
146 }
147
148 double
149 ImageMetadata::GetLatitude(void) const
150 {
151         if (__pImpl == null)
152         {
153                 return 0;
154         }
155         return __pImpl->GetLatitude();
156 }
157
158 double
159 ImageMetadata::GetLongitude(void) const
160 {
161         if (__pImpl == null)
162         {
163                 return 0;
164         }
165         return __pImpl->GetLongitude();
166 }
167
168 ImageOrientationType
169 ImageMetadata::GetOrientation(void) const
170 {
171         if (__pImpl == null)
172         {
173                 return IMAGE_ORIENTATION_TYPE_UNKNOWN;
174         }
175         return __pImpl->GetOrientation();
176 }
177
178 String
179 ImageMetadata::GetWhiteBalance(void) const
180 {
181         if (__pImpl == null)
182         {
183                 return String();
184         }
185         return __pImpl->GetWhiteBalance();
186 }
187
188 Bitmap*
189 ImageMetadata::GetThumbnailN(void) const
190 {
191         ClearLastResult();
192         result r = E_SUCCESS;
193
194         Bitmap* pBitmap = null;
195
196         SysTryReturn(NID_CNT, __pImpl != null, null, E_DATA_NOT_FOUND, "[E_DATA_NOT_FOUND] GetThumbnailN failed.");
197
198         pBitmap = __pImpl->GetThumbnailN();
199         r = GetLastResult();
200         SysTryReturn(NID_CNT, pBitmap != null, null, r, "[%s] GetThumbnailN failed.", GetErrorMessage(r));
201
202         return pBitmap;
203 }
204 }}