merge with master
[platform/framework/native/content.git] / src / inc / FCnt_ImageMetadataImpl.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_ImageMetadataImpl.h
19  * @brief               This is the header file for the %_ImageMetadataImpl class.
20  *
21  * This header file contains the declarations of the %_ImageMetadataImpl class.
22  */
23
24 #ifndef _FCNT_INTERNAL_IMAGE_METADATA_IMPL_H_
25 #define _FCNT_INTERNAL_IMAGE_METADATA_IMPL_H_
26
27 #include <unique_ptr.h>
28 #include <FBaseString.h>
29
30 namespace Tizen { namespace Content
31 {
32
33 class ImageMetadata;
34
35 struct ImageMeta
36 {
37         ImageMeta()
38                 : width(0)
39                 , height(0)
40                 , orientation(IMAGE_ORIENTATION_TYPE_UNKNOWN)
41                 , latitude(-200.0)
42                 , longitude(-200.0)
43                 , contentPath(L"")
44                 , pManufacturer(null)
45                 , pModel(null)
46                 , pDateTime(null)
47                 , pSoftware(null)
48                 , pWhiteBalance(null) {}
49
50         int width;
51         int height;
52         ImageOrientationType orientation;
53         double latitude;
54         double longitude;
55         Tizen::Base::String contentPath;
56         Tizen::Base::String* pManufacturer;
57         Tizen::Base::String* pModel;
58         Tizen::Base::String* pDateTime;
59         Tizen::Base::String* pSoftware;
60         Tizen::Base::String* pWhiteBalance;
61 };
62
63 struct ImageMetaDeleter
64 {
65         void operator()(ImageMeta* pImageMeta)
66         {
67                 if (pImageMeta != null)
68                 {
69                         if (pImageMeta->pManufacturer != null)
70                         {
71                                 delete pImageMeta->pManufacturer;
72                                 pImageMeta->pManufacturer = null;
73                         }
74                         if (pImageMeta->pModel != null)
75                         {
76                                 delete pImageMeta->pModel;
77                                 pImageMeta->pModel = null;
78                         }
79                         if (pImageMeta->pDateTime != null)
80                         {
81                                 delete pImageMeta->pDateTime;
82                                 pImageMeta->pDateTime = null;
83                         }
84                         if (pImageMeta->pSoftware != null)
85                         {
86                                 delete pImageMeta->pSoftware;
87                                 pImageMeta->pSoftware = null;
88                         }
89                         if (pImageMeta->pWhiteBalance != null)
90                         {
91                                 delete pImageMeta->pWhiteBalance;
92                                 pImageMeta->pWhiteBalance = null;
93                         }
94
95                         delete pImageMeta;
96                         pImageMeta = null;
97                 }
98         }
99 };
100
101 class _ImageMetadataImpl
102         : public Tizen::Base::Object
103 {
104 public:
105         /**
106          * This is the default constructor for this class.
107          *
108          * @since 2.1
109          */
110         _ImageMetadataImpl(void);
111
112         /**
113          * This is the copy constructor for this class.
114          *
115          * @since 2.1
116          */
117         _ImageMetadataImpl(const _ImageMetadataImpl& rhs);
118
119         /**
120          * This is the destructor for this class.
121          *
122          * @since 2.1
123          */
124         virtual ~_ImageMetadataImpl(void);
125
126         /**
127          * @see @ref Tizen::Content::ImageMetadata::GetWidth()
128          */
129         int GetWidth(void) const;
130
131         /**
132          * @see @ref Tizen::Content::ImageMetadata::GetHeight()
133          */
134         int GetHeight(void) const;
135
136         /**
137          * @see @ref Tizen::Content::ImageMetadata::GetCameraManufacturer()
138          */
139         Tizen::Base::String GetCameraManufacturer(void) const;
140
141         /**
142          * @see @ref Tizen::Content::ImageMetadata::GetCameraModel()
143          */
144         Tizen::Base::String GetCameraModel(void) const;
145
146         /**
147          * @see @ref Tizen::Content::ImageMetadata::GetSoftware()
148          */
149         Tizen::Base::String GetSoftware(void) const;
150
151         /**
152          * @see @ref Tizen::Content::ImageMetadata::GetDateTime()
153          */
154         Tizen::Base::String GetDateTime(void) const;
155
156         /**
157          * @see @ref Tizen::Content::ImageMetadata::GetLatitude()
158          */
159         double GetLatitude(void) const;
160
161         /**
162          * @see @ref Tizen::Content::ImageMetadata::GetLongitude()
163          */
164         double GetLongitude(void) const;
165
166         /**
167          * @see @ref Tizen::Content::ImageMetadata::GetOrientation()
168          */
169         ImageOrientationType GetOrientation(void) const;
170
171         /**
172          * @see @ref Tizen::Content::ImageMetadata::GetWhiteBalance()
173          */
174         Tizen::Base::String GetWhiteBalance(void) const;
175
176         /**
177          * @see @ref Tizen::Content::ImageMetadata::GetThumbnailN()
178          */
179         Tizen::Graphics::Bitmap* GetThumbnailN(void) const;
180
181         /**
182          * Gets the Impl instance.
183          *
184          * @since 2.1
185          * @return      The pointer to _ImageMetadataImpl
186          * @param[in] imageMetadata             An instance of ImageMetadata
187          */
188         static _ImageMetadataImpl* GetInstance(ImageMetadata& imageMetadata);
189
190         /**
191          * Gets the Impl instance.
192          *
193          * @since 2.1
194          * @return      The pointer to _ImageMetadataImpl
195          * @param[in] imageMetadata             An instance of ImageMetadata
196          */
197         static const _ImageMetadataImpl* GetInstance(const ImageMetadata& imageMetadata);
198
199         /**
200          * @see @ref Tizen::Content::ImageMetadata::Equals()
201          */
202         virtual bool Equals(const Tizen::Base::Object& rhs) const;
203
204         /**
205          * @see @ref Tizen::Content::ImageMetadata::GetHashCode()
206          */
207         virtual int GetHashCode(void) const;
208
209         /**
210          * @see @ref Tizen::Content::ImageMetadata::operator =()
211          */
212         _ImageMetadataImpl& operator =(const _ImageMetadataImpl& rhs);
213
214 private:
215         result SetImageMetadata(const ImageMeta* pImageMeta);
216         ImageMeta* GetImageMetadata(void) const;
217
218 private:
219         std::unique_ptr<ImageMeta, ImageMetaDeleter> __pImageMeta;
220
221         friend class _ContentManagerUtilImpl;
222
223 };  // class _ImageMetadataImpl
224
225 }}  // Tizen::Content
226
227 #endif  // _FCNT_INTERNAL_IMAGE_METADATA_IMPL_H_