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